import es

import wcs
from wcs import wcs

itemName = 'Mask of Death'

wcs.Item(itemName).registerItem('attack', 4000, "Gain health from the damage you do to others.", True)
        
def player_hurt(ev):
    command = wcs.Command(ev['attacker'])
    count   = command.GetItemCount(itemName)
    while count:
        amount = int(int(ev['dmg_health']) * .2)
        command.Heal(amount)
        es.tell(ev['attacker'], '#multi', '#greenMask of Death #default- #lightgreenYou have leached #green%s #lightgreenhealth from #green%s.' % (amount, ev['es_username']) )
        count -= 1
        
def player_death(ev):
    wcs.Command(ev['userid']).RemoveItem(itemName)
