public override ISpell GenerateAttack() { int damage = this.Unit.AttackPoints; var attack = new Stomp(damage); this.ValidateEnergy(attack); this.Unit.AttackPoints += 5; this.Unit.EnergyPoints -= attack.EnergyCost; return attack; }
public override ISpell GenerateAttack() { Spell spell = new Stomp(this.Unit); if (this.Unit.EnergyPoints - spell.EnergyCost < 0) { throw new NotEnoughEnergyException(string.Format(GlobalMessages.NotEnoughEnergy, this.Unit.Name, spell.GetType().Name)); } this.Unit.EnergyPoints -= spell.EnergyCost; return spell; }
public override ISpell GenerateAttack() { /////Each time he casts Stomp, the Ice Giant's attack points are increased by 5. /////Stomp damage: Equal to the Ice Giant's attack points. var spell = new Stomp(this.Unit.AttackPoints); this.ValidateEnergyPoints(this.Unit, spell); this.Unit.AttackPoints += 5; this.Unit.EnergyPoints -= spell.EnergyCost; return spell; }
public override ISpell GenerateAttack() { var attack = new Stomp(this.Unit.AttackPoints); this.IsThereEnoughEnergy(attack); this.RemoveEnergyOnCast(attack); this.Unit.AttackPoints += 5; return attack; }
public override ISpell GenerateAttack() { ISpell spell = new Stomp(this.Unit.AttackPoints); if (spell.EnergyCost > this.Unit.EnergyPoints) { throw new NotEnoughEnergyException(string.Format("{0} does not have enough energy to cast {1}", this.Unit.Name, spell.GetType().Name)); } this.Unit.EnergyPoints -= spell.EnergyCost; this.Unit.AttackPoints += 5; return spell; }
public override ISpell GenerateAttack() { ISpell spell = null; int damage = (this.Unit.AttackPoints); spell = new Stomp(damage); if (this.Unit.EnergyPoints >= spell.EnergyCost) { this.Unit.EnergyPoints -= spell.EnergyCost; this.Unit.AttackPoints += 5; return spell; } throw new NotEnoughEnergyException(string.Format(Messages.NotEnoughEnergyException, this.Unit.Name, spell.GetType().Name)); }
public override ISpell GenerateAttack() { var spell = new Stomp(this.Unit.AttackPoints); if (this.Unit.EnergyPoints < spell.EnergyCost) { throw new NotEnoughEnergyException(string.Format(GlobalMessages.NotEnoughEnergy, this.Unit.Name, "Stomp")); } this.Unit.AttackPoints += 5; this.Unit.EnergyPoints -= spell.EnergyCost; return spell; }
public override Contracts.ISpell GenerateAttack() { ISpell spell = new Stomp(this.Unit.AttackPoints); if (spell.EnergyCost >this.Unit.EnergyPoints) { throw new NotEnoughEnergyException( string.Format(string.Format("{0}", GlobalMessages.NotEnoughEnergy) , this.Unit.Name, spell.GetType().Name)); } this.Unit.EnergyPoints -= spell.EnergyCost; this.Unit.AttackPoints += 5; return spell; }
public ISpell GenerateAttack() { Stomp iceGiantStomp = new Stomp(); if (this.Unit.EnergyPoints < iceGiantStomp.EnergyCost) { throw new NotEnoughEnergyException( $"{this.Unit.Name} does not have enough energy to cast {this.GetType().Name}"); } iceGiantStomp.Damage = this.Unit.AttackPoints; this.Unit.EnergyPoints -= iceGiantStomp.EnergyCost; this.Unit.AttackPoints += 5; return iceGiantStomp; }
public override ISpell GenerateAttack() { ISpell stomp = new Stomp(this.Unit.AttackPoints); if (this.Unit.EnergyPoints < stomp.EnergyCost) { throw new NotEnoughEnergyException(this.Unit.Name + " does not have enough energy to cast Stomp"); } else { this.Unit.EnergyPoints -= stomp.EnergyCost; this.Unit.AttackPoints += 5; return stomp; } }
public ISpell GenerateAttack() { int currentAttackDamage = this.Unit.AttackPoints; ISpell currentAttack = new Stomp(currentAttackDamage, SpellValues.StompEnergy); if (this.Unit.EnergyPoints < currentAttack.EnergyCost) { throw new NotEnoughEnergyException(string.Format("{0} does not have enough energy to cast {1}", this.Unit.Name, currentAttack.GetType().Name)); } this.Unit.AttackPoints += UnitValues.IceGiantAttackPointIncreaseRate; this.Unit.EnergyPoints -= currentAttack.EnergyCost; return currentAttack; }
public override ISpell GenerateAttack() { int damage = this.Unit.AttackPoints; ISpell spell = new Stomp(damage); if (this.Unit.EnergyPoints < spell.EnergyCost) { throw new NotEnoughEnergyException(this.Unit.Name + " does not have enough energy to cast Stomp"); } else { this.Unit.EnergyPoints -= spell.EnergyCost; this.Unit.AttackPoints += 5; } return spell; }