all repos — RPG @ e75221ea3d14613e26def0c193decf24d4458235

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        guiName = "Miracle";
11        hasTarget = true;
12        ow_usable = true;
13        MP_cost = 200;
14    }
15
16    public override string Execute(Fighter source, Fighter target, out bool output)
17    {
18        if (target.stats.HP == 0)
19        {
20            target.dead = false;
21            target.stats.HP = target.stats.MaxHP;
22            UI.ShowDamage(target, (int)target.stats.MaxHP, false); //this should give a negative result
23            if (target.animator)
24            {
25                target.animator.SetTrigger("Alive");
26            }
27            output = true;
28            return target + " was brought back to life and fully healed!";
29        }
30        else
31        {
32            output = false;
33            return target + " isn't dead yet!";
34        }
35    }
36
37    public override string GetDescription()
38    {
39        return "Revives a party member and maxes out all their stats.";
40    }
41}