Skip to content
Snippets Groups Projects
Commit 5dad49ac authored by Robin Halseth Sandvik's avatar Robin Halseth Sandvik
Browse files

Implemented mana, stamina & hp costs.

parent e0758553
No related branches found
No related tags found
1 merge request!31Mana and stamina.
...@@ -43,6 +43,23 @@ namespace BigSock { ...@@ -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 { ...@@ -54,6 +71,9 @@ namespace BigSock {
// Check that the ability is cooled down. // Check that the ability is cooled down.
if(Ready) { if(Ready) {
//> Handle checking costs here. //> 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. // Activate the ability.
var res = Activate(actor, target); var res = Activate(actor, target);
...@@ -62,6 +82,9 @@ namespace BigSock { ...@@ -62,6 +82,9 @@ namespace BigSock {
if(res) { if(res) {
NextTimeCanUse = DateTime.Now + Cooldown; NextTimeCanUse = DateTime.Now + Cooldown;
//> Handle paying the cost (HP, mana, stamina) here. //> 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; return res;
......
...@@ -42,6 +42,24 @@ namespace BigSock { ...@@ -42,6 +42,24 @@ namespace BigSock {
bool Ready { get; } 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. Add in something for costs.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment