/// <summary> /// Add a new debuff to the agent /// </summary> public void AddNewDebuff(Debuff debuff) { DebuffList.Add(debuff); }
/// <summary> /// Remove a debuff and its effects from the agent /// </summary> public void RemoveDebuff(Debuff debuff) { DebuffList.Remove(debuff); }
public virtual void OnTurn() { //Console.WriteLine("NubiaMobile :: Tour"); m_turn++; if (m_turn > 1000) { m_turn = 0; } if (IsRenverse) { mTourRenverse--; if (mTourRenverse == 0) { Emote("*Se relève*"); SendMessage("Vous n'êtes plus renversé"); } else { ExposeToOpportunite(); } } NubiaBlessure toRemov = null; foreach (NubiaBlessure blessure in BlessureList) { blessure.OnTurn(this); if (blessure.TimeEnd <= DateTime.Now) { toRemov = blessure; break; } } if (toRemov != null) { BlessureList.Remove(toRemov); } List <AbstractBaseBuff> buffRemoveList = new List <AbstractBaseBuff>(); foreach (AbstractBaseBuff buff in BuffList) { if (Alive) { buff.OnTurn(); } if (buff.Turn < 1) { buffRemoveList.Add(buff); } } foreach (AbstractBaseBuff debuff in DebuffList) { if (debuff == null) { continue; } if (Alive) { debuff.OnTurn(); } if (debuff.Turn < 1) { buffRemoveList.Add(debuff); } } while (buffRemoveList.Count > 0) { AbstractBaseBuff r = buffRemoveList[0]; Console.WriteLine("Remove: " + r.Name); if (r.IsDebuff) { DebuffList.Remove(r as BaseDebuff); } else { BuffList.Remove(r); } buffRemoveList.RemoveAt(0); } }