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 double GetTotalStat(DebuffResistance stat) { var s = this[stat]; return((s.Base() + s.ItemModifiers()) * s.BattleMod()); }
public SingleStat this[DebuffResistance stat] { get { return(_stats[stat.AsInt()]); } set { _stats[stat.AsInt()] = value; } }
public bool TryToApplyDebuf(DebuffResistance type, int successChance) { var resistance = GetTotalStat(type) * 3; return(RHelper.RollPercentage((int)(successChance - resistance))); }
public static double TotalStat(this ICharacter character, DebuffResistance stat) { return(character.Stats.GetTotalStat(stat)); }
protected void TryToApplyDebuff(DebuffResistance type, int applyChance) { TryToApplyDebuff(Target, type, applyChance); }
protected void TryToApplyDebuff(ICharacter target, DebuffResistance type, int applyChance) { ScriptHelper.TryToApplyDebuff(target, type, applyChance); }
public static int AsInt(this DebuffResistance stat) { return((int)stat); }