all repos — RPG @ d7044262357209ad359fad4b2664315aea7096d0

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}