Ludicrously generic bits.
authorSimon Cross <hodgestar@gmail.com>
Sat, 17 May 2014 20:44:47 +0000 (22:44 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 17 May 2014 20:44:47 +0000 (22:44 +0200)
naja/actions.py

index 5701109fec37a31959b73c9fe02b2cd77772a9df..4d4a0f0b3ac9960b39f335ddb0e54253e18037d3 100644 (file)
@@ -155,6 +155,7 @@ class GenericBits(LocationAction):
         self.once = self.data.get('once', False)
         self.acquire_win = self.data.get('acquire_win', False)
         self.lose_health = self.data.get('lose_health', False)
         self.once = self.data.get('once', False)
         self.acquire_win = self.data.get('acquire_win', False)
         self.lose_health = self.data.get('lose_health', False)
+        self.gain_health = self.data.get('gain_health', False)
 
     def sanity_check(self, location):
         missing_bits = set()
 
     def sanity_check(self, location):
         missing_bits = set()
@@ -177,6 +178,9 @@ class GenericBits(LocationAction):
         if self.lose_health:
             sound.play_sound('awwww.ogg')
             board.lose_health()
         if self.lose_health:
             sound.play_sound('awwww.ogg')
             board.lose_health()
+        if self.gain_health:
+            sound.play_sound('aha.ogg')
+            board.gain_health()
         if self.once:
             location.actions.remove(self)
 
         if self.once:
             location.actions.remove(self)
 
@@ -186,6 +190,8 @@ class GenericBits(LocationAction):
             glyphs.append(ACTION_GLYPHS.WINTOKEN)
         if self.lose_health:
             glyphs.append(ACTION_GLYPHS.DAMAGE)
             glyphs.append(ACTION_GLYPHS.WINTOKEN)
         if self.lose_health:
             glyphs.append(ACTION_GLYPHS.DAMAGE)
+        if self.gain_health:
+            glyphs.append(ACTION_GLYPHS.HEAL)
         if self.set_bits:
             glyphs.append(ACTION_GLYPHS.SET_BITS)
         if self.clear_bits:
         if self.set_bits:
             glyphs.append(ACTION_GLYPHS.SET_BITS)
         if self.clear_bits:
@@ -199,9 +205,11 @@ class GenericBits(LocationAction):
             return super(GenericBits, self).get_text()
         parts = []
         if self.acquire_win:
             return super(GenericBits, self).get_text()
         parts = []
         if self.acquire_win:
-            parts.append("Gain {WINTOKEN}.")
+            parts.append("Gain {WINTOKEN}.")
         if self.lose_health:
             parts.append("Lose {HEALTH}.")
         if self.lose_health:
             parts.append("Lose {HEALTH}.")
+        if self.gain_health:
+            parts.append("Gain {HEALTH}.")
         for template, bits in [
                 ('Set %s.', self.set_bits), ('Clear %s.', self.clear_bits),
                 ('Toggle %s.', self.toggle_bits)]:
         for template, bits in [
                 ('Set %s.', self.set_bits), ('Clear %s.', self.clear_bits),
                 ('Toggle %s.', self.toggle_bits)]: