diff --git a/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs b/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs index f19870ede3fa73fcfbe58607883c12c150e678e4..9937544a5174bd039b4d913efee1571e0e60cb4a 100644 --- a/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs +++ b/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs @@ -43,6 +43,23 @@ namespace BigSock { + /* + The mana cost of the ability. + */ + public float ManaCost { get; protected set; } + + /* + The stamina cost of the ability. + */ + public float StaminaCost { get; protected set; } + + /* + The hp cost of the ability. + */ + public float HPCost { get; protected set; } + + + /* @@ -54,6 +71,9 @@ namespace BigSock { // Check that the ability is cooled down. if(Ready) { //> Handle checking costs here. + if(ManaCost > 0f && actor.Mana < ManaCost) return false; + if(StaminaCost > 0f && actor.Stamina < StaminaCost) return false; + if(HPCost > 0f && actor.HP < HPCost) return false; // Activate the ability. var res = Activate(actor, target); @@ -62,6 +82,9 @@ namespace BigSock { if(res) { NextTimeCanUse = DateTime.Now + Cooldown; //> Handle paying the cost (HP, mana, stamina) here. + if(ManaCost > 0f) actor.Mana -= ManaCost; + if(StaminaCost > 0f) actor.Stamina -= StaminaCost; + if(HPCost > 0f) actor.HP -= HPCost; } return res; diff --git a/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs b/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs index 07034791d6bbc841104db946dc9025a1413c3647..0bcd5fcb83f78cd5b80672dda1b88646759954c4 100644 --- a/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs +++ b/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs @@ -42,6 +42,24 @@ namespace BigSock { bool Ready { get; } + + /* + The mana cost of the ability. + */ + float ManaCost { get; } + + /* + The stamina cost of the ability. + */ + float StaminaCost { get; } + + /* + The hp cost of the ability. + */ + float HPCost { get; } + + + /* ----------------------------- Add in something for costs.