using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using DiskCardGame;
using InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using InscryptionAPI.Triggers;
using NevernamedsSigils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ForestUnderTheStarrySky")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ForestUnderTheStarrySky")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ce178e1a-8da7-40d5-a6ad-8af9c2f68bd8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NewCardsMod;
[BepInPlugin("NewCards", "ForestUnderTheStarrySkyMod", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Forest Under The Starry Sky Mod!");
addExtremelyFastAttack();
addFortifiedArmor();
addKillingDesire();
addBloodGuzzler();
}
private void addExtremelyFastAttack()
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
AbilityInfo val = AbilityExtensions.SetDefaultPart1Ability(AbilityExtensions.SetPixelAbilityIcon(AbilityManager.New("NewCards", "ExtremelyFastAttack", "When [creature] is played, will direct attack once.", typeof(ExtremelyFastAttack), "ExtremelyFastAttack.png"), TextureHelper.GetImageAsTexture("Act2_ExtremelyFastAttack.png", (FilterMode)0), (FilterMode?)(FilterMode)0));
val.canStack = false;
val.passive = false;
val.activated = false;
val.opponentUsable = true;
val.powerLevel = 4;
val.rulebookName = "Extremely Fast Attack";
ExtremelyFastAttack.ability = val.ability;
}
private void addFortifiedArmor()
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
AbilityInfo val = AbilityExtensions.SetDefaultPart1Ability(AbilityExtensions.SetPixelAbilityIcon(AbilityManager.New("NewCards", "FortifiedArmor", " [creature] will reduce the damage they receive by one point when they are injured.", typeof(FortifiedArmor), "FortifiedArmor.png"), TextureHelper.GetImageAsTexture("Act2_FortifiedArmor.png", (FilterMode)0), (FilterMode?)(FilterMode)0));
val.canStack = false;
val.passive = false;
val.activated = false;
val.opponentUsable = true;
val.powerLevel = 3;
val.rulebookName = "Fortified Armor";
FortifiedArmor.ability = val.ability;
}
private void addKillingDesire()
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
AbilityInfo val = AbilityExtensions.SetDefaultPart1Ability(AbilityExtensions.SetPixelAbilityIcon(AbilityManager.New("NewCards", "KillingDesire", "When [creature] is kill another card, the adjacent cards gain +1 health.", typeof(KillingDesire), "KillingDesire.png"), TextureHelper.GetImageAsTexture("Act2_KillingDesire.png", (FilterMode)0), (FilterMode?)(FilterMode)0));
val.canStack = false;
val.passive = false;
val.activated = false;
val.opponentUsable = true;
val.powerLevel = 4;
val.rulebookName = "KillingDesire";
KillingDesire.ability = val.ability;
}
private void addBloodGuzzler()
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
AbilityInfo val = AbilityExtensions.SetDefaultPart1Ability(AbilityExtensions.SetPixelAbilityIcon(AbilityManager.New("NewCards", "BloodGuzzler", "When [creature] deals damage, it gains 1 Health for each damage dealt..", typeof(BloodGuzzler), "BloodGuzzler.png"), TextureHelper.GetImageAsTexture("Act2_BloodGuzzler.png", (FilterMode)0), (FilterMode?)(FilterMode)0));
val.canStack = false;
val.passive = false;
val.activated = false;
val.opponentUsable = true;
val.powerLevel = 4;
val.rulebookName = "Blood Guzzler";
BloodGuzzler.ability = val.ability;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ForestUnderTheStarrySkyMod";
public const string PLUGIN_NAME = "ForestUnderTheStarrySkyMod";
public const string PLUGIN_VERSION = "1.0.0";
}
public class ExtremelyFastAttack : AbilityBehaviour
{
public static Ability ability;
public override Ability Ability => ability;
public override bool RespondsToResolveOnBoard()
{
return true;
}
public override IEnumerator OnResolveOnBoard()
{
yield return (object)new WaitForSeconds(0.1f);
yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
yield return (object)new WaitForSeconds(0.1f);
FakeCombatThing fakecombat = new FakeCombatThing();
yield return fakecombat.FakeCombat(!((AbilityBehaviour)this).Card.OpponentCard, (SpecialBattleSequencer)null, ((AbilityBehaviour)this).Card.Slot, (List<CardSlot>)null, -1);
yield return (object)new WaitForSeconds(0.1f);
}
}
public class Fanaticism : AbilityBehaviour
{
public static Ability ability;
public override Ability Ability => ability;
public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
{
return fromCombat && (Object)(object)killer == (Object)(object)((AbilityBehaviour)this).Card;
}
public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
{
yield return (object)new WaitForSeconds(0.1f);
yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
yield return (object)new WaitForSeconds(0.1f);
FakeCombatThing fakecombat = new FakeCombatThing();
yield return fakecombat.FakeCombat(!((AbilityBehaviour)this).Card.OpponentCard, (SpecialBattleSequencer)null, ((AbilityBehaviour)this).Card.Slot, (List<CardSlot>)null, -1);
yield return (object)new WaitForSeconds(0.1f);
}
}
public class FortifiedArmor : AbilityBehaviour, IModifyDamageTaken
{
public static Ability ability;
public override Ability Ability => ability;
public override bool RespondsToTakeDamage(PlayableCard source)
{
return true;
}
public override IEnumerator OnTakeDamage(PlayableCard source)
{
yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
yield return ((AbilityBehaviour)this).LearnAbility(0.4f);
}
public bool RespondsToModifyDamageTaken(PlayableCard target, int damage, PlayableCard attacker, int originalDamage)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
return (Object)(object)((AbilityBehaviour)this).Card == (Object)(object)target && damage > 0 && ((Object)(object)attacker == (Object)null || CardExtensions.LacksAbility(attacker, Piercing.ability));
}
public int OnModifyDamageTaken(PlayableCard target, int damage, PlayableCard attacker, int originalDamage)
{
return damage - 1;
}
public int TriggerPriority(PlayableCard target, int damage, PlayableCard attacker)
{
return 0;
}
}
public class ExtremitySprint : AbilityBehaviour
{
protected bool movingLeft;
public static Ability AbilityID { get; private set; }
public override Ability Ability => AbilityID;
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 toLeft2 = Singleton<BoardManager>.Instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, true);
CardSlot toRight2 = 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 DoStrafe(toLeft2, toRight2);
toLeft2 = Singleton<BoardManager>.Instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, true);
toRight2 = Singleton<BoardManager>.Instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, false);
yield return (object)new WaitForSeconds(0.25f);
yield return DoStrafe(toLeft2, toRight2);
}
protected virtual IEnumerator DoStrafe(CardSlot toLeft, CardSlot toRight)
{
bool flag = (Object)(object)toLeft != (Object)null && (Object)(object)toLeft.Card == (Object)null;
bool flag2 = (Object)(object)toRight != (Object)null && (Object)(object)toRight.Card == (Object)null;
if (movingLeft && !flag)
{
movingLeft = false;
}
if (!movingLeft && !flag2)
{
movingLeft = true;
}
CardSlot destination = (movingLeft ? toLeft : toRight);
bool destinationValid = (movingLeft ? flag : flag2);
yield return MoveToSlot(destination, destinationValid);
if ((Object)(object)destination != (Object)null && destinationValid)
{
yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
yield return ((AbilityBehaviour)this).LearnAbility(0f);
}
}
protected IEnumerator MoveToSlot(CardSlot destination, bool destinationValid)
{
((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 && destinationValid)
{
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)
{
if (((Object)((Card)((AbilityBehaviour)this).Card).Info).name == "Snelk" && (Object)(object)oldSlot.Card == (Object)null)
{
yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("Snelk_Neck"), oldSlot, 0.1f, true);
}
}
}
public class KillingDesire : 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();
CardSlot toLeft = Singleton<BoardManager>.Instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, true);
if ((Object)(object)toLeft != (Object)null && (Object)(object)toLeft.Card != (Object)null)
{
toLeft.Card.TemporaryMods.Add(new CardModificationInfo(0, 1));
}
CardSlot toRight = Singleton<BoardManager>.Instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, false);
if ((Object)(object)toRight != (Object)null && (Object)(object)toRight.Card != (Object)null)
{
toRight.Card.TemporaryMods.Add(new CardModificationInfo(0, 1));
}
((AbilityBehaviour)this).Card.TemporaryMods.Add(new CardModificationInfo(0, 1));
yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
}
}
public class BloodGuzzler : AbilityBehaviour
{
public static Ability ability;
public override Ability Ability => ability;
public override bool RespondsToDealDamage(int amount, PlayableCard target)
{
return CardExtensions.NotDead(((AbilityBehaviour)this).Card) && amount > 0;
}
public override IEnumerator OnDealDamage(int amount, PlayableCard target)
{
yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
((AbilityBehaviour)this).Card.AddTemporaryMod(new CardModificationInfo(0, amount));
((AbilityBehaviour)this).Card.OnStatsChanged();
((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
((Card)((AbilityBehaviour)this).Card).RenderCard();
yield return (object)new WaitForSeconds(0.25f);
yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
}
}