Assets/Scripts/Battle/Abilities/Heal.cs (view raw)
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4
5[System.Serializable]
6public class Heal : Ability
7{
8 protected double heal_amount;
9
10 public Heal()
11 {
12 dbName = "Heal";
13 guiName = "Heal";
14 hasTarget = true;
15 ow_usable = true;
16 MP_cost = 50;
17 heal_amount = 200;
18 }
19
20 public override string Execute(Fighter source, Fighter target, out bool output)
21 {
22 double amount = heal_amount;
23 output = false;
24 if(target.stats.HP <= 0)
25 {
26 return source + " can't heal " + target + " because they're dead!";
27 }
28 if(target.stats.HP == target.stats.MaxHP)
29 {
30 return target + " already has max HP, they don't need healing.";
31 }
32 amount += (amount * 0.05);
33 target.stats.HP += amount;
34 source.animator.SetTrigger("Heal");
35 UI.ShowDamage(target, -(int)amount, false); //this should give a negative result
36 output = true;
37 return target + " recovered " + (int)amount + " HP.";
38
39 }
40
41 public override string GetDescription()
42 {
43 return "Heals about " + heal_amount + "HP to one target.";
44 }
45}