#################################################################
#   )      (\_     # WOLFPACK 13.0.0 Scripts                    #
#  ((    _/{  "-;  # Created by: khpae                          #
#   )).-" {{ ;"`   # Revised by:                                #
#  ( (  ;._ \\ ctr # Last Modification: Created                 #
#################################################################

import wolfpack
from wolfpack.consts import *
from wolfpack.utilities import *
from math import floor

def onSpellSuccess( char, spell, type, target ):
	# target check is done at c++ code
	defender = target.char
	if not defender:
		return

	# noto check : it's needed even if it's not a 'bad' spell
	agression( char, defender, spell )

	# effects
	defender.soundeffect( 0x1f3 )
	defender.effect( 0x376a )

	# not a resistable spell
	# skill 1.0 = 10 point
	heal = floor( 5 + char.skill[ MAGERY ] / 200 ) # Per 20.0 Magery Bonus of 1 -> Can heal a max of 10 hitpoints

	if( defender.strength > ( defender.health + heal ) ):
		defender.health = defender.health + heal
	else:
		defender.health = defender.strength
	return 1

