Example #1
0
 def drop(self, pos_x, pos_y):
     globalvars.GAME.current_objects.append(self.owner)
     self.owner.animation_init()
     self.container.inventory.remove(self.owner)
     self.owner.x = pos_x
     self.owner.y = pos_y
     game.game_message("Item Dropped!", constants.COLOR_WHITE)
Example #2
0
def cast_fireball(caster, T_damage_radius_range):

    damage, internal_radius, max_range = T_damage_radius_range
    player_locat = (caster.x, caster.y)

    tile_selected = menu.menu_target_select(coords_origin=player_locat,
                                            range=max_range,
                                            pen_walls=False,
                                            pen_creature=False,
                                            radius=internal_radius)

    tiles_to_damage = maps.map_find_radius(tile_selected, internal_radius)

    creature_hit = False

    for (x, y) in tiles_to_damage:
        creature_to_dmg = maps.map_check_for_creatures(x, y)
        if creature_to_dmg:
            creature_to_dmg.creature.take_damage(damage)
            if creature_to_dmg is not globalvars.PLAYER:
                creature_hit = True

    if creature_hit:
        game.game_message("The fireball f***s shit up hardcore!",
                          constants.COLOR_RED)
Example #3
0
 def equip(self):
     all_equiped_items = self.owner.item.container.equipped
     for item in all_equiped_items:
         if item.equipment.slot and (item.equipment.slot == self.slot):
             game.game_message("equipment slot is occupied",
                               constants.COLOR_RED)
             return
     self.equipped = True
     game.game_message("equipped", constants.COLOR_WHITE)
Example #4
0
def death_monster(monster):
    '''On death, monster stops'''
    game.game_message((monster.creature.name + " is dead!"),
                      constants.COLOR_GREY)
    monster.animation = globalvars.ASSETS.dead_monster
    monster.animation_key = "dead_monster"
    monster.depth = constants.DEPTH_CORPSE
    monster.creature = None
    monster.ai = None
Example #5
0
def death_healing_sprite(monster):
    '''On death, monster stops'''
    game.game_message(
        (monster.creature.name + " is dead! Gather his essence to heal!"),
        constants.COLOR_GREEN)
    monster.animation = globalvars.ASSETS.healing_drop
    monster.animation_key = "healing_drop"
    monster.depth = constants.DEPTH_ITEM
    monster.creature = None
    monster.ai = None
Example #6
0
 def take_turn(self):
     if self.num_turns > 0:
         self.owner.creature.move(libtcodpy.random_get_int(0, -1, 1),
                                  libtcodpy.random_get_int(0, -1, 1))
         self.num_turns -= 1
     else:
         self.owner.ai = self.old_ai
         game.game_message(
             self.owner.display_name + " is no longer confused",
             constants.COLOR_WHITE)
Example #7
0
    def take_damage(self, damage):
        self.hp -= damage
        if self.hp <= 0:
            self.hp = 0
        game.game_message(
            self.owner.display_name + "'s health is " + str(self.hp) + "/" +
            str(self.maxhp), constants.COLOR_RED)

        if self.hp <= 0:
            if self.death_function is not None:
                self.death_function(self.owner)
Example #8
0
def cast_confusion(caster, effect_length):
    tile_selected = menu.menu_target_select()
    if tile_selected:
        x, y = tile_selected
        target = maps.map_check_for_creatures(x, y)
        if target:
            oldai = target.ai
            target.ai = ai.ai_Confuse(old_ai=oldai, num_turns=effect_length)
            target.ai.owner = target
            game.game_message(target.display_name + " is confused",
                              constants.COLOR_RED)
Example #9
0
 def pick_up(self, actor):
     if actor.container:
         if actor.container.volume + self.volume > actor.container.max_volume:
             game_message("Not enough space in your inventory!",
                          constants.COLOR_RED)
         else:
             game.game_message(self.owner.display_name + " Picked Up",
                               constants.COLOR_WHITE)
             actor.container.inventory.append(self.owner)
             self.owner.animation_destroy()
             globalvars.GAME.current_objects.remove(self.owner)
             self.container = actor.container
Example #10
0
    def attack(self, target):
        damage_dealt = self.power - target.creature.defense
        if damage_dealt < 0: damage_dealt = 0
        game.game_message((self.name + " attacks " + target.creature.name +
                           " for " + str(damage_dealt) + " damage!"),
                          constants.COLOR_WHITE)
        target.creature.take_damage(damage_dealt)

        if damage_dealt > 0 and self.owner is globalvars.PLAYER:
            pygame.mixer.Sound.play(
                globalvars.RANDOM_ENGINE.choice(
                    globalvars.ASSETS.sfx_list_hit))
Example #11
0
    def use(self):
        '''Uses item 
            Currently only consumables        
        '''
        if self.owner.equipment:
            self.owner.equipment.toggle_equip()
            return

        if self.use_function:
            result = self.use_function(self.container.owner, self.value)

            if result is not None:
                game.game_message(
                    "You're at full health. Healing would be pointless.",
                    constants.COLOR_RED)
            else:
                self.container.inventory.remove(self.owner)
Example #12
0
def cast_heal(target, value):
    if target.creature.hp == target.creature.maxhp:
        game.game_message(
            target.creature.name + " the " + target.name_object +
            " is at full HP!", constants.COLOR_WHITE)
        return "cancelled"
    else:
        game.game_message(
            target.creature.name + " the " + target.name_object +
            " healed for " + str(value) + " HP!", constants.COLOR_WHITE)
        target.creature.heal(value)
        game.game_message(
            "Current HP is " + str(target.creature.hp) + '/' +
            str(target.creature.maxhp), constants.COLOR_WHITE)
    return None
Example #13
0
 def unequip(self):
     self.equipped = False
     game.game_message("unequipped", constants.COLOR_WHITE)