public override void battleChoices(DungeonCharacter opponent) { int choice; base.battleChoices(opponent); do { Console.WriteLine("1. Attack Opponent"); Console.WriteLine("2. Crushing Blow on Opponent"); Console.WriteLine("Choose an option: "); choice = Convert.ToInt32(Console.ReadKey()); switch (choice) { case 1: attack(opponent); break; case 2: crushingBlow(opponent); break; default: Console.WriteLine("invalid choice!"); break; } numTurns--; if (numTurns > 0) { Console.WriteLine("Number of turns remaining is: " + numTurns); } } while (numTurns > 0); }
public override void battleChoices(DungeonCharacter opponent) { base.battleChoices(opponent); int choice; do { Console.WriteLine("1. Attack Opponent"); Console.WriteLine("2. Increase Hit Points"); Console.WriteLine("Choose an option: "); choice = Convert.ToInt32(Console.ReadKey()); switch (choice) { case 1: attack(opponent); break; case 2: increaseHitPoints(); break; default: Console.WriteLine("invalid choice!"); break; } numTurns--; if (numTurns > 0) { Console.WriteLine("Number of turns remaining is: " + numTurns); } } while (numTurns > 0 && hitPoints > 0 && opponent.getHitPoints() > 0); }
public virtual void battleChoices(DungeonCharacter opponent) { numTurns = attackSpeed / opponent.getAttackSpeed(); if (numTurns == 0) { numTurns++; } Console.WriteLine("Number of turns this round is: " + numTurns); }
public void crushingBlow(DungeonCharacter opponent) { Random rand = new Random(); if (rand.NextDouble() <= .4) { int blowPoints = rand.Next(100, 176); Console.WriteLine(name + " lands a CRUSHING BLOW for " + blowPoints + " damage!"); opponent.subtractHitPoints(blowPoints); } else { Console.WriteLine(name + " failed to land a crushing blow\n"); } }
public virtual void attack(DungeonCharacter opponent) { bool canAttack; int damage; Random rand = new Random(); canAttack = rand.NextDouble() <= chanceToHit; if (canAttack) { damage = rand.Next(damageMin, damageMax); opponent.subtractHitPoints(damage); Console.WriteLine(); } else { Console.WriteLine(getName() + "'s attack on " + opponent.getName() + " failed!\n"); } }
public void surpriseAttack(DungeonCharacter opponent) { Random rand = new Random(); double surprise = rand.NextDouble(); if (surprise <= .4) { Console.WriteLine("Surprise attack was successful!\n" + name + " gets an additional turn."); numTurns++; attack(opponent); } else if (surprise >= .9) { Console.WriteLine("Uh oh! " + opponent.getName() + " saw you and" + " blocked your attack!"); } else { attack(opponent); } }
public override void attack(DungeonCharacter opponent) { Console.WriteLine(name + " jabs his kris at " + opponent.getName() + ":"); base.attack(opponent); }
public override void attack(DungeonCharacter opponent) { Console.WriteLine(name + " swings a mighty sword at " + opponent.getName() + ":"); base.attack(opponent); }
public override void attack(DungeonCharacter opponent) { Console.WriteLine(name + " casts a spell of fireball at " + opponent.getName() + ":"); base.attack(opponent); }
public override void attack(DungeonCharacter opponent) { Console.WriteLine(name + " slices his rusty blade at " + opponent.getName() + ":"); base.attack(opponent); }
public override void attack(DungeonCharacter opponent) { Console.WriteLine(name + " slowly swings a club toward's " + opponent.getName() + ":"); base.attack(opponent); }