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 BepInEx;
using BepInEx.Logging;
using Conductor;
using Conductor.Extensions;
using Conductor.Interfaces;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using ShinyShoe;
using SimpleInjector;
using TrainworksReloaded.Base;
using TrainworksReloaded.Base.Extensions;
using TrainworksReloaded.Core;
using TrainworksReloaded.Core.Extensions;
using TrainworksReloaded.Core.Interfaces;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("mt2_sandscourged.Plugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.5.1.0")]
[assembly: AssemblyInformationalVersion("0.5.1+f5097e2e07206389f4e2d466afa9a3aa7e971d08")]
[assembly: AssemblyProduct("mt2_sandscourged.Plugin")]
[assembly: AssemblyTitle("mt2_sandscourged.Plugin")]
[assembly: AssemblyVersion("0.5.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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;
}
}
}
[SearchWindowPath("Card Upgrade")]
public sealed class CardEffectAddTempUpgradeToCurrentCard : CardEffectBase
{
[CompilerGenerated]
private sealed class <ApplyEffect>d__5 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CardEffectParams cardEffectParams;
public ICoreGameManagers coreGameManagers;
public CardEffectState cardEffectState;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ApplyEffect>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
if (<>1__state != 0)
{
return false;
}
<>1__state = -1;
CardState playedCard = cardEffectParams.playedCard;
if (playedCard == null)
{
return false;
}
CardManager cardManager = coreGameManagers.GetCardManager();
CardUpgradeState val = default(CardUpgradeState);
if (CardUpgradeHelper.TryApplyUpgradeToCard(playedCard, playedCard, cardEffectState.GetParamCardUpgradeData(), true, cardEffectParams.isFromHiddenTrigger, coreGameManagers, ref val))
{
playedCard.UpdateCardBodyText((SaveManager)null);
cardManager.RefreshCardInHand(playedCard, false, false, false);
CardUI cardInHand = cardManager.GetCardInHand(playedCard);
if ((Object)(object)cardInHand != (Object)null && (Object)(object)cardInHand != (Object)null)
{
cardInHand.ShowEnhanceFX();
}
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public override bool CanPlayAfterBossDead => false;
public override bool CanApplyInPreviewMode => false;
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0025: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
PropDescriptions val = new PropDescriptions { };
string fieldName;
((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Card Upgrade", "", (Type)null, false);
return val;
}
[IteratorStateMachine(typeof(<ApplyEffect>d__5))]
public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ApplyEffect>d__5(0)
{
cardEffectState = cardEffectState,
cardEffectParams = cardEffectParams,
coreGameManagers = coreGameManagers
};
}
public override void GetTooltipsStatusList(CardEffectState cardEffectState, ref List<string> outStatusIdList)
{
CardEffectAddUpgradeToCurrentCard.GetTooltipsStatusList(cardEffectState.GetSourceCardEffectData(), ref outStatusIdList);
}
public static void GetTooltipsStatusList(CardEffectData cardEffectData, ref List<string> outStatusIdList)
{
foreach (StatusEffectStackData statusEffectUpgrade in cardEffectData.GetParamCardUpgradeData().GetStatusEffectUpgrades())
{
outStatusIdList.Add(statusEffectUpgrade.statusId);
}
}
}
[SearchWindowPath("Cards")]
public sealed class CardEffectDrawTypeWithDiscardFix : CardEffectBase, ICardTargetingCardEffect
{
[CompilerGenerated]
private sealed class <ApplyEffect>d__5 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ICoreGameManagers coreGameManagers;
public CardEffectDrawTypeWithDiscardFix <>4__this;
public CardEffectState cardEffectState;
public CardEffectParams cardEffectParams;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ApplyEffect>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
CardEffectDrawTypeWithDiscardFix cardEffectDrawTypeWithDiscardFix = <>4__this;
if (num != 0)
{
return false;
}
<>1__state = -1;
CardManager cardManager = coreGameManagers.GetCardManager();
RelicManager relicManager = coreGameManagers.GetRelicManager();
cardEffectDrawTypeWithDiscardFix.toProcessCards.Clear();
List<CardState> discardPile = cardManager.GetDiscardPile(true);
ListExtensions.Shuffle<CardState>((IList<CardState>)discardPile, (RngId)5);
cardEffectDrawTypeWithDiscardFix.toProcessCards.AddRange(discardPile);
cardEffectDrawTypeWithDiscardFix.toProcessCards.AddRange(cardManager.GetDrawPile(false));
int num2 = 0;
int intInRange = cardEffectState.GetIntInRange();
CardUpgradeMaskData paramCardFilter = cardEffectState.GetParamCardFilter();
CardUpgradeMaskData paramCardFilterSecondary = cardEffectState.GetParamCardFilterSecondary();
for (int num3 = cardEffectDrawTypeWithDiscardFix.toProcessCards.Count - 1; num3 >= 0 && num2 < intInRange; num3--)
{
CardState val = cardEffectDrawTypeWithDiscardFix.toProcessCards[num3];
if (val == cardEffectParams.playedCard)
{
continue;
}
if ((Object)(object)paramCardFilter != (Object)null)
{
if (!paramCardFilter.FilterCard<CardState>(val, relicManager))
{
continue;
}
}
else if (val.GetCardType() != cardEffectState.GetTargetCardType())
{
continue;
}
cardManager.DrawSpecificCard(val, false, (DrawSource)0, cardEffectState.GetParentCardState(), 1, 1);
num2++;
}
if (num2 == 0 && (Object)(object)paramCardFilter != (Object)null && (Object)(object)paramCardFilterSecondary != (Object)null)
{
int num4 = cardEffectDrawTypeWithDiscardFix.toProcessCards.Count - 1;
while (num4 >= 0 && num2 < intInRange)
{
CardState val2 = cardEffectDrawTypeWithDiscardFix.toProcessCards[num4];
if (val2 != cardEffectParams.playedCard && paramCardFilterSecondary.FilterCard<CardState>(val2, relicManager))
{
cardManager.DrawSpecificCard(val2, false, (DrawSource)0, cardEffectState.GetParentCardState(), 1, 1);
num2++;
}
num4--;
}
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private readonly List<CardState> toProcessCards = new List<CardState>();
public override bool CanPlayAfterBossDead => false;
public override bool CanApplyInPreviewMode => false;
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0024: Expected O, but got Unknown
//IL_002c: 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_0044: Expected O, but got Unknown
//IL_0044: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
//IL_0064: Expected O, but got Unknown
//IL_0065: Expected O, but got Unknown
PropDescriptions val = new PropDescriptions { };
string fieldName;
((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Num Cards", "", (Type)null, false);
string fieldName2 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)16);
((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Card Filter", "Optional. If one is defined it will supercede other card type checking", (Type)null, false);
string fieldName3 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)17);
((Dictionary<string, PropDescription>)val)[fieldName3] = new PropDescription("Secondary Card Filter", "Optional. Only used if there is a primary card filter and it failed to find a match", (Type)null, false);
return val;
}
[IteratorStateMachine(typeof(<ApplyEffect>d__5))]
public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ApplyEffect>d__5(0)
{
<>4__this = this,
cardEffectState = cardEffectState,
cardEffectParams = cardEffectParams,
coreGameManagers = coreGameManagers
};
}
public int GetNumCardTargets(CardState cardState, CardEffectState cardEffectState, CardStatistics cardStatistics)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
StatValueData val = default(StatValueData);
val.cardState = cardState;
val.trackedValue = (TrackedValueType)19;
val.entryDuration = (EntryDuration)2;
val.cardTypeTarget = cardStatistics.ConvertCardTypeToCardTargetType(cardEffectState.GetTargetCardType());
StatValueData val2 = val;
int statValue = cardStatistics.GetStatValue(val2);
val2.trackedValue = (TrackedValueType)16;
int statValue2 = cardStatistics.GetStatValue(val2);
return statValue + statValue2;
}
}
public sealed class RoomStateAddStatusEffectOnAnyStatusApplied : RoomStateModifierBase, IRoomStateOnStatusEffectAppliedModifier, IRoomStateModifier, ILocalizationParamInt, ILocalizationParameterContext, IRoomStateOnCharacterTriggerModifier
{
[CompilerGenerated]
private sealed class <ApplyCharacterTriggerModification>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Trigger trigger;
public FireTriggersData fireTriggersData;
public RoomStateAddStatusEffectOnAnyStatusApplied <>4__this;
public CharacterState affectedCharacter;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ApplyCharacterTriggerModification>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Invalid comparison between Unknown and I4
int num = <>1__state;
RoomStateAddStatusEffectOnAnyStatusApplied roomStateAddStatusEffectOnAnyStatusApplied = <>4__this;
if (num != 0)
{
return false;
}
<>1__state = -1;
if ((int)trigger != 57)
{
return false;
}
if (fireTriggersData == null)
{
return false;
}
if (fireTriggersData.paramInt2 != roomStateAddStatusEffectOnAnyStatusApplied.thisInstTrackingId)
{
return false;
}
roomStateAddStatusEffectOnAnyStatusApplied.addStatusEffectParams.fromRoomModifier = true;
affectedCharacter.AddStatusEffect(fireTriggersData.paramString, fireTriggersData.paramInt, roomStateAddStatusEffectOnAnyStatusApplied.addStatusEffectParams, (CharacterState)null, true, false, true, false);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static int trackingIdCounter;
private int thisInstTrackingId;
private bool buffsAllowed;
private bool debuffsAllowed;
private bool persistentAllowed;
private bool abilitiesAllowed;
private readonly List<Type> teamsAllowed = new List<Type>();
private readonly List<StatusEffectStackData>? statusEffects = new List<StatusEffectStackData>();
private readonly AddStatusEffectParams? addStatusEffectParams = new AddStatusEffectParams();
public override void Initialize(RoomModifierData roomModifierData, ICoreGameManagers coreGameManagers)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
((RoomStateModifierBase)this).Initialize(roomModifierData, coreGameManagers);
thisInstTrackingId = ++trackingIdCounter;
StatusEffectStackData[] paramStatusEffects = roomModifierData.GetParamStatusEffects();
foreach (StatusEffectStackData val in paramStatusEffects)
{
StatusEffectStackData item = new StatusEffectStackData
{
statusId = val.statusId,
count = val.count
};
statusEffects?.Add(item);
}
int paramInt = roomModifierData.GetParamInt();
buffsAllowed = (paramInt & 1) > 0;
debuffsAllowed = (paramInt & 2) > 0;
persistentAllowed = (paramInt & 4) > 0;
abilitiesAllowed = (paramInt & 8) > 0;
int paramInt2 = roomModifierData.GetParamInt2();
if ((paramInt2 & 1) > 0)
{
teamsAllowed.Add((Type)2);
}
if ((paramInt2 & 2) > 0)
{
teamsAllowed.Add((Type)1);
}
}
public void OnStatusEffectAppliedModification(CharacterState affectedCharacter, string statusId, AddStatusEffectParams addStatusEffectParams, ICoreGameManagers coreGameManagers)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Expected O, but got Unknown
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
if (addStatusEffectParams.spawnEffect || addStatusEffectParams.fromRoomModifier || !teamsAllowed.Contains(affectedCharacter.GetTeamType()))
{
return;
}
StatusEffectData statusEffectDataById = StatusEffectManager.Instance.GetStatusEffectDataById(statusId, true);
DisplayCategory? val = ((statusEffectDataById != null) ? new DisplayCategory?(statusEffectDataById.GetDisplayCategory()) : null);
if (val.HasValue && ((val == (DisplayCategory?)0 && !buffsAllowed) || (val == (DisplayCategory?)1 && !debuffsAllowed) || (val == (DisplayCategory?)2 && !persistentAllowed) || (val == (DisplayCategory?)3 && !abilitiesAllowed)))
{
return;
}
CombatManager combatManager = coreGameManagers.GetCombatManager();
using List<StatusEffectStackData>.Enumerator enumerator = statusEffects.GetEnumerator();
while (enumerator.MoveNext())
{
combatManager.QueueTrigger(affectedCharacter, (Trigger)57, (CharacterState)null, true, true, new FireTriggersData
{
paramString = enumerator.Current.statusId,
paramInt = enumerator.Current.count,
paramInt2 = thisInstTrackingId
}, 1, (CharacterTriggerState)null);
}
}
[IteratorStateMachine(typeof(<ApplyCharacterTriggerModification>d__2))]
public IEnumerator ApplyCharacterTriggerModification(Trigger trigger, CharacterState affectedCharacter, FireTriggersData? fireTriggersData, ICoreGameManagers coreGameManagers)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ApplyCharacterTriggerModification>d__2(0)
{
<>4__this = this,
trigger = trigger,
affectedCharacter = affectedCharacter,
fireTriggersData = fireTriggersData
};
}
}
public sealed class RoomStateAttackPerDebuffOnTeam : RoomStateModifierBase, IRoomStateDamageModifier, IRoomStateModifier, ILocalizationParamInt, ILocalizationParameterContext
{
private int additionalDamagePerStack;
private readonly List<Type> teamsAllowed = new List<Type>();
public override void Initialize(RoomModifierData roomModifierData, ICoreGameManagers coreGameManagers)
{
((RoomStateModifierBase)this).Initialize(roomModifierData, coreGameManagers);
additionalDamagePerStack = roomModifierData.GetParamInt();
int paramInt = roomModifierData.GetParamInt2();
if ((paramInt & 1) > 0)
{
teamsAllowed.Add((Type)2);
}
if ((paramInt & 2) > 0)
{
teamsAllowed.Add((Type)1);
}
}
public int GetModifiedMagicPowerDamage(ICoreGameManagers coreGameManagers)
{
return 0;
}
public int GetModifiedAttackDamage(Type damageType, CharacterState attackerState, bool requestingForCharacterStats, ICoreGameManagers coreGameManagers)
{
if (requestingForCharacterStats)
{
return ((RoomStateModifierBase)this).GetDynamicInt(attackerState);
}
return 0;
}
public override int GetDynamicInt(CharacterState characterContext)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
if (characterContext.GetRoomStateModifiers().Contains((IRoomStateModifier)(object)this) && characterContext.GetSpawnPoint(false) != null && (Object)(object)characterContext.GetCurrentRoom(false) != (Object)null)
{
RoomState currentRoom = characterContext.GetCurrentRoom(false);
List<string> list = new List<string>();
List<CharacterState> list2 = default(List<CharacterState>);
UsingGenericPoolObject<List<CharacterState>> list3 = GenericPools.GetList<CharacterState>(ref list2);
try
{
foreach (Type item in teamsAllowed)
{
currentRoom.AddCharactersToList(list2, item, false, true);
}
List<StatusEffectStack> source = default(List<StatusEffectStack>);
foreach (CharacterState item2 in list2)
{
UsingGenericPoolObject<List<StatusEffectStack>> list4 = GenericPools.GetList<StatusEffectStack>(ref source);
try
{
item2.GetStatusEffects(ref source, false);
list.AddRange(from status in source
where (int)status.State.GetDisplayCategory() == 1
select status into debuff
select debuff.State.GetStatusId());
}
finally
{
((IDisposable)list4).Dispose();
}
}
}
finally
{
((IDisposable)list3).Dispose();
}
return list.Distinct().Count() * additionalDamagePerStack;
}
return 0;
}
}
namespace mt2_sandscourged.Plugin
{
[HarmonyPatch(typeof(CombatManager), "ShowKillCam")]
internal class AddUpgradeToDeadUnitsPatch
{
public static void Prefix(CombatManager __instance, CardManager ___cardManager)
{
if (CardEffectAddUpgradeToDeadUnits.consumedCards == null)
{
CardEffectAddUpgradeToDeadUnits.consumedCards = ___cardManager.GetExhaustedPile(true);
}
}
}
[HarmonyPatch(typeof(CombatManager), "StartCombat")]
internal class ClearListOnStartOfBattlePatch
{
public static void Postfix(CombatManager __instance)
{
CardEffectAddUpgradeToDeadUnits.consumedCards = null;
}
}
[SearchWindowPath("Card Upgrade")]
public sealed class CardEffectAddUpgradeToDeadUnits : CardEffectBase
{
[CompilerGenerated]
private sealed class <ApplyEffect>d__6 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CardEffectState cardEffectState;
public CardEffectParams cardEffectParams;
public ICoreGameManagers coreGameManagers;
public CardEffectAddUpgradeToDeadUnits <>4__this;
public ISystemManagers sysManagers;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ApplyEffect>d__6(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
CardEffectAddUpgradeToDeadUnits cardEffectAddUpgradeToDeadUnits = <>4__this;
if (num != 0)
{
return false;
}
<>1__state = -1;
if (IEnumerableUtility.IsNullOrEmpty<CardState>(consumedCards))
{
Console.Write("No consumed cards found, skipping upgrade application.");
return false;
}
IEnumerable<CardState> enumerable = consumedCards.Where((CardState c) => c.IsSpawnerCard());
Console.Write(enumerable.Count() + " dead units found for upgrade application.");
bool flag = false;
bool flag2 = cardEffectState.GetParamInt() != 2;
int num2 = 1;
if (cardEffectState.GetUseStatusEffectStackMultiplier())
{
if ((Object)(object)cardEffectParams.selfTarget == (Object)null)
{
return false;
}
string text = cardEffectState.GetParamStatusEffectStackData().FirstOrDefault()?.statusId;
if (text == null)
{
return false;
}
num2 = cardEffectParams.selfTarget.GetStatusEffectStacks(text);
}
CardUpgradeState val = default(CardUpgradeState);
foreach (CardState item in enumerable)
{
for (int i = 0; i < num2; i++)
{
Console.Write(item.GetDebugName() + " is attempting upgrade.");
if (CardUpgradeHelper.TryApplyUpgradeToCard(item, (CardState)null, cardEffectState.GetParamCardUpgradeData(), flag2, cardEffectParams.isFromHiddenTrigger, coreGameManagers, ref val))
{
Console.Write(item.GetDebugName() + $" {i}: Success!");
item.UpdateCardBodyText((SaveManager)null);
flag = true;
}
}
}
if (flag)
{
((CardEffectBase)cardEffectAddUpgradeToDeadUnits).ShowPyreNotification(cardEffectState, coreGameManagers.GetSaveManager(), (PopupNotificationManagerBase)(object)sysManagers.GetPopupNotificationManager(), (CharacterUI)null);
}
consumedCards = null;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static List<CardState>? consumedCards;
public override bool CanPlayAfterBossDead => true;
public override bool CanApplyInPreviewMode => false;
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0025: Expected O, but got Unknown
//IL_002c: 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_004d: Expected O, but got Unknown
//IL_004d: Expected O, but got Unknown
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0076: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
//IL_0096: Expected O, but got Unknown
//IL_0097: Expected O, but got Unknown
PropDescriptions val = new PropDescriptions { };
string fieldName;
((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Card Upgrade", "", (Type)null, false);
string fieldName2 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)0);
((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Upgrade Lifetime", CardUpgradeHelper.UpgradeLifetimeEditorTooltip, typeof(UnitUpgradeLifetime), false);
string fieldName3 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)25);
((Dictionary<string, PropDescription>)val)[fieldName3] = new PropDescription("Use Status Effect Stack Multiplier", "", typeof(bool), false);
string fieldName4 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)18);
((Dictionary<string, PropDescription>)val)[fieldName4] = new PropDescription("Status Effects to multiply by", "", (Type)null, false);
return val;
}
[IteratorStateMachine(typeof(<ApplyEffect>d__6))]
public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ApplyEffect>d__6(0)
{
<>4__this = this,
cardEffectState = cardEffectState,
cardEffectParams = cardEffectParams,
coreGameManagers = coreGameManagers,
sysManagers = sysManagers
};
}
public override void GetTooltipsStatusList(CardEffectState cardEffectState, ref List<string> outStatusIdList)
{
CardEffectAddTempCardUpgradeToCardsInHand.GetTooltipsStatusList(cardEffectState.GetSourceCardEffectData(), ref outStatusIdList);
}
public static void GetTooltipsStatusList(CardEffectData cardEffectData, ref List<string> outStatusIdList)
{
foreach (StatusEffectStackData statusEffectUpgrade in cardEffectData.GetParamCardUpgradeData().GetStatusEffectUpgrades())
{
outStatusIdList.Add(statusEffectUpgrade.statusId);
}
}
public override void CreateAdditionalTooltips(CardEffectState cardEffectState, TooltipContainer tooltipContainer, SaveManager saveManager)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
CardUpgradeState val = new CardUpgradeState();
val.Setup(cardEffectState.GetParamCardUpgradeData(), false, false);
tooltipContainer.AddTooltipsCardUpgrade(CardState.None, val, saveManager);
tooltipContainer.AddTooltipsUpgradedCardTraits(val);
}
}
public sealed class CardEffectPurgeCardFromHand : CardEffectBase
{
[CompilerGenerated]
private sealed class <ApplyEffect>d__8 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ICoreGameManagers coreGameManagers;
public CardEffectPurgeCardFromHand <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ApplyEffect>d__8(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//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_003d: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
int num = <>1__state;
CardEffectPurgeCardFromHand cardEffectPurgeCardFromHand = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = coreGameManagers.GetCardManager().SelectCardFromHand(new Params
{
descriptionKey = "PurgeCardFromHandKey",
overrideActionKey = "PurgeCardFromHandActionKey",
cardChosenCallback = new CardStateChosenDelegate(cardEffectPurgeCardFromHand.HandleChooseCard),
filterCallback = new FilterCardStateDelegate(cardEffectPurgeCardFromHand.CardFilterFunc),
instantApplyDelay = coreGameManagers.GetAllGameData().GetBalanceData().GetAnimationTimingData()
.cardDrawAnimationDuration,
disableIneligibleCards = true,
selectionHandState = (CardUIState)9
}, true);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <HandleChooseCard>d__9 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CardManager cardManager;
public CardState chosenCard;
public CardEffectPurgeCardFromHand <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HandleChooseCard>d__9(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
int num = <>1__state;
CardEffectPurgeCardFromHand cardEffectPurgeCardFromHand = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = cardManager.PurgeCardFromHand(new DiscardCardParams
{
overrideDiscardEffect = (DiscardEffect)3,
discardCard = chosenCard,
triggeredByCard = true,
triggeredCard = cardEffectPurgeCardFromHand.sourceCardState,
wasPlayed = false
}, false);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
cardManager.RefreshHandCards(true, false);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private CardState? sourceCardState;
public override bool CanPlayAfterBossDead => false;
public override bool CanApplyInPreviewMode => false;
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0025: Expected O, but got Unknown
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0045: Expected O, but got Unknown
//IL_0046: Expected O, but got Unknown
PropDescriptions val = new PropDescriptions { };
string fieldName;
((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("True = whitelist the subtype. False = blacklist the subtype.", "", (Type)null, false);
string fieldName2 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)9);
((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("All subtypes to restrict by", "", (Type)null, false);
return val;
}
public override void Setup(CardEffectState cardEffectState)
{
((CardEffectBase)this).Setup(cardEffectState);
sourceCardState = cardEffectState.GetParentCardState();
}
public override bool TestEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
List<CardState> hand = coreGameManagers.GetCardManager().GetHand(false);
if (hand.Count == 0)
{
return false;
}
List<CardState> list = default(List<CardState>);
UsingGenericPoolObject<List<CardState>> list2 = GenericPools.GetList<CardState>(ref list);
try
{
foreach (CardState item in hand)
{
if (item != cardEffectParams.playedCard && !CardFilterFunc(item))
{
list.Add(item);
}
}
if (list.Count == 0)
{
return false;
}
return true;
}
finally
{
((IDisposable)list2).Dispose();
}
}
[IteratorStateMachine(typeof(<ApplyEffect>d__8))]
public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ApplyEffect>d__8(0)
{
<>4__this = this,
coreGameManagers = coreGameManagers
};
}
[IteratorStateMachine(typeof(<HandleChooseCard>d__9))]
private IEnumerator HandleChooseCard(CardState chosenCard, CardManager cardManager)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HandleChooseCard>d__9(0)
{
<>4__this = this,
chosenCard = chosenCard,
cardManager = cardManager
};
}
private bool CardFilterFunc(CardState cardState)
{
return cardState.HasTrait<CardTraitUnpurgable>();
}
}
public sealed class CardEffectSubtypeRestricted : CardEffectBase
{
[CompilerGenerated]
private sealed class <ApplyEffect>d__5 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ApplyEffect>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
if (<>1__state != 0)
{
return false;
}
<>1__state = -1;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private SubtypeData? subtypeToRestrict;
private bool isWhitelist;
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0024: Expected O, but got Unknown
//IL_002c: 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_0044: Expected O, but got Unknown
//IL_0044: Expected O, but got Unknown
//IL_0045: Expected O, but got Unknown
PropDescriptions val = new PropDescriptions { };
string fieldName;
((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("True = whitelist the subtype. False = blacklist the subtype.", "", (Type)null, false);
string fieldName2 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)9);
((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("All subtypes to restrict by", "", (Type)null, false);
return val;
}
public override void Setup(CardEffectState cardEffectState)
{
((CardEffectBase)this).Setup(cardEffectState);
subtypeToRestrict = cardEffectState.GetParamSubtype();
isWhitelist = cardEffectState.GetParamBool();
}
public override bool TestEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers)
{
if (subtypeToRestrict == null)
{
return false;
}
bool flag = false;
foreach (CharacterState target in cardEffectParams.targets)
{
if (target.GetHasSubtype(subtypeToRestrict))
{
flag = true;
}
}
return flag == isWhitelist;
}
[IteratorStateMachine(typeof(<ApplyEffect>d__5))]
public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ApplyEffect>d__5(0);
}
}
public sealed class CardTraitScalingAddBattleCardToHandFromPool : CardTraitState
{
[CompilerGenerated]
private sealed class <OnCardPlayed>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CardTraitScalingAddBattleCardToHandFromPool <>4__this;
public ICoreGameManagers coreGameManagers;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <OnCardPlayed>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_0071: Expected O, but got Unknown
int num = <>1__state;
CardTraitScalingAddBattleCardToHandFromPool cardTraitScalingAddBattleCardToHandFromPool = <>4__this;
if (num != 0)
{
return false;
}
<>1__state = -1;
int additionalCards = cardTraitScalingAddBattleCardToHandFromPool.GetAdditionalCards(coreGameManagers.GetCardStatistics());
CardManager cardManager = coreGameManagers.GetCardManager();
int num2 = additionalCards;
int num3 = cardManager.GetMaxHandSize() - cardManager.GetNumCardsInHand();
if (num3 > 0)
{
num2 = Mathf.Min(num2, num3);
}
AddCardUpgradingInfo val = null;
CardUpgradeData cardUpgradeDataParam = ((CardTraitState)cardTraitScalingAddBattleCardToHandFromPool).GetCardUpgradeDataParam();
if ((Object)(object)cardUpgradeDataParam != (Object)null)
{
val = new AddCardUpgradingInfo();
val.upgradeDatas.Add(cardUpgradeDataParam);
val.tempCardUpgrade = true;
val.upgradingCardSource = ((CardTraitState)cardTraitScalingAddBattleCardToHandFromPool).GetCard();
val.ignoreTempUpgrades = false;
val.copyModifiersFromCard = ((CardTraitState)cardTraitScalingAddBattleCardToHandFromPool).GetCard();
}
List<CardData> list = default(List<CardData>);
UsingGenericPoolObject<List<CardData>> list2 = GenericPools.GetList<CardData>(ref list);
try
{
int num4 = 0;
while (true)
{
int num5 = num4;
CardPool? paramCardPool = CardTraitScalingAddBattleCardToHandFromPool.paramCardPool;
if (!(num5 < ((paramCardPool != null) ? new int?(paramCardPool.GetNumCards()) : null)))
{
break;
}
CardData cardAtIndex = CardTraitScalingAddBattleCardToHandFromPool.paramCardPool.GetCardAtIndex(num4);
list.Add(cardAtIndex);
num4++;
}
for (int i = 0; i < num2; i++)
{
int index = RandomManager.Range(0, list.Count, (RngId)6);
CardData val2 = list[index];
cardManager.AddCard(val2, (CardPile)3, i, num2, false, false, false, val, true, 1f);
}
}
finally
{
((IDisposable)list2).Dispose();
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static CardPool? paramCardPool;
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
return new PropDescriptions();
}
[IteratorStateMachine(typeof(<OnCardPlayed>d__2))]
public override IEnumerator OnCardPlayed(CardState thisCard, ICoreGameManagers coreGameManagers)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <OnCardPlayed>d__2(0)
{
<>4__this = this,
coreGameManagers = coreGameManagers
};
}
private int GetAdditionalCards(CardStatistics cardStatistics)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
if (!((CardTraitState)this).GetUseScalingParams())
{
return ((CardTraitState)this).GetParamInt();
}
StatValueData val = default(StatValueData);
val.cardState = ((CardTraitState)this).GetCard();
val.trackedValue = ((CardTraitState)this).GetParamTrackedValue();
val.entryDuration = ((CardTraitState)this).GetParamEntryDuration();
val.cardTypeTarget = ((CardTraitState)this).GetParamCardType();
val.paramSubtype = ((CardTraitState)this).GetParamSubtype();
val.forPreviewText = false;
StatValueData val2 = val;
int statValue = cardStatistics.GetStatValue(val2);
return ((CardTraitState)this).GetParamInt() * statValue;
}
}
public sealed class CardTraitScalingByHandCount : CardTraitState
{
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0024: Expected O, but got Unknown
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
//IL_0043: Expected O, but got Unknown
//IL_0044: Expected O, but got Unknown
PropDescriptions val = new PropDescriptions { };
string fieldName;
((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Multiplier per card in hand", "", (Type)null, false);
string fieldName2 = CardTraitFieldNamesHelper.GetFieldName((CardTraitFieldNames)2);
((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Divider per card in hand", "", (Type)null, false);
return val;
}
public override string GetCardTooltipTitle()
{
AllGameManagers instance = AllGameManagers.Instance;
CombatManager val = ((instance != null) ? instance.GetCombatManager() : null);
AllGameManagers instance2 = AllGameManagers.Instance;
CardManager val2 = ((instance2 != null) ? instance2.GetCardManager() : null);
if ((Object)(object)val != (Object)null && val.GetIsRunningCombat() && (Object)(object)val2 != (Object)null)
{
return string.Format(LocalizationExtensions.Localize("CardTraitScalingByHandCount_TooltipTitleInBattle", (ILocalizationParameterContext)null), val2.GetHand(false).Count);
}
return string.Format(LocalizationExtensions.Localize("CardTraitScalingByHandCount_TooltipTitleOutOfBattle", (ILocalizationParameterContext)null));
}
public override string GetCardTooltipText()
{
AllGameManagers instance = AllGameManagers.Instance;
CombatManager val = ((instance != null) ? instance.GetCombatManager() : null);
AllGameManagers instance2 = AllGameManagers.Instance;
CardManager val2 = ((instance2 != null) ? instance2.GetCardManager() : null);
if ((Object)(object)val != (Object)null && val.GetIsRunningCombat() && (Object)(object)val2 != (Object)null)
{
return string.Format(LocalizationExtensions.Localize("CardTraitScalingByHandCount_TooltipTextInBattle", (ILocalizationParameterContext)null), val2.GetHand(false).Count);
}
return string.Format(LocalizationExtensions.Localize("CardTraitScalingByHandCount_TooltipTextOutOfBattle", (ILocalizationParameterContext)null));
}
public override void OnApplyingCardUpgradeToUnit(CardState thisCard, CharacterState targetUnit, CardUpgradeState upgradeState, ICoreGameManagers coreGameManagers)
{
CardState thisCard2 = thisCard;
((CardTraitState)this).OnApplyingCardUpgradeToUnit(thisCard2, targetUnit, upgradeState, coreGameManagers);
int num = IEnumerableUtility.Count<CardState>(coreGameManagers.GetCardManager().GetHand(false), (Func<CardState, bool>)((CardState c) => c != thisCard2));
upgradeState.SetAttackDamage(((CardTraitState)this).GetParamInt() * num);
upgradeState.SetAdditionalHP(((CardTraitState)this).GetParamInt2() * num);
}
public override int OnApplyingDamage(ApplyingDamageParameters damageParams, ICoreGameManagers coreGameManagers)
{
return coreGameManagers.GetCardManager().GetHand(false).Count() * ((CardTraitState)this).GetParamInt() / ((CardTraitState)this).GetParamInt2();
}
public override int OnStatusEffectApplied(CharacterState affectedCharacter, CardState thisCard, ICoreGameManagers coreGameManagers, string statusId, int sourceStacks = 0)
{
CardState thisCard2 = thisCard;
int num = IEnumerableUtility.Count<CardState>(coreGameManagers.GetCardManager().GetHand(false), (Func<CardState, bool>)((CardState c) => c != thisCard2));
return sourceStacks * (num * ((CardTraitState)this).GetParamInt() / ((CardTraitState)this).GetParamInt2()) - sourceStacks;
}
}
public class CardTraitStatusEffectUpgradeMultiplier : CardTraitState
{
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0024: Expected O, but got Unknown
//IL_0025: Expected O, but got Unknown
PropDescriptions val = new PropDescriptions { };
string fieldName;
((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Status to multiply by.", "", (Type)null, false);
return val;
}
public override void OnApplyingCardUpgradeToUnit(CardState thisCard, CharacterState targetUnit, CardUpgradeState upgradeState, ICoreGameManagers coreGameManagers)
{
((CardTraitState)this).OnApplyingCardUpgradeToUnit(thisCard, targetUnit, upgradeState, coreGameManagers);
string statusId = ((CardTraitState)this).GetParamStatusEffects().First().statusId;
int statusEffectStacks = targetUnit.GetStatusEffectStacks(statusId);
upgradeState.SetAttackDamage(upgradeState.GetAttackDamage() * statusEffectStacks);
upgradeState.SetAdditionalHP(upgradeState.GetAdditionalHP() * statusEffectStacks);
}
}
public sealed class RelicEffectApplyStatusEffectOnCardEarlyDiscard : RelicEffectBase, IOnDiscardRelicEffect, IRelicEffect, IStatusEffectRelicEffect
{
[CompilerGenerated]
private sealed class <ApplyEffectOnCardDiscarded>d__7 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RelicEffectApplyStatusEffectOnCardEarlyDiscard <>4__this;
public CardDiscardedRelicEffectParams relicEffectParams;
public ICoreGameManagers coreGameManagers;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ApplyEffectOnCardDiscarded>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_004a: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
RelicEffectApplyStatusEffectOnCardEarlyDiscard relicEffectApplyStatusEffectOnCardEarlyDiscard = <>4__this;
if (num != 0)
{
return false;
}
<>1__state = -1;
((RelicEffectBase)relicEffectApplyStatusEffectOnCardEarlyDiscard).NotifyRelicTriggered(((RelicEffectParams)relicEffectParams).relicManager, (CharacterUI)null, "", false, 0f);
int currentSelectedRoom = coreGameManagers.GetRoomManager().CurrentSelectedRoom;
CollectTargetsData val = default(CollectTargetsData);
val.targetTeamType = relicEffectApplyStatusEffectOnCardEarlyDiscard.sourceTeam;
val.targetMode = relicEffectApplyStatusEffectOnCardEarlyDiscard.targetMode;
val.roomIndex = currentSelectedRoom;
val.inCombat = false;
val.isTesting = coreGameManagers.GetSaveManager().PreviewMode;
CollectTargetsData val2 = val;
List<CharacterState> list = new List<CharacterState>();
UsingGenericPoolObject<List<CharacterState>> list2 = GenericPools.GetList<CharacterState>(ref list);
try
{
TargetHelper.CollectTargets(val2, coreGameManagers, ref list);
foreach (CharacterState item in list)
{
StatusEffectStackData[] statusEffectsToApply = relicEffectApplyStatusEffectOnCardEarlyDiscard.statusEffectsToApply;
foreach (StatusEffectStackData val3 in statusEffectsToApply)
{
item.AddStatusEffect(val3.statusId, val3.count, relicEffectApplyStatusEffectOnCardEarlyDiscard.addStatusEffectParams, (CharacterState)null, true, false, true, false);
}
}
}
finally
{
((IDisposable)list2).Dispose();
}
((CollectTargetsData)(ref val2)).Reset((TargetMode)0);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private Type sourceTeam;
private TargetMode targetMode;
private StatusEffectStackData[] statusEffectsToApply = Array.Empty<StatusEffectStackData>();
private readonly AddStatusEffectParams addStatusEffectParams = new AddStatusEffectParams();
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0024: Expected O, but got Unknown
//IL_002c: 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_0044: Expected O, but got Unknown
//IL_0044: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
//IL_0064: Expected O, but got Unknown
//IL_0065: Expected O, but got Unknown
PropDescriptions val = new PropDescriptions { };
string fieldName;
((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Target Team", "", (Type)null, false);
string fieldName2 = RelicEffectFieldNamesHelper.GetFieldName((RelicEffectFieldNames)15);
((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Target Mode", "", (Type)null, false);
string fieldName3 = RelicEffectFieldNamesHelper.GetFieldName((RelicEffectFieldNames)26);
((Dictionary<string, PropDescription>)val)[fieldName3] = new PropDescription("Status Effects to apply", "", (Type)null, false);
return val;
}
public override void Initialize(RelicState relicState, RelicData relicData, RelicEffectData relicEffectData)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
((RelicEffectBase)this).Initialize(relicState, relicData, relicEffectData);
sourceTeam = relicEffectData.GetParamSourceTeam();
targetMode = relicEffectData.GetTargetMode();
statusEffectsToApply = relicEffectData.GetParamStatusEffects();
addStatusEffectParams.sourceRelicState = ((RelicEffectBase)this).SourceRelicState;
}
public bool TestEffectOnCardDiscarded(CardDiscardedRelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers)
{
return relicEffectParams.discardCardParams.triggeredByCard;
}
[IteratorStateMachine(typeof(<ApplyEffectOnCardDiscarded>d__7))]
public IEnumerator ApplyEffectOnCardDiscarded(CardDiscardedRelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ApplyEffectOnCardDiscarded>d__7(0)
{
<>4__this = this,
relicEffectParams = relicEffectParams,
coreGameManagers = coreGameManagers
};
}
public StatusEffectStackData[]? GetStatusEffects()
{
return statusEffectsToApply;
}
}
public sealed class RelicEffectCustomAddUpgrade : RelicEffectBase, ICardModifierRelicEffect, IRelicEffect, IStatusEffectRelicEffect
{
[CompilerGenerated]
private sealed class <OnCharacterAdded>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ICoreGameManagers coreGameManagers;
public RelicEffectCustomAddUpgrade <>4__this;
public CharacterState characterState;
public CardState fromCard;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <OnCharacterAdded>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003f: 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_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Expected O, but got Unknown
int num = <>1__state;
RelicEffectCustomAddUpgrade relicEffectCustomAddUpgrade = <>4__this;
switch (num)
{
default:
return false;
case 0:
{
<>1__state = -1;
RelicManager relicManager = coreGameManagers.GetRelicManager();
if (!((Object)(object)relicEffectCustomAddUpgrade._cardUpgradeData != (Object)null) || !((Enum)relicEffectCustomAddUpgrade._sourceTeam).HasFlag((Enum)(object)characterState.GetTeamType()) || !characterState.HasStatusEffect("cardless") || characterState.GetIsClone())
{
break;
}
if (!relicEffectCustomAddUpgrade._applyToCardlessSpawns)
{
return false;
}
foreach (CardUpgradeMaskData filter in relicEffectCustomAddUpgrade._cardUpgradeData.GetFilters())
{
if (!filter.FilterCard<CardState>(fromCard, relicManager))
{
return false;
}
if (!filter.FilterCharacter(characterState, relicManager))
{
return false;
}
}
if (relicEffectCustomAddUpgrade._cardUpgradeData.IsUnique() && fromCard != null && (fromCard.GetCardStateModifiers().HasUpgrade(((GameData)relicEffectCustomAddUpgrade._cardUpgradeData).GetID()) || fromCard.GetTemporaryCardStateModifiers().HasUpgrade(((GameData)relicEffectCustomAddUpgrade._cardUpgradeData).GetID())))
{
return false;
}
CardUpgradeState val = new CardUpgradeState();
val.Setup(relicEffectCustomAddUpgrade._cardUpgradeData, false, false);
<>2__current = characterState.ApplyCardUpgrade(val, false, "", true, false, (CardState)null, (Action<UpgradeApplicationResult>)null, (TrainRoomAttachmentState)null, false);
<>1__state = 1;
return true;
}
case 1:
<>1__state = -1;
break;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private Type _sourceTeam;
private CardUpgradeData? _cardUpgradeData;
private bool _applyToCardlessSpawns;
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0024: Expected O, but got Unknown
//IL_002c: 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_0044: Expected O, but got Unknown
//IL_0044: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
//IL_0063: Expected O, but got Unknown
//IL_0064: Expected O, but got Unknown
PropDescriptions val = new PropDescriptions { };
string fieldName;
((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Source Team", "", (Type)null, false);
string fieldName2 = RelicEffectFieldNamesHelper.GetFieldName((RelicEffectFieldNames)19);
((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Upgrade", "", (Type)null, false);
string fieldName3 = RelicEffectFieldNamesHelper.GetFieldName((RelicEffectFieldNames)8);
((Dictionary<string, PropDescription>)val)[fieldName3] = new PropDescription("Apply to Cardless Spawns", "", (Type)null, false);
return val;
}
public override void Initialize(RelicState relicState, RelicData relicData, RelicEffectData relicEffectData)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
((RelicEffectBase)this).Initialize(relicState, relicData, relicEffectData);
_sourceTeam = relicEffectData.GetParamSourceTeam();
_cardUpgradeData = relicEffectData.GetParamCardUpgradeData();
_applyToCardlessSpawns = relicEffectData.GetParamBool();
}
public bool ApplyCardStateModifiers(CardState cardState, RelicManager relicManager, SaveManager saveManager, CardManager? cardManager)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
bool result = false;
if ((Object)(object)_cardUpgradeData != (Object)null && ((Enum)_sourceTeam).HasFlag((Enum)(object)(Type)2))
{
foreach (CardUpgradeMaskData filter in _cardUpgradeData.GetFilters())
{
if (!filter.FilterCard<CardState>(cardState, relicManager))
{
return false;
}
}
CardUpgradeState val = new CardUpgradeState();
val.Setup(_cardUpgradeData, false, false);
if (cardState.GetUpgradeData() == null)
{
return false;
}
if (val.IsUnique() && cardState.GetCardStateModifiers().HasUpgrade(((GameData)_cardUpgradeData).GetID()))
{
return false;
}
cardState.ApplyPermanentUpgrade(val, saveManager, true, (string)null);
cardState.UpdateCardBodyText((SaveManager)null);
if ((Object)(object)cardManager != (Object)null)
{
cardManager.RefreshCardInHand(cardState, true, false, false);
}
return true;
}
return result;
}
[IteratorStateMachine(typeof(<OnCharacterAdded>d__3))]
public override IEnumerator OnCharacterAdded(CharacterState characterState, CardState fromCard, ICoreGameManagers coreGameManagers)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <OnCharacterAdded>d__3(0)
{
<>4__this = this,
characterState = characterState,
fromCard = fromCard,
coreGameManagers = coreGameManagers
};
}
public bool GetTooltip(out string title, out string body)
{
title = string.Empty;
body = string.Empty;
return false;
}
public StatusEffectStackData[]? GetStatusEffects()
{
if ((Object)(object)_cardUpgradeData != (Object)null)
{
return _cardUpgradeData.GetStatusEffectUpgrades().ToArray();
}
return null;
}
}
public sealed class RelicEffectDrawOnCardEarlyDiscard : RelicEffectBase, IOnDiscardRelicEffect, IRelicEffect
{
[CompilerGenerated]
private sealed class <ApplyEffectOnCardDiscarded>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RelicEffectDrawOnCardEarlyDiscard <>4__this;
public CardDiscardedRelicEffectParams relicEffectParams;
public ICoreGameManagers coreGameManagers;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ApplyEffectOnCardDiscarded>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
RelicEffectDrawOnCardEarlyDiscard relicEffectDrawOnCardEarlyDiscard = <>4__this;
if (num != 0)
{
return false;
}
<>1__state = -1;
((RelicEffectBase)relicEffectDrawOnCardEarlyDiscard).NotifyRelicTriggered(((RelicEffectParams)relicEffectParams).relicManager, (CharacterUI)null, "", false, 0f);
coreGameManagers.GetCardManager().DrawCards(relicEffectDrawOnCardEarlyDiscard._cardsToDraw, (CardState)null, (CardType)4, -1);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private int _cardsToDraw;
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0024: Expected O, but got Unknown
//IL_0025: Expected O, but got Unknown
PropDescriptions val = new PropDescriptions { };
string fieldName;
((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Num cards to draw", "", (Type)null, false);
return val;
}
public override void Initialize(RelicState relicState, RelicData relicData, RelicEffectData relicEffectData)
{
((RelicEffectBase)this).Initialize(relicState, relicData, relicEffectData);
_cardsToDraw = relicEffectData.GetParamInt();
}
public bool TestEffectOnCardDiscarded(CardDiscardedRelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers)
{
return relicEffectParams.discardCardParams.triggeredByCard;
}
[IteratorStateMachine(typeof(<ApplyEffectOnCardDiscarded>d__4))]
public IEnumerator ApplyEffectOnCardDiscarded(CardDiscardedRelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ApplyEffectOnCardDiscarded>d__4(0)
{
<>4__this = this,
relicEffectParams = relicEffectParams,
coreGameManagers = coreGameManagers
};
}
}
internal class StatusEffectHexState : StatusEffectState, IOnOtherStatusEffectAdded
{
public const string StatusId = "hex";
public int OnOtherStatusEffectBeingAdded(int myStacks, string statusId, int numStacks)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Invalid comparison between Unknown and I4
if (statusId == "hex")
{
return numStacks;
}
StatusEffectData statusEffectDataById = StatusEffectManager.Instance.GetStatusEffectDataById(statusId, true);
if (statusEffectDataById == null)
{
return numStacks;
}
if (statusEffectDataById.IsPropagatable() && (int)statusEffectDataById.GetDisplayCategory() == 1)
{
return numStacks + myStacks;
}
return numStacks;
}
}
internal class StatusEffectScourgeState : StatusEffectState, IDamageStatusEffect
{
[CompilerGenerated]
private sealed class <OnTriggered>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ICoreGameManagers coreGameManagers;
public StatusEffectScourgeState <>4__this;
public InputTriggerParams inputTriggerParams;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <OnTriggered>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
StatusEffectScourgeState statusEffectScourgeState = <>4__this;
switch (num)
{
default:
return false;
case 0:
{
<>1__state = -1;
CoreSignals.DamageAppliedPlaySound.Dispatch((Type)9);
CombatManager combatManager = coreGameManagers.GetCombatManager();
int damageAmount = statusEffectScourgeState.GetDamageAmount(statusEffectScourgeState.stacks);
CharacterState associatedCharacter = statusEffectScourgeState.associatedCharacter;
ApplyDamageToTargetParameters val = default(ApplyDamageToTargetParameters);
val.damageType = (Type)0;
StatusEffectData sourceStatusEffectData = ((StatusEffectState)statusEffectScourgeState).GetSourceStatusEffectData();
val.affectedVfx = ((sourceStatusEffectData != null) ? sourceStatusEffectData.GetOnAffectedVFX() : null);
val.relicState = inputTriggerParams.suppressingRelic;
<>2__current = combatManager.ApplyDamageToTarget(damageAmount, associatedCharacter, val);
<>1__state = 1;
return true;
}
case 1:
<>1__state = -1;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public const string StatusId = "scourge";
private CharacterState? associatedCharacter;
private int stacks;
public override bool TestTrigger(InputTriggerParams inputTriggerParams, OutputTriggerParams outputTriggerParams, ICoreGameManagers coreGameManagers)
{
if ((Object)(object)inputTriggerParams.associatedCharacter != (Object)null && inputTriggerParams.associatedCharacter.IsAlive)
{
associatedCharacter = inputTriggerParams.associatedCharacter;
}
else
{
associatedCharacter = null;
}
CharacterState val = associatedCharacter;
stacks = (((Object)(object)val != (Object)null) ? val.GetStatusEffectStacks(((StatusEffectState)this).GetStatusId()) : 0);
if (stacks > 0)
{
return (Object)(object)associatedCharacter != (Object)null;
}
return false;
}
[IteratorStateMachine(typeof(<OnTriggered>d__1))]
protected override IEnumerator OnTriggered(InputTriggerParams inputTriggerParams, OutputTriggerParams outputTriggerParams, ICoreGameManagers coreGameManagers)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <OnTriggered>d__1(0)
{
<>4__this = this,
inputTriggerParams = inputTriggerParams,
coreGameManagers = coreGameManagers
};
}
public override int GetEffectMagnitude(int stacks = 1)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
return (((StatusEffectState)this).GetParamInt() + base.relicManager.GetModifiedStatusMagnitudePerStack("mt2_sandscourged.plugin_scourge", ((StatusEffectState)this).GetAssociatedCharacter().GetTeamType())) * stacks;
}
private int GetDamageAmount(int stacks)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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)
int num = 0;
List<StatusEffectStack> source = new List<StatusEffectStack>();
UsingGenericPoolObject<List<StatusEffectStack>> list = GenericPools.GetList<StatusEffectStack>(ref source);
try
{
((StatusEffectState)this).GetAssociatedCharacter().GetStatusEffects(ref source, false);
num = source.Where((StatusEffectStack s) => (int)s.State.GetDisplayCategory() == 1).Count();
}
finally
{
((IDisposable)list).Dispose();
}
return (((StatusEffectState)this).GetParamInt() + base.relicManager.GetModifiedStatusMagnitudePerStack("mt2_sandscourged.plugin_scourge", ((StatusEffectState)this).GetAssociatedCharacter().GetTeamType())) * num * stacks;
}
}
public static class TrackedValueFunctions
{
internal static int CountCardsInHand(StatValueData _, IReadOnlyDictionary<CardState, CardStatsEntry> deckStats, ICoreGameManagers coreGameManagers)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
return IEnumerableUtility.Count<CardState>(coreGameManagers.GetCardManager().GetHand(false), (Func<CardState, bool>)((CardState c) => c != _.cardState));
}
internal static int HalfCountCardsInHand(StatValueData _, IReadOnlyDictionary<CardState, CardStatsEntry> deckStats, ICoreGameManagers coreGameManagers)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return CountCardsInHand(_, deckStats, coreGameManagers) / 2;
}
}
[BepInPlugin("mt2_sandscourged.Plugin", "mt2_sandscourged.Plugin", "0.5.1")]
public class Plugin : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static TrackedValueGetter <0>__CountCardsInHand;
public static TrackedValueGetter <1>__HalfCountCardsInHand;
}
internal static ManualLogSource Logger = new ManualLogSource("mt2_sandscourged.Plugin");
public void Awake()
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
Railhead.GetBuilder().Configure("mt2_sandscourged.Plugin", (Action<IConfigurationBuilder>)delegate(IConfigurationBuilder c)
{
ConfigurationExtensions.AddMergedJsonFile(c, new List<string>(68)
{
"json/plugin.json", "json/class.json", "json/champions/champion_Pharaoh.json", "json/champions/champion_Vizier.json", "json/units/unit_OverseerEternal.json", "json/units/unit_ReveredScarab.json", "json/units/unit_GildedScarab.json", "json/units/unit_CursedScarab.json", "json/units/unit_ScarabSwarm.json", "json/units/unit_Wretch.json",
"json/units/unit_PearlHost.json", "json/units/unit_SphinxHierarch.json", "json/units/unit_TwistedHusk.json", "json/units/unit_ForgottenHulk.json", "json/units/unit_PriestOfLostThoughts.json", "json/units/unit_Revenant.json", "json/units/unit_SuperiorEgo.json", "json/units/unit_Evermaw.json", "json/spells/card_Pitfall.json", "json/spells/card_OblivionSands.json",
"json/spells/card_Sandstorm.json", "json/spells/card_Rancor.json", "json/spells/card_InMemoriam.json", "json/spells/card_TormentA.json", "json/spells/card_TormentB.json", "json/spells/card_TormentC.json", "json/spells/card_TormentD.json", "json/spells/card_TormentE.json", "json/spells/card_Desiccate.json", "json/spells/card_Efface.json",
"json/spells/card_Beseech.json", "json/spells/card_Jinx.json", "json/spells/card_Malediction.json", "json/spells/card_SpikeOfTheScourged.json", "json/spells/card_Idolize.json", "json/spells/card_Expose.json", "json/spells/card_PartTheStorm.json", "json/spells/card_GravenRite.json", "json/spells/card_ForgottenTome.json", "json/spells/card_SelectiveMemory.json",
"json/spells/card_PainfulMemories.json", "json/equipments/equipment_ScryingEye.json", "json/equipments/equipment_PearlTap.json", "json/equipments/equipment_SpearOfTheDeserted.json", "json/equipments/equipment_CorruptedSceptre.json", "json/rooms/room_OblivionChamber.json", "json/rooms/room_ScarabPit.json", "json/blights/card_PlagueOfScarabs.json", "json/blights/card_PlagueOfBlood.json", "json/blights/card_PlagueOfGnarling.json",
"json/scourges/card_Vexation.json", "json/relics/relic_WornHourglass.json", "json/relics/relic_CarnelianMask.json", "json/relics/relic_CursedTablet.json", "json/relics/relic_BrokenSeal.json", "json/relics/relic_EvokingFlute.json", "json/relics/relic_OblivionCrook.json", "json/relics/relic_ShiningPearl.json", "json/relics/relic_TwistedReed.json", "json/relics/relic_CanopicJar.json",
"json/relics/relic_PolishedIdol.json", "json/relics/relic_SandBowl.json", "json/enhancers/enhancer_Scarabstone.json", "json/status_effects/hex.json", "json/status_effects/scourge.json", "json/card_effects/PurgeCardFromHand.json", "json/card_traits/ScalingByHandCount.json", "json/tracked_values/tracked_values.json"
});
});
Logger.LogInfo((object)"Plugin mt2_sandscourged.Plugin is loaded!");
Railend.ConfigurePostAction((Action<Container>)delegate(Container c)
{
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Expected O, but got Unknown
IRegister<CardPool> instance = c.GetInstance<IRegister<CardPool>>();
string id2 = StringExtensions.GetId("mt2_sandscourged.Plugin", "CardPool", "TormentPool");
CardTraitScalingAddBattleCardToHandFromPool.paramCardPool = IEnumerableUtility.GetValueOrDefault<string, CardPool>((IDictionary<string, CardPool>)instance, id2, (CardPool)null);
SaveManager val = default(SaveManager);
IRegister<TrackedValueType> trackedValueRegister;
if (!c.GetInstance<GameDataClient>().TryGetProvider<SaveManager>(ref val))
{
Logger.LogError((object)"Failed to get SaveManager instance please report this https://github.com/Monster-Train-2-Modding-Group/Balance-Configurator/issues");
}
else
{
AllGameData allGameData = val.GetAllGameData();
List<CardData> list = new List<CardData>(4)
{
allGameData.FindCardDataByName("mt2_sandscourged.Plugin-Card-Vexation"),
allGameData.FindCardDataByName("mt2_sandscourged.Plugin-Card-PlagueOfBlood"),
allGameData.FindCardDataByName("mt2_sandscourged.Plugin-Card-PlagueOfScarabs"),
allGameData.FindCardDataByName("mt2_sandscourged.Plugin-Card-PlagueOfGnarling")
};
BalanceData balanceData = allGameData.GetBalanceData();
object obj = SafeGetField(balanceData, "cardsThatResolveSimultaneouslyOnUnplayed");
List<CardData> simultaneousReserveCards = obj as List<CardData>;
if (simultaneousReserveCards == null)
{
Logger.LogError((object)"Couldn't find simultaneous reserve cards");
}
else
{
list.ForEach(delegate(CardData? c)
{
IEnumerableUtility.AddIfNotNull<CardData>(simultaneousReserveCards, c);
});
SafeSetField<BalanceData>(balanceData, "cardsThatResolveSimultaneouslyOnUnplayed", simultaneousReserveCards);
trackedValueRegister = c.GetInstance<IRegister<TrackedValueType>>();
TrackedValueType val2 = GetTrackedValueType("CardsInHand");
object obj2 = <>O.<0>__CountCardsInHand;
if (obj2 == null)
{
TrackedValueGetter val3 = TrackedValueFunctions.CountCardsInHand;
<>O.<0>__CountCardsInHand = val3;
obj2 = (object)val3;
}
TrackedValueTypeExtensions.SetTrackedValueGetter(val2, (TrackedValueGetter)obj2);
TrackedValueType val4 = GetTrackedValueType("HalfCardsInHand");
object obj3 = <>O.<1>__HalfCountCardsInHand;
if (obj3 == null)
{
TrackedValueGetter val5 = TrackedValueFunctions.HalfCountCardsInHand;
<>O.<1>__HalfCountCardsInHand = val5;
obj3 = (object)val5;
}
TrackedValueTypeExtensions.SetTrackedValueGetter(val4, (TrackedValueGetter)obj3);
}
}
TrackedValueType GetTrackedValueType(string id)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
return IEnumerableUtility.GetValueOrDefault<string, TrackedValueType>((IDictionary<string, TrackedValueType>)trackedValueRegister, StringExtensions.GetId("mt2_sandscourged.Plugin", "TrackedValueTypeEnum", id), (TrackedValueType)0);
}
});
Utilities.SetupTraitTooltips(((object)this).GetType().Assembly);
Utilities.SetupCardEffectTooltips(((object)this).GetType().Assembly);
new Harmony("mt2_sandscourged.Plugin").PatchAll();
}
private void SafeSetField<T>(T? data, string field, object? obj)
{
if (data == null)
{
Logger.LogError((object)"Internal Error data is null");
throw new ArgumentNullException("data");
}
if (obj == null)
{
Logger.LogWarning((object)("Not setting " + typeof(T).Name + " field " + field + " because the value to set is null (value specified may be invalid or field not present)"));
return;
}
try
{
Logger.LogDebug((object)$"Setting {typeof(T).Name} field {field} to {obj}");
AccessTools.Field(data.GetType(), field).SetValue(data, obj);
}
catch (Exception ex)
{
Logger.LogError((object)("Could not set " + typeof(T).Name + " field " + field + " because of an exception " + ex.Message));
}
}
private object? SafeGetField(BalanceData balanceData, string field)
{
try
{
Logger.LogDebug((object)("Getting BalanceData field " + field));
return AccessTools.Field(((object)balanceData).GetType(), field).GetValue(balanceData);
}
catch (Exception ex)
{
Logger.LogError((object)("Could not get BalanceData field " + field + " because of an exception " + ex.Message));
}
return null;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "mt2_sandscourged.Plugin";
public const string PLUGIN_NAME = "mt2_sandscourged.Plugin";
public const string PLUGIN_VERSION = "0.5.1";
}
}