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

import wolfpack
from wolfpack.consts import *
from spells.spellfunctions import *
from wolfpack.utilities import *

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

	if not defender:
		return

	agression( char, defender, spell )

	reflected = magicReflection( char, defender )

	attacker = char
	if( reflected == 1 ):
		attacker = defender
		defender = char

	# effects
	defender.soundeffect( 0x1e7 )
	defender.effect( 0x374a )

	# disturb medi
	defender.disturb()
	# unfreeze - needed to be implemented

	modStr = - ( 1 + attacker.skill[ MAGERY ] / 100 ) # 10.0 Skill for 1 Bonus

	statmodifier( defender, 60000, modStr, 0, 0 )

	return 1
