Display power buffs

This commit is contained in:
henriquenakashima 2020-10-10 21:49:04 -04:00
parent 515602b670
commit 034e6beca6
8 changed files with 86 additions and 25 deletions

View file

@ -29,6 +29,7 @@ public class BuffManager {
List<Buff> current = GetAllBuffsFor(effect.Participant);
current.Add(new Buff(effect.Type, effect.Amount, CalculateEnd(timeNow, effect.Duration)));
mBuffs[effect.Participant] = current;
effect.Participant.TriggerOnBuffsChanged();
}
public int GetTotalBuffAmountOfType(BattleParticipant participant, BuffType type) {
@ -50,8 +51,13 @@ public class BuffManager {
}
private void NotifyBattleTime(BattleTime timeNow) {
foreach (List<Buff> buffs in mBuffs.Values) {
buffs.RemoveAll(buff => timeNow.Int >= buff.End.Int);
foreach (KeyValuePair<BattleParticipant, List<Buff>> p in mBuffs) {
BattleParticipant participant = p.Key;
List<Buff> buffs = p.Value;
int buffsRemoved = buffs.RemoveAll(buff => timeNow.Int >= buff.End.Int);
if (buffsRemoved > 0) {
participant.TriggerOnBuffsChanged();
}
}
}