Decompiled source of BittysChallenges v6.1.2

BittysChallenges.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BittysSigils;
using DiskCardGame;
using GBC;
using HarmonyLib;
using InscryptionAPI.Ascension;
using InscryptionAPI.Boons;
using InscryptionAPI.Card;
using InscryptionAPI.Dialogue;
using InscryptionAPI.Helpers;
using InscryptionAPI.Helpers.Extensions;
using InscryptionAPI.RuleBook;
using InscryptionAPI.Saves;
using InscryptionAPI.Slots;
using InscryptionAPI.Sound;
using InscryptionAPI.Triggers;
using Microsoft.CodeAnalysis;
using Pixelplacement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("BittysChallenges")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1d7a058b5b6610b5e33756d887530c144cfc780e")]
[assembly: AssemblyProduct("BittysChallenges")]
[assembly: AssemblyTitle("BittysChallenges")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class ParamCollectionAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BittysChallenges
{
	[HarmonyPatch]
	public class Abilities
	{
		public class GiveSlotSpawner : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				List<CardSlot> playerSlots = ((BoardManager)Singleton<BoardManager3D>.Instance).PlayerSlotsCopy;
				for (int i = 0; i < playerSlots.Count; i++)
				{
					if (i == 0)
					{
						yield return playerSlots[0].FadeToSlotMod(SlotMods.SlotMod_Growth.SlotType);
					}
					if (i == 1)
					{
						yield return playerSlots[1].FadeToSlotMod(SlotMods.SlotMod_Grave.SlotType);
					}
					if (i == 2)
					{
						yield return playerSlots[2].FadeToSlotMod(SlotMods.SlotMod_Flood.SlotType);
					}
					if (i == 3)
					{
						yield return playerSlots[3].FadeToSlotMod(SlotMods.SlotMod_Obelisk.SlotType);
					}
				}
				((Card)((AbilityBehaviour)this).Card).Anim.PlayDeathAnimation(false);
				Object.Destroy((Object)(object)((Component)((AbilityBehaviour)this).Card).gameObject);
			}
		}

		public class GiveRaft : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				yield return SlotModificationExtensions.SetSlotModification(((AbilityBehaviour)this).Card.Slot, SlotMods.SlotMod_Raft.SlotType);
				((Card)((AbilityBehaviour)this).Card).Anim.PlayDeathAnimation(false);
				Object.Destroy((Object)(object)((Component)((AbilityBehaviour)this).Card).gameObject);
			}
		}

		public class AddCloverReRollAbility : SpecialCardBehaviour, IOnOtherCardResolveInHand
		{
			public static readonly SpecialTriggeredAbility CloverReRollSpecialAbility = SpecialTriggeredAbilityManager.Add("bitty45.inscryption.challenges", "CloverReRollSpecialAbility", typeof(AddCloverReRollAbility)).Id;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				yield return MoveCardIntoDeck(Singleton<PlayerHand>.Instance.cardsInHand[0], toSideDeck: true);
				int cardsToDraw = 0;
				int cardsToShuffle = Singleton<PlayerHand>.Instance.cardsInHand.Count;
				for (int i = 0; i < cardsToShuffle; i++)
				{
					cardsToDraw++;
					yield return MoveCardIntoDeck(Singleton<PlayerHand>.Instance.cardsInHand[0]);
				}
				if (CardDrawPiles3D.Instance.SideDeck.CardsInDeck > 0)
				{
					yield return (object)new WaitForSeconds(0.4f);
					if ((int)Singleton<ViewManager>.Instance.CurrentView != 1)
					{
						yield return (object)new WaitForSeconds(0.2f);
						Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
						yield return (object)new WaitForSeconds(0.2f);
					}
					CardDrawPiles3D.Instance.SidePile.Draw();
					yield return CardDrawPiles3D.Instance.DrawFromSidePile();
				}
				for (int j = 0; j < cardsToDraw; j++)
				{
					if (((CardDrawPiles)CardDrawPiles3D.Instance).Deck.CardsInDeck > 0)
					{
						yield return (object)new WaitForSeconds(0.4f);
						if ((int)Singleton<ViewManager>.Instance.CurrentView != 1)
						{
							yield return (object)new WaitForSeconds(0.2f);
							Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
							yield return (object)new WaitForSeconds(0.2f);
						}
						CardDrawPiles3D.Instance.Pile.Draw();
						yield return ((CardDrawPiles)CardDrawPiles3D.Instance).DrawCardFromDeck((CardInfo)null, (Action<PlayableCard>)null);
					}
				}
				((Card)((SpecialCardBehaviour)this).PlayableCard).Anim.PlayDeathAnimation(false);
				Object.Destroy((Object)(object)((Component)((SpecialCardBehaviour)this).PlayableCard).gameObject);
			}

			public bool RespondsToOtherCardResolveInHand(PlayableCard resolvingCard)
			{
				return CardExtensions.IsPlayerCard(resolvingCard) && (Object)(object)resolvingCard != (Object)(object)((SpecialCardBehaviour)this).PlayableCard;
			}

			public IEnumerator OnOtherCardResolveInHand(PlayableCard resolvingCard)
			{
				Singleton<PlayerHand>.Instance.RemoveCardFromHand(((SpecialCardBehaviour)this).PlayableCard);
				Object.Destroy((Object)(object)((Component)((SpecialCardBehaviour)this).PlayableCard).gameObject);
				yield break;
			}

			public IEnumerator MoveCardIntoDeck(PlayableCard card, bool toSideDeck = false)
			{
				bool is3D = Singleton<BoardManager>.Instance is BoardManager3D;
				if (Singleton<PlayerHand>.Instance.CardsInHand.Contains(card) && (int)Singleton<ViewManager>.Instance.CurrentView > 0)
				{
					yield return (object)new WaitForSeconds(0.2f);
					Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
					yield return (object)new WaitForSeconds(0.2f);
				}
				if (Singleton<PlayerHand>.Instance.CardsInHand.Contains(card))
				{
					Singleton<PlayerHand>.Instance.RemoveCardFromHand(card);
				}
				if (is3D && toSideDeck)
				{
					Singleton<CardDrawPiles3D>.Instance.sidePile.MoveCardToPile((Card)(object)card, true, 0f, 0.7f);
					Object.Destroy((Object)(object)((Component)card).gameObject, 1f);
				}
				else if (is3D)
				{
					Singleton<CardDrawPiles3D>.Instance.pile.MoveCardToPile((Card)(object)card, true, 0f, 0.7f);
					Object.Destroy((Object)(object)((Component)card).gameObject, 1f);
				}
				CreateCardInDeck(((Card)card).Info, toSideDeck);
			}

			public void CreateCardInDeck(CardInfo info, bool toSideDeck = false)
			{
				bool flag = Singleton<BoardManager>.Instance is BoardManager3D;
				if (flag && toSideDeck)
				{
					Singleton<CardDrawPiles3D>.Instance.sidePile.CreateCards(1, 15f);
					Singleton<CardDrawPiles3D>.Instance.SideDeck.AddCard(info);
					return;
				}
				if (flag)
				{
					Singleton<CardDrawPiles3D>.Instance.pile.CreateCards(1, 15f);
				}
				Singleton<CardDrawPiles>.Instance.Deck.AddCard(info);
			}
		}

		public class AddTravelingOuroAbility : SpecialCardBehaviour
		{
			public static readonly SpecialTriggeredAbility TravelingOuroSpecialAbility = SpecialTriggeredAbilityManager.Add("bitty45.inscryption.challenges", "TravelingOuroSpecialAbility", typeof(AddTravelingOuroAbility)).Id;

			public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
			{
				return true;
			}

			public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
			{
				Challenges.MiscEncounters.IncreaseOuro();
				string zoom = "OuroDies";
				if ((int)Singleton<Opponent>.Instance.OpponentType == 20)
				{
					zoom = ((!((Object)(object)killer != (Object)null) || killer.OpponentCard) ? "RoyalOuroDies" : "RoyalOuroDiesPlayer");
				}
				if (Plugin.modModeActive(Plugin.MOD_MODE.P03))
				{
					zoom = "P03OuroDies";
				}
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent(zoom, (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			}
		}

		public class AddGoldenSheepAbility : SpecialCardBehaviour
		{
			public static readonly SpecialTriggeredAbility GoldenSheepSpecialAbility = SpecialTriggeredAbilityManager.Add("bitty45.inscryption.challenges", "GoldenSheep Special Ability", typeof(AddGoldenSheepAbility)).Id;

			private int turnCount;

			private int MAX_TURNS = 2;

			public static Ability ability;

			public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
			{
				return true;
			}

			public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
			{
				Challenges.MiscEncounters.GoldenSheepKill();
				yield return GiveWool(fromBattle: true);
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("SheepDies", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			}

			private IEnumerator GiveWool(bool fromBattle)
			{
				yield return (object)new WaitForSeconds(0.5f);
				if (fromBattle)
				{
					CardInfo pelt = CardLoader.GetCardByName("PeltGolden");
					CardModificationInfo mod = new CardModificationInfo();
					mod.abilities.Add(GiveFragile.ability);
					pelt.Mods.Add(mod);
					((CardCollectionInfo)RunState.Run.playerDeck).AddCard(pelt);
					yield return (object)new WaitForSeconds(0.3f);
					Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
					yield return Singleton<CardSpawner>.Instance.SpawnCardToHand(pelt, (List<CardModificationInfo>)null, 0.25f, (Action<PlayableCard>)null);
					yield return (object)new WaitForSeconds(0.45f);
				}
			}

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return ((SpecialCardBehaviour)this).PlayableCard.OpponentCard != playerUpkeep;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				turnCount++;
				if (turnCount > MAX_TURNS)
				{
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("SheepEscapes", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					((Card)((SpecialCardBehaviour)this).PlayableCard).Anim.PlayDeathAnimation(false);
					Object.Destroy((Object)(object)((Component)((SpecialCardBehaviour)this).PlayableCard).gameObject);
				}
			}
		}

		public class GiveWarper : AbilityBehaviour
		{
			public static Ability ability;

			protected bool movingLeft;

			public override Ability Ability => ability;

			public override bool RespondsToTurnEnd(bool playerTurnEnd)
			{
				return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && ((AbilityBehaviour)this).Card.OpponentCard != playerTurnEnd;
			}

			public override IEnumerator OnTurnEnd(bool playerTurnEnd)
			{
				CardSlot toLeft = Singleton<BoardManager>.Instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, true);
				CardSlot toRight = Singleton<BoardManager>.Instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, false);
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
				yield return (object)new WaitForSeconds(0.25f);
				yield return ((MonoBehaviour)this).StartCoroutine(DoStrafe(toLeft, toRight));
			}

			protected virtual IEnumerator DoStrafe(CardSlot toLeft, CardSlot toRight)
			{
				if ((Object)(object)toLeft == (Object)null)
				{
					toLeft = Singleton<BoardManager>.Instance.playerSlots.Last();
				}
				if ((Object)(object)toRight == (Object)null)
				{
					toRight = Singleton<BoardManager>.Instance.playerSlots.First();
				}
				CardSlot toLefttwice = Singleton<BoardManager>.Instance.GetAdjacent(toLeft, true);
				CardSlot toRighttwice = Singleton<BoardManager>.Instance.GetAdjacent(toRight, false);
				if ((Object)(object)toLefttwice == (Object)null)
				{
					toLefttwice = Singleton<BoardManager>.Instance.playerSlots.Last();
				}
				if ((Object)(object)toRighttwice == (Object)null)
				{
					toRighttwice = Singleton<BoardManager>.Instance.playerSlots.First();
				}
				bool canmoveleft = (Object)(object)toLeft.Card == (Object)null || (Object)(object)toLefttwice.Card == (Object)null;
				bool canmoveright = (Object)(object)toRight.Card == (Object)null || (Object)(object)toRighttwice.Card == (Object)null;
				if (movingLeft && !canmoveleft)
				{
					movingLeft = false;
				}
				if (!movingLeft && !canmoveright)
				{
					movingLeft = true;
				}
				CardSlot destination = (movingLeft ? toLeft : toRight);
				if ((Object)(object)destination.Card != (Object)null)
				{
					destination = (movingLeft ? toLefttwice : toRighttwice);
				}
				yield return ((MonoBehaviour)this).StartCoroutine(MoveToSlot(destination));
			}

			protected IEnumerator MoveToSlot(CardSlot destination)
			{
				((Card)((AbilityBehaviour)this).Card).RenderInfo.SetAbilityFlipped(((AbilityBehaviour)this).Ability, movingLeft);
				((Card)((AbilityBehaviour)this).Card).RenderInfo.flippedPortrait = movingLeft && ((Card)((AbilityBehaviour)this).Card).Info.flipPortraitForStrafe;
				((Card)((AbilityBehaviour)this).Card).RenderCard();
				if ((Object)(object)destination != (Object)null && (Object)(object)destination.Card == (Object)null)
				{
					CardSlot oldSlot = ((AbilityBehaviour)this).Card.Slot;
					yield return Singleton<BoardManager>.Instance.AssignCardToSlot(((AbilityBehaviour)this).Card, destination, 0.1f, (Action)null, true);
					yield return PostSuccessfulMoveSequence(oldSlot);
					yield return (object)new WaitForSeconds(0.25f);
				}
				else
				{
					((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
					yield return (object)new WaitForSeconds(0.15f);
				}
			}

			protected virtual IEnumerator PostSuccessfulMoveSequence(CardSlot oldSlot)
			{
				yield break;
			}
		}

		public class GiveFragile : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
			{
				return true;
			}

			public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
			{
				DeckInfo currentDeck = SaveManager.SaveFile.CurrentDeck;
				CardInfo card = ((CardCollectionInfo)currentDeck).Cards.Find((CardInfo x) => x.HasAbility(ability) && ((Object)x).name == ((Object)((Card)((AbilityBehaviour)this).Card).Info).name);
				((CardCollectionInfo)currentDeck).RemoveCard(card);
				yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
				if (!wasSacrifice && (Object)(object)killer != (Object)null)
				{
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("FragileEnemy", (MessageAdvanceMode)1, (EventIntersectMode)0, new string[2]
					{
						((Card)((AbilityBehaviour)this).Card).Info.displayedName,
						((Card)killer).Info.displayedName
					}, (Action<Line>)null);
				}
				else if (!wasSacrifice && (Object)(object)killer == (Object)null)
				{
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("FragileDies", (MessageAdvanceMode)1, (EventIntersectMode)0, new string[1] { ((Card)((AbilityBehaviour)this).Card).Info.displayedName }, (Action<Line>)null);
				}
				else
				{
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("FragileSacrifice", (MessageAdvanceMode)1, (EventIntersectMode)0, new string[1] { ((Card)((AbilityBehaviour)this).Card).Info.displayedName }, (Action<Line>)null);
				}
			}
		}

		public class GiveFalseUnkillable : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;
		}

		public class GiveParalysis : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				bool flag = Singleton<TurnManager>.Instance.TurnNumber % 2 == 0;
				return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && ((AbilityBehaviour)this).Card.OpponentCard != playerUpkeep && flag;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				CardModificationInfo cardModificationInfo = new CardModificationInfo();
				if (!((AbilityBehaviour)this).Card.HasAbility(GiveCantAttack.ability))
				{
					cardModificationInfo.abilities.Add(GiveCantAttack.ability);
					cardModificationInfo.RemoveOnUpkeep = true;
					((AbilityBehaviour)this).Card.AddTemporaryMod(cardModificationInfo);
					((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveStrafeKiller : Strafe
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override IEnumerator DoStrafe(CardSlot toLeft, CardSlot toRight)
			{
				bool toLeftValid = (Object)(object)toLeft != (Object)null;
				bool toRightValid = (Object)(object)toRight != (Object)null;
				if (base.movingLeft && !toLeftValid)
				{
					base.movingLeft = false;
				}
				if (!base.movingLeft && !toRightValid)
				{
					base.movingLeft = true;
				}
				CardSlot destination = (base.movingLeft ? toLeft : toRight);
				bool destinationValid = (base.movingLeft ? toLeftValid : toRightValid);
				if ((Object)(object)destination != (Object)null && (Object)(object)destination.Card != (Object)null)
				{
					yield return destination.Card.Die(false, ((AbilityBehaviour)this).Card, true);
				}
				yield return (object)new WaitForSeconds(0.2f);
				yield return ((Strafe)this).MoveToSlot(destination, destinationValid);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}

			public override IEnumerator PostSuccessfulMoveSequence(CardSlot oldSlot)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			}
		}

		public class GiveStrafeAvalanche : Strafe
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override IEnumerator DoStrafe(CardSlot toLeft, CardSlot toRight)
			{
				bool toLeftValid = (Object)(object)toLeft != (Object)null;
				bool toRightValid = (Object)(object)toRight != (Object)null;
				if (base.movingLeft && !toLeftValid)
				{
					base.movingLeft = false;
				}
				if (!base.movingLeft && !toRightValid)
				{
					base.movingLeft = true;
				}
				CardSlot destination = (base.movingLeft ? toLeft : toRight);
				bool destinationValid = (base.movingLeft ? toLeftValid : toRightValid);
				List<CardSlot> slotsCopy = (((AbilityBehaviour)this).Card.OpponentCard ? Singleton<BoardManager>.Instance.OpponentSlotsCopy : Singleton<BoardManager>.Instance.PlayerSlotsCopy);
				if (slotsCopy != null && (Object)(object)slotsCopy[slotsCopy.Count - 1].Card == (Object)(object)((AbilityBehaviour)this).Card)
				{
					yield return ((AbilityBehaviour)this).Card.Die(false, (PlayableCard)null, true);
					yield return ((AbilityBehaviour)this).LearnAbility(0f);
					yield break;
				}
				int killLoops = 0;
				while ((Object)(object)destination != (Object)null && (Object)(object)destination.Card != (Object)null && killLoops < 5)
				{
					killLoops++;
					yield return destination.Card.Die(false, ((AbilityBehaviour)this).Card, true);
				}
				yield return (object)new WaitForSeconds(0.2f);
				yield return ((Strafe)this).MoveToSlot(destination, destinationValid);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}

			public override IEnumerator PostSuccessfulMoveSequence(CardSlot oldSlot)
			{
				if ((Object)(object)oldSlot.Card != (Object)null)
				{
					yield return oldSlot.Card.Die(false, ((AbilityBehaviour)this).Card, true);
				}
			}
		}

		public class GiveCannoneer : SpecialCardBehaviour
		{
			public static readonly SpecialTriggeredAbility MinicelloSpecialAbility = SpecialTriggeredAbilityManager.Add("bitty45.inscryption.challenges", "Minicello Special Ability", typeof(GiveCannoneer)).Id;

			private static List<GiveCannoneer> allInstancesOfThisClass = new List<GiveCannoneer>();

			public bool triggeredThisTurn;

			private List<CardSlot> cannonTargetSlots = new List<CardSlot>();

			private List<GameObject> targetIcons = new List<GameObject>();

			private GameObject targetIconPrefab;

			public void ClearAllTargetIcons()
			{
				foreach (GiveCannoneer item in allInstancesOfThisClass)
				{
					if ((Object)(object)item != (Object)null)
					{
						item.CleanupTargetIcons();
					}
				}
			}

			private void Start()
			{
				allInstancesOfThisClass.Add(this);
			}

			public override bool RespondsToTurnEnd(bool playerTurnEnd)
			{
				return playerTurnEnd != ((SpecialCardBehaviour)this).PlayableCard.OpponentCard;
			}

			public override IEnumerator OnTurnEnd(bool playerTurnEnd)
			{
				if (cannonTargetSlots.Count > 0)
				{
					yield return FireCannonsSequence();
				}
				if ((Object)(object)((SpecialCardBehaviour)this).PlayableCard != (Object)null)
				{
					yield return ChooseCannonTargetsSequence();
				}
			}

			public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
			{
				return true;
			}

			public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
			{
				CleanupTargetIcons();
				yield break;
			}

			public void CleanupTargetIcons()
			{
				targetIcons.ForEach(delegate(GameObject x)
				{
					if ((Object)(object)x != (Object)null)
					{
						CleanUpTargetIcon(x);
					}
				});
				targetIcons.Clear();
			}

			private void CleanUpTargetIcon(GameObject icon)
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)icon != (Object)null)
				{
					Tween.LocalScale(icon.transform, Vector3.zero, 0.1f, 0f, Tween.EaseIn, (LoopType)0, (Action)null, (Action)delegate
					{
						Object.Destroy((Object)(object)icon);
					}, true);
				}
			}

			private IEnumerator FireCannonsSequence()
			{
				for (int i = 0; i < cannonTargetSlots.Count; i++)
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)1, false, true);
					yield return (object)new WaitForSeconds(0.25f);
					CardSlot slot = cannonTargetSlots[i];
					if ((Object)(object)slot.Card != (Object)null && !slot.Card.Dead)
					{
						AudioController.Instance.PlaySound2D("pirateskull_cannon_fire", (MixerGroup)4, 0.7f, 0f, new Pitch((Variation)0), (Repetition)null, (Randomization)null, (Distortion)null, false);
						yield return (object)new WaitForSeconds(0.3f);
						Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
						yield return (object)new WaitForSeconds(0.2f);
						CleanUpTargetIcon(targetIcons[i]);
						GameObject cannonBall = Object.Instantiate<GameObject>(ResourceBank.Get<GameObject>("Prefabs/Cards/SpecificCardModels/CannonBallAnim"));
						cannonBall.transform.position = ((Component)slot).transform.position;
						Object.Destroy((Object)(object)cannonBall, 1f);
						yield return (object)new WaitForSeconds(0.1666f);
						Singleton<TableVisualEffectsManager>.Instance.ThumpTable(0.4f);
						AudioController.Instance.PlaySound3D("metal_object_hit#1", (MixerGroup)4, cannonBall.transform.position, 1f, 0f, new Pitch((Variation)0), (Repetition)null, (Randomization)null, (Distortion)null, false);
						yield return slot.Card.TakeDamage(10, ((SpecialCardBehaviour)this).PlayableCard);
					}
				}
				CleanupTargetIcons();
			}

			private IEnumerator ChooseCannonTargetsSequence()
			{
				Plugin.Log.LogInfo((object)"Cannoneer Activation");
				yield return (object)new WaitForSeconds(0.3f);
				int num = ((TriggerReceiver)this).GetRandomSeed() + Singleton<TurnManager>.Instance.TurnNumber;
				if ((Object)(object)targetIconPrefab == (Object)null)
				{
					targetIconPrefab = ResourceBank.Get<GameObject>("Prefabs/Cards/SpecificCardModels/CannonTargetIcon");
				}
				if (((SpecialCardBehaviour)this).PlayableCard.OpponentCard)
				{
					List<CardSlot> playerSlotsCopy = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
					playerSlotsCopy.RemoveAll((CardSlot x) => cannonTargetSlots.Contains(x));
					cannonTargetSlots.Clear();
					cannonTargetSlots.Add(playerSlotsCopy[SeededRandom.Range(0, playerSlotsCopy.Count, num)]);
				}
				else
				{
					List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
					opponentSlotsCopy.RemoveAll((CardSlot x) => cannonTargetSlots.Contains(x));
					cannonTargetSlots.Clear();
					cannonTargetSlots.Add(opponentSlotsCopy[SeededRandom.Range(0, opponentSlotsCopy.Count, num)]);
				}
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
				yield return (object)new WaitForSeconds(0.25f);
				foreach (CardSlot slot in cannonTargetSlots)
				{
					yield return (object)new WaitForSeconds(0.05f);
					GameObject gameObject = Object.Instantiate<GameObject>(targetIconPrefab, ((Component)slot).transform);
					gameObject.transform.localPosition = new Vector3(0f, 0.25f, 0f);
					gameObject.transform.localRotation = Quaternion.identity;
					targetIcons.Add(gameObject);
				}
				AudioController.Instance.PlaySound2D("dial_low", (MixerGroup)4, 0.7f, 0f, new Pitch((Variation)0), (Repetition)null, (Randomization)null, (Distortion)null, false);
			}
		}

		public class GiveRedChamp : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;
		}

		public class GiveYellowChamp : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;
		}

		public class GiveGreenChamp : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
			{
				return (Object)(object)killer == (Object)(object)((AbilityBehaviour)this).Card;
			}

			public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return Singleton<LifeManager>.Instance.ShowDamageSequence(1, 1, ((AbilityBehaviour)this).Card.OpponentCard, 0.125f, (GameObject)null, 0f, true);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveOrangeChamp : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToDealDamageDirectly(int amount)
			{
				return RunState.Run.currency >= 1 || !((AbilityBehaviour)this).Card.OpponentCard;
			}

			public override IEnumerator OnDealDamageDirectly(int amount)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				if (((AbilityBehaviour)this).Card.OpponentCard)
				{
					yield return Singleton<CurrencyBowl>.Instance.SpillOnTable();
					yield return (object)new WaitForSeconds(0.4f);
					int moneyToTake = 1;
					if (RunState.Run.currency >= 2)
					{
						moneyToTake = 2;
					}
					List<Rigidbody> list = Singleton<CurrencyBowl>.Instance.TakeWeights(moneyToTake);
					foreach (Rigidbody rigidbody in list)
					{
						float num = (float)list.IndexOf(rigidbody) * 0.05f;
						Tween.Position(((Component)rigidbody).transform, ((Component)rigidbody).transform.position + Vector3.up * 0.5f, 0.075f, num, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true);
						Tween.Position(((Component)rigidbody).transform, new Vector3(0f, 5.5f, 4f), 0.3f, 0.125f + num, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
						Object.Destroy((Object)(object)((Component)rigidbody).gameObject, 0.5f);
					}
					RunState.Run.currency = RunState.Run.currency - moneyToTake;
					yield return (object)new WaitForSeconds(0.4f);
					yield return ((MonoBehaviour)this).StartCoroutine(Singleton<CurrencyBowl>.Instance.CleanUpFromTableAndExit());
				}
				else
				{
					yield return Singleton<CurrencyBowl>.Instance.ShowGain(5, false, true);
					RunState run = RunState.Run;
					run.currency += 2;
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveCyanChamp : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
			{
				return !wasSacrifice;
			}

			public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				foreach (PlayableCard target in Singleton<BoardManager>.Instance.CardsOnBoard)
				{
					((Card)target).Anim.StrongNegationEffect();
					yield return target.TakeDamage(1, (PlayableCard)null);
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveWhiteChamp : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
			{
				return !wasSacrifice && ((AbilityBehaviour)this).Card.OnBoard;
			}

			public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return (object)new WaitForSeconds(0.3f);
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("Boulder"), ((AbilityBehaviour)this).Card.Slot, 0.15f, true);
				yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
			}
		}

		public class GiveMagentaChamp : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return playerUpkeep == ((AbilityBehaviour)this).Card.OpponentCard;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				yield return (object)new WaitForSeconds(0.3f);
				int seed = ((TriggerReceiver)this).GetRandomSeed() + Singleton<TurnManager>.Instance.TurnNumber;
				PlayableCard target;
				if (((AbilityBehaviour)this).Card.OpponentCard)
				{
					List<PlayableCard> playerCardsCopy = BoardManagerExtensions.GetPlayerCards(Singleton<BoardManager>.Instance, (Predicate<PlayableCard>)null);
					target = ((playerCardsCopy.Count <= 0) ? null : playerCardsCopy[SeededRandom.Range(0, playerCardsCopy.Count - 1, seed)]);
				}
				else
				{
					List<PlayableCard> opponentCardsCopy = BoardManagerExtensions.GetOpponentCards(Singleton<BoardManager>.Instance, (Predicate<PlayableCard>)null);
					target = ((opponentCardsCopy.Count <= 0) ? null : opponentCardsCopy[SeededRandom.Range(0, opponentCardsCopy.Count - 1, seed)]);
				}
				if (!((Object)(object)target == (Object)null))
				{
					yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
					((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
					yield return (object)new WaitForSeconds(0.3f);
					((Card)target).Anim.StrongNegationEffect();
					yield return target.TakeDamage(1, ((AbilityBehaviour)this).Card);
					yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
				}
			}
		}

		public class GivePurpleChamp : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToOtherCardResolve(PlayableCard otherCard)
			{
				return (Object)(object)otherCard != (Object)null && (Object)(object)otherCard.Slot != (Object)null && CardExtensions.IsPlayerCard(otherCard) == ((AbilityBehaviour)this).Card.OpponentCard && (Object)(object)otherCard.Slot != (Object)(object)((AbilityBehaviour)this).Card.Slot.opposingSlot;
			}

			public override IEnumerator OnOtherCardResolve(PlayableCard otherCard)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
				yield return (object)new WaitForSeconds(0.15f);
				CardSlot targetSlot = CardExtensions.OpposingSlot(((AbilityBehaviour)this).Card);
				if ((Object)(object)targetSlot.Card != (Object)null)
				{
					((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
					yield return (object)new WaitForSeconds(0.3f);
					yield break;
				}
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				Vector3 a = (((Component)otherCard.Slot).transform.position + ((Component)targetSlot).transform.position) / 2f;
				Tween.Position(((Component)otherCard).transform, a + Vector3.up * 0.5f, 0.1f, 0f, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true);
				yield return Singleton<BoardManager>.Instance.AssignCardToSlot(otherCard, targetSlot, 0.1f, (Action)null, true);
				yield return (object)new WaitForSeconds(0.3f);
				yield return ((AbilityBehaviour)this).LearnAbility(0.1f);
			}
		}

		public class GiveBlueChamp : AbilityBehaviour, IOnBellRung
		{
			private CardModificationInfo airborneMod = new CardModificationInfo
			{
				singletonId = "bitty_airborne_champ",
				abilities = new List<Ability> { (Ability)19 }
			};

			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToOtherCardResolve(PlayableCard otherCard)
			{
				return RespondsToTrigger(otherCard);
			}

			public override IEnumerator OnOtherCardResolve(PlayableCard otherCard)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return AddAirborne(otherCard);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}

			public override bool RespondsToOtherCardAssignedToSlot(PlayableCard otherCard)
			{
				return RespondsToTrigger(otherCard);
			}

			public override IEnumerator OnOtherCardAssignedToSlot(PlayableCard otherCard)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return AddAirborne(otherCard);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}

			public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
			{
				return true;
			}

			public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				foreach (PlayableCard target in Singleton<BoardManager>.Instance.CardsOnBoard)
				{
					yield return RemoveAirborne(target);
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}

			private bool RespondsToTrigger(PlayableCard otherCard)
			{
				return !((AbilityBehaviour)this).Card.Dead && !otherCard.Dead && (Object)(object)otherCard != (Object)(object)((AbilityBehaviour)this).Card && otherCard.OpponentCard == ((AbilityBehaviour)this).Card.OpponentCard;
			}

			public IEnumerator AddAirborne(PlayableCard target)
			{
				CardModificationInfo cardModificationInfo = target.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == airborneMod.singletonId);
				if (cardModificationInfo == null && !((Card)target).Info.HasTrait((Trait)12) && !target.HasAbility((Ability)19))
				{
					Plugin.Log.LogInfo((object)"Apply Airborne");
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
					target.AddTemporaryMod(airborneMod);
					target.OnStatsChanged();
					((Card)target).Anim.StrongNegationEffect();
					yield return (object)new WaitForSeconds(0.1f);
				}
			}

			public IEnumerator RemoveAirborne(PlayableCard target)
			{
				CardModificationInfo cardModificationInfo = target.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == airborneMod.singletonId);
				if (cardModificationInfo != null)
				{
					Plugin.Log.LogInfo((object)"Remove Airborne");
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
					target.RemoveTemporaryMod(cardModificationInfo, true);
					target.OnStatsChanged();
					((Card)target).Anim.StrongNegationEffect();
					yield return (object)new WaitForSeconds(0.1f);
				}
			}

			public bool RespondsToBellRung(bool playerCombatPhase)
			{
				return true;
			}

			public IEnumerator OnBellRung(bool playerCombatPhase)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				List<PlayableCard> cards = (CardExtensions.IsPlayerCard(((AbilityBehaviour)this).Card) ? BoardManagerExtensions.GetPlayerCards(Singleton<BoardManager>.Instance, (Predicate<PlayableCard>)null) : BoardManagerExtensions.GetOpponentCards(Singleton<BoardManager>.Instance, (Predicate<PlayableCard>)null));
				foreach (PlayableCard curCard in cards)
				{
					if ((Object)(object)curCard != (Object)(object)((AbilityBehaviour)this).Card)
					{
						yield return AddAirborne(curCard);
					}
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveLightBlueChamp : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToPreDeathAnimation(bool wasSacrifice)
			{
				return !wasSacrifice;
			}

			public override IEnumerator OnPreDeathAnimation(bool wasSacrifice)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ExplodeFromSlot(((AbilityBehaviour)this).Card.slot);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}

			public IEnumerator ExplodeFromSlot(CardSlot slot)
			{
				List<CardSlot> adjacentSlots = Singleton<BoardManager>.Instance.GetAdjacentSlots(slot);
				if (adjacentSlots.Count > 0 && adjacentSlots[0].Index < slot.Index)
				{
					if ((Object)(object)adjacentSlots[0].Card != (Object)null && !adjacentSlots[0].Card.Dead)
					{
						yield return BombCard(adjacentSlots[0].Card, slot.Card);
					}
					adjacentSlots.RemoveAt(0);
				}
				if ((Object)(object)slot.opposingSlot.Card != (Object)null && !slot.opposingSlot.Card.Dead)
				{
					yield return BombCard(slot.opposingSlot.Card, slot.Card);
				}
				if (adjacentSlots.Count > 0 && (Object)(object)adjacentSlots[0].Card != (Object)null && !adjacentSlots[0].Card.Dead)
				{
					yield return BombCard(adjacentSlots[0].Card, slot.Card);
				}
			}

			private IEnumerator BombCard(PlayableCard target, PlayableCard attacker)
			{
				yield return (object)new WaitForSeconds(0.5f);
				((Card)target).Anim.PlayHitAnimation();
				yield return target.TakeDamage(3, attacker);
			}
		}

		public class GiveLightGreenChamp : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToResolveOnBoard()
			{
				return true;
			}

			public override IEnumerator OnResolveOnBoard()
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((AbilityBehaviour)this).Card.Status.hiddenAbilities.Add((Ability)54);
				((AbilityBehaviour)this).Card.AddTemporaryMod(new CardModificationInfo((Ability)54));
				((AbilityBehaviour)this).Card.ResetShield();
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}

			public override bool RespondsToSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
			{
				if ((Object)(object)attacker != (Object)null)
				{
					bool flag = attacker.HasAbility((Ability)19);
					return (Object)(object)slot.Card == (Object)(object)((AbilityBehaviour)this).Card && (!flag || ((AbilityBehaviour)this).Card.HasAbility((Ability)23));
				}
				return false;
			}

			public override IEnumerator OnSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				((AbilityBehaviour)this).Card.AddTemporaryMod(new CardModificationInfo
				{
					negateAbilities = { ((AbilityBehaviour)this).Ability }
				});
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		public class GiveBrightRedChamp : AbilityBehaviour
		{
			public static Ability ability;

			public override Ability Ability => ability;

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return playerUpkeep == ((AbilityBehaviour)this).Card.OpponentCard;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				foreach (PlayableCard target in Singleton<BoardManager>.Instance.CardsOnBoard)
				{
					if (target.OpponentCard == ((AbilityBehaviour)this).Card.OpponentCard && !CardExtensions.HasTrait(target, (Trait)12) && target.Health < target.MaxHealth)
					{
						target.HealDamage(1);
					}
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
			}
		}

		public static void AddAbilities()
		{
			Plugin.Log.LogInfo((object)"Start of sigils");
			Add_Ability_FalseUnkillable();
			Add_Ability_Warper();
			Add_Ability_Fragile();
			Add_Ability_Paralysis();
			Add_Ability_StrafeKiller();
			Add_Ability_StrafeAvalanche();
			Add_Ability_SlotSpawner();
			Add_Ability_RedChamp();
			Add_Ability_YellowChamp();
			Add_Ability_GreenChamp();
			Add_Ability_OrangeChamp();
			Add_Ability_CyanChamp();
			Add_Ability_WhiteChamp();
			Add_Ability_MagentaChamp();
			Add_Ability_PurpleChamp();
			Add_Ability_BlueChamp();
			Add_Ability_LightBlueChamp();
			Add_Ability_LightGreenChamp();
			Add_Ability_BrightRedChamp();
			Plugin.Log.LogInfo((object)"End of sigils");
		}

		public static void Add_Reliant_Abilities()
		{
			Plugin.Log.LogInfo((object)"Start of reliant sigils");
			Add_Ability_Raft();
			Plugin.Log.LogInfo((object)"End of reliant sigils");
		}

		private static void Add_Ability_SlotSpawner()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Slot Spawner", "When played, spawns a slot. Used for testing.", typeof(GiveSlotSpawner), (Texture)(object)Tools.LoadTexture("ability_test.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 1;
			GiveSlotSpawner.ability = val.ability;
		}

		private static void Add_Ability_Raft()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = RuleBookRedirectExtensions.SetSlotRedirect(AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Seaworthy", "When played, converts the slot into a Raft.", typeof(GiveRaft), (Texture)(object)Tools.LoadTexture("ability_raft.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]), "Raft", SlotMods.SlotMod_Raft.SlotType, GameColors.Instance.orange);
			val.powerLevel = 1;
			GiveRaft.ability = val.ability;
		}

		private static void Add_Ability_Warper()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Warper", "At the end of the owner's turn, [creature] will move to the right, jumping over any creatures in its path. If it encounters the edge of the board, it will loop over to the other side.", typeof(GiveWarper), (Texture)(object)Tools.LoadTexture("ability_warper.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 0;
			GiveWarper.ability = val.ability;
		}

		private static void Add_Ability_Fragile()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Fragile", "If [creature] perishes, it is permanently removed from your deck.", typeof(GiveFragile), (Texture)(object)Tools.LoadTexture("ability_fragile.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = -3;
			GiveFragile.ability = val.ability;
		}

		private static void Add_Ability_FalseUnkillable()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Unkillable", "When [creature] perishes, a copy of it is created in the opponent's hand.", typeof(GiveFalseUnkillable), (Texture)(object)Tools.LoadTexture("ability_drawcopyondeath")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[2]
			{
				default(AbilityMetaCategory),
				(AbilityMetaCategory)2
			});
			val.powerLevel = 1;
			GiveFalseUnkillable.ability = val.ability;
		}

		private static void Add_Ability_Paralysis()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Paralysis", "[creature] may not attack every other turn.", typeof(GiveParalysis), (Texture)(object)Tools.LoadTexture("ability_paralysis.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = -1;
			GiveParalysis.ability = val.ability;
		}

		private static void Add_Ability_StrafeKiller()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Trampler", "At the end of the owner's turn, [creature] will move in the direction inscribed in the sigil. Creatures in the way will be killed.", typeof(GiveStrafeKiller), (Texture)(object)Tools.LoadTexture("ability_strafeskull.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 0;
			GiveStrafeKiller.ability = val.ability;
		}

		private static void Add_Ability_StrafeAvalanche()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Avalancher", "At the end of the owner's turn, [creature] will move in the direction inscribed in the sigil. Creatures in the way will be killed. If [creature] is at the right most side of the board, it dies.", typeof(GiveStrafeAvalanche), (Texture)(object)Tools.LoadTexture("ability_strafeskull.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 0;
			GiveStrafeAvalanche.ability = val.ability;
		}

		private static void Add_Ability_RedChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Red Champion", "This champion starts with 2 additional Health.", typeof(GiveRedChamp), (Texture)(object)Tools.LoadTexture("ability_redChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GiveRedChamp.ability = val.ability;
		}

		private static void Add_Ability_YellowChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Yellow Champion", "This champion starts with 1 additional Power.", typeof(GiveYellowChamp), (Texture)(object)Tools.LoadTexture("ability_yellowChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GiveYellowChamp.ability = val.ability;
		}

		private static void Add_Ability_GreenChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Green Champion", "This champion will deal 1 damage directly to you, after it destroys another creature.", typeof(GiveGreenChamp), (Texture)(object)Tools.LoadTexture("ability_greenChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GiveGreenChamp.ability = val.ability;
		}

		private static void Add_Ability_OrangeChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Orange Champion", "This champion will steal 2 golden teeth from you if it damages you directly.", typeof(GiveOrangeChamp), (Texture)(object)Tools.LoadTexture("ability_orangeChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GiveOrangeChamp.ability = val.ability;
		}

		private static void Add_Ability_CyanChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Cyan Champion", "When this champion perishes, it will deal 1 damage to every other creature on the board.", typeof(GiveCyanChamp), (Texture)(object)Tools.LoadTexture("ability_cyanChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GiveCyanChamp.ability = val.ability;
		}

		private static void Add_Ability_WhiteChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "White Champion", "When this champion perishes, it will create a Boulder in its space. [define:Boulder]", typeof(GiveWhiteChamp), (Texture)(object)Tools.LoadTexture("ability_whiteChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GiveWhiteChamp.ability = val.ability;
		}

		private static void Add_Ability_MagentaChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Magenta Champion", "At the start of each turn, this champion will attack for 1 damage in a random space on your side.", typeof(GiveMagentaChamp), (Texture)(object)Tools.LoadTexture("ability_magentaChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GiveMagentaChamp.ability = val.ability;
		}

		private static void Add_Ability_PurpleChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Purple Champion", "Each time you play a card, if the space opposing this champion is empty, that card will move to that space.", typeof(GivePurpleChamp), (Texture)(object)Tools.LoadTexture("ability_purpleChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GivePurpleChamp.ability = val.ability;
		}

		private static void Add_Ability_BlueChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Blue Champion", "This champion will cause all other non-Terrain cards on the same side to gain flight, as long as the champion is alive.", typeof(GiveBlueChamp), (Texture)(object)Tools.LoadTexture("ability_blueChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GiveBlueChamp.ability = val.ability;
		}

		private static void Add_Ability_LightBlueChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Light Blue Champion", "When this champion perishes, it will deal 3 damage to creatures to the left and right of it as well as the opposing creature.", typeof(GiveLightBlueChamp), (Texture)(object)Tools.LoadTexture("ability_lightBlueChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GiveLightBlueChamp.ability = val.ability;
		}

		private static void Add_Ability_LightGreenChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Light Green Champion", "This champion will prevent all damage from the first strike dealt to it. Damage from effects like sigils will not be prevented.", typeof(GiveLightGreenChamp), (Texture)(object)Tools.LoadTexture("ability_lightGreenChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GiveLightGreenChamp.ability = val.ability;
		}

		private static void Add_Ability_BrightRedChamp()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = AbilityExtensions.AddMetaCategories(AbilityManager.New("bitty45.inscryption.challenges", "Bright Red Champion", "At the start of each turn, this champion will heal all other non-terrain creatures on the opponent's side by 1.", typeof(GiveBrightRedChamp), (Texture)(object)Tools.LoadTexture("ability_brightRedChampion.png")), (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			val.powerLevel = 5;
			GiveBrightRedChamp.ability = val.ability;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TurnManager), "CleanupPhase")]
		public static void CannoneerPatch()
		{
			try
			{
				GiveCannoneer giveCannoneer = new GiveCannoneer();
				giveCannoneer.ClearAllTargetIcons();
			}
			catch
			{
				Plugin.Log.LogInfo((object)"Did not find Cannoneer Instance");
			}
		}
	}
	public class Boons
	{
		public abstract class ChallengeBoonBase : BoonBehaviour
		{
			private static int randomMod;

			protected abstract Type boonType { get; }

			public override bool RespondsToPostBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPostBoonActivation()
			{
				if (Plugin.modModeActive(Plugin.MOD_MODE.KCM) && Singleton<BoonsHandler>.Instance.HasBoonOfType(boonType))
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
					yield return Singleton<BoonsHandler>.Instance.PlayBoonAnimation(boonType);
				}
				string P03 = (Plugin.modModeActive(Plugin.MOD_MODE.P03) ? "P03" : "");
				if (SaveFile.IsAscension && !DialogueEventsData.EventIsPlayed(P03 + "EnvironmentsIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					Singleton<ChallengeActivationUI>.Instance.ShowActivation(Challenges.Challenge_environment.challengeType);
					((MonoBehaviour)Singleton<TextDisplayer>.Instance).StartCoroutine(Singleton<TextDisplayer>.Instance.PlayDialogueEvent(P03 + "EnvironmentsIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null));
				}
			}

			public override bool RespondsToPostBattleCleanup()
			{
				return true;
			}

			public override IEnumerator OnPostBattleCleanup()
			{
				SetSceneEffectsShown(showEffects: false);
				yield break;
			}

			public List<CardSlot> SelectRandomSlots(int amount, List<CardSlot> slotsCopy)
			{
				List<CardSlot> list = new List<CardSlot>();
				randomMod += amount;
				int num = SaveManager.SaveFile.GetCurrentRandomSeed() + randomMod;
				for (int i = 0; i < amount; i++)
				{
					if (i >= slotsCopy.Count)
					{
						return list;
					}
					int index = SeededRandom.Range(0, slotsCopy.Count, num * i);
					list.Add(slotsCopy[index]);
					slotsCopy.Remove(slotsCopy[index]);
				}
				return list;
			}

			public void SetSceneEffectsShown(bool showEffects, Color mainLightColor, Color cardLightColor, Color interactablesColor, Color slotDefaultColor, Color slotInteractableColor, Color slotHighlightColor, Color queueSlotDefaultColor, Color queueSlotInteractableColor, Color queueSlotHighlightColor)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				Singleton<TableVisualEffectsManager>.Instance.SetDustParticlesActive(!showEffects);
				if (showEffects)
				{
					Color darkRed = GameColors.Instance.darkRed;
					darkRed.a = 0.5f;
					Color glowRed = GameColors.Instance.glowRed;
					glowRed.a = 0.5f;
					Singleton<TableVisualEffectsManager>.Instance.ChangeTableColors(mainLightColor, cardLightColor, interactablesColor, slotDefaultColor, slotInteractableColor, slotHighlightColor, queueSlotDefaultColor, queueSlotInteractableColor, queueSlotHighlightColor);
				}
				else
				{
					Singleton<TableVisualEffectsManager>.Instance.ResetTableColors();
				}
			}

			public void SetSceneEffectsShown(bool showEffects)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				Singleton<TableVisualEffectsManager>.Instance.SetDustParticlesActive(!showEffects);
				if (showEffects)
				{
					Color gray = GameColors.Instance.gray;
					gray.a = 0.5f;
					Color blue = GameColors.Instance.blue;
					blue.a = 0.5f;
					Singleton<TableVisualEffectsManager>.Instance.ChangeTableColors(GameColors.Instance.brightNearWhite, GameColors.Instance.brightBlue, GameColors.Instance.brightNearWhite, gray, GameColors.Instance.gray, GameColors.Instance.brightNearWhite, blue, GameColors.Instance.blue, GameColors.Instance.brightNearWhite);
				}
				else
				{
					Singleton<TableVisualEffectsManager>.Instance.ResetTableColors();
				}
			}
		}

		public class ChallengeBoonMud : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("MudBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("MudBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				List<CardInfo> boardCards = new List<CardInfo>();
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.PlayerSlotsCopy)
				{
					if ((Object)(object)slot.Card != (Object)null)
					{
						boardCards.Add(((Card)slot.Card).Info);
					}
				}
				List<CardSlot> playerSlotsCopy = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
				playerSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> slots = SelectRandomSlots(Math.Max((playerSlotsCopy.Count + 1) / 2, 1), playerSlotsCopy);
				for (int i = 0; i < slots.Count; i++)
				{
					yield return slots[i].FadeToSlotMod(SlotMods.SlotMod_Muddy.SlotType);
					if (RunState.CurrentRegionTier >= 1)
					{
						yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("Daus"), slots[i].opposingSlot, 0.1f, true);
					}
				}
			}
		}

		public class ChallengeBoonHail : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				Color darkRed = GameColors.Instance.gray;
				darkRed.a = 0.5f;
				Color brownOrange = GameColors.Instance.blue;
				brownOrange.a = 0.5f;
				SetSceneEffectsShown(showEffects: true, GameColors.Instance.brightBlue, GameColors.Instance.brightBlue, GameColors.Instance.brightNearWhite, darkRed, GameColors.Instance.gray, GameColors.Instance.brightNearWhite, brownOrange, GameColors.Instance.blue, GameColors.Instance.brightNearWhite);
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("HailBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("HailBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				opponentSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> slotsO = SelectRandomSlots(3 - RunState.CurrentRegionTier, opponentSlotsCopy);
				for (int i = 0; i < slotsO.Count; i++)
				{
					yield return slotsO[i].FadeToSlotMod(SlotMods.SlotMod_Hail.SlotType);
				}
				List<CardSlot> playerSlotsCopy = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
				playerSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				int playerHail = 2;
				if (RunState.CurrentRegionTier >= 2)
				{
					playerHail = 3;
				}
				List<CardSlot> slotsP = SelectRandomSlots(playerHail, playerSlotsCopy);
				for (int i2 = 0; i2 < slotsP.Count; i2++)
				{
					yield return slotsP[i2].FadeToSlotMod(SlotMods.SlotMod_Hail.SlotType);
				}
			}
		}

		public class ChallengeBoonCliffs : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("CliffsBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("CliffsBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				CardInfo cardInfo = CardLoader.GetCardByName("bitty_Cliff");
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(cardInfo, opponentSlotsCopy[0], 0.1f, true);
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(cardInfo, opponentSlotsCopy[0].opposingSlot, 0.1f, true);
				yield return Singleton<Opponent>.Instance.QueueCard(cardInfo, opponentSlotsCopy[0], true, false, true);
			}
		}

		public class ChallengeBoonMushrooms : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("MushroomsBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				opponentSlotsCopy.Remove(opponentSlotsCopy[0]);
				opponentSlotsCopy.Remove(opponentSlotsCopy[opponentSlotsCopy.Count - 1]);
				opponentSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> slots = SelectRandomSlots(1, opponentSlotsCopy);
				for (int i = 0; i < slots.Count; i++)
				{
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("bitty_Mushrooms"), slots[i], 0.1f, true);
				}
				yield return AudioController.Instance.PlaySound2D("mushroom_large_appear", (MixerGroup)4, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
			}
		}

		public class ChallengeBoonDynamite : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("DynamiteBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("DynamiteBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				List<CardSlot> allSlotsCopy = Singleton<BoardManager>.Instance.AllSlotsCopy;
				allSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> slots = SelectRandomSlots(4, allSlotsCopy);
				for (int i = 0; i < slots.Count; i++)
				{
					yield return slots[i].FadeToSlotMod(SlotMods.SlotMod_Dynamite.SlotType);
				}
				if (RunState.CurrentRegionTier >= 2)
				{
					List<CardSlot> playerSlotsCopy = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
					playerSlotsCopy.RemoveAll((CardSlot x) => (int)SlotModificationExtensions.GetSlotModification(x) == 0);
					for (int i2 = 0; i2 < playerSlotsCopy.Count; i2++)
					{
						yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("GoldNugget"), playerSlotsCopy[i2].opposingSlot, 0.1f, true);
					}
				}
			}
		}

		public class ChallengeBoonBait : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("BaitBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("BaitBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				List<CardInfo> boardCards = new List<CardInfo>();
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
				{
					if ((Object)(object)slot.Card != (Object)null)
					{
						boardCards.Add(((Card)slot.Card).Info);
					}
				}
				List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				opponentSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> slots = SelectRandomSlots(Math.Max((opponentSlotsCopy.Count + 1) / 2, 1), opponentSlotsCopy);
				for (int i = 0; i < slots.Count; i++)
				{
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("BaitBucket"), slots[i], 0.1f, true);
				}
				if (RunState.CurrentRegionTier >= 2)
				{
					List<CardSlot> opponentSlotsCopy2 = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
					opponentSlotsCopy2.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
					for (int i2 = 0; i2 < opponentSlotsCopy2.Count; i2++)
					{
						yield return opponentSlotsCopy2[i2].opposingSlot.FadeToSlotMod(SlotMods.SlotMod_Muddy.SlotType);
					}
				}
			}

			public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
			{
				return ((Object)((Card)card).Info).name == "BaitBucket";
			}

			public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
			{
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("Shark"), deathSlot, 0.1f, true);
			}
		}

		public class ChallengeBoonTrap : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("TrapBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("TrapBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				List<CardInfo> boardCards = new List<CardInfo>();
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
				{
					if ((Object)(object)slot.Card != (Object)null)
					{
						boardCards.Add(((Card)slot.Card).Info);
					}
				}
				List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				opponentSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> slots = SelectRandomSlots(Math.Max((opponentSlotsCopy.Count + 1) / 2, 1), opponentSlotsCopy);
				for (int i = 0; i < slots.Count; i++)
				{
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("Trap"), slots[i], 0.1f, true);
				}
				if (RunState.CurrentRegionTier >= 2)
				{
					List<CardSlot> opponentSlotsCopy2 = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
					opponentSlotsCopy2.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
					for (int i2 = 0; i2 < opponentSlotsCopy2.Count; i2++)
					{
						yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("bitty_IceCube"), opponentSlotsCopy2[i2].opposingSlot, 0.1f, true);
					}
				}
			}
		}

		public class ChallengeBoonTotem : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("TotemBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("TotemBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				List<CardInfo> boardCards = new List<CardInfo>();
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
				{
					if ((Object)(object)slot.Card != (Object)null)
					{
						boardCards.Add(((Card)slot.Card).Info);
					}
				}
				List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				opponentSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> slots = SelectRandomSlots(opponentSlotsCopy.Count / 5 + 1, opponentSlotsCopy);
				for (int i = 0; i < slots.Count; i++)
				{
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("bitty_Totem"), slots[i], 0.1f, true);
					if (RunState.CurrentRegionTier >= 2)
					{
						slots[i].Card.AddTemporaryMod(new CardModificationInfo((Ability)54)
						{
							healthAdjustment = 1
						});
					}
				}
			}
		}

		public class ChallengeBoonBloodMoon : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				Color darkRed = GameColors.Instance.darkRed;
				darkRed.a = 0.5f;
				Color brownOrange = GameColors.Instance.glowRed;
				brownOrange.a = 0.5f;
				SetSceneEffectsShown(showEffects: true, GameColors.Instance.glowRed, GameColors.Instance.brightRed, GameColors.Instance.nearBlack, darkRed, GameColors.Instance.lightGray, GameColors.Instance.nearBlack, brownOrange, GameColors.Instance.lightGray, GameColors.Instance.nearBlack);
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("BloodMoonBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				yield return (object)new WaitForSeconds(0.1f);
				yield return Singleton<Opponent>.Instance.ClearBoard();
				yield return Singleton<Opponent>.Instance.ClearQueue();
				yield return (object)new WaitForSeconds(0.1f);
				LeshyAnimationController.Instance.SetEyesTexture(ResourceBank.Get<Texture>("Art/Effects/red"));
				yield return CardGlitchSequence(CardLoader.GetCardByName("DireWolfCub"));
			}

			public static IEnumerator CardGlitchSequence(CardInfo grizzlyInfo)
			{
				((ScreenEffect)Singleton<UIManager>.Instance.Effects.GetEffect<ScreenGlitchEffect>()).SetIntensity(1f, 1.5f);
				Singleton<CameraEffects>.Instance.Shake(0.1f, 1f);
				AudioController.Instance.PlaySound2D("broken_hum", (MixerGroup)0, 0.5f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
				{
					if (!Singleton<TurnManager>.Instance.Opponent.QueuedSlots.Contains(slot))
					{
						yield return Singleton<TurnManager>.Instance.Opponent.QueueCard(grizzlyInfo, slot, false, false, false);
					}
					if ((Object)(object)slot.Card == (Object)null)
					{
						yield return Singleton<BoardManager>.Instance.CreateCardInSlot(grizzlyInfo, slot, 0f, true);
					}
					if ((Object)(object)slot.Card != (Object)null)
					{
						Tutorial4BattleSequencer.GiveCardReachAndRedColor(slot.Card);
					}
				}
				foreach (PlayableCard playableCard in Singleton<TurnManager>.Instance.Opponent.Queue)
				{
					Tutorial4BattleSequencer.GiveCardReachAndRedColor(playableCard);
				}
				yield return (object)new WaitForSeconds(0.5f);
			}
		}

		public class ChallengeBoonCarrotPatch : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				Color darkRed = GameColors.Instance.darkRed;
				darkRed.a = 0.5f;
				Color brownOrange = GameColors.Instance.glowRed;
				brownOrange.a = 0.5f;
				SetSceneEffectsShown(showEffects: true, GameColors.Instance.glowRed, GameColors.Instance.brightRed, GameColors.Instance.nearBlack, darkRed, GameColors.Instance.lightGray, GameColors.Instance.nearBlack, brownOrange, GameColors.Instance.lightGray, GameColors.Instance.nearBlack);
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("BloodMoonBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				yield return (object)new WaitForSeconds(0.1f);
				yield return Singleton<Opponent>.Instance.ClearBoard();
				yield return Singleton<Opponent>.Instance.ClearQueue();
				yield return (object)new WaitForSeconds(0.1f);
				LeshyAnimationController.Instance.SetEyesTexture(ResourceBank.Get<Texture>("Art/Effects/red"));
				yield return CardGlitchSequence(CardLoader.GetCardByName("Rabbit"));
				SetSceneEffectsShown(showEffects: false);
				LeshyAnimationController.Instance.ResetEyesTexture();
				Singleton<ViewManager>.Instance.SwitchToView((View)6, false, false);
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("CarrotBoonIntro", (MessageAdvanceMode)0, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				yield return (object)new WaitForSeconds(0.5f);
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("CarrotBoonIntro2", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			}

			public static IEnumerator CardGlitchSequence(CardInfo grizzlyInfo)
			{
				((ScreenEffect)Singleton<UIManager>.Instance.Effects.GetEffect<ScreenGlitchEffect>()).SetIntensity(1f, 1.5f);
				Singleton<CameraEffects>.Instance.Shake(0.1f, 1f);
				AudioController.Instance.PlaySound2D("broken_hum", (MixerGroup)0, 0.5f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
				{
					if (!Singleton<TurnManager>.Instance.Opponent.QueuedSlots.Contains(slot))
					{
						yield return Singleton<TurnManager>.Instance.Opponent.QueueCard(grizzlyInfo, slot, false, false, false);
					}
					if ((Object)(object)slot.Card == (Object)null)
					{
						yield return Singleton<BoardManager>.Instance.CreateCardInSlot(grizzlyInfo, slot, 0f, true);
					}
					if ((Object)(object)slot.Card != (Object)null)
					{
						Tutorial4BattleSequencer.GiveCardReachAndRedColor(slot.Card);
					}
				}
				foreach (PlayableCard playableCard in Singleton<TurnManager>.Instance.Opponent.Queue)
				{
					Tutorial4BattleSequencer.GiveCardReachAndRedColor(playableCard);
				}
				yield return (object)new WaitForSeconds(0.5f);
			}
		}

		public class ChallengeBoonBlizzard : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				Color darkRed = GameColors.Instance.gray;
				darkRed.a = 0.5f;
				Color brownOrange = GameColors.Instance.blue;
				brownOrange.a = 0.5f;
				SetSceneEffectsShown(showEffects: true, GameColors.Instance.brightBlue, GameColors.Instance.brightBlue, GameColors.Instance.brightNearWhite, darkRed, GameColors.Instance.gray, GameColors.Instance.brightNearWhite, brownOrange, GameColors.Instance.blue, GameColors.Instance.brightNearWhite);
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("BlizzardBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("BlizzardBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				List<CardSlot> playerSlotsCopy = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
				CardInfo cardInfo = CardLoader.GetCardByName("bitty_Avalanche");
				if ((Object)(object)playerSlotsCopy[0].Card != (Object)null)
				{
					yield return playerSlotsCopy[0].Card.TakeDamage(10, (PlayableCard)null);
				}
				if ((Object)(object)playerSlotsCopy[0].opposingSlot.Card != (Object)null)
				{
					yield return playerSlotsCopy[0].opposingSlot.Card.TakeDamage(10, (PlayableCard)null);
				}
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(cardInfo, playerSlotsCopy[0], 0.1f, true);
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(cardInfo, playerSlotsCopy[0].opposingSlot, 0.1f, true);
			}

			public override bool RespondsToUpkeep(bool playerUpkeep)
			{
				return playerUpkeep;
			}

			public override IEnumerator OnUpkeep(bool playerUpkeep)
			{
				Plugin.Log.LogInfo((object)"Avalanche Activation");
				bool avalancheExists = false;
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.AllSlotsCopy)
				{
					if ((Object)(object)slot.Card != (Object)null && ((Object)((Card)slot.Card).Info).name == "bitty_Avalanche")
					{
						avalancheExists = true;
					}
				}
				if (!avalancheExists)
				{
					Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
					yield return Singleton<BoonsHandler>.Instance.PlayBoonAnimation(boonType);
					yield return (object)new WaitForSeconds(0.5f);
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, true);
					yield return (object)new WaitForSeconds(0.5f);
					List<CardSlot> playerSlotsCopy = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
					CardInfo cardInfo = CardLoader.GetCardByName("bitty_Avalanche");
					if ((Object)(object)playerSlotsCopy[0].Card != (Object)null)
					{
						yield return playerSlotsCopy[0].Card.TakeDamage(10, (PlayableCard)null);
					}
					if ((Object)(object)playerSlotsCopy[0].opposingSlot.Card != (Object)null)
					{
						yield return playerSlotsCopy[0].opposingSlot.Card.TakeDamage(10, (PlayableCard)null);
					}
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(cardInfo, playerSlotsCopy[0], 0.1f, true);
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(cardInfo, playerSlotsCopy[0].opposingSlot, 0.1f, true);
				}
				yield return (object)new WaitForSeconds(0.5f);
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			}
		}

		public class ChallengeBoonObelisk : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				opponentSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> slots = SelectRandomSlots(1, opponentSlotsCopy);
				for (int i = 0; i < slots.Count; i++)
				{
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("bitty_Obelisk"), slots[i], 0.1f, true);
					if ((Object)(object)slots[i].opposingSlot.Card != (Object)null)
					{
						yield return slots[i].opposingSlot.Card.Die(false, (PlayableCard)null, false);
					}
					yield return slots[i].opposingSlot.FadeToSlotMod(SlotMods.SlotMod_Obelisk.SlotType);
				}
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("ObeliskBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("ObeliskBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
			}
		}

		public class ChallengeBoonMinicello : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				opponentSlotsCopy.Remove(opponentSlotsCopy[0]);
				opponentSlotsCopy.Remove(opponentSlotsCopy[opponentSlotsCopy.Count - 1]);
				opponentSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> slots = SelectRandomSlots(1, opponentSlotsCopy);
				for (int i = 0; i < slots.Count; i++)
				{
					CardInfo card = CardLoader.GetCardByName("bitty_Minicello");
					card.mods.Add(new CardModificationInfo((Ability)33));
					card.mods.Add(new CardModificationInfo(0, 3));
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(card, slots[i], 0.1f, true);
				}
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
					if (!DialogueEventsData.EventIsPlayed("MinicelloBoonIntro"))
					{
						yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("MinicelloBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					}
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("MinicelloBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				}
			}
		}

		public class ChallengeBoonDarkForest : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				Color darkRed = GameColors.Instance.gray;
				darkRed.a = 0.5f;
				Color brownOrange = GameColors.Instance.lightGray;
				brownOrange.a = 0.5f;
				SetSceneEffectsShown(showEffects: true, GameColors.Instance.gray, GameColors.Instance.gray, GameColors.Instance.brightNearWhite, darkRed, GameColors.Instance.gray, GameColors.Instance.lightGray, brownOrange, GameColors.Instance.gray, GameColors.Instance.lightGray);
				List<CardInfo> boardCards = new List<CardInfo>();
				foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
				{
					if ((Object)(object)slot.Card != (Object)null)
					{
						boardCards.Add(((Card)slot.Card).Info);
						PlayableCard otherCard = slot.Card;
						if (CardExtensions.HasTrait(otherCard, (Trait)12))
						{
							object obj = ((Card)otherCard).Info.Clone();
							CardInfo cardInfo = (CardInfo)((obj is CardInfo) ? obj : null);
							CardModificationInfo cardModificationInfo = new CardModificationInfo();
							cardModificationInfo.attackAdjustment = 1;
							cardModificationInfo.nameReplacement = string.Format(Localization.Translate("Living {0}"), cardInfo.DisplayedNameLocalized);
							cardInfo.Mods.Add(cardModificationInfo);
							yield return otherCard.TransformIntoCard(cardInfo, (Action)null, (Action)null);
						}
						yield break;
					}
				}
				List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				opponentSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				int terrainCards = 0;
				if (boardCards.Count <= 0)
				{
					terrainCards = 3;
				}
				else if (boardCards.Count <= 1)
				{
					terrainCards = 2;
				}
				else if (boardCards.Count == 2)
				{
					terrainCards = 1;
				}
				List<CardSlot> slots = SelectRandomSlots(terrainCards, opponentSlotsCopy);
				for (int i = 0; i < slots.Count; i++)
				{
					CardInfo card = CardLoader.GetCardByName("Tree");
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(card, slots[i], 0.1f, true);
				}
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("DarkForestBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("DarkForestBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
			}

			public override bool RespondsToOtherCardResolve(PlayableCard otherCard)
			{
				return otherCard.OpponentCard;
			}

			public override IEnumerator OnOtherCardResolve(PlayableCard otherCard)
			{
				if (CardExtensions.HasTrait(otherCard, (Trait)12))
				{
					object obj = ((Card)otherCard).Info.Clone();
					CardInfo cardInfo = (CardInfo)((obj is CardInfo) ? obj : null);
					CardModificationInfo cardModificationInfo = new CardModificationInfo();
					cardModificationInfo.attackAdjustment = 1;
					cardModificationInfo.nameReplacement = string.Format(Localization.Translate("Living {0}"), cardInfo.DisplayedNameLocalized);
					cardInfo.Mods.Add(cardModificationInfo);
					yield return otherCard.TransformIntoCard(cardInfo, (Action)null, (Action)null);
				}
			}
		}

		public class ChallengeBoonFlood : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				Color darkRed = GameColors.Instance.gray;
				darkRed.a = 0.5f;
				Color brownOrange = GameColors.Instance.blue;
				brownOrange.a = 0.5f;
				SetSceneEffectsShown(showEffects: true, GameColors.Instance.darkBlue, GameColors.Instance.brightBlue, GameColors.Instance.brightNearWhite, darkRed, GameColors.Instance.gray, GameColors.Instance.brightNearWhite, brownOrange, GameColors.Instance.blue, GameColors.Instance.brightNearWhite);
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("FloodBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("FloodBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
					yield return (object)new WaitForSeconds(0.7f);
				}
				for (int i = 0; i < 3 - RunState.CurrentRegionTier; i++)
				{
					yield return Singleton<CardSpawner>.Instance.SpawnCardToHand(CardLoader.GetCardByName("bitty_Raft"), 0.25f);
					yield return (object)new WaitForSeconds(0.2f);
				}
				List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				opponentSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> opponentSlots = SelectRandomSlots(2, opponentSlotsCopy);
				for (int i2 = 0; i2 < opponentSlots.Count; i2++)
				{
					yield return opponentSlots[i2].FadeToSlotMod(SlotMods.SlotMod_Flood.SlotType);
				}
				List<CardSlot> playerSlots = Singleton<BoardManager>.Instance.AllSlotsCopy;
				playerSlots.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				for (int i3 = 0; i3 < playerSlots.Count; i3++)
				{
					yield return playerSlots[i3].FadeToSlotMod(SlotMods.SlotMod_Flood.SlotType);
				}
			}
		}

		public class ChallengeBoonBreeze : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed("EnvironmentsIntro") && !DialogueEventsData.EventIsPlayed("BreezeBoonIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("BreezeBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				List<CardSlot> allSlotsCopy = Singleton<BoardManager>.Instance.AllSlotsCopy;
				allSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> slots = SelectRandomSlots(6, allSlotsCopy);
				for (int i = 0; i < slots.Count; i++)
				{
					yield return slots[i].FadeToSlotMod(SlotMods.SlotMod_Breeze.SlotType);
				}
			}
		}

		public class ChallengeBoonGraveyard : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				Color darkRed = GameColors.Instance.gray;
				darkRed.a = 0.5f;
				Color brownOrange = GameColors.Instance.lightGray;
				brownOrange.a = 0.5f;
				SetSceneEffectsShown(showEffects: true, GameColors.Instance.lightGray, GameColors.Instance.lightGray, GameColors.Instance.gray, darkRed, GameColors.Instance.gray, GameColors.Instance.gray, brownOrange, GameColors.Instance.gray, GameColors.Instance.gray);
				string P03 = (Plugin.modModeActive(Plugin.MOD_MODE.P03) ? "P03" : "");
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed(P03 + "EnvironmentsIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent(P03 + "GraveyardBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				if (Plugin.modModeActive(Plugin.MOD_MODE.KCM) && RunState.CurrentRegionTier >= 1)
				{
					List<CardSlot> opponentSlotsCopy = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
					opponentSlotsCopy.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
					List<CardSlot> slots = SelectRandomSlots(Math.Max((opponentSlotsCopy.Count + 1) / 2, 1), opponentSlotsCopy);
					for (int i = 0; i < slots.Count; i++)
					{
						string name = (SeededRandom.Bool(SaveManager.SaveFile.GetCurrentRandomSeed() + i) ? "bitty_SkeletonPirate" : "Amoeba");
						yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName(name), slots[i], 0.1f, true);
					}
				}
				else if (Plugin.modModeActive(Plugin.MOD_MODE.P03))
				{
					List<CardSlot> opponentSlotsCopy2 = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
					opponentSlotsCopy2.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
					List<CardSlot> slots2 = SelectRandomSlots(Math.Max((opponentSlotsCopy2.Count + 1) / 2, 1), opponentSlotsCopy2);
					for (int i2 = 0; i2 < slots2.Count; i2++)
					{
						string name2 = (SeededRandom.Bool(SaveManager.SaveFile.GetCurrentRandomSeed() + i2) ? "BrokenBot" : "Amoebot");
						yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName(name2), slots2[i2], 0.1f, true);
					}
				}
				List<CardSlot> allSlotsCopy = Singleton<BoardManager>.Instance.AllSlotsCopy;
				allSlotsCopy = SelectRandomSlots(6, allSlotsCopy);
				for (int i3 = 0; i3 < allSlotsCopy.Count; i3++)
				{
					yield return allSlotsCopy[i3].FadeToSlotMod(SlotMods.SlotMod_Grave.SlotType);
				}
			}
		}

		public class ChallengeBoonFlashGrowth : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				Color darkRed = GameColors.Instance.darkLimeGreen;
				darkRed.a = 0.5f;
				Color brownOrange = GameColors.Instance.brightLimeGreen;
				brownOrange.a = 0.5f;
				SetSceneEffectsShown(showEffects: true, GameColors.Instance.brightLimeGreen, GameColors.Instance.brightLimeGreen, GameColors.Instance.brightLimeGreen, darkRed, GameColors.Instance.darkLimeGreen, GameColors.Instance.brightLimeGreen, brownOrange, GameColors.Instance.limeGreen, GameColors.Instance.brightLimeGreen);
				string P03 = (Plugin.modModeActive(Plugin.MOD_MODE.P03) ? "P03" : "");
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed(P03 + "EnvironmentsIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent(P03 + "FlashGrowthBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
				List<CardSlot> slots = SelectRandomSlots(slotsCopy: Singleton<BoardManager>.Instance.OpponentSlotsCopy, amount: RunState.CurrentRegionTier + 1);
				for (int i = 0; i < slots.Count; i++)
				{
					yield return slots[i].FadeToSlotMod(SlotMods.SlotMod_Growth.SlotType);
				}
				List<CardSlot> playerSlotsCopy = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
				List<CardSlot> slots2 = SelectRandomSlots(2, playerSlotsCopy);
				for (int j = 0; j < slots2.Count; j++)
				{
					yield return slots2[j].FadeToSlotMod(SlotMods.SlotMod_Growth.SlotType);
				}
			}
		}

		public class ChallengeBoonGemSanctuary : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				List<CardSlot> emptySlots = Singleton<BoardManager>.Instance.OpponentSlotsCopy;
				emptySlots.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null);
				List<CardSlot> slots = SelectRandomSlots(Math.Max((emptySlots.Count + 1) / 2, 1), emptySlots);
				CardSlot animatorSlot = null;
				for (int i = 0; i < slots.Count; i++)
				{
					string name = (SeededRandom.Bool(SaveManager.SaveFile.GetCurrentRandomSeed() + i + 1) ? "EmptyVessel_OrangeGem" : "EmptyVessel_GreenGem");
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName(name), slots[i], 0.1f, true);
					if (i == 0)
					{
						slots[i].Card.AddTemporaryMod(new CardModificationInfo((Ability)40));
						animatorSlot = slots[i];
					}
				}
				emptySlots = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
				emptySlots.RemoveAll((CardSlot x) => (Object)(object)x.Card != (Object)null || (Object)(object)x == (Object)(object)animatorSlot);
				slots = SelectRandomSlots(1, emptySlots);
				for (int i2 = 0; i2 < slots.Count; i2++)
				{
					string name2 = "EmptyVessel_GreenGem";
					yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName(name2), slots[i2], 0.1f, true);
					if (i2 == 0)
					{
						slots[i2].Card.AddTemporaryMod(new CardModificationInfo((Ability)40));
					}
				}
				string P03 = "P03";
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed(P03 + "EnvironmentsIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent(P03 + "GemSanctuaryBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
				}
			}
		}

		public class ChallengeBoonElectricStorm : ChallengeBoonBase
		{
			internal static Type boo;

			protected override Type boonType => boo;

			public override bool RespondsToPreBoonActivation()
			{
				return true;
			}

			public override IEnumerator OnPreBoonActivation()
			{
				string P03 = "P03";
				if (SaveFile.IsAscension && DialogueEventsData.EventIsPlayed(P03 + "EnvironmentsIntro"))
				{
					yield return (object)new WaitForSeconds(0.7f);
					yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent(P03 + "ElectricStormBoonIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)Dialogue.P03HappyCloseUp);
				}
				List<CardSlot> allSlotsCopy = Singleton<BoardManager>.Instance.AllSlotsCopy;
				List<CardSlot> slots = SelectRandomSlots(6, allSlotsCopy);
				for (int i = 0; i < slots.Count; i++)
				{
					yield return slots[i].FadeToSlotMod(SlotMods.SlotMod_Overclock.SlotType);
				}
			}
		}

		public static void AddBoons()
		{
			Plugin.Log.LogInfo((object)"Start of boons");
			Add_Boon_Mud();
			Add_Boon_Hail();
			Add_Boon_Cliff();
			Add_Boon_Mushrooms();
			Add_Boo