Mercurial > skaapsteker
view skaapsteker/sprites/npcs.py @ 634:20d6aef11249 default tip
Fix iCCC profiles in PNGs to avoid verbose warnings from libpng.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Fri, 27 Jan 2023 23:32:07 +0100 |
parents | 79a9b61e12ff |
children |
line wrap: on
line source
from .base import NPC, BlockingNPC, PC_LAYER, notify from pygame import transform class Monk(NPC): image_dir = 'sprites/monk' animation_regexes = [ ("meditating", "monk.png"), ] class Guard(BlockingNPC): image_dir = 'sprites/guard' def update(self): if not self._me.block and self.block: self.collides_with = set([]) self.block = False super(Guard, self).update() class Hattori(BlockingNPC): image_dir = 'sprites/hattori' facings = { 'running' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), 'standing' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), } def update(self): if not self._me.block: self.remove() class Ichiro(BlockingNPC): image_dir = 'sprites/ichiro' facings = { 'running' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), 'standing' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), } def update(self): if not self._me.block: self.remove() class Kaneda(NPC): image_dir = 'sprites/kaneda' wants_updates = True animation_regexes = [ ("standing", r"^.*_standing.png$"), ("invisible", r"^.*_invisible.png$"), ] facings = { 'standing' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), 'invisible' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), } def setup(self, name, world, dsm, state, present, facing=None): super(Kaneda, self).setup(name, world, dsm, state, facing) if not self._me.present and self._me.level == "geisha_room": self._animation = 'invisible' self._update_image() def player_action(self, player): if not self._me.present: return super(Kaneda, self).player_action(player) def update(self): if not self._me.present and self.alive() and self._me.level == "tea_house": self.remove() if self.world.missions.kumikos_kimono_torn and self.world.missions.fish_in_room and self.world.items.vase.broken and not self._me.present: self._me.present = True self._animation = 'standing' self._update_image() elif self.world.missions.kumiko_disgraced and self.alive and self._me.level == 'geisha_room': self.remove() super(Kaneda, self).update() class Tetsuo(NPC): image_dir = 'sprites/tetsuo' animation_regexes = [ ("standing", r"^.*_standing.png$"), ] facings = { 'standing' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), } class Kumiko(NPC): image_dir = 'sprites/geisha' wants_updates = True animation_regexes = [ ("standing", r"^.*_01.png$"), ] facings = { 'standing' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), } collides_with = set([PC_LAYER]) def damage(self, damage): """Destroy the kimono""" if not self.world.missions.kumikos_kimono_torn: self.world.missions.kumikos_kimono_torn = True notify("Shoo, dirty fox! Oh, look what you've done" "- you've made a great big tear in my finest silk kimono." "What will the businessman think of a ragged dress like this?") def update(self): if self.world.missions.kumikos_kimono_torn and self.world.missions.fish_in_room and self.world.items.vase.broken: self.facing = "right" super(Kumiko, self).update() class FishMonger(NPC): image_dir = 'sprites/fishmonger' animation_regexes = [ ("standing", r"^.*_standing.png$"), ] def setup(self, **opts): super(FishMonger, self).setup(**opts) self.world.missions.fishmonger_demons_killed = 0 class Maneki(NPC): image_dir = 'sprites/maneki neko' animation_regexes = [ ("standing", r"^.*_standing.png$"), ] class Actor(NPC): image_dir = 'sprites/fishmonger' animation_regexes = [ ("standing", r"^.*_standing.png$"), ] class Sasuke(NPC): image_dir = 'sprites/sasuke' def setup(self, name, world, dsm, state, present, facing=None): self._animation = 'standing' super(Sasuke, self).setup(name, world, dsm, state, facing) def update(self): if not self._me.present: self.remove() super(Sasuke, self).update() class Kitsune(NPC): image_dir = 'sprites' animation_regexes = [ ("being_evil", "boss_kitsune.png"), ]