Ejemplo n.º 1
0
def make_boss(x, y, level, case):
    max_hp = 30 + 5 * level + random.randint(0, 5)
    attack_stat = 5 + 2 * level + random.randint(0, 5)
    defend_stat = 5 + 2 * level + random.randint(0, 5)
    hit_stat = 15 + 2 * level + random.randint(0, 5)
    critical_stat = 15 + level + random.randint(0, 5)

    combat = CombatComponent(
        max_hp=max_hp,
        attack_stat=attack_stat,
        defend_stat=defend_stat,
        hit_stat=hit_stat,
        critical_stat=critical_stat,
    )

    if case == 1:
        display = DisplayComponent('W')
        name = NameComponent('sword master')
        weapon = make_exotic_sword(level)
    elif case == 2:
        display = DisplayComponent('A')
        name = NameComponent('axe master')
        weapon = make_exotic_axe(level)
    elif case == 3:
        display = DisplayComponent('P')
        name = NameComponent('spear master')
        weapon = make_exotic_spear(level)
    elif case == 4:
        display = DisplayComponent('C')
        name = NameComponent('crossbow master')
        weapon = make_exotic_bow(level)
    else:
        assert False  # Unreachable branch

    inventory = InventoryComponent(capacity=2)
    inventory.items[0] = weapon

    if random.random() < 0.4:
        inventory.items[1] = random_consumable()

    return Entity(
        display,
        name,
        PositionComponent(x, y),
        AIComponent(),
        RandomNumberComponent(),
        BlockingComponent(),
        BossComponent(),
        combat,
        inventory,
    )
Ejemplo n.º 2
0
def make_throne(x, y):
    return Entity(
        DisplayComponent(char=chr(210),
                         fg=constants.COLOR_YELLOW,
                         layer=DrawLayer.THRONE),
        NameComponent(name='throne'),
        PositionComponent(x, y),
        ThroneComponent(),
    )
Ejemplo n.º 3
0
def smoke_bomb():
    return Entity(
        NameComponent('smoke bomb'),
        DisplayComponent(char=chr(173),
                         fg=constants.COLOR_WHITE,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        consumables.SmokeBomb(),
        DurabilityComponent(durability=3),
    )
Ejemplo n.º 4
0
def elixir():
    return Entity(
        NameComponent('elixir'),
        DisplayComponent(char=chr(173),
                         fg=constants.COLOR_WHITE,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        consumables.Elixir(),
        DurabilityComponent(durability=5),
    )
Ejemplo n.º 5
0
def antidote():
    return Entity(
        NameComponent('antidote'),
        DisplayComponent(char=chr(173),
                         fg=constants.COLOR_WHITE,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        consumables.Antidote(),
        DurabilityComponent(durability=3),
    )
Ejemplo n.º 6
0
def make_endboss_weapon():
    return Entity(
        NameComponent('executioner\'s sword'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_YELLOW,
                         layer=DrawLayer.ITEM),
        ItemComponent(droppable=False),
        WeaponComponent(attack_bonus=15, hit_bonus=30),
        ExecuteComponent(),
    )
Ejemplo n.º 7
0
def make_sword_player():
    return Entity(
        NameComponent('ancestral sword'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_YELLOW,
                         layer=DrawLayer.ITEM),
        ItemComponent(droppable=False),
        WeaponComponent(attack_bonus=3, hit_bonus=80, critical_bonus=5),
        ExtraDamageComponent(tier=0),
    )
Ejemplo n.º 8
0
def make_sword1():
    return Entity(
        NameComponent('bronze sword'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_GRAY3,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        WeaponComponent(attack_bonus=5, hit_bonus=70),
        DurabilityComponent(durability=30),
        ExtraDamageComponent(tier=0),
    )
Ejemplo n.º 9
0
def make_spear3():
    return Entity(
        NameComponent('steel spear'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_GRAY3,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        WeaponComponent(attack_bonus=15, hit_bonus=60),
        DurabilityComponent(durability=20),
        KnockbackComponent(tier=2),
    )
Ejemplo n.º 10
0
def make_spear2():
    return Entity(
        NameComponent('iron spear'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_GRAY3,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        WeaponComponent(attack_bonus=10, hit_bonus=55),
        DurabilityComponent(durability=25),
        KnockbackComponent(tier=1),
    )
Ejemplo n.º 11
0
def make_axe3():
    return Entity(
        NameComponent('steel axe'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_GRAY3,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        WeaponComponent(attack_bonus=17, hit_bonus=40),
        DurabilityComponent(durability=20),
        CleaveComponent(tier=2),
    )
Ejemplo n.º 12
0
def make_axe2():
    return Entity(
        NameComponent('iron axe'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_GRAY3,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        WeaponComponent(attack_bonus=12, hit_bonus=45),
        DurabilityComponent(durability=25),
        CleaveComponent(tier=1),
    )
Ejemplo n.º 13
0
def make_axe1():
    return Entity(
        NameComponent('bronze axe'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_GRAY3,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        WeaponComponent(attack_bonus=9, hit_bonus=50),
        DurabilityComponent(durability=30),
        CleaveComponent(tier=0),
    )
Ejemplo n.º 14
0
def make_sword3():
    return Entity(
        NameComponent('steel sword'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_GRAY3,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        WeaponComponent(attack_bonus=13, hit_bonus=60),
        DurabilityComponent(durability=20),
        ExtraDamageComponent(tier=2),
    )
Ejemplo n.º 15
0
def make_midboss_weapon():
    return Entity(
        NameComponent('book of lightning'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_YELLOW,
                         layer=DrawLayer.ITEM),
        ItemComponent(droppable=False),
        WeaponComponent(max_range=constants.FOV_RADIUS,
                        attack_bonus=15,
                        hit_bonus=0,
                        smite=True),
        ThunderComponent(),
    )
Ejemplo n.º 16
0
def make_crossbow3():
    return Entity(
        NameComponent('arbalest'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_GRAY3,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        WeaponComponent(max_range=constants.FOV_RADIUS,
                        attack_bonus=13,
                        hit_bonus=40),
        DurabilityComponent(durability=20),
        ExtraDamageComponent(tier=2),
    )
Ejemplo n.º 17
0
def make_crossbow1():
    return Entity(
        NameComponent('light crossbow'),
        DisplayComponent(char=')',
                         fg=constants.COLOR_GRAY3,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        WeaponComponent(max_range=constants.FOV_RADIUS,
                        attack_bonus=5,
                        hit_bonus=50),
        DurabilityComponent(durability=30),
        ExtraDamageComponent(tier=0),
    )
Ejemplo n.º 18
0
def make_player(x, y):
    inventory = InventoryComponent(capacity=10)
    inventory.items = {
        0: make_sword_player(),
        1: elixir(),
        2: smoke_bomb(),
    }
    return Entity(
        DisplayComponent(char='@'),
        NameComponent(name='you'),
        CombatComponent(20, 8, 8, 10, 5),
        PositionComponent(x, y),
        RandomNumberComponent(),
        BlockingComponent(),
        inventory,
    )
Ejemplo n.º 19
0
def make_endboss(x, y):
    inventory = InventoryComponent(capacity=1)
    inventory.items = {
        0: make_endboss_weapon(),
    }
    return Entity(
        DisplayComponent(char='G'),
        NameComponent(name='general'),
        CombatComponent(75, 30, 30, 45, 30),
        PositionComponent(x, y),
        BossComponent(),
        AIComponent(),
        RandomNumberComponent(),
        BlockingComponent(),
        inventory,
    )
Ejemplo n.º 20
0
def make_midboss(x, y):
    inventory = InventoryComponent(capacity=3)
    inventory.items = {
        0: make_midboss_weapon(),
        1: tonic(),
        2: tonic(),
    }
    return Entity(
        DisplayComponent(char='M'),
        NameComponent(name='magician'),
        CombatComponent(50, 15, 10, 35, 30),
        PositionComponent(x, y),
        BossComponent(),
        AIComponent(),
        RandomNumberComponent(),
        BlockingComponent(),
        inventory,
    )
Ejemplo n.º 21
0
def tonic():
    pool = [
        ('health tonic', consumables.HealthTonic, 1),
        ('attack tonic', consumables.AttackTonic, 1),
        ('defend tonic', consumables.DefendTonic, 1),
        ('hit tonic', consumables.HitTonic, 1),
        ('critical tonic', consumables.CriticalTonic, 1),
    ]

    name, constructor, durability = random.choice(pool)

    return Entity(
        NameComponent(name),
        DisplayComponent(char=chr(173),
                         fg=constants.COLOR_YELLOW,
                         layer=DrawLayer.ITEM),
        ItemComponent(),
        constructor(),
        DurabilityComponent(durability=durability),
    )