class Defencerock(Npc): images = load_images(["defencerock.png"]) dp = 8 def do_collide(self, player): player.defence += self.dp self.kill()
class Spider(BaseSpider): images = load_images(["spider.png", "spider2.png"]) hp = 540 money = 13 exp = 12 condition = "POISON" pois_improb = 10
class Smalldrug(Npc): images = load_images(["smalldrug.png"]) heal = 130 def do_collide(self, player): player.health += self.heal self.kill()
class KingSnake(Snake): images = load_images(["kingsnake.png", "kingsnake2.png"]) _hp = 350 money = 10 exp = 10 first_ften = True feature = 'None' skill = "NO" condition = "NORMAL" def do_collide(self, player): super(KingSnake, self).do_collide(player) for sprite in player.currentfloor.group: if isinstance(sprite, Switchdoor): sprite.kill() player.currentfloor.group.add( Largedprock((3.5 * CELL_SIZE, 3.5 * CELL_SIZE)), Largedprock((4.5 * CELL_SIZE, 3.5 * CELL_SIZE)), Middledrug((3.5 * CELL_SIZE, 4.5 * CELL_SIZE)), Middledrug((4.5 * CELL_SIZE, 4.5 * CELL_SIZE)), BlueKey((3.5 * CELL_SIZE, 5.5 * CELL_SIZE)), BlueKey((4.5 * CELL_SIZE, 5.5 * CELL_SIZE))) if player.health > 0: Msgbox("No!!! How can you kill me! How can you be so terrible!" ).show()
class Firerock(Npc): images = load_images(["firerock.png"]) feature = "FIRE" def do_collide(self, player): player.feature = self.feature self.kill()
class Franklin(Talkable): images = load_images(["franklin.png"]) msgs = [ "My name is Franklin.", "And you'll see you have magic sum now.", "Some monsters have power to kill the magic.", "These monsters have their own special power.", "They have different features.", "The Leafies have leaf-feature.", "I just can tell you these informations. Good luck.", ] def do_collide(self, player): if player.currentfloor.floornum == 11: super(Franklin, self).do_collide(player) elif player.currentfloor.floornum == 14: self.msgs = [ "Worior: It's you! We're meet again!", "Franklin: Yep. I just want to tell you about the sword.", "Worior: The sword on the 13th floor?", "Franklin: You know it! You will use it to open a strange door.", "Worior: Which door?", "Franklin: It is...", "(Suddenly some smelly grass-smells come.)", "Franklin: Sorry, I can't bear the grass smell here. I must go.", "Worior: Oh no, please wait...", "Worior: Dad gone it! I must look for him later.", ] super(Franklin, self).do_collide(player)
class Ftendoor(Npc): images = load_images(["specialdoor.png"]) def do_collide(self, player): player.undo() for sprite in player.currentfloor.group: if isinstance(sprite, Ftendoor): sprite.kill()
class MagicSnake(Snake): images = load_images(["magicsnake.png", "magicsnake2.png"]) _hp = 300 money = 9 exp = 8 feature = 'None' skill = "NO" condition = "NORMAL"
class MiddleSnake(Snake): images = load_images(["middlesnake.png", "middlesnake2.png"]) _hp = 105 money = 4 exp = 3 feature = 'None' skill = "NO" condition = "NORMAL"
class LargeButterfly(Butterfly): images = load_images(["largebutterfly.png", "largebutterfly2.png"]) hp = 550 money = 13 exp = 13 feature = 'None' skill = "NO" condition = "NORMAL"
class LargeSnake(Snake): images = load_images(["largesnake.png", "largesnake2.png"]) _hp = 280 money = 8 exp = 8 feature = 'None' skill = "NO" condition = "NORMAL"
class LargeSoldier(MidSoldier): images = load_images(["largesoldier.png", "largesoldier2.png"]) hp = 500 money = 12 exp = 12 feature = 'None' skill = "NO" condition = "NORMAL"
class MidSoldier(Enemy): images = load_images(["midsoldier.png", "midsoldier2.png"]) hp = 420 money = 10 exp = 10 feature = 'None' skill = "NO" condition = "NORMAL"
class MidButterfly(Butterfly): images = load_images(["midbutterfly.png", "midbutterfly2.png"]) hp = 150 money = 4 exp = 4 feature = 'None' skill = "NO" condition = "NORMAL"
class Butterfly(Enemy): images = load_images(["butterfly.png", "butterfly2.png"]) hp = 80 money = 2 exp = 2 feature = 'None' skill = "NO" condition = "NORMAL"
class MiddleDProck(Defencerock): images = load_images(["middledprock.png"]) dp = 30 def do_collide(self, player): super(MiddleDProck, self).do_collide(player) for group in self.groups(): if isinstance(sprite, Trap): sprite.kill() Msgbox("You killed the trap, you are so clever.").show()
class Snake(Enemy): images = load_images(["snake.png", "snake2.png"]) _hp = 10 money = 1 exp = 1 feature = 'None' skill = "NO" condition = "NORMAL" @classmethod def hp(cls, player): return max(cls._hp - player.snakerocknum * 13, 0)
class MoneyShop(Shop): images = load_images(["moneyshop.png"]) funcdict = { pygame.K_1: 'buy_y', pygame.K_2: 'buy_b', pygame.K_3: 'buy_r', pygame.K_4: 'buy_g' } msgs = [ "Press 1 to buy a yellow key, $ 20.", "Press 2 to buy a blue key, $ 30.", "Press 3 to buy a red key, $ 50.", "Press 4 to buy a green key, $ 80.", "Press other key to quit." ]
class SecondExp(Shop): images = load_images(["secondexp.png"]) funcdict = { pygame.K_1: 'buy_largedr', pygame.K_2: 'buy_largedef', pygame.K_3: 'buy_magic', pygame.K_4: 'buy_level2' } msgs = [ "Press 1 to buy a large drug, EXP 70.", "Press 2 to buy a large defence, EXP 150.", "Press 3 to buy a magic jewer, EXP 80.", "Press 4 to buy three levels, EXP 270.", "Press other key to quit." ]
class SecondMoney(Shop): images = load_images(["secondmoney.png"]) funcdict = { pygame.K_1: 'buy_y2', pygame.K_2: 'buy_b2', pygame.K_3: 'buy_r2', pygame.K_4: 'buy_g2' } msgs = [ "Press 1 to buy five yellow keys, $ 80.", "Press 2 to buy five blue keys, $ 130.", "Press 3 to buy five red keys, $ 220.", "Press 4 to buy five green keys, $ 360.", "Press other key to quit." ]
class ExpShop(Shop): images = load_images(["expshop.png"]) funcdict = { pygame.K_1: 'buy_smalldr', pygame.K_2: 'buy_defrk', pygame.K_3: 'buy_snakerk', pygame.K_4: 'buy_level' } msgs = [ "Press 1 to buy a small drug, EXP 20.", "Press 2 to buy a defencerock, EXP 20.", "Press 3 to buy a snakerock, EXP 20.", "Press 4 to buy a level, EXP 100.", "Press other key to quit." ]
class Soldier(MidSoldier): images = load_images(["soldier.png", "soldier2.png"]) counter = 0 hp = 320 money = 9 exp = 9 feature = 'None' skill = "NO" condition = "NORMAL" def do_collide(self, player): super(Soldier, self).do_collide(player) Soldier.counter -= 1 if Soldier.counter == 0: player.currentfloor.show_greenkeys()
class Oldman(Talkable): images = load_images(["oldman.png"]) msgs = [ "Do not think about everything is so easy. Mind traps.", ] def do_collide(self, player): if player.currentfloor.floornum == 5: super(Oldman, self).do_collide(player) elif player.currentfloor.floornum == 17: self.msgs = [ "Oldman: The fairy on the 23rd floor is waiting for you.", "Worior: What? Waiting for me?", "Oldman: Right. She is looking for something.", "Oldman: And she need you to bring it.", "Worior: And could you tell me the thing?", "Oldman: Sorry, I don't know. You can go and ask her yourself.", "Worior: Can you help me to beat the monsters above us?", "Oldman: No, it is your stuff. Do it yourself.", "Oldman: But it's really difficult. Really. So good luck, boy.", "Worior: OK. Thanks...", ] super(Oldman, self).do_collide(player)
class LightButterfly(Butterfly): images = load_images(["lightbutterfly.png", "lightbutterfly2.png"]) hp = 960 money = 20 exp = 19 feature = 'LIGHT' skill = "LIGHTNING-BOMB" condition = "NORMAL" def do_collide(self, player): Msgbox("Skill: Lightning-Bomb! Be careful!").show() miss = random.randint(1, 10) if miss == 1: Msgbox("The skill missed!").show() else: Msgbox("The skill hit!").show() if player.feature in ["GRASS", "SOIL"]: player.weaken(120) elif player.feature in ["WATER", "SKY", "DARK"]: player.weaken(480) player.hurt(100) else: player.weaken(240) super(LightButterfly, self).do_collide(player)
class Largedprock(Defencerock): images = load_images(["largedprock.png"]) dp = 60
class Fakewall(Wall): images = load_images(["wall.png"]) def do_collide(self, player): self.kill()
class Exlargedrug(Smalldrug): images = load_images(["exlargedrug.png"]) heal = 650
class Largedrug(Smalldrug): images = load_images(["largedrug.png"]) heal = 500
class Middledrug(Smalldrug): images = load_images(["middledrug.png"]) heal = 300
class Wall(Npc): images = load_images(["wall.png"]) def do_collide(self, player): player.undo()