"""Staff of Striking - lies about damage.
Copyright 1998 Cabochon Technologies, Inc.
"""

from wyvern.lib import HookCallback
from wyvern.lib.classes.weapons import Staff
from wyvern.common.util import Strings
from wyvern.kernel.combat import DamageCommand

class staff_of_striking(Staff, HookCallback):

    def initialize(self):
        self.super__initialize()
        self.setProperty('short', 'staff')
        self.setProperty('id', 'staff of striking')
        self.setProperty('value', 10000)
        self.setWeight('2lb')
        self.setProperty('wc-smash', 10)
        self.setProperty('to-hit', 10)
        self.setCategory('weapons/artifact')
        self.setBitmap('staff_of_striking')

    def setWielded(self, wielded, agent):
        success = self.super__setWielded(wielded, agent)
        if not success: return0
        if wielded:
            agent.addHook(self, 'damagePreHook')
        else:
            agent.removeHook(self, 'damagePreHook')
        return 1

    def hookEvent(self, hookName, event):
        agent = event.getAgent()
        defender = event.getTarget()
        damage = event.getIntProperty('damage')

        # get a damage message for a higher damage level
        msg = DamageCommand.getAttackerMsg(defender, damage*5)
        event.setProperty('attacker-msg', msg)