Changeset 357:d2c7e17299a7 for nagslang


Ignore:
Timestamp:
Sep 6, 2013, 5:14:04 PM (7 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Message:

Moonlight tiles force wolf form.

Location:
nagslang
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nagslang/game_object.py

    r356 r357  
    511511        # low, they shouldn't impact gameplay
    512512        if self._ticks == 0:
    513             protagonist.lose_health(self.damage)
     513            self.apply_effect(protagonist)
    514514        self._ticks += 1
    515515        if self._ticks > self.rate:
    516516            self._ticks = 0
    517517
     518    def apply_effect(self, protagonist):
     519        protagonist.lose_health(self.damage)
     520
    518521    @classmethod
    519522    def requires(cls):
     
    525528    damage = 1
    526529    tile = 'acid.png'
     530
     531
     532class ForceWolfFloor(HostileTerrain):
     533    tile = 'moonlight.png'
     534    rate = 0
     535
     536    def apply_effect(self, protagonist):
     537        protagonist.force_wolf_form()
  • nagslang/protagonist.py

    r356 r357  
    7777        self.is_moving = False
    7878        self.changing_sequence = []
     79        self.change_delay = 0
    7980
    8081        self.go_human()
     
    253254
    254255    def toggle_form(self):
     256        if self.change_delay:
     257            return
    255258        self.changing_sequence.extend(self.CHANGING_SEQUENCE[self.form])
    256259
     
    344347
    345348    def update(self, dt):
     349        if self.change_delay > 0:
     350            self.change_delay -= 1
    346351        if self.changing_sequence:
    347352            self._go_to_next_form()
     
    350355                self.gain_health(1)
    351356        super(Protagonist, self).update(dt)
     357
     358    def force_wolf_form(self):
     359        if self.in_human_form() and not self.changing_sequence:
     360            self.toggle_form()
     361        self.change_delay = 2
Note: See TracChangeset for help on using the changeset viewer.