def create_state(self): user_active = TransposePokemon.from_state_pokemon_dict( self.user.active.to_dict()) user_reserve = dict() for mon in self.user.reserve: user_reserve[mon.name] = TransposePokemon.from_state_pokemon_dict( mon.to_dict()) opponent_active = TransposePokemon.from_state_pokemon_dict( self.opponent.active.to_dict()) opponent_reserve = dict() for mon in self.opponent.reserve: opponent_reserve[ mon.name] = TransposePokemon.from_state_pokemon_dict( mon.to_dict()) user = Side(user_active, user_reserve, copy(self.user.wish), copy(self.user.side_conditions)) opponent = Side(opponent_active, opponent_reserve, copy(self.opponent.wish), copy(self.opponent.side_conditions)) state = State(user, opponent, self.weather, self.field, self.trick_room) return state
def to_object(self): # the bot knows the disabled status of it's own moves - this only needs to be done for the opponent self.opponent.lock_moves() user_active = TransposePokemon.from_state_pokemon_dict( self.user.active.to_dict()) user_reserve = dict() for mon in self.user.reserve: user_reserve[mon.name] = TransposePokemon.from_state_pokemon_dict( mon.to_dict()) opponent_active = TransposePokemon.from_state_pokemon_dict( self.opponent.active.to_dict()) opponent_reserve = dict() for mon in self.opponent.reserve: opponent_reserve[ mon.name] = TransposePokemon.from_state_pokemon_dict( mon.to_dict()) user = Side(user_active, user_reserve, copy(self.user.side_conditions), self.user.trapped) opponent = Side(opponent_active, opponent_reserve, copy(self.opponent.side_conditions), self.opponent.trapped) state = State(user, opponent, self.weather, self.field, self.trick_room, self.force_switch, self.wait) return state
def to_object(self): user_active = TransposePokemon.from_state_pokemon_dict( self.user.active.to_dict()) user_reserve = dict() for mon in self.user.reserve: user_reserve[mon.name] = TransposePokemon.from_state_pokemon_dict( mon.to_dict()) opponent_active = TransposePokemon.from_state_pokemon_dict( self.opponent.active.to_dict()) opponent_reserve = dict() for mon in self.opponent.reserve: opponent_reserve[ mon.name] = TransposePokemon.from_state_pokemon_dict( mon.to_dict()) user = Side(user_active, user_reserve, copy(self.user.side_conditions), self.user.trapped) opponent = Side(opponent_active, opponent_reserve, copy(self.opponent.side_conditions), self.opponent.trapped) state = State(user, opponent, self.weather, self.field, self.trick_room, self.force_switch, self.wait) return state
def setUp(self): self.blastoise = Pokemon.from_state_pokemon_dict( StatePokemon("blastoise", 100).to_dict()) self.venusaur = Pokemon.from_state_pokemon_dict( StatePokemon("venusaur", 100).to_dict()) self.state = State( Side(self.blastoise, dict(), (0, 0), defaultdict(lambda: 0)), Side(self.venusaur, dict(), (0, 0), defaultdict(lambda: 0)), None, None, None)
def test_pokemon_init_gives_correct_number_of_physical_moves(self): # 2 moves that are physical moves = [ {constants.ID: 'flamethrower'}, {constants.ID: 'flareblitz'}, {constants.ID: 'flamewheel'}, {constants.ID: 'reflect'}, ] state_pkmn_dict = StatePokemon('charizardmegax', 100).to_dict() state_pkmn_dict[constants.MOVES] = moves pkmn = Pokemon.from_state_pokemon_dict(state_pkmn_dict) self.assertEqual(2, pkmn.burn_multiplier)
def setUp(self): self.state = State( Side( Pokemon.from_state_pokemon_dict( StatePokemon("pikachu", 100).to_dict()), { "rattata": Pokemon.from_state_pokemon_dict( StatePokemon("rattata", 100).to_dict()), "charmander": Pokemon.from_state_pokemon_dict( StatePokemon("charmander", 100).to_dict()), "squirtle": Pokemon.from_state_pokemon_dict( StatePokemon("squirtle", 100).to_dict()), "bulbasaur": Pokemon.from_state_pokemon_dict( StatePokemon("bulbasaur", 100).to_dict()), "pidgey": Pokemon.from_state_pokemon_dict( StatePokemon("pidgey", 100).to_dict()) }, defaultdict(lambda: 0)), Side( Pokemon.from_state_pokemon_dict( StatePokemon("pikachu", 100).to_dict()), { "rattata": Pokemon.from_state_pokemon_dict( StatePokemon("rattata", 100).to_dict()), "charmander": Pokemon.from_state_pokemon_dict( StatePokemon("charmander", 100).to_dict()), "squirtle": Pokemon.from_state_pokemon_dict( StatePokemon("squirtle", 100).to_dict()), "bulbasaur": Pokemon.from_state_pokemon_dict( StatePokemon("bulbasaur", 100).to_dict()), "pidgey": Pokemon.from_state_pokemon_dict( StatePokemon("pidgey", 100).to_dict()) }, defaultdict(lambda: 0)), None, None, False) self.mutator = StateMutator(self.state)
def setUp(self): self.charizard = Pokemon.from_state_pokemon_dict( StatePokemon("charizard", 100).to_dict()) self.venusaur = Pokemon.from_state_pokemon_dict( StatePokemon("venusaur", 100).to_dict())
def setUp(self): self.state = State( Side( Pokemon.from_state_pokemon_dict(StatePokemon("raichu", 73).to_dict()), { "xatu": Pokemon.from_state_pokemon_dict(StatePokemon("xatu", 81).to_dict()), "starmie": Pokemon.from_state_pokemon_dict(StatePokemon("starmie", 81).to_dict()), "gyarados": Pokemon.from_state_pokemon_dict(StatePokemon("gyarados", 81).to_dict()), "dragonite": Pokemon.from_state_pokemon_dict(StatePokemon("dragonite", 81).to_dict()), "hitmonlee": Pokemon.from_state_pokemon_dict(StatePokemon("hitmonlee", 81).to_dict()), }, (0, 0), defaultdict(lambda: 0) ), Side( Pokemon.from_state_pokemon_dict(StatePokemon("aromatisse", 81).to_dict()), { "yveltal": Pokemon.from_state_pokemon_dict(StatePokemon("yveltal", 73).to_dict()), "slurpuff": Pokemon.from_state_pokemon_dict(StatePokemon("slurpuff", 73).to_dict()), "victini": Pokemon.from_state_pokemon_dict(StatePokemon("victini", 73).to_dict()), "toxapex": Pokemon.from_state_pokemon_dict(StatePokemon("toxapex", 73).to_dict()), "bronzong": Pokemon.from_state_pokemon_dict(StatePokemon("bronzong", 73).to_dict()), }, (0, 0), defaultdict(lambda: 0) ), None, None, False ) self.state.self.active.moves = [ {constants.ID: 'tackle', constants.DISABLED: False}, {constants.ID: 'charm', constants.DISABLED: False}, {constants.ID: 'growl', constants.DISABLED: False}, {constants.ID: 'stringshot', constants.DISABLED: False}, ] self.state.opponent.active.moves = [ {constants.ID: 'tackle', constants.DISABLED: False}, {constants.ID: 'charm', constants.DISABLED: False}, {constants.ID: 'growl', constants.DISABLED: False}, {constants.ID: 'stringshot', constants.DISABLED: False}, ]
def setUp(self): self.pokemon = Pokemon.from_state_pokemon_dict( StatePokemon('pikachu', 100).to_dict() )