public GymBox() { InitializeComponent(); pokemon = PokemonFactory.Create(4); this.pokemonBox.Render(pokemon); }
private void pokemonComboBox_SelectedIndexChanged(object sender, EventArgs e) { string id = pokemonComboBox.Items[pokemonComboBox.SelectedIndex].ToString(); pokemon = PokemonFactory.Create(int.Parse(id)); Render(); }
private static void Main(string[] args) { Pokemon pokemon = PokemonFactory.CreateInstance(1); pokemon.attackBehavior = BehaviorFactory.CreateBehavior("魯夫橡膠戰斧"); pokemon.Attack(pokemon); }
public void ShouldMoreThanTwentyButLessThanFiftyDamagePoints() { IPokemon attackingPokemon = PokemonFactory.CreatePokemon <Gengar>(); IPokemon targetPokemon = PokemonFactory.CreatePokemon <Pidgeot>(); TypeEffect effectOfTypeOnTargetPokemon = TypeComparer.CompareGhostType(targetPokemon.Types[0]); int totalDamage = TypeDamageCalculator.CalculateDamage( attackingPokemon, targetPokemon, attackingPokemon.Moves[2], effectOfTypeOnTargetPokemon ); Assert.True(totalDamage >= 20 && totalDamage < 50); totalDamage = TypeDamageCalculator.CalculateDamage( attackingPokemon, targetPokemon, attackingPokemon.Moves[1], effectOfTypeOnTargetPokemon ); Assert.True(totalDamage >= 20 && totalDamage < 50); }
public void ShouldDealLessOrEqualToTwentyDamage() { IPokemon attackingPokemon = PokemonFactory.CreatePokemon <Pikachu>(); IPokemon targetPokemon = PokemonFactory.CreatePokemon <Onix>(); TypeEffect effectOfTypeOnTargetPokemon = TypeComparer.CompareElectricType(targetPokemon.Types[0]); int totalDamage = TypeDamageCalculator.CalculateDamage( attackingPokemon, targetPokemon, attackingPokemon.Moves[1], effectOfTypeOnTargetPokemon ); Assert.True(totalDamage <= 20); totalDamage = TypeDamageCalculator.CalculateDamage( attackingPokemon, targetPokemon, attackingPokemon.Moves[2], effectOfTypeOnTargetPokemon ); Assert.True(totalDamage <= 20); }
public void GhostTypePokemonShouldNotTakeDamageFromPhysicalAttack() { IPokemon ghostTypePokemon = PokemonFactory.CreatePokemon <Gengar>(); IMove move = new Tackle(); Assert.True(TypeComparer.PokemonTypeDoesNotMakeContactWithMove(ghostTypePokemon?.Types, move)); }
public void CreatePokemon_GivenIdAndLevel_ReturnsHealthyPokemon(int level, int id) { Prepare(); IPokemon pokemon = PokemonFactory.CreatePokemon(level, id); Assert.AreEqual(pokemon.HPCurrent, pokemon.HPMax); }
public void UsePotion() { if (this.Potions > 0) { int index = 1; int choice; Console.WriteLine("Use potion to: "); foreach (var item in this.Pokemons) { Console.WriteLine($"{index}. {item.name.english}"); } choice = Convert.ToInt32(Console.ReadLine()); if (this.Pokemons[choice - 1].HP + 25 < PokemonFactory.CreateSpecificPokemon(this.Pokemons[choice - 1].name.english).HP) { this.Pokemons[choice - 1].HP += 25; } else { this.Pokemons[choice - 1].HP = PokemonFactory.CreateSpecificPokemon(this.Pokemons[choice - 1].name.english).HP; } this.Potions--; } else { Console.WriteLine("You have not any potion!\n"); } }
public void setUp() { Fi.startEngine(); pokemonFactory = new PokemonFactory(); calculations = new BattleCalculations(); pokemonBattleManager = new PokemonBattleManager(); }
// Start is called before the first frame update void Start() { player = PokemonSelect.player; enemy = PokemonFactory.CreateRandom(); playerPokemon.text = player.name; playerLvl.text = "Lv" + player.level.ToString(); playerHp.maxValue = player.maxHp; enemyPokemon.text = enemy.name; enemyLvl.text = "Lv" + enemy.level.ToString(); enemyHp.maxValue = enemy.maxHp; playerHp.value = player.hp; enemyHp.value = enemy.hp; UpdateHp(player); UpdateHp(enemy); actionText.text = ""; if (player.moves.Count == 2) { move1.gameObject.SetActive(true); move2.gameObject.SetActive(true); move1.GetComponentInChildren <Text>().text = player.moves[0].name; move2.GetComponentInChildren <Text>().text = player.moves[1].name; } else if (player.moves.Count == 1) { move1.gameObject.SetActive(true); move1.GetComponentInChildren <Text>().text = player.moves[0].name; } StartCoroutine(TextTyper(actionText, "Choose your next move")); Invoke("SetFightLoop", 1f); }
public Player() { pokemonfactory = new PokemonFactory(); testPokemon = pokemonfactory.createPokemon(25, 10); name = ""; }
public static void HuntWildPokemon(Trainer trainer) { Pokemon wildPokemon = PokemonFactory.CreateWildPokemon(); Console.WriteLine($"Hey! It's a {wildPokemon.name.english}.\n"); Battle(wildPokemon, trainer); }
public List<PokemonFactory> All() { List<PokemonFactory> factories = new List<PokemonFactory>(); SQLiteCommand command = new SQLiteCommand("select * from pokemon_factories", connection); SQLiteDataReader reader = command.ExecuteReader(); while (reader.Read()) { int type_1 = (int)(long)reader["type_1_id"]; int type_2 = (int)(long)reader["type_2_id"]; StatRange hp_range = new StatRange((int)(long)reader["hp_min"], (int)(long)reader["hp_max"]); StatRange attack_range = new StatRange((int)(long)reader["attack_min"], (int)(long)reader["attack_max"]); StatRange defense_range = new StatRange((int)(long)reader["defense_min"], (int)(long)reader["defense_max"]); StatRange special_attack_range = new StatRange((int)(long)reader["special_attack_min"], (int)(long)reader["special_attack_max"]); StatRange special_defense_range = new StatRange((int)(long)reader["special_defense_min"], (int)(long)reader["special_defense_max"]); StatRange speed_range = new StatRange((int)(long)reader["speed_min"], (int)(long)reader["speed_max"]); string name = (string)reader["name"]; PokemonFactory factory = new PokemonFactory(type_1, type_2, hp_range, attack_range, defense_range, special_attack_range, special_defense_range, speed_range, name); factories.Add(factory); } return factories; }
//setup all the information of the start of battle public IEnumerator SetupBattle() { state = BattleState.START; battleCam.enabled = true; playerPokemon = PokemonFactory.Create(5, "Charizard"); //enemyPokemon = PokemonFactory.CreateRandom(); enemyPokemon = PokemonFactory.CreateRandom(); //Added more moves to the player for testing Move move2 = new Move("Fire Stuff"); Move move3 = new Move("Fire Blast"); Move move4 = new Move("Fly"); List <Move> MovesToadd = new List <Move> { move2, move3, move4 }; playerPokemon.moves.AddRange(MovesToadd); dialogText.text = "A crazy " + enemyPokemon.name + " appeared"; SetHud(); AssingMoves(); yield return(new WaitForSeconds(1.5f)); state = BattleState.PLAYERTURN; PlayerTurn(); }
public void PokemonShouldReceiveDamage() { IPokemon pokemon = PokemonFactory.CreatePokemon <Eevee>(); pokemon?.ReceiveDamage(10); Assert.True(pokemon?.CurrentHealthPoints < pokemon.TotalHealthPoints); }
public void GhostTypePokemonShouldTakeDamageFromSpecialAttack() { IPokemon ghostTypePokemon = PokemonFactory.CreatePokemon <Gengar>(); IMove move = new ShadowBall(); Assert.False(TypeComparer.PokemonTypeDoesNotMakeContactWithMove(ghostTypePokemon?.Types, move)); }
public void CreatePokemon_GivenBadLevel_Returns_CorrectLevel(int level, int id, int expectedLevel) { Prepare(); IPokemon pokemon = PokemonFactory.CreatePokemon(level, id); Assert.AreEqual(expectedLevel, pokemon.Level); }
public void PokemonShouldFaint() { IPokemon pokemon = PokemonFactory.CreatePokemon <Pikachu>(); pokemon?.ReceiveDamage((int)pokemon?.TotalHealthPoints); Assert.True(pokemon?.HasFainted()); }
public static Pokemon Create(int level, string name) { // Let's parse the Pokedex.csv file to find the requested pokemon! // Note that now you can easily add custom pokemons or modify existing ones! :) using (var reader = new StreamReader(@"Assets\Pokedex.csv")) { // Let's call readline to skip the first line (the one with the headers) reader.ReadLine(); // We countinue reading one line at a time until we get to the end of the file while (!reader.EndOfStream) { // Each line is stored in the 'line' variable, and then split using the comma (CSV = Comma Separated Values) String line = reader.ReadLine(); String[] values = line.Split(','); // Now we can check if the name required is a match for the current line if (values[2].ToLower() == name.ToLower()) { // We have found the pokemon requested! return(PokemonFactory.Create(level, name)); } } } //if we get here, it means we couldn't find the specified pokemon, so let's raise an exception throw new ArgumentException("Not a valid pokemon!"); }
public void CreatePokemon_GivenID_Returns_CorrectName(int level, int id, string expectedResult) { Prepare(); IPokemon pokemon = PokemonFactory.CreatePokemon(level, id); Assert.AreEqual(expectedResult, pokemon.Name); Assert.AreEqual(level, pokemon.Level); }
public void Render() { Pokemon pokemon = PokemonFactory.Generate(); this.pokemon = pokemon; this.PokemonBox.Image = (Image)Properties.Resources.ResourceManager.GetObject(pokemon.ImageFileName); this.pokemonHpLabel.Text = "HP: " + pokemon.CurrentHP.ToString() + "/" + pokemon.HP; }
private static void Main(string[] args) { Pokemon pokemon1 = PokemonFactory.Create(1); Pokemon pokemon2 = PokemonFactory.Create(2); Console.WriteLine(pokemon1); Console.WriteLine(pokemon2); }
private void Form1_Load(object sender, EventArgs e) { Random random = new Random(); pokemon1 = PokemonFactory.Create(random.Next(1, 5)); pokemon2 = PokemonFactory.Create(random.Next(1, 5)); Render(); }
public void factoryTest() { PokemonFactory factory = new PokemonFactory(); Pokemon pokemon = factory.GetPokemonByName("Ivysaur"); Assert.IsNotNull(pokemon); Assert.AreEqual("IVYSAUR", pokemon.Name); }
public void InitializeTrainerTeam() { PokemonTeam = new List <TrainerPokemon> { new TrainerPokemon(PokemonFactory.CreatePokemon <Onix>()), new TrainerPokemon(PokemonFactory.CreatePokemon <Machamp>()) }; }
public void Render(Pokemon pokemon) { this.pokemon1 = pokemon; this.pictureBox1.Image = (Image)Properties.Resources.ResourceManager.GetObject(pokemon.ImageFileName); this.pokemon2 = PokemonFactory.Create(2); this.hpLabel.Text = "HP: " + pokemon1.CurrentHP.ToString(); this.pictureBox2.Image = (Image)Properties.Resources.ResourceManager.GetObject(pokemon2.ImageFileName); }
public void CreatePokemon_GivenIdAndLevel_ReturnsDefaultStatModifierStages(int level, int id) { IPokemon pokemon = PokemonFactory.CreatePokemon(level, id); for (int i = 0; i < pokemon.StatModifierStages.Length; i++) { Assert.AreEqual(pokemon.StatModifierStages[i], 0); } }
public void InitializeTrainerTeam() { PokemonTeam = new List <TrainerPokemon> { new TrainerPokemon(PokemonFactory.CreatePokemon <Hypno>()), new TrainerPokemon(PokemonFactory.CreatePokemon <Alakazam>()), new TrainerPokemon(PokemonFactory.CreatePokemon <Gengar>()), }; }
private static void Main(string[] args) { int[] nationalNos = new int[] { 1, 2, 25 }; Random random = new Random(); int nationalNo1 = nationalNos[random.Next(0, nationalNos.Length)]; int nationalNo2 = nationalNos[random.Next(0, nationalNos.Length)]; Pokemon pokemon1 = PokemonFactory.Create(nationalNo1); Pokemon pokemon2 = PokemonFactory.Create(nationalNo2); }
public void InitializeTrainerTeam() { PokemonTeam = new List <TrainerPokemon> { new TrainerPokemon(PokemonFactory.CreatePokemon <Gyarados>()), new TrainerPokemon(PokemonFactory.CreatePokemon <Arcanine>()), new TrainerPokemon(PokemonFactory.CreatePokemon <Exeggutor>()) }; }
public void CreatePokemon_GivenIdAndLevel_ReturnsPokemonWithoutSpecialStatus(int level, int id, bool expectedResult) { Prepare(); IPokemon pokemon = PokemonFactory.CreatePokemon(level, id); Assert.AreEqual(expectedResult, pokemon.IsFlinched); Assert.AreEqual(expectedResult, pokemon.IsConfused); Assert.AreEqual(expectedResult, pokemon.IsEnergyFocused); Assert.AreEqual(expectedResult, pokemon.Condition != 0); }