Commits

featheredmelody committed a5f951a

Added Lord Fuzzy's special drop event to CH2ST5

  • Participants
  • Parent commits 4122f31

Comments (0)

Files changed (3)

Story of a Lost Sky/lostsky/missions/ch0st1.py

     
         required_starters = ['Youmu', 'Keine']
         pre_mission_MAE = PreMissionMAE()
-        mid_mission_MAE_list = [TagTarget(), FuzzyDrop()]
+        mid_mission_MAE_list = []
         required_survivors = ['Youmu']
         post_mission_MAE = PostMissionMAE()
     
         pass
 
 
-class TagTarget(MapActionEvent):
-
-        def __init__(self):
-            triggers = [TeamTurnTrigger(1), CustVarTrigger('Test 1', True), UnitAliveTrigger('Fairy A', True)]
-            MapActionEvent.__init__(self,triggers, repeat = True)
-
-
-
-        def render_grid(self, target):
-
-            target_location = target.location_tile
-            nearest_neighbors = [target.location_tile+Vector2(0,1),
-                                target.location_tile+Vector2(0,-1),
-                                target.location_tile+Vector2(1,0),
-                                target.location_tile+Vector2(-1,0)]
-            next_nearest_neighbors = [target.location_tile+Vector2(0,2),
-                                      target.location_tile+Vector2(2,0),
-                                      target.location_tile+Vector2(-2,0),
-                                      target.location_tile+Vector2(0,-2),
-                                      target.location_tile+Vector2(1,1),
-                                      target.location_tile+Vector2(-1,1),
-                                      target.location_tile+Vector2(1,-1),
-                                      target.location_tile+Vector2(-1,-1),
-
-                                      ]
-
-            # Draw a target zone moving outward from target.
-            self.add_highlight(target_location)
-            self.render_update()
-            self.pause(0.1)
-            for location in nearest_neighbors:
-                self.add_highlight(location)
-            self.render_update()
-            self.pause(0.1)
-            for location in next_nearest_neighbors:
-                self.add_highlight(location)
-
-            self.render_update()
-            self.pause(1)
-
-            # Remove all highlights
-            self.remove_highlight(target_location)
-            all_neighbor_locations = next_nearest_neighbors+nearest_neighbors
-            for location in all_neighbor_locations:
-                self.remove_highlight(location)
-
-
-        def render_update(self):
-
-            self.map.render_background()
-            self.map.render_all_units()
-            self.map.render_cursor()
-            self.map.render_menu_panel()
-
-            # Draws emoticon frame
-            pygame.display.flip()
-
-        def execute(self):
-            """
-            Prologue event
-            """
-
-            # Determine the unit with highest density of neighbors
-
-            prioritized_units = []
-
-            for unit in self.map.team1:
-
-                score = 0
-
-                for neighbor in self.map.team1:
-
-                    neighbor_distance = abs(unit.location_tile.x - neighbor.location_tile.x) + abs(unit.location_tile.y - neighbor.location_tile.y)
-
-                    if neighbor_distance == 0:
-                        pass
-                    elif neighbor_distance == 1:
-                        score += 2
-                    elif neighbor_distance == 2:
-                        score += 1
-
-                prioritized_units.append([score, unit.name, unit])
-
-            prioritized_units.sort()
-            prioritized_units.reverse()
-
-            target = prioritized_units[0][2]
-
-
-            self.say('Drop target selected: %s'%target.name, None, None)
-
-            self.set_status_effect(target.name, "Target")
-            self.render_grid(target)
-
-            pass
-
-class FuzzyDrop(MapActionEvent):
-
-    def __init__(self):
-        triggers = [TeamTurnTrigger(2), UnitAliveTrigger('Fairy A', True), CustVarTrigger('Test 1', True)]
-        MapActionEvent.__init__(self,triggers, repeat = True)
-        self.user = 'Fairy A'
-
-
-    def animate_action(self, target):
-
-        old_position = self.map.all_units_by_name[self.user].location_tile.copy()
-
-        self.move_unit(self.user, (old_position.x, old_position.y-15))
-        self.emote(target.name, 'exclamation')
-        self.set_unit_pos(self.user, (target.location_tile.x,target.location_tile.y-15))
-        self.move_unit(self.user, target.location_tile)
-
-        self.play_sfx('explode')
-        self.fade_to_color('white', 0.5)
-        self.set_unit_pos(self.user, old_position)
-        self.fade_from_color('white', 0.5)
-
-
-    def render_effect(self, target, damage_value):
-
-
-        text_name = self.map.engine.bfont.render("Fuzzy Drop!",True,(0,0,0))
-        half_width = text_name.get_width()/2
-
-
-        effect_text = self.map.engine.render_outlined_text(str(damage_value),self.map.engine.cfont,(255,0,0),(255,255,255))
-
-        self.map.render_background()
-        self.map.render_all_units()
-        self.map.render_cursor()
-        self.map.engine.surface.blit(self.map.engine.menu_board,(0,490))
-        self.map.engine.surface.blit(self.map.engine.map_spell_board,(175,0))
-        self.map.engine.surface.blit(text_name,(420-half_width,25))
-        target.plot_stats()
-        self.map.engine.surface.blit(effect_text,((target.location_pixel.x+18-effect_text.get_width()/2,target.location_pixel.y-25)-self.map.screen_shift*self.map.engine.tilesize))
-
-        pygame.display.flip()
-        self.map.engine.clock.tick(60)
-        self.map.engine.pause(1)
-
-    def execute_damage(self, target):
-
-        # Damage values
-        target_HP_fraction = 0.30
-        nearest_neighbor_HP_fraction = 0.25
-        nnn_HP_fraction = 0.20
-
-        damage = int(target.HP*target_HP_fraction)
-        start_HP = target.HP
-        target.HP -= damage
-
-        self.play_sfx('crit')
-        self.render_effect(target, damage)
-        target.render_hp_change(start_HP, target.HP)
-
-        for neighbor in self.map.all_units_by_name.values():
-            # Drop affects all units except for lord fuzzy
-            if neighbor.name != self.user:
-                # find distance
-
-                neighbor_distance = abs(target.location_tile.x - neighbor.location_tile.x) + abs(target.location_tile.y - neighbor.location_tile.y)
-
-                # Damage to nearest neighbors
-                if neighbor_distance == 1:
-
-                    damage = int(target.HP*nearest_neighbor_HP_fraction)
-
-                # Damage to NNN
-                elif neighbor_distance == 2:
-
-                    damage = int(target.HP*nnn_HP_fraction)
-
-                # Target out of range, skip
-                else:
-                    continue
-
-                start_HP = neighbor.HP
-                neighbor.HP -= damage
-
-                self.play_sfx('hit')
-                self.render_effect(neighbor, damage)
-                neighbor.render_hp_change(start_HP, neighbor.HP)
-
-
-
-
-    def execute(self):
-            # Find targetted units
-
-            for unit in self.map.team1:
-                if "Target" in unit.status.keys():
-
-
-                    # animate action
-                    self.animate_action(unit)
-
-                    # execute damage
-                    self.execute_damage(unit)
-
-                    unit.remove_status('Target')
-
-
-
         
 class PostMissionMAE(MapActionEvent):
     def __init__(self):

Story of a Lost Sky/lostsky/missions/ch2st5.py

 from lostsky.worldmap.event import BattleEvent 
 from lostsky.battle.mapdata import MapData
-from lostsky.battle.mapaction import MapActionEvent, ArrivalTrigger
+from lostsky.battle.mapaction import MapActionEvent, ArrivalTrigger, TeamTurnTrigger, UnitAliveTrigger, CustVarTrigger, TurnNumTrigger
+from lostsky.core.linalg import Vector2
+import pygame
+from random import choice
 
 class Mission(BattleEvent):
     
     
         required_starters = ['Youmu','Chen','Ran','Marisa','Reimu','Mokou','Keine']
         pre_mission_MAE = PreMissionMAE()
-        mid_mission_MAE_list = [TreasureMAE()]
+        mid_mission_MAE_list = [TreasureMAE(), InitFuzzyAttack(), TagTarget(), FuzzyDrop()]
         required_survivors = ['Lord Fuzzy', 'Youmu', 'Reimu', 'Marisa', 'Ran',
                               'Chen', 'Mokou', 'Keine'] 
         post_mission_MAE = PostMissionMAE()
                 None,
                 None)
         self.add_item('treasure', '004_magiclamp', 1)
-        
+
+class InitFuzzyAttack(MapActionEvent):
+
+    def __init__(self):
+        triggers = [TurnNumTrigger(2)]
+        MapActionEvent.__init__(self, triggers)
+
+    def execute(self):
+
+        self.center_on('Lord Fuzzy')
+
+        self.say("That's it! You humans are going down!",
+            'Lord Fuzzy',
+            None)
+
+        self.say("Uh oh! The boss is really ticked off!",
+            'Fuzzball',
+            'Fuzzball')
+
+        self.say("Does that mean he'll be using THAT attack?",
+            'Fuzzball',
+            'Fuzzball')
+
+        self.say("I hear he can crush a bunch of walking trees by his size alone!",
+            'Fuzzball',
+            'Fuzzball')
+
+
+
+        self.set_cust_var('Activate', True)
+
+
+class TagTarget(MapActionEvent):
+
+    def __init__(self):
+        triggers = [TeamTurnTrigger(1), CustVarTrigger('Activate', True), UnitAliveTrigger('Lord Fuzzy', True)]
+        MapActionEvent.__init__(self,triggers, repeat = True)
+
+
+
+    def render_grid(self, target):
+
+        target_location = target.location_tile
+        nearest_neighbors = [target.location_tile+Vector2(0,1),
+                             target.location_tile+Vector2(0,-1),
+                             target.location_tile+Vector2(1,0),
+                             target.location_tile+Vector2(-1,0)]
+        next_nearest_neighbors = [target.location_tile+Vector2(0,2),
+                                  target.location_tile+Vector2(2,0),
+                                  target.location_tile+Vector2(-2,0),
+                                  target.location_tile+Vector2(0,-2),
+                                  target.location_tile+Vector2(1,1),
+                                  target.location_tile+Vector2(-1,1),
+                                  target.location_tile+Vector2(1,-1),
+                                  target.location_tile+Vector2(-1,-1),
+
+                                  ]
+
+        # Draw a target zone moving outward from target.
+        self.add_highlight(target_location)
+        self.render_update()
+        self.pause(0.1)
+        for location in nearest_neighbors:
+            self.add_highlight(location)
+        self.render_update()
+        self.pause(0.1)
+        for location in next_nearest_neighbors:
+            self.add_highlight(location)
+
+        self.render_update()
+        self.pause(1)
+
+        # Remove all highlights
+        self.remove_highlight(target_location)
+        all_neighbor_locations = next_nearest_neighbors+nearest_neighbors
+        for location in all_neighbor_locations:
+            self.remove_highlight(location)
+
+
+    def render_update(self):
+
+        self.map.render_background()
+        self.map.render_all_units()
+        self.map.render_cursor()
+        self.map.render_menu_panel()
+
+        # Draws emoticon frame
+        pygame.display.flip()
+
+    def execute(self):
+        """
+
+
+
+        """
+
+        # Determine the unit with highest density of neighbors
+
+        prioritized_units = []
+
+        for unit in self.map.team1:
+
+            score = 0
+
+            for neighbor in self.map.team1:
+
+                neighbor_distance = abs(unit.location_tile.x - neighbor.location_tile.x) + abs(unit.location_tile.y - neighbor.location_tile.y)
+
+                if neighbor_distance == 0:
+                    pass
+                elif neighbor_distance == 1:
+                    score += 2
+                elif neighbor_distance == 2:
+                    score += 1
+
+            prioritized_units.append([score, unit.name, unit])
+
+        prioritized_units.sort()
+        prioritized_units.reverse()
+
+        target = prioritized_units[0][2]
+
+        self.center_on(target.name)
+        self.set_status_effect(target.name, "Target")
+        self.render_grid(target)
+
+        pass
+
+class FuzzyDrop(MapActionEvent):
+
+    def __init__(self):
+        triggers = [TeamTurnTrigger(2), UnitAliveTrigger('Lord Fuzzy', True), CustVarTrigger('Activate', True)]
+        MapActionEvent.__init__(self,triggers, repeat = True)
+        self.user = 'Lord Fuzzy'
+
+
+    def animate_action(self, target):
+
+        old_position = self.map.all_units_by_name[self.user].location_tile.copy()
+
+        self.center_on(self.user)
+        self.move_unit(self.user, (old_position.x, old_position.y-15))
+
+        self.center_on(target.name)
+        self.emote(target.name, 'exclamation')
+        self.set_unit_pos(self.user, (target.location_tile.x,target.location_tile.y-15))
+        self.move_unit(self.user, target.location_tile)
+
+        self.play_sfx('explode')
+        self.fade_to_color('white', 0.5)
+        self.set_unit_pos(self.user, old_position)
+        self.fade_from_color('white', 0.5)
+
+
+    def render_effect(self, target, damage_value):
+
+
+        text_name = self.map.engine.bfont.render("Fuzzy Drop!",True,(0,0,0))
+        half_width = text_name.get_width()/2
+
+
+        effect_text = self.map.engine.render_outlined_text(str(damage_value),self.map.engine.cfont,(255,0,0),(255,255,255))
+
+        self.map.render_background()
+        self.map.render_all_units()
+        self.map.render_cursor()
+        self.map.engine.surface.blit(self.map.engine.menu_board,(0,490))
+        self.map.engine.surface.blit(self.map.engine.map_spell_board,(175,0))
+        self.map.engine.surface.blit(text_name,(420-half_width,25))
+        target.plot_stats()
+        self.map.engine.surface.blit(effect_text,((target.location_pixel.x+18-effect_text.get_width()/2,target.location_pixel.y-25)-self.map.screen_shift*self.map.engine.tilesize))
+
+        pygame.display.flip()
+        self.map.engine.clock.tick(60)
+        self.map.engine.pause(1)
+
+    def execute_damage(self, target):
+
+        # Damage values
+        target_HP_fraction = 0.25
+        nearest_neighbor_HP_fraction = 0.20
+        nnn_HP_fraction = 0.15
+
+        damage = int(target.HP*target_HP_fraction)
+        start_HP = target.HP
+        target.HP -= damage
+
+        if target.HP < 0:
+            target.HP = 0
+
+
+        self.play_sfx('crit')
+        self.render_effect(target, damage)
+        target.render_hp_change(start_HP, target.HP)
+
+        if target.HP == 0:
+            self.map.kill(target)
+
+        for neighbor in self.map.all_units_by_name.values():
+            # Drop affects all units except for lord fuzzy
+            if neighbor.name != self.user:
+                # find distance
+
+                neighbor_distance = abs(target.location_tile.x - neighbor.location_tile.x) + abs(target.location_tile.y - neighbor.location_tile.y)
+
+                # Damage to nearest neighbors
+                if neighbor_distance == 1:
+
+                    damage = int(neighbor.HP*nearest_neighbor_HP_fraction)
+
+                # Damage to NNN
+                elif neighbor_distance == 2:
+
+                    damage = int(neighbor.HP*nnn_HP_fraction)
+
+                # Target out of range, skip
+                else:
+                    continue
+
+                start_HP = neighbor.HP
+                neighbor.HP -= damage
+
+                if neighbor.HP < 0:
+                    neighbor.HP = 0
+
+                self.play_sfx('hit')
+                self.render_effect(neighbor, damage)
+                neighbor.render_hp_change(start_HP, neighbor.HP)
+
+                if neighbor.HP == 0:
+                    self.map.kill(neighbor)
+
+
+
+
+    def execute(self):
+        # Find targetted units
+
+        possible_lines = ['Here I come!',
+                          'No escape from the King of Fuzzballs!',
+                          'I\'ll crush you to bits!',
+                          'Destruction from above!',
+                          'Secret technique: Fuzzy Crusher!'
+                                  ]
+
+        line = choice(possible_lines)
+
+        self.say(line,
+            'Lord Fuzzy',
+            None)
+
+        for unit in self.map.team1:
+            if "Target" in unit.status.keys():
+
+
+                # animate action
+                self.animate_action(unit)
+
+                # execute damage
+                self.execute_damage(unit)
+
+                unit.remove_status('Target')
+
+
+
 class PostMissionMAE(MapActionEvent):
     def __init__(self):
         triggers = []

Story of a Lost Sky/tools/mission_launcher.py

 ###########################
 
 # Make sure your mission is loaded in the mission_catalog.py file.
-mission_name =  'CH0ST1'
+mission_name =  'CH2ST5'
 print "Launching Mission: %s"%mission_name
 
 # Add all characters. If the character is added during
 # a certain mission as part of the story, do not place them here.
 characters = {
-              'Youmu':{'level':5,
+              'Youmu':{'level':6,
                         'spells':['Dagger Throw','Ageless Obsession'],
                         'traits':[] },
                
-              'Ran':{'level':5,
+              'Ran':{'level':6,
                         'spells':['Fireball','Princess Tenko','Mystic Wall','Mystic Barrier','Fried Tofu'],
                         'traits':[] },
                                  
-              'Chen':{'level':5,
+              'Chen':{'level':6,
                         'spells':['Leaf Crystal','Pentagram Flight'],
                         'traits':[]},
 
-              'Marisa':{'level':5,
+              'Marisa':{'level':6,
                          'spells':['Fireball','Master Spark','Rice Cake'],
                          'traits':[]},
 
-               'Reimu':{'level':5,
+               'Reimu':{'level':6,
                          'spells':['Holy Amulet','Fantasy Seal','Barrier Buster','Weakening Amulet'],
                          'traits':[] },
-#               'Keine':{'level':11,
-#                         'spells':['Healing Drop','Medicinal Drop','Sunbeam Mirror','Encourage','Tracking Shot'],
-#                         'traits':[] },
-#
-#               'Mokou':{'level':11,
-#                        'spells':['Dagger Throw','Flying Phoenix','Rice Cake'],
-#                         'traits':[] },
+               'Keine':{'level':6,
+                         'spells':['Healing Drop','Medicinal Drop','Sunbeam Mirror','Encourage','Tracking Shot'],
+                         'traits':[] },
+
+               'Mokou':{'level':6,
+                        'spells':['Dagger Throw','Flying Phoenix','Rice Cake'],
+                         'traits':[] },
 #               'Aya':{'level':12,
 #                         'spells':['Holy Amulet','Tengu Wind Path', 'Rice Cake'],
 #                         'traits':[] },