def post_cast(sender, **kwargs): """ Execute action after a spell is cast. This is used to implement specific spells such as 'clean any existing spell' cast. Returns True if action has been taken, False if not. """ try: psdue = kwargs['psdue'] except: return # Log usage to SpellHistory SpellHistory.used(psdue.source, psdue.spell, psdue.player) # Special actions if psdue.spell.name == 'dispell': for psd in psdue.player.magic.spells: signals.postExpire.send(sender=None, psdue=psd) psd.delete() return True if psdue.spell.name == 'cure': for psd in psdue.player.magic.spells.filter(spell__type='n'): signals.postExpire.send(sender=None, psdue=psd) psd.delete() # also delete itself psdue.delete() return True if psdue.spell.name == 'top-disguise': psdue.player.points = 1.0 * psdue.player.points * psdue.player.magic.modifier_percents('top-disguise') / 100 psdue.player.save() return False
def post_cast(self, psdue): """ Execute action after a spell is cast. This is used to implement specific spells such as 'clean any existing spell' cast. Returns True if action has been taken, False if not. """ # Always executed, so log SpellHistory.used(psdue.source, psdue.spell, psdue.player) # Also trigger anonymous activiy from wouso.interface.activity import signals if psdue.source == psdue.player: signal_msg = 'a facut o vraja asupra sa.' else: signal_msg = 'a facut o vraja asupra {to}.' signals.addActivity.send(sender=None, user_from=psdue.source, user_to=psdue.player, message=signal_msg, arguments=dict(to=psdue.player), game=None) if psdue.spell.name == 'dispell': for psd in psdue.player.magic.spells: psd.delete() return True if psdue.spell.name == 'cure': for psd in psdue.player.magic.spells.filter(spell__type='n'): psd.delete() # also delete itself psdue.delete() return True if psdue.spell.name == 'steal': psdue.player.steal_points(psdue.source, psdue.spell.percents) psdue.delete() return True return False
def post_cast(self, psdue): """ Execute action after a spell is cast. This is used to implement specific spells such as 'clean any existing spell' cast. Returns True if action has been taken, False if not. """ # Log usage to SpellHistory SpellHistory.used(psdue.source, psdue.spell, psdue.player) # Special actions if psdue.spell.name == 'dispell': for psd in psdue.player.magic.spells: self.post_expire(psd) psd.delete() return True if psdue.spell.name == 'cure': for psd in psdue.player.magic.spells.filter(spell__type='n'): self.post_expire(psd) psd.delete() # also delete itself psdue.delete() return True if psdue.spell.name == 'steal': psdue.player.steal_points(psdue.source, psdue.spell.percents) psdue.delete() return True if psdue.spell.name == 'top-disguise': psdue.player.points = 1.0 * psdue.player.points * psdue.player.magic.modifier_percents( 'top-disguise') / 100 psdue.player.save() return False
def post_cast(self, psdue): """ Execute action after a spell is cast. This is used to implement specific spells such as 'clean any existing spell' cast. Returns True if action has been taken, False if not. """ # Log usage to SpellHistory SpellHistory.used(psdue.source, psdue.spell, psdue.player) # Special actions if psdue.spell.name == 'dispell': for psd in psdue.player.magic.spells: self.post_expire(psd) psd.delete() return True if psdue.spell.name == 'cure': for psd in psdue.player.magic.spells.filter(spell__type='n'): self.post_expire(psd) psd.delete() # also delete itself psdue.delete() return True if psdue.spell.name == 'steal': psdue.player.steal_points(psdue.source, psdue.spell.percents) psdue.delete() return True if psdue.spell.name == 'top-disguise': psdue.player.points = 1.0 * psdue.player.points * psdue.player.magic.modifier_percents('top-disguise') / 100 psdue.player.save() return False
def post_cast(self, psdue): """ Execute action after a spell is cast. This is used to implement specific spells such as 'clean any existing spell' cast. Returns True if action has been taken, False if not. """ # Always executed, so log SpellHistory.used(psdue.source, psdue.spell, psdue.player) # Also trigger anonymous activiy from wouso.interface.activity import signals if psdue.source == psdue.player: signal_msg = 'a facut o vraja asupra sa.' else: signal_msg = 'a facut o vraja asupra {to}.' action_msg = 'cast' signals.addActivity.send(sender=None, user_from=psdue.source, user_to=psdue.player, message=signal_msg, arguments=dict(to=psdue.player), action=action_msg, game=None) if psdue.spell.name == 'dispell': for psd in psdue.player.magic.spells: self.post_expire(psd) psd.delete() return True if psdue.spell.name == 'cure': for psd in psdue.player.magic.spells.filter(spell__type='n'): self.post_expire(psd) psd.delete() # also delete itself psdue.delete() return True if psdue.spell.name == 'steal': psdue.player.steal_points(psdue.source, psdue.spell.percents) psdue.delete() return True if psdue.spell.name == 'top-disguise': psdue.player.points = 1.0 * psdue.player.points * psdue.player.magic.modifier_percents( 'top-disguise') / 100 psdue.player.save() return False