Implement statuses, GolemCharge, GolemBerserk, stun
This commit is contained in:
parent
caf782c884
commit
ef9ec43c8a
16 changed files with 260 additions and 38 deletions
|
|
@ -14,9 +14,11 @@ public class BattleParticipant
|
|||
protected int maxHP;
|
||||
protected int block;
|
||||
protected bool dead;
|
||||
protected Dictionary<BattleStatus, int> statuses;
|
||||
|
||||
public BattleParticipant(bool isHero) {
|
||||
this.isHero = isHero;
|
||||
this.statuses = new Dictionary<BattleStatus, int>();
|
||||
}
|
||||
|
||||
public void Init() {
|
||||
|
|
@ -95,4 +97,29 @@ public class BattleParticipant
|
|||
this.OnDeath(this);
|
||||
}
|
||||
}
|
||||
|
||||
public int AddStatus(BattleStatus status, int amount) {
|
||||
int currentAmount;
|
||||
this.statuses.TryGetValue(status, out currentAmount);
|
||||
this.statuses[status] = currentAmount + amount;
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void TickStatuses() {
|
||||
Dictionary<BattleStatus, int> newStatuses = new Dictionary<BattleStatus, int>();
|
||||
foreach (KeyValuePair<BattleStatus, int> pair in this.statuses) {
|
||||
if (pair.Value >= 1) {
|
||||
newStatuses[pair.Key] = pair.Value - 1;
|
||||
}
|
||||
}
|
||||
this.statuses = newStatuses;
|
||||
}
|
||||
|
||||
public bool CanUseCard(BaseCard card) {
|
||||
return IsAlive() && !HasStatus(BattleStatus.Stun);
|
||||
}
|
||||
|
||||
public bool HasStatus(BattleStatus status) {
|
||||
return this.statuses.ContainsKey(status);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue