all repos — RPG @ d7044262357209ad359fad4b2664315aea7096d0

Fully functional 3D turn based role playing game coded in C# and base Unity.

Assets/Scripts/Battle/Fighters/Brady.cs (view raw)

 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5public class Brady : BadGuy
 6{
 7    public Brady()
 8    {
 9        stats = new Stats("Brady");
10        description = "Son of the dark lord, he's not too bad.";
11
12        goldDrop = 150;
13        itemsDrop = new Inventory();
14        itemsDrop.generateItem(new ItemInfo(new BottledBlessing(), 1));
15
16        dead = defending = false;
17    }
18    
19    public override string Combat_AI()
20    {
21        this.stats.MP = this.stats.MaxMP;
22        bool output;
23        int res;
24        Ability ability;
25        Fighter target;
26        do {
27            res = Random.Range(1, 101);
28            if (res < 70)
29            {
30                output = true;
31                //attack
32                Fighter[] ggs = GameObject.FindObjectOfType<BattleManager>().getGuys(false);
33
34                target = ggs[Random.Range(0, ggs.Length)];
35
36                if(res < 35)
37                {
38                    //basic
39                    ability = new Attack();
40                } else {
41                    //magic
42                    ability = new FireBall();
43                }
44            } else
45            {
46                //heal
47                ability = new HealGreat();
48                target = this;
49                if(this.stats.HP < this.stats.MaxHP)
50                {
51                    output = true;
52                } else {
53                    output = false;
54                }
55            }
56        } while (output == false);
57        
58        return AbilityDB.Process(this, ability, target, true, out output);
59    }
60}