public void TryToApplyDebuff(ICharacter target, DebuffResistance type, int applyChance) { var result = new BoolConsolidator(); target.FireApplyingDebuffEvent(result); if (!result.Result()) { return; } if (!target.Stats.TryToApplyDebuf(type, applyChance)) { return; } IAffliction affl = null; var afflFac = Model.AfflictionFactory; switch (type) { case DebuffResistance.PSN: affl = afflFac.GetAffliction("Poison"); target.AddAffliction("PSN"); break; case DebuffResistance.PAR: affl = afflFac.GetAffliction("Paralyze"); target.AddAffliction("PAR"); break; case DebuffResistance.DTH: affl = afflFac.GetAffliction("InstaDeath"); target.AddAffliction("DTH"); break; case DebuffResistance.SIL: affl = afflFac.GetAffliction("Silence"); target.AddAffliction("SIL"); break; } if (affl == null) { return; } affl.AttachTo(target); _charAfflDictionary.GetOrCreate(target).Add(affl); }
public void ApplyAffliction(ICharacter target, string affliction) { var affl = Model.AfflictionFactory.GetAffliction(affliction); var result = new BoolConsolidator(); if (affl.Type == AfflictionType.Buff) { target.FireApplyingBuffEvent(result); } else { target.FireApplyingDebuffEvent(result); } if (!result.Result()) { return; } affl.AttachTo(target); target.AddAffliction(affliction); _charAfflDictionary.GetOrCreate(target).Add(affl); }