/// <summary> /// Remove a Debuff from the Monster /// </summary> /// <returns>Whether or not the Debuff existed before removal</returns> public bool RemoveDebuff(Debuff debuff) { bool retBool = Debuffs.ContainsKey(debuff); Debuffs.Remove(debuff); return(retBool); }
/// <summary> /// 获得Debuff /// </summary> /// <param name="buff">debuff种类</param> /// <param name="lastTurn">debuff持续时间</param> public void GainBuff(Buff buff, int lastTurn) { if (buff.IsPower) { if (!Powers.ContainsKey(buff.BuffName)) { Powers.Add(buff.BuffName, buff); Powers[buff.BuffName].BuffIncrease(lastTurn); buff.BuffStart(this); } else { Powers[buff.BuffName].BuffIncrease(lastTurn); if (Powers[buff.BuffName].BuffLastTurn == 0) { Powers[buff.BuffName].BuffEnd(this); Powers.Remove(buff.BuffName); } } } else { if (buff.IsDebuff) { PreGainDebuffEvent?.Invoke(); if (!Debuffs.ContainsKey(buff.BuffName)) { PreGainNewDebuffEvent?.Invoke(); Debuffs.Add(buff.BuffName, buff); Debuffs[buff.BuffName].BuffIncrease(lastTurn); buff.BuffStart(this); } else { Debuffs[buff.BuffName].BuffIncrease(lastTurn); } } } }
/// <summary> /// 获得Debuff /// </summary> /// <param name="buff">debuff种类</param> /// <param name="lastTurn">debuff持续时间</param> public void GainBuff(Buff buff, int lastTurn) { if (PreGainDebuffEvent != null) { PreGainDebuffEvent(); } if (Debuffs.ContainsKey(buff.BuffName)) { Debuffs[buff.BuffName].BuffLastTurn += lastTurn; } else { if (PreGainNewDebuffEvent != null) { PreGainNewDebuffEvent(); } Debuffs.Add(buff.BuffName, buff); buff.BuffStart(this); } }
public bool HasDebuff(Debuff debuff) { return(Debuffs.ContainsKey(debuff)); }