Scriptname swordWeaponGigaBreakScript extends ObjectReference Const

import Utility

ActorValue property AP  Auto Const

Weapon Property swordWeaponGigaBreak  Auto Const

Explosion Property swordExplosionGigaBreak  Auto Const

Idle Property swordIdleGigaBreak Auto Const

ObjectReference Property Cast Auto Const

GlobalVariable Property SwordBlastGigaBreakAP  Auto Const

Event OnEquipped(Actor akActor)

	akActor.UnequipItem(swordWeaponGigaBreak,0, true)
	float ActionPoint = SwordBlastGigaBreakAP.getValue() as float 

	if akActor.GetValue(AP) as float >= ActionPoint 
		akActor.DamageValue(AP,ActionPoint)

		float ftimeStart = GetCurrentRealTime()
		float ftimeEnd = 0.0

		if !IsInMenuMode() 
			akActor.PlayIdle(swordIdleGigaBreak)
		endif

		While ftimeEnd - ftimeStart < 0.7
			ftimeEnd = GetCurrentRealTime()
		endWhile 
		akActor.placeatme(swordExplosionGigaBreak)

		While ftimeEnd - ftimeStart < 1.5
			ftimeEnd = GetCurrentRealTime()
		endWhile 
		akActor.placeatme(swordExplosionGigaBreak)

		While ftimeEnd - ftimeStart < 2.7
			ftimeEnd = GetCurrentRealTime()
		endWhile 
		akActor.placeatme(swordExplosionGigaBreak)
	
	endif

EndEvent

