IF
  Global("RedBadgeFight","GLOBAL",1)
  !Allegiance(Myself,ENEMY)
THEN
  RESPONSE #100
    Enemy()
    SetGlobalTimer("Cloud","LOCALS",0)
    Continue()
END

IF
  Global("RedBadgeFight","GLOBAL",1)
  GlobalTimerExpired("Cloud","LOCALS")
  See(NearestEnemyOf(Myself))
  Allegiance(Myself,ENEMY)
  !HasItem("solasna1",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna3",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna4",LastSeenBy(Myself))  // ~Ixil's Spike +6~
THEN
  RESPONSE #100
    ReallyForceSpell(LastSeenBy(Myself),POISONOUS_CLOUD)
    SetGlobalTimer("Cloud","LOCALS",30)
    Continue()
END

IF
  Global("RedBadgeFight","GLOBAL",1)
  CheckStatLT(SixthNearestEnemyOf(Myself),50,RESISTPOISON)
  !HasItem("AMUL22",SixthNearestEnemyOf(Myself))  // ~Periapt of Proof Against Poison~
  !HasItem("RING46",SixthNearestEnemyOf(Myself))  // ~Ring of Anti-Venom~
  !StateCheck(SixthNearestEnemyOf(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(SixthNearestEnemyOf(Myself),STATE_POISONED)
  CheckStat(SixthNearestEnemyOf(Myself),0,SANCTUARY)
  See(SixthNearestEnemyOf(Myself))
  !HasItem("solasna1",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna3",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna4",LastSeenBy(Myself))  // ~Ixil's Spike +6~
THEN
  RESPONSE #100
    SpellNoDec(LastSeenBy(Myself),POISON_NO_SAVE)
END

IF
  Global("RedBadgeFight","GLOBAL",1)
  CheckStatLT(FifthNearestEnemyOf(Myself),50,RESISTPOISON)
  !HasItem("AMUL22",FifthNearestEnemyOf(Myself))  // ~Periapt of Proof Against Poison~
  !HasItem("RING46",FifthNearestEnemyOf(Myself))  // ~Ring of Anti-Venom~
  !StateCheck(FifthNearestEnemyOf(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(FifthNearestEnemyOf(Myself),STATE_POISONED)
  CheckStat(FifthNearestEnemyOf(Myself),0,SANCTUARY)
  See(FifthNearestEnemyOf(Myself))
  !HasItem("solasna1",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna3",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna4",LastSeenBy(Myself))  // ~Ixil's Spike +6~
THEN
  RESPONSE #100
    SpellNoDec(LastSeenBy(Myself),POISON_NO_SAVE)
END

IF
  Global("RedBadgeFight","GLOBAL",1)
  CheckStatLT(FourthNearestEnemyOf(Myself),50,RESISTPOISON)
  !HasItem("AMUL22",FourthNearestEnemyOf(Myself))  // ~Periapt of Proof Against Poison~
  !HasItem("RING46",FourthNearestEnemyOf(Myself))  // ~Ring of Anti-Venom~
  !StateCheck(FourthNearestEnemyOf(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(FourthNearestEnemyOf(Myself),STATE_POISONED)
  CheckStat(FourthNearestEnemyOf(Myself),0,SANCTUARY)
  See(FourthNearestEnemyOf(Myself))
  !HasItem("solasna1",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna3",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna4",LastSeenBy(Myself))  // ~Ixil's Spike +6~
THEN
  RESPONSE #100
    SpellNoDec(LastSeenBy(Myself),POISON_NO_SAVE)
END

IF
  Global("RedBadgeFight","GLOBAL",1)
  CheckStatLT(ThirdNearestEnemyOf(Myself),50,RESISTPOISON)
  !HasItem("AMUL22",ThirdNearestEnemyOf(Myself))  // ~Periapt of Proof Against Poison~
  !HasItem("RING46",ThirdNearestEnemyOf(Myself))  // ~Ring of Anti-Venom~
  !StateCheck(ThirdNearestEnemyOf(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(ThirdNearestEnemyOf(Myself),STATE_POISONED)
  CheckStat(ThirdNearestEnemyOf(Myself),0,SANCTUARY)
  See(ThirdNearestEnemyOf(Myself))
  !Allegiance(LastSeenBy(Myself),ENEMY)
  !HasItem("solasna1",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna3",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna4",LastSeenBy(Myself))  // ~Ixil's Spike +6~
THEN
  RESPONSE #100
    SpellNoDec(LastSeenBy(Myself),POISON_NO_SAVE)
END

IF
  Global("RedBadgeFight","GLOBAL",1)
  CheckStatLT(SecondNearestEnemyOf(Myself),50,RESISTPOISON)
  !HasItem("AMUL22",SecondNearestEnemyOf(Myself))  // ~Periapt of Proof Against Poison~
  !HasItem("RING46",SecondNearestEnemyOf(Myself))  // ~Ring of Anti-Venom~
  !StateCheck(SecondNearestEnemyOf(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(SecondNearestEnemyOf(Myself),STATE_POISONED)
  CheckStat(SecondNearestEnemyOf(Myself),0,SANCTUARY)
  See(SecondNearestEnemyOf(Myself))
  !Allegiance(LastSeenBy(Myself),ENEMY)
  !HasItem("solasna1",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna3",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna4",LastSeenBy(Myself))  // ~Ixil's Spike +6~
THEN
  RESPONSE #100
    SpellNoDec(LastSeenBy(Myself),POISON_NO_SAVE)
END

IF
  Global("RedBadgeFight","GLOBAL",1)
  CheckStatLT(NearestEnemyOf(Myself),50,RESISTPOISON)
  !HasItem("AMUL22",NearestEnemyOf(Myself))  // ~Periapt of Proof Against Poison~
  !HasItem("RING46",NearestEnemyOf(Myself))  // ~Ring of Anti-Venom~
  !StateCheck(NearestEnemyOf(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(NearestEnemyOf(Myself),STATE_POISONED)
  CheckStat(NearestEnemyOf(Myself),0,SANCTUARY)
  See(NearestEnemyOf(Myself))
  !Allegiance(LastSeenBy(Myself),ENEMY)
  !HasItem("solasna1",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna3",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna4",LastSeenBy(Myself))  // ~Ixil's Spike +6~
THEN
  RESPONSE #100
    SpellNoDec(LastSeenBy(Myself),POISON_NO_SAVE)
END

IF
  Global("RedBadgeFight","GLOBAL",1)
  OR(5)
    See(NearestEnemyOf(Myself))
    See([PC.0.0.BARD_ALL])
    See([PC.0.0.DRUID_ALL])
    See([PC.0.0.CLERIC_ALL])
    See([PC.0.0.LONG_BOW])
  !HasItem("solasna1",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna3",LastSeenBy(Myself))  // ~Hallowed Redeemer~
  !HasItem("solasna4",LastSeenBy(Myself))  // ~Ixil's Spike +6~
THEN
  RESPONSE #100
    SpellNoDec(LastSeenBy(Myself),POISON_NO_SAVE)
END

