Example #1
0
def deathMonster(monster):
    '''
    What happens when a non-player character dies?
    Monster is actor class instance.
    '''
    GAME.addMessage(monster.name + " has been slain!")

    monster.creatureToItems()
Example #2
0
 def drop(self):
     actor = self.currentContainer.owner
     GAME.currentLevel.addObject(self)  #clunky AF
     # GAME.currentLevel.objects.append(self) #clunky AF
     self.currentContainer.inventory.remove(self)
     #self.currentContainer = None
     self.x = actor.x
     self.y = actor.y
     self.resyncGraphicPosition()
     GAME.addMessage("item " + self.name + " dropped!")
Example #3
0
    def pickup(self, actor):
        if actor.container:
            if actor.container.volume_used + self.volume > actor.container.max_volume:

                GAME.addMessage(actor.name + " doesn't have enough room")
            else:
                GAME.addMessage(actor.name + " picked up " + self.name)
                actor.container.inventory.append(self)
                GAME.currentLevel.removeObject(self)
                # GAME.currentLevel.objects.remove(self)
                self.currentContainer = actor.container
Example #4
0
def castHeal(target, value) -> float:
    ''' Target is a Creature type. '''
    print("heal was cast")
    #TODO:  implement creature.heal function
    endHp = min(target.maxHp, target.hp + value)
    deltaHp = endHp - target.hp
    target.hp = endHp

    if deltaHp > 0:
        GAME.addMessage(target.name + " heals for " + str(deltaHp))
        return True
    else:
        GAME.addMessage(target.name + " is already at full HP")
        return False
Example #5
0
    def execute(self) -> bool:
        # attack at the start of the duration.
        if not self.started:
            if self.target.dead:
                return False

            GAME.addMessage(
                f'{self.actor.uniqueName} attacks {self.target.uniqueName}')

            if not dexterityFunction(self.actor, self.target):
                GAME.addMessage(f'... and misses!')
                # add stunned time
                return False

            damage = damageFunction(self.actor, self.target)
            GAME.addMessage(f'... and hits for {damage} hp!')

            self.target.scheduleDamage(dhp=damage, emoteName='fireSmall')
        self.tick()
        return True
Example #6
0
 def equip(self) -> None:
     #self.canBeEquipped(owner)
     #self.owner.unequipElseInSlot(self)
     #slot stuff
     self.equipped = True
     GAME.addMessage(f'{self.name} equipped')
Example #7
0
 def unequip(self) -> None:
     #slot stuff
     self.equipped = False
     GAME.addMessage(f'{self.name} unequipped')