all repos — RPG @ 2c47b59ca4f9a2bb3bef127052e434f0c5c48cfa

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

Assets/Scripts/Battle/Abilities/ReviveFull.cs (view raw)

 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5[System.Serializable]
 6public class ReviveFull : Ability
 7{
 8    public ReviveFull()
 9    {
10        dbName = "ReviveFull";
11        guiName = "Miracle";
12        hasTarget = true;
13        ow_usable = true;
14        MP_cost = 200;
15    }
16
17    public override string Execute(Fighter source, Fighter target, out bool output)
18    {
19        if (target.stats.HP == 0)
20        {
21            target.dead = false;
22            target.stats.HP = target.stats.MaxHP;
23            UI.ShowDamage(target, (int)target.stats.MaxHP, false); //this should give a negative result
24            if (target.animator)
25            {
26                target.animator.SetTrigger("Alive");
27            }
28            output = true;
29            return target + " was brought back to life and fully healed!";
30        }
31        else
32        {
33            output = false;
34            return target + " isn't dead yet!";
35        }
36    }
37
38    public override string GetDescription()
39    {
40        return "Revives a party member and maxes out all their stats.";
41    }
42}