Пример #1
0
 def highlight_targets(self):
     old_highlighted = self.highlighted
     self.highlighted = []
     # Get targets
     targets = self.stack_gui.focused.ability.targets
     for t in targets:
         if not isinstance(t, MultipleTargets):
             t = [
                 t.get_targeted()
             ]  # or isinstance(t, AllPermanentTargets) or isinstance(t, AllPlayerTargets)): t = [t.target]
         else:
             t = t.get_targeted()
         for i, tt in enumerate(t):
             if tt == None:
                 continue  # For delayed targeting abilities, like champion
             if isPlayer(tt):
                 for status in [self.window.mainplayer_status, self.window.otherplayer_status]:
                     if tt == status.player:
                         status.animate("life")
             elif isPermanent(tt):
                 for play in [self.window.mainplay, self.window.otherplay]:
                     guicard = play.get_card(tt)
                     if guicard:
                         self.highlighted.append(guicard)
                         if guicard in old_highlighted:
                             old_highlighted.remove(guicard)
                         guicard.highlight()
             # elif isStackAbility(tt):
             #    guicard = self.stack_gui.get_card(tt)
             #    if guicard:
             #        self.highlighted.append(guicard)
             #        if guicard in old_highlighted: old_highlighted.remove(guicard)
             #        guicard.highlight()
     for obj in old_highlighted:
         obj.unhighlight()
Пример #2
0
 def targeted_by(self, sender, targeter):
     color =  (0.5,0.71,0.94, 1.0)
     dt = 2.0
     if isPlayer(sender):
         pstatus = self.player_status[sender]
         avatar = pstatus.avatar
         pos = pstatus.pos + avatar.pos
         self.sparks.add_star_spark(pos, pos, dt=dt, color=color, dim=2)
     if isPermanent(sender):
         zone = self.play_zones[sender.controller]
         guicard = zone.get_card(sender)
         start_pos = self.project_to_window(*tuple(zone.pos+guicard.pos))
         self.sparks.add_star_spark(start_pos, start_pos, dt=dt, color=color, dim=2)
Пример #3
0
 def invalid_target(self, sender, target):
     if isPlayer(target):
         pstatus = self.player_status[target]
         avatar = pstatus.avatar
         if avatar.shaking == 0:
             avatar.shaking = 1
             avatar._pos.set_transition(dt=0.25, method=lambda t: anim.oscillate_n(t, 4))
             avatar.pos += euclid.Vector3(10, 0, 0)
             clock.schedule_once(lambda t: setattr(avatar, "shaking", 0), 0.5)
     elif isPermanent(target):
         zone = self.play_zones[target.controller]
         guicard = zone.get_card(target)
         guicard.shake()
         clock.schedule_once(lambda t: guicard.unshake(), 0.25)
Пример #4
0
 def invalid_target(self, sender, target):
     if isPlayer(target):
         pstatus = self.player_status[target]
         avatar = pstatus.avatar
         if avatar.shaking == 0:
             avatar.shaking = 1
             avatar._pos.set_transition(
                 dt=0.25, method=lambda t: anim.oscillate_n(t, 4))
             avatar.pos += euclid.Vector3(10, 0, 0)
             clock.schedule_once(lambda t: setattr(avatar, "shaking", 0),
                                 0.5)
     elif isPermanent(target):
         zone = self.play_zones[target.controller]
         guicard = zone.get_card(target)
         guicard.shake()
         clock.schedule_once(lambda t: guicard.unshake(), 0.25)
Пример #5
0
 def targeted_by(self, sender, targeter):
     color = (0.5, 0.71, 0.94, 1.0)
     dt = 2.0
     if isPlayer(sender):
         pstatus = self.player_status[sender]
         avatar = pstatus.avatar
         pos = pstatus.pos + avatar.pos
         self.sparks.add_star_spark(pos, pos, dt=dt, color=color, dim=2)
     if isPermanent(sender):
         zone = self.play_zones[sender.controller]
         guicard = zone.get_card(sender)
         start_pos = self.project_to_window(*tuple(zone.pos + guicard.pos))
         self.sparks.add_star_spark(start_pos,
                                    start_pos,
                                    dt=dt,
                                    color=color,
                                    dim=2)
Пример #6
0
 def highlight_targets(self):
     old_highlighted = self.highlighted
     self.highlighted = []
     # Get targets
     targets = self.stack_gui.focused.ability.targets
     for t in targets:
         if not isinstance(t, MultipleTargets):
             t = [
                 t.get_targeted()
             ]  #or isinstance(t, AllPermanentTargets) or isinstance(t, AllPlayerTargets)): t = [t.target]
         else:
             t = t.get_targeted()
         for i, tt in enumerate(t):
             if tt == None:
                 continue  # For delayed targeting abilities, like champion
             if isPlayer(tt):
                 for status in [
                         self.window.mainplayer_status,
                         self.window.otherplayer_status
                 ]:
                     if tt == status.player:
                         status.animate("life")
             elif isPermanent(tt):
                 for play in [self.window.mainplay, self.window.otherplay]:
                     guicard = play.get_card(tt)
                     if guicard:
                         self.highlighted.append(guicard)
                         if guicard in old_highlighted:
                             old_highlighted.remove(guicard)
                         guicard.highlight()
             #elif isStackAbility(tt):
             #    guicard = self.stack_gui.get_card(tt)
             #    if guicard:
             #        self.highlighted.append(guicard)
             #        if guicard in old_highlighted: old_highlighted.remove(guicard)
             #        guicard.highlight()
     for obj in old_highlighted:
         obj.unhighlight()