all repos — RPG @ 630b570dd1644c2775f6e1679ac3209144caf618

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        bool output;
22        int res;
23        Ability ability;
24        Fighter target;
25        do {
26            res = Random.Range(1, 101);
27            if (res < 70)
28            {
29                output = true;
30                //attack
31                Fighter[] ggs = GameObject.FindObjectOfType<BattleManager>().getGuys(false);
32
33                target = ggs[Random.Range(0, ggs.Length)];
34
35                if(res < 35)
36                {
37                    //basic
38                    ability = new Attack();
39                } else {
40                    //magic
41                    ability = new FireBall();
42                }
43            } else
44            {
45                //heal
46                ability = new HealGreat();
47                target = this;
48                if(this.stats.HP < this.stats.MaxHP)
49                {
50                    output = true;
51                } else {
52                    output = false;
53                }
54            }
55        } while (output == false);
56        
57        return AbilityDB.Process(this, ability, target, true, out output);
58    }
59}