def remove(self, itemName): #removes item from cargo if there is 1 or more #removes count/instance of item from cargo list if itemName in self.cargo: if self.cargo[itemName][0] > 0: item = self.cargo[itemName].pop() self.cargo[itemName][0] -= 1 self.currentStorage -= item.weight updater.deregister(item)
def remove(self, itemName): #removes item from inventory #subtracts weight #item goes poof if itemName in self.items: if self.items[itemName][0] > 0: self.items[itemName][0] -= 1 listItem = self.items[itemName].pop() self.carriedWeight -= listItem.weight updater.deregister(listItem)
def attackMonster(self, mon): #~~ clear() while self.health >= 0 and mon.health >= 0: clear() FightArt(False, False) print("") print("Your health is " + str(round(self.health, 2)) + ".") print(mon.name + "'s health is " + str(mon.health) + ".") #** self.health -= round(mon.damage * (1 - self.damagereduction), 1) mon.health -= round(self.damage, 1) print("") print("You attacked " + mon.name + " for " + str(round(self.damage, 2)) + " damage.") print(mon.name + " attacked you for " + str(round(mon.damage * (1 - self.damagereduction), 2)) + " damage.") input("Press enter to continue...") if self.health <= 0: self.alive = False elif mon.health <= 0: self.health = round(self.health, 1) print("You win. Your health is now " + str(round(self.health, 2)) + ".") self.monsterSlayer = True self.spawnItems() #If you win, world drops items, kill counter increases, and xp goes up. @100 u lvl up successfully if mon in self.location.monsters: self.location.removeMonster(mon) updater.deregister(mon) self.zombieKillCounter += 1 #you can change specific xp bonuses for each monster class self.xp += mon.xpMod self.levelUp() print("Level: " + str(self.level) + " Experience: " + str(self.xp)) print("Zombies Killed: " + str(self.zombieKillCounter)) print() input("Press enter to continue...") return True else: self.alive = False
def die(self): self.room.removeCreature(self) updater.deregister(self)
def update(self): if self.loc.type != "player": self.timeAlive += 1 if self.timeAlive > self.decayTime: self.loc.removeItem(self) updater.deregister(self)
def update(self): #corpses disappear after a while self.timeleft-=1 if self.timeleft<0 or self.items==[]: updater.deregister(self) self.loc.removeItem(self)
def die(self): self.loc.removeMonster(self) updater.deregister(self)
def die(self): self.room.removeMonster(self) self.room.update() updater.deregister(self)
def die(self): self.room.removeMonster(self) updater.deregister(self)
def die(self): self.dropLoot() #Added loot dropping self.room.removeMonster(self) updater.deregister(self) monsterlist.remove(self)