Ejemplo n.º 1
0
def burn_and_spread_test_1(battlefield):
    spread_controller = controllers.SpreadAttackController()
    spread_bot = bot_game.Bot(coords=(1, 1),
                              max_hp=100,
                              hp=100,
                              power=1,
                              attack_range=2,
                              speed=0,
                              sight=5,
                              energy=0,
                              movement=1,
                              player='1',
                              message='RIGHT',
                              controller=spread_controller,
                              spread=1,
                              burn=9)
    battlefield.add_bot(spread_bot)

    target_coords = [(3, 1), (2, 1), (4, 1), (3, 0), (3, 2)]
    for coords in target_coords:
        controller = controllers.SitController()
        bot = bot_game.Bot(coords=coords,
                           max_hp=100,
                           hp=100,
                           power=10,
                           attack_range=0,
                           speed=0,
                           sight=5,
                           energy=0,
                           movement=1,
                           player='2',
                           message='RIGHT',
                           controller=controller)
        battlefield.add_bot(bot)
Ejemplo n.º 2
0
def stealth_test_1(battlefield):
    # sit_controller = controllers.SitController()
    controller_1 = controllers.SeekAndFightController()
    stealth_bot = bot_game.Bot(coords=(5, 5),
                               max_hp=100,
                               hp=100,
                               power=20,
                               attack_range=1,
                               speed=0,
                               sight=10,
                               energy=0,
                               movement=1,
                               player='1',
                               message='RIGHT',
                               controller=controller_1,
                               stealth=1)
    battlefield.add_bot(stealth_bot)

    fight_controller = controllers.SeekAndFightController()
    fight_bot = bot_game.Bot(coords=(0, 0),
                             max_hp=100,
                             hp=100,
                             power=20,
                             attack_range=1,
                             speed=0,
                             sight=10,
                             energy=0,
                             movement=1,
                             player='2',
                             message='RIGHT',
                             controller=fight_controller)
    battlefield.add_bot(fight_bot)
Ejemplo n.º 3
0
def absorb_test_1(battlefield):
    fight_controller_1 = controllers.SeekAndFightController()
    absorb_bot = bot_game.Bot(coords=(0, 0),
                              max_hp=200,
                              hp=200,
                              power=20,
                              attack_range=1,
                              speed=0,
                              sight=5,
                              energy=0,
                              movement=1,
                              player='1',
                              message='RIGHT',
                              controller=fight_controller_1,
                              absorb=1)

    fight_controller_2 = controllers.SeekAndFightController()
    plain_bot = bot_game.Bot(coords=(1, 0),
                             max_hp=200,
                             hp=200,
                             power=20,
                             attack_range=1,
                             speed=0,
                             sight=5,
                             energy=0,
                             movement=1,
                             player='2',
                             message='RIGHT',
                             controller=fight_controller_2)

    battlefield.add_bot(absorb_bot)
    battlefield.add_bot(plain_bot)
Ejemplo n.º 4
0
def burn_test_1(battlefield):
    fight_controller_1 = controllers.SeekAndFightController()
    burn_bot = bot_game.Bot(coords=(1, 1),
                            max_hp=100,
                            hp=100,
                            power=1,
                            attack_range=1,
                            speed=0,
                            sight=5,
                            energy=0,
                            movement=1,
                            player='1',
                            message='RIGHT',
                            controller=fight_controller_1,
                            burn=9)
    battlefield.add_bot(burn_bot)

    sit_controller = controllers.SitController()
    sit_bot = bot_game.Bot(
        coords=(2, 1),
        max_hp=100,
        hp=100,
        power=1,
        attack_range=1,
        speed=0,
        sight=5,
        energy=0,
        movement=1,
        player='2',
        message='RIGHT',
        controller=sit_controller,
    )
    battlefield.add_bot(sit_bot)
Ejemplo n.º 5
0
def get_start_bots(con_1, con_2, battlefield=None, width=None, height=None):

    if battlefield:
        width = width if width else battlefield.width
        height = height if height else battlefield.height

    bot_1 = bot_game.Bot(coords=(0, 0),
                         max_hp=1,
                         hp=1,
                         power=0,
                         attack_range=0,
                         speed=0,
                         sight=1,
                         energy=0,
                         movement=1,
                         player='1',
                         message='',
                         controller=con_1)

    bot_2 = bot_game.Bot(coords=(width - 1, height - 1),
                         max_hp=1,
                         hp=1,
                         power=0,
                         attack_range=0,
                         speed=0,
                         sight=1,
                         energy=0,
                         movement=1,
                         player='2',
                         message='',
                         controller=con_2)

    return bot_1, bot_2
Ejemplo n.º 6
0
def get_bot(coords,
            max_hp=1,
            hp=1,
            power=1,
            attack_range=1,
            speed=1,
            sight=1,
            energy=0,
            movement=1,
            player=1,
            message='',
            controller=None,
            **special_stats):

    controller = controller if controller else controllers.SitController()

    return bot_game.Bot(coords,
                        max_hp=max_hp,
                        hp=hp,
                        power=power,
                        attack_range=attack_range,
                        speed=speed,
                        sight=sight,
                        energy=energy,
                        movement=movement,
                        player=player,
                        message=message,
                        controller=controller,
                        **special_stats)
Ejemplo n.º 7
0
def test_1(battlefield):
    energy_source_1 = bot_game.EnergySource((1, 1), 10)
    energy_source_2 = bot_game.EnergySource((2, 3), 10)
    energy_source_3 = bot_game.EnergySource((4, 2), 10)
    energy_source_4 = bot_game.EnergySource((1, 4), 10)
    energy_source_5 = bot_game.EnergySource((3, 5), 10)
    battlefield.add_item(energy_source_1)
    battlefield.add_item(energy_source_2)
    battlefield.add_item(energy_source_3)
    battlefield.add_item(energy_source_4)
    battlefield.add_item(energy_source_5)

    ctlr_1 = controllers.SeekEnergyController()
    bot_1 = bot_game.Bot(coords=(0, 0),
                         max_hp=10,
                         hp=10,
                         power=10,
                         attack_range=1,
                         speed=0,
                         sight=10,
                         energy=0,
                         movement=1,
                         player='1',
                         message='',
                         controller=ctlr_1)
    battlefield.add_item(bot_1)
Ejemplo n.º 8
0
def give_life_test_1(battlefield):
    energy_source = bot_game.EnergySource((0, 0), 10)
    battlefield.add_item(energy_source)

    heal_controller = controllers.GiveLifeController()
    heal_bot = bot_game.Bot(coords=(0, 0),
                            max_hp=100,
                            hp=10,
                            power=10,
                            attack_range=1,
                            speed=0,
                            sight=5,
                            energy=0,
                            movement=1,
                            player='1',
                            message='RIGHT',
                            controller=heal_controller,
                            heal=1)
    battlefield.add_item(heal_bot)
    print('heal_bot.heal: {}'.format(heal_bot.heal))

    sit_controller = controllers.SitController()
    hurt_bot = bot_game.Bot(coords=(1, 0),
                            max_hp=100,
                            hp=10,
                            power=10,
                            attack_range=1,
                            speed=0,
                            sight=5,
                            energy=0,
                            movement=1,
                            player='1',
                            message='RIGHT',
                            special_stats=dict(),
                            controller=sit_controller)
    battlefield.add_item(hurt_bot)
Ejemplo n.º 9
0
def heal_test_1(battlefield):
    energy_source = bot_game.EnergySource((0, 0), 10)
    battlefield.add_item(energy_source)

    heal_controller = controllers.GiveLifeController()
    heal_bot = bot_game.Bot(coords=(0, 0),
                            max_hp=100,
                            hp=10,
                            power=10,
                            attack_range=1,
                            speed=0,
                            sight=5,
                            energy=0,
                            movement=1,
                            player='1',
                            message='RIGHT',
                            controller=heal_controller,
                            heal=1)

    battlefield.add_item(heal_bot)
Ejemplo n.º 10
0
def give_energy_test_1(battlefield):
    """
    Test GIVE_ENERGY processing.
    """
    energy_source = bot_game.EnergySource((0, 0), 10)
    battlefield.add_item(energy_source)

    controller = controllers.ChainEnergyController()
    bot = bot_game.Bot(coords=(0, 0),
                       max_hp=10,
                       hp=10,
                       power=10,
                       attack_range=1,
                       speed=0,
                       sight=5,
                       energy=0,
                       movement=1,
                       player='1',
                       message='RIGHT',
                       special_stats=dict(),
                       controller=controller)
    battlefield.add_item(bot)