public AbilityResult PotentialDamage(DefenceDieFace defence) { // TODO: can there be abilities that trigger multiple things? // - there are a few, but it is out of the scope of the project // if so I should be a boolian class like EquipedItems!!! // and this should be a switch statment if (this.Type == AbilityType.Damage) { return(new AbilityResult(this.Val, this.Val, defence.Shield)); } else if (this.Type == AbilityType.Pierce) { int pierce = Math.Min(this.Val, defence.Shield); return(new AbilityResult(pierce, 0, defence.Shield - pierce)); } return(new AbilityResult(0, 0, defence.Shield)); // TODO support other effects, such as tab for surges }
public void ResolveSurges(AttackDieFace attackRoll, DefenceDieFace defenceRoll, int range, int expectedDamage) { Hero leoric = GetLeoric(); var dice = new DiceOutcome(attackRoll, defenceRoll); int damage = leoric.ResolveSurges(dice, range); Assert.Equal(expectedDamage, damage); if (expectedDamage != 0) { dice = new DiceOutcome(attackRoll, defenceRoll); TrinketItem damageTrinket = new TrinketItem("Free Damage", new ItemCatagory[] { ItemCatagory.Helmet }, new Ability[] { new Ability(1, AbilityType.Damage, 0) }); leoric.Equip(damageTrinket); damage = leoric.ResolveSurges(dice, range); Assert.Equal(expectedDamage + 1, damage); } }
public AbilityResult(int damage, int attack, int defence) { this.Damage = damage; this.Attack = new AttackDieFace(attack); this.Defence = new DefenceDieFace(defence); }