private T ComputeBuffedResult <T>(ICombatant attacker, ICombatant defender, Func <T> computation) { var buffProvider = GetBuffProvider(attacker, defender); buffProvider.ReceiverPreCombatBuffs .Where(buff => buff.AppliesToSkill(Type)) .Each(buff => defender.AddTemporaryBuff(buff)); buffProvider.InitiatorPreCombatBuffs .Where(buff => buff.AppliesToSkill(Type)) .Each(buff => attacker.AddTemporaryBuff(buff)); var result = computation(); buffProvider.ReceiverPreCombatBuffs .Where(buff => buff.AppliesToSkill(Type)) .Each(buff => defender.RemoveTemporaryBuff(buff)); buffProvider.InitiatorPreCombatBuffs .Where(buff => buff.AppliesToSkill(Type)) .Each(buff => attacker.RemoveTemporaryBuff(buff)); return(result); }