using System;
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 DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using HarmonyLib;
using LBoL.Base;
using LBoL.Base.Extensions;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Adventures;
using LBoL.Core.Battle;
using LBoL.Core.Battle.BattleActions;
using LBoL.Core.Cards;
using LBoL.Core.Randoms;
using LBoL.Core.StatusEffects;
using LBoL.Core.Units;
using LBoL.EntityLib.Adventures;
using LBoL.EntityLib.EnemyUnits.Character;
using LBoL.EntityLib.Exhibits.Adventure;
using LBoL.EntityLib.StatusEffects.Basic;
using LBoL.Presentation.UI.Panels;
using LBoL.Presentation.UI.Widgets;
using LBoL.Presentation.Units;
using LBoLEntitySideloader;
using LBoLEntitySideloader.Attributes;
using LBoLEntitySideloader.Entities;
using LBoLEntitySideloader.Resource;
using LBoLEntitySideloader.Utils;
using UnityEngine;
using UnityEngine.Events;
using Yarn;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[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("CyanToolbox")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CyanToolbox")]
[assembly: AssemblyTitle("CyanToolbox")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace CyanToolbox
{
[BepInPlugin("cyaneko.lbol.mods.toolbox", "CyanToolbox", "0.5.0")]
[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 IResourceSource embeddedSource = (IResourceSource)new EmbeddedSource(Assembly.GetExecutingAssembly());
internal static TemplateSequenceTable sequenceTable = new TemplateSequenceTable(0);
internal static DirectorySource directorySource = new DirectorySource("cyaneko.lbol.mods.toolbox", "");
internal static BatchLocalization jadeboxLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(JadeBoxTemplate), "Jadeboxes", (Locale)0, false);
internal static BatchLocalization seLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(StatusEffectTemplate), "StatusEffects", (Locale)0, false);
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 = "cyaneko.lbol.mods.toolbox";
public const string Name = "CyanToolbox";
public const string version = "0.5.0";
public static readonly Harmony harmony = new Harmony("cyaneko.lbol.mods.toolbox");
}
internal class WatermarkWrapper
{
[MethodImpl(MethodImplOptions.NoInlining)]
internal static void ActivateWatermark()
{
API.ActivateWatermark();
}
}
}
namespace CyanToolbox.JadeBoxes
{
public sealed class DoubleTroubleDef : JadeBoxTemplate
{
public override IdContainer GetId()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("DoubleTroubleJadebox");
}
public override JadeBoxConfig MakeConfig()
{
return ((JadeBoxTemplate)this).DefaultConfig();
}
public override LocalizationOption LoadLocalization()
{
return (LocalizationOption)(object)BepinexPlugin.jadeboxLoc.AddEntity((EntityDefinition)(object)this);
}
}
[EntityLogic(typeof(DoubleTroubleDef))]
public sealed class DoubleTroubleJadebox : JadeBox
{
public static readonly Type[] AllBosses = new Type[3]
{
typeof(Sanae),
typeof(Junko),
typeof(Remilia)
};
protected override void OnEnterBattle()
{
((JadeBox)this).ReactBattleEvent<GameEventArgs>(((JadeBox)this).Battle.BattleStarting, (EventSequencedReactor<GameEventArgs>)OnBattleStarting);
}
private IEnumerable<BattleAction> OnBattleStarting(GameEventArgs args)
{
EnemyUnit enemyByRootIndex = ((JadeBox)this).Battle.GetEnemyByRootIndex(0);
if (enemyByRootIndex == null)
{
yield break;
}
Type rootEnemyType = ((object)enemyByRootIndex).GetType();
if (!AllBosses.Contains(rootEnemyType))
{
yield break;
}
((JadeBox)this).NotifyActivating();
GameDirector.ActiveFormation = "Shu";
Type type = CollectionsExtensions.Sample<Type>(AllBosses.Where((Type boss) => boss != rootEnemyType), ((GameEntity)this).GameRun.EnemyBattleRng);
yield return (BattleAction)new SpawnEnemyAction(enemyByRootIndex, type, 1, 0f, 0.3f, false);
EnemyFormation ef = Singleton<GameDirector>.Instance.Formations[GameDirector.ActiveFormation];
int i = 0;
while (i < ef.enemyLocations.Count)
{
EnemyUnit enemy = ((JadeBox)this).Battle.GetEnemyByRootIndex(i);
if (enemy != null)
{
yield return (BattleAction)(object)new ApplyStatusEffectAction<StrengthSuppressionSe>((Unit)(object)enemy, (int?)null, (int?)null, (int?)null, (int?)null, 0f, true);
IEnemyUnitView view = enemy.View;
IEnemyUnitView obj = ((view is UnitView) ? view : null);
if (obj != null)
{
TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOMove(((Component)obj).transform, ((Component)ef.enemyLocations[i]).transform.position, 0.8f, false), (Ease)6);
}
}
int num = i + 1;
i = num;
}
}
}
public sealed class StrengthSuppressionDef : StatusEffectTemplate
{
public override IdContainer GetId()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("StrengthSuppressionSe");
}
public override StatusEffectConfig MakeConfig()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
return new StatusEffectConfig(0, "", 8, (StatusEffectType)2, false, false, (int?)null, false, (StackType?)(StackType)0, false, (StackType?)(StackType)0, (DurationDecreaseTiming)0, false, (StackType?)(StackType)3, (StackType?)(StackType)3, false, (Keyword)0, (IReadOnlyList<string>)new List<string>(), (string)null, "DebuffBlack", "DebuffBlack", "Debuff");
}
public override LocalizationOption LoadLocalization()
{
return (LocalizationOption)(object)BepinexPlugin.seLoc.AddEntity((EntityDefinition)(object)this);
}
public override Sprite LoadSprite()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return ResourceLoader.LoadSprite(IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + ".png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 1, (Vector2?)null);
}
}
[EntityLogic(typeof(StrengthSuppressionDef))]
public sealed class StrengthSuppressionSe : StatusEffect
{
protected override void OnAdded(Unit unit)
{
((StatusEffect)this).ShowCount = false;
((StatusEffect)this).HandleOwnerEvent<DamageDealingEventArgs>(unit.DamageDealing, (GameEventHandler<DamageDealingEventArgs>)OnDamageDealing);
((StatusEffect)this).ReactOwnerEvent<DieEventArgs>(((StatusEffect)this).Battle.EnemyDied, (EventSequencedReactor<DieEventArgs>)OnEnemyDied);
}
private void OnDamageDealing(DamageDealingEventArgs args)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
DamageInfo damageInfo = args.DamageInfo;
if ((int)((DamageInfo)(ref damageInfo)).DamageType == 2)
{
((DamageInfo)(ref damageInfo)).Damage = ((DamageInfo)(ref damageInfo)).Amount * 0.5f;
args.DamageInfo = damageInfo;
((GameEventArgs)args).AddModifier((GameEntity)(object)this);
}
}
private IEnumerable<BattleAction> OnEnemyDied(DieEventArgs args)
{
if (!((StatusEffect)this).Battle.BattleShouldEnd && 1 == ((StatusEffect)this).Battle.AllAliveEnemies.Where((EnemyUnit e) => !((Unit)e).HasStatusEffect<Servant>() && DoubleTroubleJadebox.AllBosses.Contains(((object)e).GetType())).Count())
{
yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)this, true, 0f);
}
}
}
public sealed class HighlanderDef : JadeBoxTemplate
{
public override IdContainer GetId()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("HighlanderJadebox");
}
public override JadeBoxConfig MakeConfig()
{
return ((JadeBoxTemplate)this).DefaultConfig();
}
public override LocalizationOption LoadLocalization()
{
return (LocalizationOption)(object)BepinexPlugin.jadeboxLoc.AddEntity((EntityDefinition)(object)this);
}
}
[EntityLogic(typeof(HighlanderDef))]
public sealed class HighlanderJadebox : JadeBox
{
[HarmonyPatch(typeof(GameRunController))]
private class GameRunController_Patches
{
[HarmonyPatch("RollCards", new Type[]
{
typeof(RandomGen),
typeof(CardWeightTable),
typeof(int),
typeof(ManaGroup?),
typeof(bool),
typeof(bool),
typeof(bool),
typeof(bool),
typeof(Predicate<CardConfig>)
})]
[HarmonyPrefix]
private static void ExcludeLibraryCardsFromNonBattleRolls(ref bool battleRolling, ref Predicate<CardConfig> filter, GameRunController __instance)
{
if (IsHighlander(__instance) && !battleRolling)
{
Predicate<CardConfig> predCopy = filter;
filter = (CardConfig cfg) => AlsoAbsentFromLibrary(__instance, predCopy, cfg);
}
}
}
public static bool IsHighlander(GameRunController run)
{
if (run == null)
{
return false;
}
return run.HasJadeBox<HighlanderJadebox>();
}
public static bool AlsoAbsentFromLibrary(GameRunController run, Predicate<CardConfig> prevPred, CardConfig cardCfg)
{
if (prevPred == null || prevPred(cardCfg))
{
return !run.BaseDeck.Any((Card card) => card.Config.Id == cardCfg.Id);
}
return false;
}
}
public sealed class MillennialRevelationDef : JadeBoxTemplate
{
public override IdContainer GetId()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("MillennialRevelationJadebox");
}
public override JadeBoxConfig MakeConfig()
{
return ((JadeBoxTemplate)this).DefaultConfig();
}
public override LocalizationOption LoadLocalization()
{
return (LocalizationOption)(object)BepinexPlugin.jadeboxLoc.AddEntity((EntityDefinition)(object)this);
}
}
[EntityLogic(typeof(MillennialRevelationDef))]
public sealed class MillennialRevelationJadebox : JadeBox
{
private bool DrawStep;
protected override void OnEnterBattle()
{
((JadeBox)this).HandleBattleEvent<UnitEventArgs>(((Unit)((JadeBox)this).Battle.Player).TurnStarting, (GameEventHandler<UnitEventArgs>)OnPreTurnStart);
((JadeBox)this).HandleBattleEvent<UnitEventArgs>(((Unit)((JadeBox)this).Battle.Player).TurnStarted, (GameEventHandler<UnitEventArgs>)OnPostTurnStart);
((JadeBox)this).HandleBattleEvent<CardEventArgs>(((JadeBox)this).Battle.Predraw, (GameEventHandler<CardEventArgs>)OnPredraw);
}
private void OnPreTurnStart(UnitEventArgs args)
{
DrawStep = true;
((JadeBox)this).Battle.DrawCardCount = ((JadeBox)this).Battle.MaxHand - ((JadeBox)this).Battle.HandZone.Count;
}
private void OnPostTurnStart(UnitEventArgs args)
{
DrawStep = false;
}
private void OnPredraw(CardEventArgs args)
{
if (!DrawStep)
{
((JadeBox)this).NotifyActivating();
((GameEventArgs)args).CancelBy((GameEntity)(object)this);
}
}
}
public sealed class NightOfNightmaresDef : JadeBoxTemplate
{
public override IdContainer GetId()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("NightOfNightmaresJadebox");
}
public override JadeBoxConfig MakeConfig()
{
return ((JadeBoxTemplate)this).DefaultConfig();
}
public override LocalizationOption LoadLocalization()
{
return (LocalizationOption)(object)BepinexPlugin.jadeboxLoc.AddEntity((EntityDefinition)(object)this);
}
}
[EntityLogic(typeof(NightOfNightmaresDef))]
public sealed class NightOfNightmaresJadebox : JadeBox
{
[HarmonyPatch(typeof(ManaFreezer))]
private class ManaFreezer_Patches
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPostfix]
private static void GetFreezeLevel(ManaFreezer __instance, ref int __result)
{
if (IsNightOfNightmares(((GameEntity)__instance).GameRun))
{
if (__instance is NightMana1)
{
__result = 1;
}
else if (__instance is NightMana2)
{
__result = 2;
}
else if (__instance is NightMana3 || __instance is NightMana4)
{
__result = 3;
}
}
}
}
[HarmonyPatch(typeof(BattleController))]
private class BattleController_Patches
{
[HarmonyPatch("AddCardToHand", new Type[]
{
typeof(Card),
typeof(bool)
})]
[HarmonyPostfix]
private static void AdjustLongNightAddedToHand(BattleController __instance, Card card)
{
AdjustLongNight(__instance, card);
}
[HarmonyPatch("AddCardToDrawZone", new Type[]
{
typeof(Card),
typeof(DrawZoneTarget)
})]
[HarmonyPostfix]
private static void AdjustLongNightAddedToDrawPile(BattleController __instance, Card card)
{
AdjustLongNight(__instance, card);
}
[HarmonyPatch("AddCardToDiscard", new Type[] { typeof(Card) })]
[HarmonyPostfix]
private static void AdjustLongNightAddedToDiscard(BattleController __instance, Card card)
{
AdjustLongNight(__instance, card);
}
[HarmonyPatch("AddCardToDiscard", new Type[] { typeof(Card) })]
[HarmonyPostfix]
private static void AdjustLongNightAddedToExile(BattleController __instance, Card card)
{
AdjustLongNight(__instance, card);
}
[HarmonyPatch("AddCardToFollowArea", new Type[] { typeof(Card) })]
[HarmonyPostfix]
private static void AdjustLongNightAddedToFollowArea(BattleController __instance, Card card)
{
AdjustLongNight(__instance, card);
}
}
[HarmonyPatch(typeof(StartGamePanel))]
private class StartGamePanel_Patches
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void EnsureLongNightIsOn(StartGamePanel __instance)
{
try
{
JadeBoxToggle jt = __instance._jadeBoxToggles.FirstOrDefault((KeyValuePair<JadeBox, JadeBoxToggle> t) => t.Value.JadeBox is NightOfNightmaresJadebox).Value;
JadeBoxToggle obj = jt;
if (obj == null)
{
return;
}
((UnityEvent<bool>)(object)obj.Toggle.onValueChanged).AddListener((UnityAction<bool>)delegate
{
if (jt.IsOn && (!__instance._puzzleToggles.TryGetValue((PuzzleFlag)64, out var value) || !value.Toggle.isOn))
{
jt.Toggle.isOn = false;
}
});
}
catch (Exception arg)
{
BepinexPlugin.log.LogError((object)$"Error while checking jadebox toggle and puzzle flags compat\n{arg}");
}
}
}
public static bool IsNightOfNightmares(GameRunController run)
{
if (run == null)
{
return false;
}
return run.HasJadeBox<NightOfNightmaresJadebox>();
}
public static void AdjustLongNight(BattleController battle, Card card)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
if (!IsNightOfNightmares(battle.GameRun))
{
return;
}
ManaFreezer val = (ManaFreezer)(object)((card is ManaFreezer) ? card : null);
if (val != null)
{
CardConfig val2 = ObjectExtensions.Copy<CardConfig>(((Card)val).Config);
if (val is NightMana1)
{
val2.Mana = ManaGroup.Anys(1);
}
else if (val is NightMana2)
{
val2.Mana = ManaGroup.Anys(2);
}
else if (val is NightMana3 || val is NightMana4)
{
val2.Mana = ManaGroup.Anys(3);
}
val.FreezeTimes = 1;
((Card)val).Config = val2;
}
}
}
public sealed class RainbowCardsDef : JadeBoxTemplate
{
public const int ExtraCards = 1;
public override IdContainer GetId()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("RainbowCardsJadebox");
}
public override JadeBoxConfig MakeConfig()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
JadeBoxConfig obj = ((JadeBoxTemplate)this).DefaultConfig();
obj.Value1 = 1;
obj.Group = new List<string> { "TwoColorStart" };
obj.Mana = ManaGroup.Single((ManaColor)7);
return obj;
}
public override LocalizationOption LoadLocalization()
{
return (LocalizationOption)(object)BepinexPlugin.jadeboxLoc.AddEntity((EntityDefinition)(object)this);
}
}
[EntityLogic(typeof(RainbowCardsDef))]
public sealed class RainbowCardsJadebox : JadeBox
{
[HarmonyPatch(typeof(GameRunController))]
private class GameRunController_Patches
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPostfix]
private static void ApplyBlankCardEffect(GameRunController __instance, GameRunStartupParameters startupParameters)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_0038: 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_004f: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_0075: Unknown result type (might be due to invalid IL or missing references)
if (__instance.HasJadeBox<RainbowCardsJadebox>())
{
initialExhibit = startupParameters.InitExhibit;
if (startupParameters.Player.Config.InitialMana + BaseManaGroup.op_Implicit(initialExhibit.BaseMana) == __instance.BaseMana)
{
BaseManaGroup baseMana = initialExhibit.BaseMana;
ManaGroup value = ((BaseManaGroup)(ref baseMana)).Value;
__instance.GainBaseMana(ManaGroup.Philosophies(((ManaGroup)(ref value)).Amount), false);
__instance.LoseBaseMana(BaseManaGroup.op_Implicit(initialExhibit.BaseMana), false);
}
}
}
}
[HarmonyPatch(typeof(Debut))]
private class Debut_Patches
{
[HarmonyPatch("InitVariables", new Type[] { typeof(IVariableStorage) })]
[HarmonyPostfix]
private static void DisableExhibitSwap(Debut __instance, IVariableStorage storage)
{
if (((Adventure)__instance).GameRun.HasJadeBox<RainbowCardsJadebox>())
{
storage.SetValue("$twoColorStart", true);
}
}
}
private static Exhibit initialExhibit;
protected override void OnAdded()
{
GameRunController gameRun = ((GameEntity)this).GameRun;
gameRun.RewardAndShopCardColorLimitFlag += 1;
GameRunController gameRun2 = ((GameEntity)this).GameRun;
gameRun2.AdditionalRewardCardCount += 1;
}
}
public sealed class RustyBatteryDef : JadeBoxTemplate
{
public override IdContainer GetId()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("RustyBatteryJadebox");
}
public override JadeBoxConfig MakeConfig()
{
return ((JadeBoxTemplate)this).DefaultConfig();
}
public override LocalizationOption LoadLocalization()
{
return (LocalizationOption)(object)BepinexPlugin.jadeboxLoc.AddEntity((EntityDefinition)(object)this);
}
}
[EntityLogic(typeof(RustyBatteryDef))]
public sealed class RustyBatteryJadebox : JadeBox
{
[HarmonyPatch]
private class UltimateSkill_Patches
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPostfix]
private static void GetLevel(UltimateSkill __instance, ref int __result)
{
if (IsRustyBattery(((GameEntity)__instance).GameRun))
{
__result = Math.Max(__result - 1, 1);
}
}
[HarmonyPatch(typeof(JuanzengZhengming), "OnAdded")]
[HarmonyPrefix]
private static bool SetLevelFix(JuanzengZhengming __instance, PlayerUnit player)
{
if (IsRustyBattery(((GameEntity)player).GameRun))
{
UltimateSkill us = player.Us;
us.MaxPowerLevel += ((Exhibit)__instance).Value1 + 1;
player.Us.UsRepeatableType = (UsRepeatableType)0;
return false;
}
return true;
}
}
public static bool IsRustyBattery(GameRunController run)
{
if (run == null)
{
return false;
}
return run.HasJadeBox<RustyBatteryJadebox>();
}
}
public sealed class ThunderlordDef : JadeBoxTemplate
{
private const int PlayerBuffMultiplier = 2;
private const int EnemyBuffMultiplier = 1;
private const int BuffCap = 3;
public override IdContainer GetId()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("ThunderlordJadebox");
}
public override JadeBoxConfig MakeConfig()
{
JadeBoxConfig obj = ((JadeBoxTemplate)this).DefaultConfig();
obj.Value1 = 2;
obj.Value2 = 1;
obj.Value3 = 3;
return obj;
}
public override LocalizationOption LoadLocalization()
{
return (LocalizationOption)(object)BepinexPlugin.jadeboxLoc.AddEntity((EntityDefinition)(object)this);
}
}
[EntityLogic(typeof(ThunderlordDef))]
public sealed class ThunderlordJadebox : JadeBox
{
protected override void OnEnterBattle()
{
((JadeBox)this).ReactBattleEvent<GameEventArgs>(((JadeBox)this).Battle.BattleStarting, (EventSequencedReactor<GameEventArgs>)OnBattleStarting);
((JadeBox)this).ReactBattleEvent<UnitEventArgs>(((JadeBox)this).Battle.EnemySpawned, (EventSequencedReactor<UnitEventArgs>)OnEnemySpawned);
}
private int GetBuffLevel(int actNum)
{
return Math.Min(actNum, ((JadeBox)this).Value3);
}
private IEnumerable<BattleAction> OnBattleStarting(GameEventArgs args)
{
((JadeBox)this).NotifyActivating();
int actNum = ((GameEntity)this).GameRun._stageIndex + 1;
yield return (BattleAction)(object)new ApplyStatusEffectAction<Electric>((Unit)(object)((JadeBox)this).Battle.Player, (int?)(((JadeBox)this).Value1 * GetBuffLevel(actNum)), (int?)null, (int?)null, (int?)null, 0f, true);
foreach (EnemyUnit allAliveEnemy in ((JadeBox)this).Battle.AllAliveEnemies)
{
yield return (BattleAction)(object)new ApplyStatusEffectAction<Electric>((Unit)(object)allAliveEnemy, (int?)(((JadeBox)this).Value2 * GetBuffLevel(actNum)), (int?)null, (int?)null, (int?)null, 0f, true);
}
}
private IEnumerable<BattleAction> OnEnemySpawned(UnitEventArgs args)
{
((JadeBox)this).NotifyActivating();
int actNum = ((GameEntity)this).GameRun._stageIndex + 1;
yield return (BattleAction)(object)new ApplyStatusEffectAction<Electric>(args.Unit, (int?)(((JadeBox)this).Value2 * GetBuffLevel(actNum)), (int?)null, (int?)null, (int?)null, 0f, true);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}