Beispiel #1
0
 def get_player(self):
     """
     :return: A Player object with 2 Elementals on their Team.
     """
     player = PlayerBuilder().with_level(10).build()
     player.add_elemental(ElementalBuilder().with_level(10).build())
     player.add_elemental(ElementalBuilder().with_level(10).build())
     return player
Beispiel #2
0
 def test_get_enemy_target(self):
     error = "Ability that targets an enemy didn't get the correct target"
     team_a = CombatTeam([ElementalBuilder().build()],
                         PlayerBuilder().build())
     team_b = CombatTeam([ElementalBuilder().build()],
                         PlayerBuilder().build())
     combat = Combat([team_a], [team_b], Mock())
     ability = Mock()
     ability.targeting = Target.ENEMY
     target = combat.get_target(ability, team_a.active_elemental)
     self.assertEqual(target, team_b.active_elemental, error)
 def test_rolling_thunder_duration(self):
     error = "Rolling Thunder turn duration didn't decrement"
     effect = RollingThunderEffect()
     team = CombatTeam([ElementalBuilder().build()],
                       PlayerBuilder().build())
     effect.applier = team.elementals[0]
     enemy_team = CombatTeam([ElementalBuilder().build()],
                             PlayerBuilder().build())
     get_mocked_combat(team, enemy_team)
     enemy_team.add_status_effect(effect)
     duration_before = effect.rounds_remaining
     enemy_team.end_round()
     self.assertLess(effect.rounds_remaining, duration_before, error)
Beispiel #4
0
 def elementalist_money(self):
     error = "Elementalist didn't award money"
     winning_teams = [CombatTeam([], PlayerBuilder().build())]
     losing_teams = [CombatTeam([], NPCBuilder().build())]
     generator = LootGenerator(winning_teams, losing_teams)
     generator.generate_loot()
     self.assertGreater(generator.gold_earned, 0, error)
Beispiel #5
0
 def test_victory_elementalist_no_loot(self):
     error = "Elementalist shouldn't award loot"
     winning_teams = [CombatTeam([], PlayerBuilder().build())]
     elemental = ElementalBuilder().with_species(Manapher()).build()  # Manapher has 100% drop rate
     losing_teams = [CombatTeam([elemental], NPCBuilder().build())]
     generator = LootGenerator(winning_teams, losing_teams)
     generator.generate_loot()
     self.assertEqual(len(generator.items_dropped), 0, error)
Beispiel #6
0
 def test_elemental_action(self):
     error = "ElementalAction could incorrectly trigger when the elemental is KOed."
     elemental = ElementalBuilder().build()
     team = CombatTeam([elemental], PlayerBuilder().build())
     elemental.receive_damage(10000)
     action = ElementalAction(actor=team.elementals[0],
                              ability=Claw(),
                              combat=Mock())
     self.assertFalse(action.can_execute, error)
Beispiel #7
0
 def test_valid_level(self):
     error = "NPC level is potentially less than 1"
     is_correct_level = True
     player = PlayerBuilder().with_level(1).build()
     for i in range(100):
         npc = NPCBuilder().with_opponent(player).build()
         if npc.level < 1:
             is_correct_level = False
             break
     self.assertTrue(is_correct_level, error)
Beispiel #8
0
 def test_elemental_exp_gain(self):
     error = "Knocking out an elemental didn't grant exp to player's elementals"
     elemental = ElementalBuilder().with_level(5).build()
     team_a = CombatTeam([elemental], PlayerBuilder().build())
     team_b = make_combat_team()
     get_mocked_combat(team_a, team_b)
     # Nearly fatal damage
     damage = team_b.active_elemental.max_hp - 1
     team_b.active_elemental.receive_damage(damage, team_a.active_elemental)
     exp_before = elemental.current_exp
     team_a.make_move(Claw())
     team_b.make_move(Claw())
     exp_after = elemental.current_exp
     self.assertGreater(exp_after, exp_before, error)
Beispiel #9
0
 def test_player_exp_gain(self):
     error = "Knocking out an elemental didn't grant exp to player"
     player = PlayerBuilder().build()
     team_a = CombatTeam([ElementalBuilder().build()], player)
     team_b = make_combat_team()
     get_mocked_combat(team_a, team_b)
     # Nearly fatal damage
     damage = team_b.active_elemental.max_hp - 1
     team_b.active_elemental.receive_damage(damage, team_a.elementals[0])
     exp_before = player.current_exp
     team_a.make_move(Claw())
     team_b.make_move(Claw())
     exp_after = player.current_exp
     self.assertGreater(exp_after, exp_before, error)
def make_combat_team() -> CombatTeam:
    return CombatTeam([ElementalBuilder().build()], PlayerBuilder().build())
Beispiel #11
0
 def setUp(self):
     self.user = UserBuilder().with_name("Dopple").build()
     self.player = PlayerBuilder().with_user(self.user).build()
Beispiel #12
0
 def __init__(self):
     self._owner = PlayerBuilder().with_elementals([]).build()
     self._elementals = [
         ElementalBuilder().with_species(Manapher()).build()
     ]