
//==============================================================================
//		OVERWRITING STATES FOR ALTERING MONSTER FUNCTION
//==============================================================================
// Make sure to specify what attacks the monster can use in A_Chase

//	Missile -> MissileHatredList -> MissileFriendlyCheck -> MissileSpecialAttackCheck -> MissileProper
//	RepeatFriendlyCheck -> RepeatSpecialAttackCheck -> RepeatProper
//	Melee -> MeleeHatredList -> MeleeFriendlyCheck -> MeleeSpecialAttackCheck -> MeleeProper
//	Pain -> PainMain
//	Death -> DeathMain
//	XDeath -> XDeathMain

//==============================================================================
//		Base monster attack states are defined here, to cut down on repetition
//==============================================================================
 // Checks for DRPG, and gets any aura tokens available
  Missile:
    "####" "#" 0 A_JumpIf(CallACS("DRPGCheck"), "MissileDRPGCheck")
    "####" "#" 0 A_JumpIf(1, "MissileHatredList")
	Goto MissileHatredList
  Melee:
    "####" "#" 0 A_JumpIf(CallACS("DRPGCheck"), "MeleeDRPGCheck")
    "####" "#" 0 A_JumpIf(1, "MeleeHatredList")
	Goto MeleeHatredList

// These give the monster tokens based on whatever DRPG Auras they happen to have
  MissileDRPGCheck:
    "####" "#" 0 ACS_NamedExecuteAlways("GetAuraTokens", 0)
    "####" "#" 0 A_JumpIf(1, "MissileHatredList")
	Goto MissileHatredList
  MeleeDRPGCheck:
    "####" "#" 0 ACS_NamedExecuteAlways("GetAuraTokens", 0)
    "####" "#" 0 A_JumpIf(1, "MeleeHatredList")
	Goto MeleeHatredList
//=============================================================================================================================
	 // Gets overwritten to determine which monsters this monster doesn't get along with
  MissileHatredList:
    "####" "#" 0 A_JumpIf(CheckClass("Wantopus", AAPTR_TARGET, TRUE), "HatredOn")
    "####" "#" 0 A_JumpIf(CheckClass("RLWantopusBase", AAPTR_TARGET, TRUE), "HatredOn")
    "####" "#" 0 A_JumpIfInventory ("RLHatredToken", 1, "MissileHatredOff")
    "####" "#" 0 A_JumpIf(1, "MissileFriendlyCheck")
	Goto MissileFriendlyCheck
  MeleeHatredList:
    "####" "#" 0 A_JumpIf(CheckClass("Wantopus", AAPTR_TARGET, TRUE), "HatredOn")
    "####" "#" 0 A_JumpIf(CheckClass("RLWantopusBase", AAPTR_TARGET, TRUE), "HatredOn")
    "####" "#" 0 A_JumpIfInventory ("RLHatredToken", 1, "MeleeHatredOff")
    "####" "#" 0 A_JumpIf(1, "MeleeFriendlyCheck")
	Goto MeleeFriendlyCheck

//=============================================================================================================================
	
  MissileFriendlyCheck:
    "####" "#" 0 A_CheckFlag ("FRIENDLY", "MissileSpecialAttackCheck")
    "####" "#" 0 A_JumpIf(CheckClass("Wantopus", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLWantopusBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(1, "MissileSpecialAttackCheck")
	Goto MissileSpecialAttackCheck
  RepeatFriendlyCheck:
    "####" "#" 0 A_CheckFlag ("FRIENDLY", "RepeatSpecialAttackCheck")
    "####" "#" 0 A_JumpIf(CheckClass("Wantopus", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLWantopusBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(1, "RepeatSpecialAttackCheck")
	Goto RepeatSpecialAttackCheck
  MeleeFriendlyCheck:
    "####" "#" 0 A_CheckFlag ("FRIENDLY", "MeleeSpecialAttackCheck")
    "####" "#" 0 A_JumpIf(CheckClass("Wantopus", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLWantopusBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(1, "MeleeSpecialAttackCheck")
	Goto MeleeSpecialAttackCheck

//=============================================================================================================================
	
  MissileSpecialAttackCheck: // Check for any alternate attack methods it should use
	"####" "#" 0 A_JumpIf(CallACS("DRLAMonsterOnlyCheck"), "ArsenalMissileCheck") // Check for full DRLA
    "####" "#" 0 A_JumpIfInventory("LDLegendaryMonsterTransformed", 1, "LegendaryMissileAttack") // LegenDoom legendary monster
    "####" "#" 0 A_JumpIf(1, "MissileProper")
	Goto MissileProper
  RepeatSpecialAttackCheck: // Check for any alternate attack methods it should use
	"####" "#" 0 A_JumpIf(CallACS("DRLAMonsterOnlyCheck"), "ArsenalRepeatCheck") // Check for full DRLA
    "####" "#" 0 A_JumpIfInventory("LDLegendaryMonsterTransformed", 1, "LegendaryRepeatAttack") // LegenDoom legendary monster
    "####" "#" 0 A_JumpIf(1, "RepeatProper")
	Goto RepeatProper
  MeleeSpecialAttackCheck: // Check for any alternate attack methods it should use
	"####" "#" 0 A_JumpIf(CallACS("DRLAMonsterOnlyCheck"), "ArsenalMeleeCheck") // Check for full DRLA
    "####" "#" 0 A_JumpIfInventory("LDLegendaryMonsterTransformed", 1, "LegendaryMeleeAttack") // LegenDoom legendary monster
    "####" "#" 0 A_JumpIf(1, "MeleeProper")
	Goto MeleeProper

//=============================================================================================================================
	// Overwrite these states in any monster with hitscan attacks
  ArsenalMissileCheck:
	"####" "#" 0 A_JumpIf(CallACS("DRLA_specialstarts") == 2, "Duke2LaserAttack")
    "####" "#" 0 A_JumpIfInventory("DRPGShadowAuraToken", 1, "ShadowAuraMissileAttack") // DRPG Shadow Aura
    "####" "#" 0 A_JumpIfInventory("LDLegendaryMonsterTransformed", 1, "LegendaryMissileAttack") // LegenDoom legendary monster
    "####" "#" 0 A_JumpIf(1, "MissileProper")
	Goto MissileProper
  ArsenalRepeatCheck:
	"####" "#" 0 A_JumpIf(CallACS("DRLA_specialstarts") == 2, "Duke2LaserRepeat")
    "####" "#" 0 A_JumpIfInventory("DRPGShadowAuraToken", 1, "ShadowAuraRepeatAttack") // DRPG Shadow Aura
    "####" "#" 0 A_JumpIfInventory("LDLegendaryMonsterTransformed", 1, "LegendaryRepeatAttack") // LegenDoom legendary monster
    "####" "#" 0 A_JumpIf(1, "RepeatProper")
	Goto RepeatProper
  ArsenalMeleeCheck:
    "####" "#" 0 A_JumpIfInventory("DRPGShadowAuraToken", 1, "ShadowAuraMeleeAttack") // DRPG Shadow Aura
    "####" "#" 0 A_JumpIfInventory("LDLegendaryMonsterTransformed", 1, "LegendaryMeleeAttack") // LegenDoom legendary monster
    "####" "#" 0 A_JumpIf(1, "MeleeProper")
	Goto MeleeProper
	
//=============================================================================================================================
	// Overwrite these states for any special attacks that are developed
	
	// These are the final attack states used by monsters
	// Default to the See state if none exist somehow, otherwise MissileProper
  MissileProper:
	TNT1 A 0
    Goto See
  RepeatProper:
	TNT1 A 0
    Goto MissileProper
  MeleeProper:
	TNT1 A 0
    Goto MissileProper
	
	// Used in any monster that has a hitscan attack when running the Duke II gamemode in DRLA
	// Default to basic attack if it does not exist
  Duke2LaserAttack:
	TNT1 A 0
    Goto MissileProper
  Duke2LaserRepeat:
	TNT1 A 0
    Goto RepeatProper
	
	// Used in any monster that has a DRPG Shadow Aura
	// Default to basic attack if it does not exist
  ShadowAuraMissileAttack:
	TNT1 A 0
    Goto MissileProper
  ShadowAuraRepeatAttack:
	TNT1 A 0
    Goto RepeatProper
  ShadowAuraMeleeAttack:
	TNT1 A 0
    Goto MeleeProper
	
	// Used in any transformed legendary monster
	// Default to DRPG's Shadow Aura attack if it does not exist
  LegendaryMissileAttack:
	TNT1 A 0
    Goto ShadowAuraMissileAttack
  LegendaryRepeatAttack:
	TNT1 A 0
    Goto ShadowAuraRepeatAttack
  LegendaryMeleeAttack:
	TNT1 A 0
    Goto ShadowAuraMeleeAttack