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

import wolfpack
from spells.spellfunctions import *
import whrandom

def onSpellSuccess( char, spell, type, target ):
	# target check is done at c++ code
	tgt = target.item
	if not tgt:
		return
	# skill check is done in c++ core
	# target validation
	# door / small pouch / wooden box
	if( ( tgt.type == 12 ) or ( tgt.id == "e79" ) or ( tgt.id == "e7d" ) ):
		whrandom.seed()
		if( whrandom.randint( 0, 2 ) ):
			# will give damage 1
			tgt.settag( "magictrap", 1 )
		else:
			# will give damage 0
			tgt.settag( "magictrap", 0 )
	# effects
	tgt.soundeffect( 0x1f0 )
	tgt.effect( 0x376a )
	return 1

