//actor PowerAdaptorWep_NormalBar : NormalBar {Args 4,42}
actor PowerAdaptorWep_ScriptBar : ScriptBar {}

actor PowerAdaptorWep : BaseMM8BDMWep
{
tag "$TAG_POWERADAPTOR"
dropitem "PowerAdaptorUpgrade"
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Weapon.SlotNumber 1
Obituary "$OB_POWERADAPTOR"
weapon.ammotype "PowerMeter"
inventory.icon "NULLICON"
States
{
SpawnLoop:
POWA Z 1
stop

Deselect:
POWA A 0 A_TakeInventory("PowerMeter")
goto DeselectSwap
Select:
POWA A 0
goto SelectSwap

Ready:
POWA A 0 A_JumpIfInventory("BusterGiven",1,"TakeBusters")
Goto Ready2
TakeBusters:
POWA A 0 A_GiveInventory("TakeBuster",1)
Goto Ready2
Ready2:
POWA A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_POWERFLIGHT)
POWA A 0 A_SpawnItemEx("PowerShoulderLF",-18,-1,30,0,0,0,-90)
POWA A 0 A_SpawnItemEx("PowerShoulderRF",-18,1,30,0,0,0,90)
POWA A 0 A_SpawnItemEx("PowerShoulderLB",-18,-1,30,0,0,0,-90)
POWA A 0 A_SpawnItemEx("PowerShoulderRB",-18,1,30,0,0,0,90)
Ready3:
POWA A 1 A_WeaponReady
wait

Flash.Charge:
TNT1 A 1 A_GiveInventory("PowerMeter",1+CallACS("core_checkrune",RUNE_RAGE,0))
TNT1 A 0 A_JumpIfInventory("PowerMeter",1,"Flash.Charge")
stop

Flash.Charge1:
TNT1 AAAAAAAAAA 1
TNT1 A 0 A_JumpIfInventory("PowerMeter",0,1)
stop
TNT1 AAAAAAAAAA 1
TNT1 A 0 A_JumpIfInventory("PowerMeter",35,"Flash.Charge2")
stop
Flash.Charge2:
TNT1 A 1 A_PlaySound("weapon/MM5Charge",1)
TNT1 AAAAAA 1 A_RailWait
TNT1 A 0 A_JumpIfInventory("PowerMeter",0,1)
stop
TNT1 AAAAAAA 1 A_RailWait
TNT1 A 0 A_JumpIfInventory("PowerMeter",0,"Flash.Charge2")
stop

Fire:
POWA B 1 A_GunFlash("Flash.Charge",1)
POWA B 0 A_Refire(1)
Goto Fire1
POWA B 1 A_JumpIfInTargetInventory("PlayerPropertyRage",1,2)
POWA B 0 A_Refire(1)
Goto Fire1
POWA C 1
POWA C 0 A_Refire(1)
Goto Fire1
POWA C 1 A_JumpIfInTargetInventory("PlayerPropertyRage",1,2)
POWA C 0 A_Refire(1)
Goto Fire1
POWA D 1
POWA D 0 A_Refire(1)
Goto Fire1
POWA D 1 A_JumpIfInTargetInventory("PlayerPropertyRage",1,2)
POWA D 0 A_Refire(1)
Goto Fire1
POWA E 1
POWA E 0 A_Refire(1)
Goto Fire1
POWA E 1 A_JumpIfInTargetInventory("PlayerPropertyRage",1,2)
POWA E 0 A_Refire("Charge0")
Goto Fire1

Charge0:
TNT1 A 1 A_JumpIfInventory("PowerMeter",17,"Charge1_Snd")
TNT1 A 0 A_Refire("Charge0")
Goto Fire1

Charge1_Snd:
TNT1 A 0 A_PlaySound("weapon/coilstart",1)
Charge1:
TNT1 A 0 A_JumpIfInventory("PowerMeter",35,"Charge2_Snd")
TNT1 A 1 ACS_NamedExecuteWithResult("core_chargecolor",DYE_POWERCHARGEAA,TCLR_POWERCHARGEAA)
TNT1 A 0 A_Refire(1)
Goto Fire2
TNT1 A 0 A_JumpIfInventory("PowerMeter",35,"Charge2_Snd")
TNT1 A 1 ACS_NamedExecuteWithResult("core_chargecolor",DYE_POWERCHARGEAB,TCLR_POWERCHARGEAB)
TNT1 A 0 A_Refire("Charge1")
Goto Fire2

Charge2_Snd:
TNT1 A 0 A_GunFlash("Flash.Charge1",1)
Charge2:
TNT1 A 1 ACS_NamedExecuteWithResult("core_chargecolor",DYE_POWERCHARGEBA,TCLR_POWERCHARGEBA)
TNT1 A 0 A_Refire(1)
Goto Fire3
TNT1 A 1 ACS_NamedExecuteWithResult("core_chargecolor",DYE_POWERCHARGEBB,TCLR_POWERCHARGEBB)
TNT1 A 0 A_Refire(1)
Goto Fire3
TNT1 A 1 ACS_NamedExecuteWithResult("core_chargecolor",DYE_POWERFLIGHT,TCLR_DEFAULT)
TNT1 A 0 A_JumpIfInventory("IsBot",1,"BotFire")
TNT1 A 0 A_Refire("Charge2")
Goto Fire3
BotFire:
TNT1 A 0 A_Jump(16,"Fire3")
TNT1 A 0 A_Refire("Charge2")
Goto Fire3

Altfire:
POWA J 2 A_PlaySound("weapon/wrapfire",1)
POWA K 0 A_PlaySound("weapon/mbuster",1)
POWA K 2 A_FireCustomMissile("PowerShot",0,0,8,0)
POWA LM 2
TNT1 A 4
POWA NO 2 A_Refire("Altfire")
goto Ready3

Fire1:
POWA J 2 A_GiveInventory("PowerAdaptor_FireReset_P")
POWA K 0 A_PlaySound("weapon/mbuster",1)
POWA K 2 A_FireCustomMissile("PowerShot",0,0,8,0)
POWA LM 2
TNT1 A 2
POWA NO 2
goto Ready3
Fire2:
POWA J 2 A_GiveInventory("PowerAdaptor_FireReset_P")
POWA K 0 A_PlaySound("weapon/mbuster",1)
POWA K 2 A_FireCustomMissile("PowerShot2",0,0,8,0)
POWA LM 2
TNT1 A 4
POWA NO 2
goto Ready3
Fire3:
POWA J 2 A_GiveInventory("PowerAdaptor_FireReset_P")
POWA K 0 A_Quake(2,14,0,8,"none")
POWA K 0 A_PlaySound("Weapon/napalm",1)
POWA K 2 A_FireCustomMissile("PowerShot3",0,0,8,0)
POWA LM 2
TNT1 A 6
POWA NO 2
goto Ready3

}
}

actor PowerMeter : Ammo
{
inventory.amount 1
inventory.maxamount 35
+INVENTORY.IGNORESKILL
}

actor PowerAdaptorUpgrade : BaseMM8BDMBusterUpgrade
{
Inventory.RespawnTics 350
inventory.pickupmessage "$PU_POWERADAPTOR"
Tag "$TAG_POWERADAPTORUPGRADE"
inventory.icon "POWUP"
Inventory.PickupSound "item/1up"
scale 2.0
+COUNTITEM
+INVBAR
states
{
SpawnLoop:
UPGR B 1
loop
Use:
TNT1 A 0 A_PlaySoundEx("item/refill","Voice")
TNT1 A 0 A_JumpIfInventory("IsMegaman_F",1,"MegaUse")
TNT1 A 0 A_GiveInventory("BusterGiven",1)
TNT1 A 0 A_GiveInventory("PowerAdaptorWep",1)
TNT1 A 0 A_SelectWeapon("PowerAdaptorWep")
stop
MegaUse:
TNT1 A 0 A_SpawnItemEx("HeroMegaman_H2")
TNT1 A 0 //A_GiveInventory("Megaman_W2",1)
TNT1 A 0 //A_SelectWeapon("Megaman_W2")
stop
}
}
actor PowerAdaptorUpgrade_Respawn : 8BDMItemRespawn{Translation "192:198=4:42" mass 350}
actor PowerAdaptorUpgrade_RespawnShadow : 8BDMItemRespawnShadow
{
mass 350
States
{
Spawn:
UPGR B 0
//POWA Z 0
goto Super::Spawn
}
}


actor PowerAdaptor_FireReset_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySound("weapon/wrapfire",1)
TNT1 A 0 ACS_NamedExecuteWithResult("core_chargecolor",DYE_POWERFLIGHT,TCLR_NONE)
TNT1 A 0 A_TakeInventory("PowerMeter")
stop
}
}

actor PowerShot : ProjSpawnFuncActor
{
PROJECTILE
damagetype "MegaM_PowerFist"
Obituary "$OB_POWERADAPTOR"
+BRIGHT
+THRUGHOST
ReactionTime 9
Damage (200)
radius 10
height 10
Speed 60
scale 2.5
States
{
Spawn:
POWW A 0
POWW A 0 A_Jump(256,1,2,3,4)
SpawnL:
POWW AABB 1 A_CountDown
loop

Death:
MMFX E 0 A_Explode(200,60,0,0,20)
XDeath:
MMFX E 0 A_ChangeFlag("FORCEXYBILLBOARD",true)
MMFX EDCB 2
POWW F 2
stop
}
}

actor PowerShot2 : PowerShot
{
damagetype "MegaM_PowerFist2"
ReactionTime 9
Damage (300)//350
radius 15
height 15
States
{
Spawn:
POWW C 0
POWW C 0 A_Jump(256,1,2,3,4)
SpawnL:
POWW CCDD 1 A_CountDown
loop

Death:
MMFX E 0 A_Explode(300,60,0,0,20)
XDeath:
MMFX E 0 A_ChangeFlag("FORCEXYBILLBOARD",true)
MMFX EDCB 2
POWW F 2
stop
}
}

actor PowerShot3 : PowerShot
{
damagetype "MegaM_PowerFist3"
+FORCEXYBILLBOARD
ReactionTime 1
Damage (450)//600//700
radius 20
height 20
Speed 50
States
{
Spawn:
MMFX C 0
MMFX C 1 A_CountDown
wait

Death:
MMFX E 0 A_Explode(450,70,0,0,20)
XDeath:
MMFX E 0 A_SpawnItemEx("PropBlowerEffect")
MMFX EDCB 2
POWW F 2
stop
}
}

actor PowerShoulder : BaseShieldWarper
{
Translation "192:192=4:4","198:198=42:42"
speed 100
states
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteAlways("core_shieldwarper",0,1)
TNT1 A 0 A_Jump(256,"Shield")
Goto Shield
Death:
TNT1 A 0
stop
}
}

actor PowerShoulderLF : PowerShoulder
{
states
{
Shield:
POWW R 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
POWW R 1 A_Warp(AAPTR_TARGET, -18, -1, 30, -90, WARPF_NOCHECKPOSITION|WARPF_COPYINTERPOLATION)//8+64
loop
}
}

actor PowerShoulderRF : PowerShoulder
{
states
{
Shield:
POWW R 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
POWW R 1 A_Warp(2,-18,1,30,90,8+64)
loop
}
}

actor PowerShoulderLB : PowerShoulder
{
states
{
Shield:
POWW R 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
POWW R 1 A_Warp(2,-18,1,30,-90,8+64)
loop
}
}

actor PowerShoulderRB : PowerShoulder
{
states
{
Shield:
POWW R 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
POWW R 1 A_Warp(2,-18,-1,30,90,8+64)
loop
}
}

