public void UsePokeBall(PokeBall pokeBall) { pokeBall.Use(TrainersPoke, WildPoke); HpFinishedEventArgs hpFinishedEventArgs = new HpFinishedEventArgs() { RemainingHp = WildPoke.RemainingHitPoint, Loser = WildPoke, Type = FinishType.pokeBall, Winner = TrainersPoke }; OnHpFinished(hpFinishedEventArgs); }
public void UseItem() { Console.WriteLine(Constants.useItemMenu); string choice; bool valid = false; do { choice = Console.ReadLine(); if (choice == Constants.menuChoices1) { if (Trainer.Instance.HavePotion()) { UsePotion(); valid = true; } else { Console.WriteLine(Constants.noPotionError); } } else if (choice == Constants.menuChoices2) { PokeBall pokeBall = new PokeBall(); valid = true; if (Trainer.Instance.HavePokeBall()) { if (pokeBall.IsCaptureSuccessfull(TrainersPoke)) { UsePokeBall(pokeBall); } else { Console.WriteLine(Constants.captureError); } } else { Console.WriteLine(Constants.noPokeballError); } } } while (!valid); }