using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AddWatermark;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using LBoL.Base;
using LBoL.Base.Extensions;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Battle;
using LBoL.Core.Battle.BattleActions;
using LBoL.Core.Cards;
using LBoL.Core.StatusEffects;
using LBoL.Core.Units;
using LBoL.EntityLib.Cards.Enemy;
using LBoL.EntityLib.StatusEffects.Enemy;
using LBoL.Presentation;
using LBoLEntitySideloader;
using LBoLEntitySideloader.Attributes;
using LBoLEntitySideloader.Entities;
using LBoLEntitySideloader.Resource;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("LBoL.Base")]
[assembly: IgnoresAccessChecksTo("LBoL.ConfigData")]
[assembly: IgnoresAccessChecksTo("LBoL.Core")]
[assembly: IgnoresAccessChecksTo("LBoL.EntityLib")]
[assembly: IgnoresAccessChecksTo("LBoL.Presentation")]
[assembly: IgnoresAccessChecksTo("Untitled.ConfigDataBuilder.Base")]
[assembly: AssemblyCompany("AutoBattlerJadeBox")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AutoBattlerJadeBox")]
[assembly: AssemblyTitle("AutoBattlerJadeBox")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AutoBattlerJadeBox
{
[BepInPlugin("intoxicatedkid.autobattlerjadebox", "Auto Battler Jade Box", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("LBoL.exe")]
public class BepinexPlugin : BaseUnityPlugin
{
private static readonly Harmony harmony = PInfo.harmony;
internal static ManualLogSource log;
internal static TemplateSequenceTable sequenceTable = new TemplateSequenceTable(0);
internal static IResourceSource embeddedSource = (IResourceSource)new EmbeddedSource(Assembly.GetExecutingAssembly());
internal static DirectorySource directorySource = new DirectorySource("intoxicatedkid.autobattlerjadebox", "");
private void Awake()
{
log = ((BaseUnityPlugin)this).Logger;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
EntityManager.RegisterSelf();
harmony.PatchAll();
if (Chainloader.PluginInfos.ContainsKey("neo.lbol.tools.watermark"))
{
WatermarkWrapper.ActivateWatermark();
}
}
private void OnDestroy()
{
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
}
public static class PInfo
{
public const string GUID = "intoxicatedkid.autobattlerjadebox";
public const string Name = "Auto Battler Jade Box";
public const string version = "1.0.1";
public static readonly Harmony harmony = new Harmony("intoxicatedkid.autobattlerjadebox");
}
public sealed class TASBotDef : ExhibitTemplate
{
[EntityLogic(typeof(TASBotDef))]
[UsedImplicitly]
public sealed class TASBot : Exhibit
{
protected override void OnEnterBattle()
{
((Exhibit)this).ReactBattleEvent<GameEventArgs>(((Exhibit)this).Battle.BattleStarted, (EventSequencedReactor<GameEventArgs>)OnBattleStarted);
}
private IEnumerable<BattleAction> OnBattleStarted(GameEventArgs args)
{
<>n__0();
yield return (BattleAction)(object)new ApplyStatusEffectAction<TASBotSeDef.TASBotSe>((Unit)(object)((Exhibit)this).Owner, (int?)null, (int?)null, (int?)null, (int?)((Exhibit)this).Value1, 0f, true);
}
[CompilerGenerated]
[DebuggerHidden]
private void <>n__0()
{
((Exhibit)this).NotifyActivating();
}
}
public override IdContainer GetId()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("TASBot");
}
public override LocalizationOption LoadLocalization()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
LocalizationFiles val = new LocalizationFiles(BepinexPlugin.embeddedSource);
val.AddLocaleFile((Locale)0, "Resources.ExhibitsEn.yaml");
return (LocalizationOption)(object)val;
}
public override ExhibitSprites LoadSprite()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
string folder = "";
ExhibitSprites val = new ExhibitSprites();
Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
val.main = func("");
return val;
}
public override ExhibitConfig MakeConfig()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
int num = BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig));
int? num2 = 15;
ManaGroup value = default(ManaGroup);
((ManaGroup)(ref value)).Any = 0;
return new ExhibitConfig(num, "", 10, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)2, num2, (int?)null, (int?)null, (ManaGroup?)value, (ManaColor?)null, (ManaColor?)null, 0, false, (int?)0, (Keyword)0, (IReadOnlyList<string>)new List<string> { "Invincible" }, (IReadOnlyList<string>)new List<string>());
}
}
public sealed class TASBotSeDef : StatusEffectTemplate
{
[EntityLogic(typeof(TASBotSeDef))]
public sealed class TASBotSe : StatusEffect
{
private bool LastSpell;
[UsedImplicitly]
public ManaGroup Mana => ManaGroup.Anys(0);
protected override void OnAdded(Unit unit)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
LastSpell = false;
foreach (Card item in ((StatusEffect)this).Battle.HandZone.Where((Card card) => (int)card.CardType == 7))
{
((GameEntity)this).React(Reactor.op_Implicit((BattleAction)new ExileCardAction(item)));
}
((StatusEffect)this).HandleOwnerEvent<UnitEventArgs>(((Unit)((StatusEffect)this).Battle.Player).TurnStarting, (GameEventHandler<UnitEventArgs>)delegate
{
((StatusEffect)this).Count = ((StatusEffect)this).Limit;
});
((StatusEffect)this).HandleOwnerEvent<CardEventArgs>(((StatusEffect)this).Battle.Predraw, (GameEventHandler<CardEventArgs>)OnPredraw);
((StatusEffect)this).HandleOwnerEvent<DieEventArgs>(((StatusEffect)this).Owner.Dying, (GameEventHandler<DieEventArgs>)OnDying);
((StatusEffect)this).HandleOwnerEvent<DamageEventArgs>(((Unit)((StatusEffect)this).Battle.Player).DamageReceived, (GameEventHandler<DamageEventArgs>)OnPlayerDamageReceived);
((StatusEffect)this).HandleOwnerEvent<StatusEffectApplyEventArgs>(((StatusEffect)this).Owner.StatusEffectAdding, (GameEventHandler<StatusEffectApplyEventArgs>)OnStatusEffectAdding);
((StatusEffect)this).ReactOwnerEvent<UnitEventArgs>(((Unit)((StatusEffect)this).Battle.Player).TurnStarted, (EventSequencedReactor<UnitEventArgs>)OnPlayerTurnStarted);
((StatusEffect)this).ReactOwnerEvent<CardEventArgs>(((StatusEffect)this).Battle.CardDrawn, (EventSequencedReactor<CardEventArgs>)OnCardDrawn);
((StatusEffect)this).ReactOwnerEvent<CardMovingEventArgs>(((StatusEffect)this).Battle.CardMoved, (EventSequencedReactor<CardMovingEventArgs>)OnCardMoved);
((StatusEffect)this).ReactOwnerEvent<CardsEventArgs>(((StatusEffect)this).Battle.CardsAddedToHand, (EventSequencedReactor<CardsEventArgs>)OnCardsAddedToHand);
}
private void OnPredraw(CardEventArgs args)
{
if (((StatusEffect)this).Count > 0)
{
int count = ((StatusEffect)this).Count - 1;
((StatusEffect)this).Count = count;
}
else
{
((StatusEffect)this).NotifyActivating();
((GameEventArgs)args).CancelBy((GameEntity)(object)this);
}
}
private void OnDying(DieEventArgs args)
{
if (((GameEntity)this).GameRun.Battle != null && ((StatusEffect)this).Battle.Player.Power >= ((StatusEffect)this).Battle.Player.Us.PowerCost)
{
((StatusEffect)this).NotifyActivating();
int num = MathExtensions.RoundToInt((double)(args.Unit.MaxHp * 20) / 100.0);
((GameEntity)this).GameRun.SetHpAndMaxHp(num, args.Unit.MaxHp, false);
((GameEventArgs)args).CancelBy((GameEntity)(object)this);
LastSpell = true;
}
}
private void OnPlayerDamageReceived(DamageEventArgs args)
{
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Expected I4, but got Unknown
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Expected O, but got Unknown
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
if (((GameEntity)this).GameRun.Battle != null && LastSpell)
{
LastSpell = false;
((StatusEffect)this).NotifyActivating();
((GameEntity)this).React(Reactor.op_Implicit((BattleAction)(object)new ApplyStatusEffectAction<Invincible>(((StatusEffect)this).Owner, (int?)null, (int?)1, (int?)null, (int?)null, 0f, true)));
Unit source = args.Source;
EnemyUnit val = (EnemyUnit)(object)((source is EnemyUnit) ? source : null);
EnemyUnit val2 = ((val != null) ? val : CollectionsExtensions.Sample<EnemyUnit>(((StatusEffect)this).Battle.AllAliveEnemies, ((GameEntity)this).GameRun.BattleRng));
TargetType targetType = ((StatusEffect)this).Battle.Player.Us.TargetType;
TargetType val3 = targetType;
UnitSelector val4 = (UnitSelector)((int)val3 switch
{
0 => UnitSelector.Nobody,
1 => (object)new UnitSelector(val2),
2 => UnitSelector.AllEnemies,
3 => UnitSelector.RandomEnemy,
4 => UnitSelector.Self,
5 => UnitSelector.All,
_ => throw new ArgumentOutOfRangeException(),
});
((GameEntity)this).React(Reactor.op_Implicit(((BattleAction)new UseUsAction(((StatusEffect)this).Battle.Player.Us, val4, ((StatusEffect)this).Battle.Player.Us.PowerCost)).SetCause((ActionCause)16)));
((StatusEffect)this).NotifyActivating();
((StatusEffect)this).NotifyChanged();
}
}
private void OnStatusEffectAdding(StatusEffectApplyEventArgs args)
{
if (args.Effect is FoxCharm)
{
((GameEventArgs)args).CancelBy((GameEntity)(object)this);
((StatusEffect)this).NotifyActivating();
}
}
private IEnumerable<BattleAction> OnPlayerTurnStarted(GameEventArgs args)
{
if (((StatusEffect)this).Battle.BattleShouldEnd)
{
yield break;
}
<>n__0();
GameRunController gameRun = ((GameEntity)this).GameRun;
gameRun.SynergyAdditionalCount += 1;
List<Card> list = ((StatusEffect)this).Battle.HandZone.ToList();
foreach (Card card in list)
{
if (((StatusEffect)this).Battle.BattleShouldEnd)
{
GameRunController gameRun2 = ((GameEntity)this).GameRun;
gameRun2.SynergyAdditionalCount -= 1;
yield break;
}
if (card.Config.TargetType == (TargetType?)0 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Nobody, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Nobody, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)1 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
EnemyUnit enemy = CollectionsExtensions.Sample<EnemyUnit>(((StatusEffect)this).Battle.AllAliveEnemies, ((GameEntity)this).GameRun.BattleRng);
UnitSelector unitSelector = new UnitSelector(enemy);
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, unitSelector, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, unitSelector, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)2 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.AllEnemies, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.AllEnemies, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)3 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.RandomEnemy, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.RandomEnemy, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)4 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Self, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Self, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)5 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.All, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.All, Mana);
}
}
}
GameRunController gameRun3 = ((GameEntity)this).GameRun;
gameRun3.SynergyAdditionalCount -= 1;
yield return (BattleAction)new RequestEndPlayerTurnAction();
}
private IEnumerable<BattleAction> OnCardDrawn(CardEventArgs args)
{
Card card = args.Card;
if ((int)((GameEventArgs)args).Cause == 12 || (int)args.Card.Zone != 2 || ((StatusEffect)this).Battle.BattleShouldEnd)
{
yield break;
}
if (card.Config.TargetType == (TargetType?)0 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Nobody, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Nobody, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)1 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
EnemyUnit enemy = CollectionsExtensions.Sample<EnemyUnit>(((StatusEffect)this).Battle.AllAliveEnemies, ((GameEntity)this).GameRun.BattleRng);
UnitSelector unitSelector = new UnitSelector(enemy);
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, unitSelector, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, unitSelector, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)2 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.AllEnemies, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.AllEnemies, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)3 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.RandomEnemy, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.RandomEnemy, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)4 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Self, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Self, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)5 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.All, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.All, Mana);
}
}
}
private IEnumerable<BattleAction> OnCardMoved(CardMovingEventArgs args)
{
Card card = args.Card;
if ((int)((GameEventArgs)args).Cause == 12 || (int)card.Zone != 2 || ((int)args.SourceZone == 3 && (int)args.DestinationZone == 2) || ((StatusEffect)this).Battle.BattleShouldEnd)
{
yield break;
}
if (card.Config.TargetType == (TargetType?)0 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Nobody, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Nobody, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)1 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
EnemyUnit enemy = CollectionsExtensions.Sample<EnemyUnit>(((StatusEffect)this).Battle.AllAliveEnemies, ((GameEntity)this).GameRun.BattleRng);
UnitSelector unitSelector = new UnitSelector(enemy);
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, unitSelector, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, unitSelector, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)2 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.AllEnemies, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.AllEnemies, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)3 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.RandomEnemy, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.RandomEnemy, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)4 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Self, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.Self, Mana);
}
}
else if (card.Config.TargetType == (TargetType?)5 && (int)card.Zone == 2 && ((int)card.CardType != 5 || ((int)card.CardType == 5 && !card.Summoned) || ((int)card.CardType == 5 && card.Summoned && card.Loyalty >= -card.MinFriendCost)) && !card.IsForbidden)
{
if (card.IsXCost)
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.All, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card, UnitSelector.All, Mana);
}
}
}
private IEnumerable<BattleAction> OnCardsAddedToHand(CardsEventArgs args)
{
List<Card> list = args.Cards.Where((Card card) => (int)card.Zone == 2 && !card.Summoned).ToList();
foreach (Card card2 in list)
{
if (((StatusEffect)this).Battle.BattleShouldEnd)
{
yield break;
}
if (card2 is Bribery || card2 is Payment)
{
yield return (BattleAction)new ExileCardAction(card2);
}
else if (card2.Config.TargetType == (TargetType?)0 && (int)card2.Zone == 2 && ((int)card2.CardType != 5 || ((int)card2.CardType == 5 && !card2.Summoned) || ((int)card2.CardType == 5 && card2.Summoned && card2.Loyalty >= -card2.MinFriendCost)) && !card2.IsForbidden)
{
if (card2.IsXCost)
{
yield return (BattleAction)new UseCardAction(card2, UnitSelector.Nobody, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card2, UnitSelector.Nobody, Mana);
}
}
else if (card2.Config.TargetType == (TargetType?)1 && (int)card2.Zone == 2 && ((int)card2.CardType != 5 || ((int)card2.CardType == 5 && !card2.Summoned) || ((int)card2.CardType == 5 && card2.Summoned && card2.Loyalty >= -card2.MinFriendCost)) && !card2.IsForbidden)
{
EnemyUnit enemy = CollectionsExtensions.Sample<EnemyUnit>(((StatusEffect)this).Battle.AllAliveEnemies, ((GameEntity)this).GameRun.BattleRng);
UnitSelector unitSelector = new UnitSelector(enemy);
if (card2.IsXCost)
{
yield return (BattleAction)new UseCardAction(card2, unitSelector, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card2, unitSelector, Mana);
}
}
else if (card2.Config.TargetType == (TargetType?)2 && (int)card2.Zone == 2 && ((int)card2.CardType != 5 || ((int)card2.CardType == 5 && !card2.Summoned) || ((int)card2.CardType == 5 && card2.Summoned && card2.Loyalty >= -card2.MinFriendCost)) && !card2.IsForbidden)
{
if (card2.IsXCost)
{
yield return (BattleAction)new UseCardAction(card2, UnitSelector.AllEnemies, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card2, UnitSelector.AllEnemies, Mana);
}
}
else if (card2.Config.TargetType == (TargetType?)3 && (int)card2.Zone == 2 && ((int)card2.CardType != 5 || ((int)card2.CardType == 5 && !card2.Summoned) || ((int)card2.CardType == 5 && card2.Summoned && card2.Loyalty >= -card2.MinFriendCost)) && !card2.IsForbidden)
{
if (card2.IsXCost)
{
yield return (BattleAction)new UseCardAction(card2, UnitSelector.RandomEnemy, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card2, UnitSelector.RandomEnemy, Mana);
}
}
else if (card2.Config.TargetType == (TargetType?)4 && (int)card2.Zone == 2 && ((int)card2.CardType != 5 || ((int)card2.CardType == 5 && !card2.Summoned) || ((int)card2.CardType == 5 && card2.Summoned && card2.Loyalty >= -card2.MinFriendCost)) && !card2.IsForbidden)
{
if (card2.IsXCost)
{
yield return (BattleAction)new UseCardAction(card2, UnitSelector.Self, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card2, UnitSelector.Self, Mana);
}
}
else if (card2.Config.TargetType == (TargetType?)5 && (int)card2.Zone == 2 && ((int)card2.CardType != 5 || ((int)card2.CardType == 5 && !card2.Summoned) || ((int)card2.CardType == 5 && card2.Summoned && card2.Loyalty >= -card2.MinFriendCost)) && !card2.IsForbidden)
{
if (card2.IsXCost)
{
yield return (BattleAction)new UseCardAction(card2, UnitSelector.All, ((StatusEffect)this).Battle.BattleMana);
}
else
{
yield return (BattleAction)new UseCardAction(card2, UnitSelector.All, Mana);
}
}
}
}
[CompilerGenerated]
[DebuggerHidden]
private void <>n__0()
{
((StatusEffect)this).NotifyActivating();
}
}
public override IdContainer GetId()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("TASBotSe");
}
public override LocalizationOption LoadLocalization()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
LocalizationFiles val = new LocalizationFiles(BepinexPlugin.embeddedSource);
val.AddLocaleFile((Locale)0, "Resources.StatusEffectsEn.yaml");
return (LocalizationOption)(object)val;
}
public override Sprite LoadSprite()
{
return ResourceLoader.LoadSprite("Resources.TASBotSe.png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
}
public override StatusEffectConfig MakeConfig()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
return new StatusEffectConfig(BepinexPlugin.sequenceTable.Next(typeof(StatusEffectConfig)), "", 70, (StatusEffectType)2, false, true, (int?)null, false, (StackType?)(StackType)0, false, (StackType?)(StackType)0, (DurationDecreaseTiming)0, true, (StackType?)(StackType)3, (StackType?)(StackType)3, false, (Keyword)0, (IReadOnlyList<string>)new List<string>(), "Default", "Default", "Default");
}
}
internal class WatermarkWrapper
{
[MethodImpl(MethodImplOptions.NoInlining)]
internal static void ActivateWatermark()
{
API.ActivateWatermark();
}
}
}
namespace AutoBattlerJadeBox.JadeBoxes
{
public sealed class AutoBattlerJadeBoxDef : JadeBoxTemplate
{
public override IdContainer GetId()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("AutoBattlerJadeBox");
}
public override LocalizationOption LoadLocalization()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
return (LocalizationOption)new DirectLocalization(new Dictionary<string, object>
{
{ "Name", "Auto Battler" },
{ "Description", "Combats become (semi)automatic." }
}, (Locale)0, (Locale)0, false);
}
public override JadeBoxConfig MakeConfig()
{
return ((JadeBoxTemplate)this).DefaultConfig();
}
}
[EntityLogic(typeof(AutoBattlerJadeBoxDef))]
public sealed class AutoBattlerJadeBox : JadeBox
{
protected override void OnGain(GameRunController gameRun)
{
((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(GainExhibits(gameRun));
}
private IEnumerator GainExhibits(GameRunController gameRun)
{
HashSet<Type> ABexhibit = new HashSet<Type> { typeof(TASBotDef.TASBot) };
foreach (Type exhibit in ABexhibit)
{
yield return gameRun.GainExhibitRunner(Library.CreateExhibit(exhibit), false, (VisualSourceData)null);
}
gameRun.ExhibitPool.RemoveAll((Type e) => ABexhibit.Contains(e));
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}