public void DefaultBasicAttack(Character attackedCharacter) { if (!IsAlive) { return; //Dead characters cannot use basic attacks! } if (HasFreeAttackUntilEndOfTheTurn) { HasFreeAttackUntilEndOfTheTurn = false; } var damage = new Damage(AttackPoints.Value, DamageType.Physical); BeforeBasicAttack?.Invoke(attackedCharacter, damage); attackedCharacter.BeforeBeingBasicAttacked?.Invoke(this, damage); Attack(attackedCharacter, damage); //TODO: Make this default basic attack, maybe other overload AfterBasicAttack?.Invoke(attackedCharacter, damage); HasUsedBasicAttackInPhaseBefore = true; }
public void DefaultBasicAttack(Character attackedCharacter) { var damage = new Damage(AttackPoints.Value, DamageType.Physical); BeforeBasicAttack?.Invoke(attackedCharacter, damage); attackedCharacter.BeforeBeingBasicAttacked?.Invoke(attackedCharacter, damage); Attack(attackedCharacter, damage); // if (attackedCharacter.Abilities.All(a => a.BeforeParentBasicAttacked(this))) // { // if (attackedCharacter.Owner == Owner) // { // if (Abilities.Any(a => a.OverridesFriendAttack)) // { // if (Abilities.Count(a => a.OverridesFriendAttack) > 1) // throw new Exception("Więcej niż jedna umiejętność próbuje nadpisać atak!"); // // Abilities.Single(a => a.OverridesFriendAttack).AttackFriend(attackedCharacter, damage); // } // } // else // { // if (Abilities.Any(a => a.OverridesEnemyAttack)) // { // if (Abilities.Count(a => a.OverridesEnemyAttack) > 1) // throw new Exception("Więcej niż jedna umiejętność próbuje nadpisać atak!"); // // Abilities.Single(a => a.OverridesEnemyAttack).AttackEnemy(attackedCharacter, damage); // } // else // { // Attack(attackedCharacter, damage)); // } // } // } AfterBasicAttack?.Invoke(attackedCharacter, damage); HasUsedBasicAttackInPhaseBefore = true; //HasUsedNormalAbilityInPhaseBefore = true; }