oh, i found an error in this script:
you.health=max((you.health-my.totaldmg),0);//you loose health or die
my.totaldmg doesn't exist here; replace it with my.damage.