Display power buffs
This commit is contained in:
parent
515602b670
commit
034e6beca6
8 changed files with 86 additions and 25 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue