Esempio n. 1
0
 def use(cls, item):
     add_log_message(
         LogMessage(
             get_message(
                 get_monster_message_prefix(item.monster) +
                 'item.potion.use').format(
                     str.capitalize(item.monster.get_name()),
                     item.get_name())))
Esempio n. 2
0
 def remove_effect(self):
     if tcod.map_is_in_fov(self.monster.game_map.fov_map, self.monster.x,
                           self.monster.y):
         add_log_message(
             LogMessage(
                 get_message(
                     get_monster_message_prefix(self.monster) +
                     "poison.end").format(
                         str.capitalize(self.monster.get_name())),
                 tcod.desaturated_orange))
Esempio n. 3
0
 def __init__(self, monster, turns):
     super().__init__(monster, turns)
     if tcod.map_is_in_fov(monster.game_map.fov_map, monster.x, monster.y):
         add_log_message(
             LogMessage(
                 get_message(
                     get_monster_message_prefix(self.monster) +
                     "poison.begin").format(
                         str.capitalize(self.monster.get_name())),
                 tcod.dark_orange))
Esempio n. 4
0
 def use_ability(cls, monster):
     items = monster.game_map.get_items_at(monster.x, monster.y)
     if not items:
         add_log_message(
             LogMessage(
                 get_message(get_monster_message_prefix(monster) + 'pickup_item.none'),
                 tcod.dark_grey
             )
         )
     else:
         item = items.pop()
         monster.inventory.add_item(item)
         add_log_message(
             LogMessage(
                 get_message(get_monster_message_prefix(monster) + 'pickup_item')
                 .format(monster.get_name(), item.get_name()),
                 tcod.white
             )
         )
     cls.reset_turn(monster)
Esempio n. 5
0
 def heal(self, amount, with_message=True):
     self.hp += amount
     self.check_max_hp()
     if with_message:
         add_log_message(
             LogMessage(
                 get_message(get_monster_message_prefix(self) + 'healed')
                 .format(str.capitalize(self.get_name())),
                 tcod.desaturated_green if self.player is None else tcod.green
             )
         )
Esempio n. 6
0
 def remove_effect(self):
     self.monster.remove_stat_bonus('dexterity', 'spider_web')
     self.monster.remove_stat_bonus('land_speed', 'spider_web')
     if tcod.map_is_in_fov(self.monster.game_map.fov_map, self.monster.x,
                           self.monster.y):
         add_log_message(
             LogMessage(
                 get_message(
                     get_monster_message_prefix(self.monster) +
                     "spider_web.end").format(
                         str.capitalize(self.monster.get_name())),
                 tcod.desaturated_orange))
Esempio n. 7
0
 def remove_effect(self):
     self.monster.remove_stat_bonus('strength', 'fatigue')
     self.monster.remove_stat_bonus('constitution', 'fatigue')
     self.monster.remove_stat_bonus('dexterity', 'fatigue')
     if tcod.map_is_in_fov(self.monster.game_map.fov_map, self.monster.x,
                           self.monster.y):
         add_log_message(
             LogMessage(
                 get_message(
                     get_monster_message_prefix(self.monster) +
                     "fatigue.end").format(
                         str.capitalize(self.monster.get_name())),
                 tcod.desaturated_orange))
Esempio n. 8
0
 def __init__(self, monster, turns):
     super().__init__(monster, turns)
     monster.add_stat_bonus('strength', 'fatigue', -2)
     monster.add_stat_bonus('constitution', 'fatigue', -2)
     monster.add_stat_bonus('dexterity', 'fatigue', -2)
     if tcod.map_is_in_fov(monster.game_map.fov_map, monster.x, monster.y):
         add_log_message(
             LogMessage(
                 get_message(
                     get_monster_message_prefix(self.monster) +
                     "fatigue.begin").format(
                         str.capitalize(self.monster.get_name())),
                 tcod.dark_orange))
Esempio n. 9
0
 def remove_effect(self):
     self.monster.remove_stat_bonus('strength', 'rage')
     self.monster.remove_stat_bonus('constitution', 'rage')
     self.monster.remove_stat_bonus('dexterity', 'rage')
     self.monster.remove_stat_bonus('intelligence', 'rage')
     if tcod.map_is_in_fov(self.monster.game_map.fov_map, self.monster.x,
                           self.monster.y):
         add_log_message(
             LogMessage(
                 get_message(
                     get_monster_message_prefix(self.monster) +
                     "rage.end").format(
                         str.capitalize(self.monster.get_name())),
                 tcod.desaturated_blue))
     self.monster.add_status(StatusEffectFatigue, self.elapsed_turns * 2)
Esempio n. 10
0
 def __init__(self, monster, turns):
     self.elapsed_turns = 0
     super().__init__(monster, turns)
     monster.add_stat_bonus('strength', 'rage', 8)
     monster.add_stat_bonus('constitution', 'rage', 4)
     monster.add_stat_bonus('dexterity', 'rage', -4)
     monster.add_stat_bonus('intelligence', 'rage', -8)
     if tcod.map_is_in_fov(monster.game_map.fov_map, monster.x, monster.y):
         add_log_message(
             LogMessage(
                 get_message(
                     get_monster_message_prefix(self.monster) +
                     "rage.begin").format(
                         str.capitalize(self.monster.get_name())),
                 tcod.blue))
Esempio n. 11
0
 def take_damage(self, damage, source = None):
     self.hp -= damage
     if self.hp <= 0:
         add_log_message(
             LogMessage(
                 get_message(get_monster_message_prefix(self) + "die")
                 .format(str.capitalize(self.get_name())),
                 tcod.orange if self.player is None else tcod.red
             )
         )
         self.dead = True
         if source is not None:
             source.gain_exp(self.get_defeat_experience())
         if self.player is not None:
             delete_game()
Esempio n. 12
0
 def __init__(self, monster, turns):
     super().__init__(monster, turns)
     self.total_turns = turns
     self.total_dex_malus = -1
     self.total_speed_malus = 25
     monster.add_stat_bonus('dexterity', 'spider_web', self.total_dex_malus)
     monster.add_stat_bonus('land_speed', 'spider_web',
                            self.total_speed_malus)
     if tcod.map_is_in_fov(monster.game_map.fov_map, monster.x, monster.y):
         add_log_message(
             LogMessage(
                 get_message(
                     get_monster_message_prefix(self.monster) +
                     "spider_web.begin").format(
                         str.capitalize(self.monster.get_name())),
                 tcod.dark_orange))
Esempio n. 13
0
 def gain_level(self, level, log=False):
     if level < 1:
         return
     for _ in range(level - 1):
         self.monster_race.gain_level(self)
         if self.monster_class:
             self.monster_class.gain_level(self)
     self.level += level
     if log:
         add_log_message(
             LogMessage(
                 get_message(get_monster_message_prefix(self) + "level_up")
                 .format(str.capitalize(self.get_name())),
                 tcod.orange if self.player is None else tcod.green
             )
         )
Esempio n. 14
0
def attack(attacker, target):
    message_key_prefix = get_monster_message_prefix(attacker)

    roll = make_attack_roll(attacker)
    evasion = target.get_evasion()
    roll -= evasion
    if roll <= 0:
        add_log_message(
            LogMessage(
                get_message(message_key_prefix + "miss_dodge").format(
                    str.capitalize(attacker.get_name()), target.get_name()),
                tcod.grey))
        return

    damage = make_damage_roll(attacker)
    if damage <= target.get_shield_block():
        shield = target.get_shield_rate()
        roll -= shield
        if roll <= 0:
            add_log_message(
                LogMessage(
                    get_message(message_key_prefix + "miss_block").format(
                        str.capitalize(attacker.get_name()),
                        target.get_name()), tcod.grey))
            return

    armor = target.get_armor_value()
    if armor >= 1:
        damage -= randint(0, armor)
    if damage <= 0:
        add_log_message(
            LogMessage(
                get_message(message_key_prefix + "miss_armor").format(
                    str.capitalize(attacker.get_name()), target.get_name()),
                tcod.grey))
        return

    add_log_message(
        LogMessage(
            get_message(message_key_prefix + "hit").format(
                str.capitalize(attacker.get_name()), target.get_name(),
                damage), tcod.white))
    target.take_damage(damage, attacker)
    attacker.apply_attack_effect(target)
Esempio n. 15
0
    def stack(self, monster, turns):
        add_turns = min(300, self.turns + turns) - self.turns
        self.turns += add_turns
        self.total_turns += add_turns
        self.total_dex_malus = max(-5, self.total_dex_malus - 1)
        self.total_speed_malus = min(250, self.total_speed_malus + 25)

        multiplier = self.turns / self.total_turns
        monster.add_stat_bonus('dexterity', 'spider_web',
                               floor(self.total_dex_malus * multiplier))
        monster.add_stat_bonus('land_speed', 'spider_web',
                               ceil(self.total_speed_malus * multiplier))

        if tcod.map_is_in_fov(monster.game_map.fov_map, monster.x, monster.y):
            add_log_message(
                LogMessage(
                    get_message(
                        get_monster_message_prefix(self.monster) +
                        "spider_web.stack").format(
                            str.capitalize(self.monster.get_name())),
                    tcod.dark_orange))