public abstract float HumanChooseAttackType(Warrior warrior, Random rng, Battlefield currentBattlefield);
static void Main(string[] args) { Battlefield game = new Battlefield(); game.RunGame(); }
static void Main(string[] args) { Battlefield battlefield = new Battlefield(); battlefield.Battle(); }
// Human attack consisting of choosing attack type. Calls GetHit method on target robot. public override float HumanChooseAttackType(Warrior targetWarrior, Random rng, Battlefield battlefield) { // Set to 0 in case of miss. float hitAmount = 0f; int selection; bool valid = false; // Verify input is valid before continuing. do { Console.WriteLine("Choose an Attack: "); for (int i = 0; i < attackTypes.Length; i++) { Console.WriteLine($"{i + 1}) {attackTypes[i]} Hit Chance: {attackTypeModifierHitChance[i]}% Bonus: x{attackTypesModifiers[i]} damage"); } valid = Int32.TryParse(Console.ReadLine(), out selection); if (valid) { valid = (selection > 0 && selection <= attackTypes.Length); selection--; } if (!valid) { battlefield.UpdateStatsDisplay(); } } while (!valid); // Calculate if the attack hits based on attack type hit chace. if (rng.Next(101) < attackTypeModifierHitChance[selection]) { // Calculate damage based on attack type modifier bonus. hitAmount = AttackPower * attackTypesModifiers[selection]; } return(targetWarrior.GetHit(this, hitAmount)); }
static void Main(string[] args) { Battlefield newBattle = new Battlefield(); newBattle.MainMenu(); }
public Game() { battlefield = new Battlefield(); }
static void Main(string[] args) { Battlefield warzone = new Battlefield(); warzone.RunGame(); }
public override float HumanChooseAttackType(Warrior warrior, Random rng, Battlefield currentBattlefield) { throw new NotImplementedException(); }