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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using ShinyShoe;
using TrainworksReloaded.Core;
using TrainworksReloaded.Core.Extensions;
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_succclan.Plugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.3.0")]
[assembly: AssemblyInformationalVersion("0.1.3+113aa0e16453296047efd9da66366f182f05e0c9")]
[assembly: AssemblyProduct("mt2_succclan.Plugin")]
[assembly: AssemblyTitle("mt2_succclan.Plugin")]
[assembly: AssemblyVersion("0.1.3.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace mt2_succclan.Plugin
{
public sealed class CardEffectDiscardSpecificCard : CardEffectBase, ICardEffectDiscards, ICardEffect
{
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_0006: Expected O, but got Unknown
return new PropDescriptions();
}
public override bool TestEffect(CardEffectState s, CardEffectParams p, ICoreGameManagers c)
{
return IEnumerableUtility.Count<CardState>(c.GetCardManager().GetHand(false), (Func<CardState, bool>)((CardState card) => card != p.playedCard && card.GetCardDataID() == ((GameData)s.GetParamCardData()).GetID())) >= s.GetParamInt();
}
public override IEnumerator ApplyEffect(CardEffectState s, CardEffectParams p, ICoreGameManagers c, ISystemManagers m)
{
CardManager manager = c.GetCardManager();
string id = ((GameData)s.GetParamCardData()).GetID();
List<CardState> list = (from card in manager.GetHand(true)
where card != p.playedCard && card.GetCardDataID() == id
select card).ToList();
int num = Math.Min(s.GetParamInt(), list.Count);
while (list.Count > num)
{
list.RemoveAt(RandomManager.Range(0, list.Count, (RngId)6));
}
foreach (CardState item in list)
{
yield return manager.DiscardCard(new DiscardCardParams
{
discardCard = item,
triggeredByCard = true,
triggeredCard = p.playedCard,
wasPlayed = false
}, false);
}
}
}
public sealed class CardEffectPsionicPermanentGrowth : CardEffectAddCardUpgradeToUnits
{
public override IEnumerator ApplyEffect(CardEffectState s, CardEffectParams p, ICoreGameManagers c, ISystemManagers m)
{
CharacterState selfTarget = p.selfTarget;
if (!((Object)(object)selfTarget == (Object)null) && !selfTarget.IsDestroyed)
{
StatusEffectStackData val = s.GetSourceCardEffectData().GetParamStatusEffects()[0];
int times = selfTarget.GetStatusEffectStacks(val.statusId) / val.count;
selfTarget.RemoveStatusEffect(val.statusId, times * val.count, false);
for (int i = 0; i < times; i++)
{
yield return <>n__0(s, p, c, m);
}
}
}
[CompilerGenerated]
[DebuggerHidden]
private IEnumerator <>n__0(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
{
return ((CardEffectAddCardUpgradeToUnits)this).ApplyEffect(cardEffectState, cardEffectParams, coreGameManagers, sysManagers);
}
}
public sealed class RelicEffectRageOnFrantic : RelicEffectBase
{
public override bool CanApplyInPreviewMode => true;
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();
}
public override void OnCharacterStatusEffectApplied(CharacterState character, StatusEffectState status, ICoreGameManagers core, RelicManager relics, SaveManager save, bool spawnEffect)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
if (!(status.GetStatusId() != "mt2_succclan.Plugin_frantic"))
{
character.AddStatusEffect("buff", 1, new AddStatusEffectParams
{
sourceRelicState = ((RelicEffectBase)this).SourceRelicState
}, (CharacterState)null, true, false, true, false, false);
}
}
}
public sealed class RelicEffectArmorOnPyreAttacked : RelicEffectBase
{
public override bool CanApplyInPreviewMode => true;
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();
}
}
[HarmonyPatch(typeof(CharacterState), "DoAttackedStatusEffects")]
internal static class PyreAttackedArmorPatch
{
private static void Postfix(CharacterState __instance, CharacterState attacker, RelicManager ___relicManager, ref IEnumerator __result)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Invalid comparison between Unknown and I4
if (__instance.IsPyreHeart() && !((Object)(object)attacker == (Object)null) && (int)attacker.GetTeamType() == 1)
{
__result = ApplyAfter(__result, __instance, ___relicManager);
}
}
private static IEnumerator ApplyAfter(IEnumerator original, CharacterState pyre, RelicManager relics)
{
yield return original;
foreach (RelicEffectArmorOnPyreAttacked relicEffect in relics.GetRelicEffects<RelicEffectArmorOnPyreAttacked>(new List<RelicEffectArmorOnPyreAttacked>()))
{
StatusEffectStackData[] paramStatusEffects = ((RelicEffectBase)relicEffect).SourceRelicEffectData.GetParamStatusEffects();
foreach (StatusEffectStackData val in paramStatusEffects)
{
pyre.AddStatusEffect(val.statusId, val.count, new AddStatusEffectParams
{
sourceRelicState = ((RelicEffectBase)relicEffect).SourceRelicState
}, (CharacterState)null, true, false, true, false, false);
}
}
}
}
public class CardEffectAddStatusEffectToClones : CardEffectBase
{
public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
{
StatusEffectStackData[] paramStatusEffects = cardEffectState.GetSourceCardEffectData().GetParamStatusEffects();
if (paramStatusEffects == null || paramStatusEffects.Length == 0)
{
yield break;
}
foreach (CharacterState target in cardEffectParams.targets)
{
if ((Object)(object)target == (Object)null || !target.GetIsClone())
{
continue;
}
StatusEffectStackData[] array = paramStatusEffects;
foreach (StatusEffectStackData val in array)
{
if (val != null && val.count > 0 && target.GetStatusEffectStacks(val.statusId) <= 0)
{
AddStatusEffectParams val2 = new AddStatusEffectParams
{
sourceRelicState = cardEffectParams.sourceRelic,
sourceIsHero = ((int)cardEffectState.GetSourceTeamType() == 1),
fromEffectType = ((object)this).GetType()
};
target.AddStatusEffect(val.statusId, val.count, val2, (CharacterState)null, false, cardEffectParams.isFromHiddenTrigger, true, false, 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("Status Effects", "Estados que se aplican, y solo, a las unidades marcadas como clon.", (Type)null, false);
return val;
}
}
public sealed class CardEffectCopyWithStatuses : CardEffectBase
{
private int numCopiesOfEachUnit;
private bool shouldCopyHeroStats;
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("Num Copies Of Each Unit", "", (Type)null, false);
string fieldName2 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)7);
((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Copy Hero Stats", "Only applies when copying hero units - copies status effects after spawning a new unit.", (Type)null, false);
return val;
}
public override void Setup(CardEffectState cardEffectState)
{
((CardEffectBase)this).Setup(cardEffectState);
numCopiesOfEachUnit = cardEffectState.GetParamInt();
shouldCopyHeroStats = cardEffectState.GetParamBool();
}
public override bool TestEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers)
{
return cardEffectParams.targets.Count > 0;
}
public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
{
int numSpawns = 0;
MonsterManager monsterManager = coreGameManagers.GetMonsterManager();
HeroManager heroManager = coreGameManagers.GetHeroManager();
RoomManager roomManager = coreGameManagers.GetRoomManager();
SaveManager saveManager = coreGameManagers.GetSaveManager();
CombatManager combatManager = coreGameManagers.GetCombatManager();
List<CharacterState> originalUnitsInRoom = default(List<CharacterState>);
UsingGenericPoolObject<List<CharacterState>> list = GenericPools.GetList<CharacterState>(ref originalUnitsInRoom);
try
{
RoomState room = roomManager.GetRoom(cardEffectParams.selectedRoom);
if ((Object)(object)room != (Object)null)
{
room.AddCharactersToList(originalUnitsInRoom, (Type)3, false, true);
}
foreach (CharacterState copyUnit in cardEffectParams.targets)
{
SpawnPoint spawnPoint = copyUnit.GetSpawnPoint(false);
if (spawnPoint == null)
{
continue;
}
for (int i = 0; i < numCopiesOfEachUnit; i++)
{
if ((int)cardEffectState.GetTargetTeamType() == 1)
{
CharacterState newHero = null;
CharacterState val = (shouldCopyHeroStats ? copyUnit : null);
yield return heroManager.SpawnHeroInRoom(copyUnit.GetSourceCharacterData(), cardEffectParams.selectedRoom, newHero, saveManager.PreviewMode, val);
if ((Object)(object)newHero != (Object)null)
{
int num = numSpawns;
numSpawns = num + 1;
}
continue;
}
CharacterState createdClone = null;
yield return monsterManager.CloneMonsterState(copyUnit, cardEffectParams.selectedRoom, (Action<CharacterState>)delegate(CharacterState newCharacter)
{
if ((Object)(object)newCharacter != (Object)null)
{
int num2 = numSpawns;
numSpawns = num2 + 1;
createdClone = newCharacter;
}
}, coreGameManagers, (SpawnMode)3, spawnPoint, (Action<CharacterState>)null, false, (CharacterData)null, (List<string>)null, (AddStatusEffectParams)null, true, (Action<CharacterState>)null, (CardState)null);
if (!((Object)(object)createdClone != (Object)null) || createdClone.IsDestroyed)
{
continue;
}
StatusEffectStackData[] paramStatusEffects = cardEffectState.GetSourceCardEffectData().GetParamStatusEffects();
foreach (StatusEffectStackData val2 in paramStatusEffects)
{
if (!createdClone.HasStatusEffect(val2.statusId))
{
createdClone.AddStatusEffect(val2.statusId, val2.count, (CharacterState)null, false, false);
}
}
}
}
if (numSpawns > 0)
{
foreach (CharacterState item in originalUnitsInRoom)
{
combatManager.QueueTrigger(item, (Trigger)20, (CharacterState)null, true, true, (FireTriggersData)null, numSpawns, (CharacterTriggerState)null);
}
}
if (numSpawns > 1 && !saveManager.PreviewMode)
{
if ((int)cardEffectState.GetTargetTeamType() == 1)
{
yield return roomManager.HandleRoomUnitOrderPossiblyChanged();
}
else
{
yield return roomManager.GetRoomUI().CenterCharacters(cardEffectParams.GetSelectedRoom(coreGameManagers.GetRoomManager()), false, false, false);
}
}
monsterManager.RefreshCharacterAbilityUI();
monsterManager.RefreshEquipmentUI();
}
finally
{
((IDisposable)list/*cast due to .constrained prefix*/).Dispose();
}
}
}
public sealed class CardEffectMultiplyNegativeStatusEffects : CardEffectBase
{
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return ((CardEffectBase)new CardEffectMultiplyAllStatusEffects()).CreateEditorInspectorDescriptions();
}
public override IEnumerator ApplyEffect(CardEffectState effect, CardEffectParams args, ICoreGameManagers managers, ISystemManagers systems)
{
AddStatusEffectParams val = new AddStatusEffectParams();
val.ApplyEffectParams<CardEffectMultiplyNegativeStatusEffects>(effect, args);
List<StatusEffectStack> list = new List<StatusEffectStack>();
for (int num = args.targets.Count - 1; num >= 0; num--)
{
CharacterState val2 = args.targets[num];
list.Clear();
val2.GetStatusEffects(ref list, false);
foreach (StatusEffectStack item in list)
{
if ((int)item.State.GetDisplayCategory() == 1)
{
int num2 = item.Count * (effect.GetParamInt() - 1);
if (num2 > 0)
{
val2.AddStatusEffect(item.State.GetStatusId(), num2, val, (CharacterState)null, true, args.isFromHiddenTrigger, true, false, false);
}
}
}
}
yield break;
}
}
internal class StatusEffectFranticState : StatusEffectState
{
private const string MultistrikeStatusId = "multistrike";
public override bool TestTrigger(InputTriggerParams inputTriggerParams, OutputTriggerParams outputTriggerParams, ICoreGameManagers coreGameManagers)
{
CharacterState associatedCharacter = inputTriggerParams.associatedCharacter;
if ((Object)(object)associatedCharacter != (Object)null && associatedCharacter.IsAlive && !FranticBossImmunity.IsBoss(associatedCharacter))
{
return associatedCharacter.GetStatusEffectStacks(((StatusEffectState)this).GetStatusId()) > 0;
}
return false;
}
protected override IEnumerator OnTriggered(InputTriggerParams inputTriggerParams, OutputTriggerParams outputTriggerParams, ICoreGameManagers coreGameManagers)
{
CharacterState thisCharacter = inputTriggerParams.associatedCharacter;
CombatManager combatManager = coreGameManagers.GetCombatManager();
SpawnPoint val = ((thisCharacter != null) ? thisCharacter.GetSpawnPoint(false) : null);
RoomState room = ((val != null) ? val.GetRoomOwner() : null);
if ((Object)(object)thisCharacter == (Object)null || (Object)(object)combatManager == (Object)null || (Object)(object)room == (Object)null)
{
outputTriggerParams.canAttackOrHeal = false;
yield break;
}
CoreSignals.DamageAppliedPlaySound.Dispatch((Type)4);
int multistrikeStacks = thisCharacter.GetStatusEffectStacks("multistrike");
for (int i = 0; i <= multistrikeStacks; i++)
{
if (!thisCharacter.IsAlive)
{
break;
}
CharacterState val2 = FindAllyTarget(combatManager, thisCharacter, room);
int damageAmount = GetDamageAmount(thisCharacter);
ApplyDamageToTargetParameters val3 = new ApplyDamageToTargetParameters
{
damageType = (Type)4
};
StatusEffectData sourceStatusEffectData = ((StatusEffectState)this).GetSourceStatusEffectData();
val3.affectedVfx = ((sourceStatusEffectData != null) ? sourceStatusEffectData.GetOnAffectedVFX() : null);
val3.relicState = inputTriggerParams.suppressingRelic;
yield return combatManager.ApplyDamageToTarget(damageAmount, val2, val3);
}
thisCharacter.RemoveStatusEffect(((StatusEffectState)this).GetStatusId(), 1, true);
outputTriggerParams.canAttackOrHeal = false;
}
private static CharacterState FindAllyTarget(CombatManager combatManager, CharacterState thisCharacter, RoomState room)
{
//IL_0031: 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)
List<CharacterState> list = new List<CharacterState>();
combatManager.GetAllCharactersInRoom(list, room);
foreach (CharacterState item in list)
{
if ((Object)(object)item != (Object)null && item.IsAlive && item.GetTeamType() == thisCharacter.GetTeamType())
{
return item;
}
}
return thisCharacter;
}
public override int GetEffectMagnitude(int stacks = 1)
{
CharacterState associatedCharacter = ((StatusEffectState)this).GetAssociatedCharacter();
object obj;
if (associatedCharacter == null)
{
obj = null;
}
else
{
SpawnPoint spawnPoint = associatedCharacter.GetSpawnPoint(false);
obj = ((spawnPoint != null) ? spawnPoint.GetRoomOwner() : null);
}
if ((Object)obj == (Object)null)
{
return 0;
}
return GetDamageAmount(associatedCharacter);
}
private static int GetDamageAmount(CharacterState character)
{
return character.GetAttackDamage();
}
}
internal class StatusEffectMarkerState : StatusEffectState
{
}
public sealed class RoomStateSuccClanTurnStartEffects : RoomStateModifierBase
{
private readonly List<CardEffectState> effects = new List<CardEffectState>();
private int lastAppliedTurn = -1;
public override void Initialize(RoomModifierData data, SaveManager save)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
((RoomStateModifierBase)this).Initialize(data, save);
effects.Clear();
lastAppliedTurn = -1;
foreach (CardEffectData paramCardEffectDatum in data.GetParamCardEffectData())
{
CardEffectState val = new CardEffectState();
val.Setup(paramCardEffectDatum, (CardState)null, (SaveManager)null);
effects.Add(val);
}
}
public IEnumerator Apply(RoomState room, ICoreGameManagers core)
{
int turnCount = core.GetCombatManager().GetTurnCount();
if (lastAppliedTurn != turnCount)
{
lastAppliedTurn = turnCount;
yield return ((RoomStateModifierBase)this).ShowTriggeredVFX(room, core);
yield return core.GetCombatManager().ApplyEffects(effects, room.GetRoomIndex(), (CardState)null, false, (RelicState)null, (CharacterState)null, (SpawnPoint)null, true, (ApplyPreEffectsVfxAction)null, (ApplyPreEffectsAction)null, (ApplyEffectsAction)null, false, (CharacterState)null, (CharacterState)null, 1, (CharacterState)null, false, (CardTriggerType)2, (CharacterTriggerState)null, (CharacterState)null, (RoomState)null, false, false, (CharacterState)null);
}
}
}
[HarmonyPatch(typeof(CardManager), "DrawHand")]
internal static class SuccClanTurnStartRoomPatch
{
private static void Postfix(AllGameManagers ___allGameManagers, ref IEnumerator __result)
{
__result = AfterDraw(__result, ___allGameManagers);
}
private static IEnumerator AfterDraw(IEnumerator original, AllGameManagers managers)
{
yield return original;
if ((Object)(object)managers == (Object)null)
{
yield break;
}
ICoreGameManagers core = managers.GetCoreManagers();
if ((int)core.GetCombatManager().GetCombatPhase() != 3)
{
yield break;
}
RoomManager rooms = core.GetRoomManager();
for (int i = 0; i < rooms.GetNumRooms(); i++)
{
RoomState room = rooms.GetRoom(i);
if ((Object)(object)room == (Object)null)
{
continue;
}
foreach (RoomStateSuccClanTurnStartEffects item in room.GetRoomStateModifiersFromTrainRoomAttachments<RoomStateSuccClanTurnStartEffects>((Type)2).ToList())
{
yield return item.Apply(room, core);
}
}
}
}
[BepInPlugin("mt2_succclan.Plugin", "mt2_succclan.Plugin", "0.1.3")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger = new ManualLogSource("mt2_succclan.Plugin");
public void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
new Harmony("mt2_succclan.Plugin").PatchAll();
Railhead.GetBuilder().Configure("mt2_succclan.Plugin", (Action<IConfigurationBuilder>)delegate(IConfigurationBuilder c)
{
ConfigurationExtensions.AddMergedJsonFile(c, new List<string>(61)
{
"json/plugin.json", "json/class.json", "json/essences.json", "json/status_effects/psionic.json", "json/status_effects/frantic.json", "json/champions/champion_KnightMare.json", "json/champions/champion_ShadowLady.json", "json/spells/card_BloodCarnival.json", "json/spells/card_CubusSpike.json", "json/spells/card_DangerousGame.json",
"json/spells/card_DarkFury.json", "json/spells/card_DarkPact.json", "json/spells/card_DepressionWhisper.json", "json/spells/card_DreadShot.json", "json/spells/card_Flogging.json", "json/spells/card_ForTheQueen.json", "json/spells/card_IllusionTwins.json", "json/spells/card_Inception.json", "json/spells/card_InsanityReach.json", "json/spells/card_MindBurning.json",
"json/spells/card_MindDomination.json", "json/spells/card_ObsessingShard.json", "json/spells/card_PainAndPleasure.json", "json/spells/card_ParadoxTome.json", "json/spells/card_PiercingShriek.json", "json/spells/card_PlagueBoost.json", "json/spells/card_PowerSiphon.json", "json/spells/card_ProfaneAscending.json", "json/spells/card_ShadowEmbrace.json", "json/spells/card_VitalityExtraction.json",
"json/rooms/room_SpectralRefuge.json", "json/rooms/room_ObsessionVault.json", "json/equipment/equip_WhisperingBlade.json", "json/equipment/equip_MourningVeil.json", "json/relics/relic_AbyssCrown.json", "json/relics/relic_DemonBlood.json", "json/relics/relic_DesireCrystal.json", "json/relics/relic_FlareRibbon.json", "json/relics/relic_FleshRing.json", "json/relics/relic_MutantElixirs.json",
"json/relics/relic_NetherBlossom.json", "json/relics/relic_ObsessingAromatherapy.json", "json/relics/relic_PoisonSerum.json", "json/relics/relic_ProfaneCrossbow.json", "json/relics/relic_ShadowCloak.json", "json/units/unit_AbyssPrincess.json", "json/units/unit_ArroganceGhost.json", "json/units/unit_ChaosCreation.json", "json/units/unit_DemonPioneer.json", "json/units/unit_EndlessShadow.json",
"json/units/unit_EnvyGhost.json", "json/units/unit_GluttonyGhost.json", "json/units/unit_GreedGhost.json", "json/units/unit_IncubusButcher.json", "json/units/unit_LustGhost.json", "json/units/unit_Oolioddroo.json", "json/units/unit_ShadowWarrior.json", "json/units/unit_SlothGhost.json", "json/units/unit_SuccbusTorturer.json", "json/units/unit_Vrolikai.json",
"json/units/unit_WrathGhost.json"
});
});
Logger.LogInfo((object)"Plugin mt2_succclan.Plugin is loaded!");
}
}
internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "mt2_succclan.Plugin";
public const string PLUGIN_NAME = "mt2_succclan.Plugin";
public const string PLUGIN_VERSION = "0.1.3";
}
public sealed class CardTraitBlightHandDamage : CardTraitState
{
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();
}
public override int OnApplyingDamage(ApplyingDamageParameters damage, ICoreGameManagers core)
{
//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)
int num = IEnumerableUtility.Count<CardState>(core.GetCardManager().GetHand(false), (Func<CardState, bool>)((CardState card) => card != damage.damageSourceCard && (int)card.GetCardType() == 5));
return damage.damage + num * ((CardTraitState)this).GetParamInt();
}
}
public sealed class CardEffectDiscardAllBlights : CardEffectBase, ICardEffectDiscards, ICardEffect
{
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_0006: Expected O, but got Unknown
return new PropDescriptions();
}
public override IEnumerator ApplyEffect(CardEffectState state, CardEffectParams parameters, ICoreGameManagers core, ISystemManagers systems)
{
CardManager manager = core.GetCardManager();
List<CardState> list = (from card in manager.GetHand(true)
where card != parameters.playedCard && (int)card.GetCardType() == 5
select card).ToList();
foreach (CardState item in list)
{
yield return manager.DiscardCard(new DiscardCardParams
{
discardCard = item,
triggeredByCard = true,
triggeredCard = parameters.playedCard,
wasPlayed = false
}, false);
}
}
}
internal static class FranticBossImmunity
{
internal const string StatusId = "mt2_succclan.Plugin_frantic";
internal static bool IsBoss(CharacterState character)
{
if (!character.IsAnyBoss())
{
return character.IsCompanionBoss();
}
return true;
}
internal static bool Blocks(CharacterState character, string statusId)
{
if (string.Equals(statusId, "mt2_succclan.Plugin_frantic", StringComparison.OrdinalIgnoreCase))
{
return IsBoss(character);
}
return false;
}
}
[HarmonyPatch(typeof(CharacterState), "IsImmune")]
internal static class FranticBossImmunityQueryPatch
{
private static void Postfix(CharacterState __instance, string statusEffectId, ref bool __result)
{
if (FranticBossImmunity.Blocks(__instance, statusEffectId))
{
__result = true;
}
}
}
[HarmonyPatch(typeof(CharacterState), "AddStatusEffect", new Type[]
{
typeof(string),
typeof(int),
typeof(AddStatusEffectParams),
typeof(CharacterState),
typeof(bool),
typeof(bool),
typeof(bool),
typeof(bool),
typeof(bool)
})]
internal static class FranticBossApplicationPatch
{
private static bool Prefix(CharacterState __instance, string statusId)
{
return !FranticBossImmunity.Blocks(__instance, statusId);
}
}
public sealed class CardEffectKnightmareRebirth : CardEffectBase
{
private const string Psionic = "mt2_succclan.Plugin_psionic";
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();
}
public override bool TestEffect(CardEffectState effect, CardEffectParams parameters, ICoreGameManagers core)
{
CharacterState selfTarget = parameters.selfTarget;
RoomState selectedRoom = parameters.GetSelectedRoom(core.GetRoomManager());
if ((Object)(object)selfTarget != (Object)null && selfTarget.IsDead && !selfTarget.IsDestroyed && selfTarget.GetMaxHP() > 0 && effect.GetParamInt() > 0 && selfTarget.GetStatusEffectStacks("mt2_succclan.Plugin_psionic") >= effect.GetParamInt() && (Object)(object)selectedRoom != (Object)null)
{
return selectedRoom.IsRoomEnabled();
}
return false;
}
public override IEnumerator ApplyEffect(CardEffectState effect, CardEffectParams parameters, ICoreGameManagers core, ISystemManagers systems)
{
if (!((CardEffectBase)this).TestEffect(effect, parameters, core))
{
yield break;
}
CharacterState source = parameters.selfTarget;
RoomState selectedRoom = parameters.GetSelectedRoom(core.GetRoomManager());
if ((Object)(object)source == (Object)null || (Object)(object)selectedRoom == (Object)null)
{
yield break;
}
SpawnPoint spawnPoint = source.GetSpawnPoint(true);
if (spawnPoint == null)
{
yield break;
}
int indexInRoom = spawnPoint.GetIndexInRoom();
int num = selectedRoom.ShiftSpawnPoints((Type)2, indexInRoom);
indexInRoom = Math.Max(indexInRoom - num, 0);
if (selectedRoom.GetRemainingSpawnPointCount((Type)2) <= 0)
{
yield break;
}
SpawnPoint monsterPoint = selectedRoom.GetMonsterPoint(indexInRoom);
if (monsterPoint == null)
{
yield break;
}
int cost = effect.GetParamInt();
source.RemoveStatusEffect("mt2_succclan.Plugin_psionic", cost, false);
CharacterState reborn = null;
yield return core.GetMonsterManager().CloneMonsterState(source, parameters.selectedRoom, (Action<CharacterState>)delegate(CharacterState character)
{
reborn = character;
}, core, (SpawnMode)3, monsterPoint, (Action<CharacterState>)null, false, (CharacterData)null, (List<string>)null, (AddStatusEffectParams)null, true, (Action<CharacterState>)null, (CardState)null);
if ((Object)(object)reborn == (Object)null || reborn.IsDestroyed)
{
source.AddStatusEffect("mt2_succclan.Plugin_psionic", cost, (CharacterState)null, false, false);
yield break;
}
reborn.SetHealth(reborn.GetMaxHP(), reborn.GetMaxHP());
CardUpgradeState upgrade = new CardUpgradeState();
upgrade.Setup(effect.GetParamCardUpgradeData(), false, false);
yield return reborn.ApplyCardUpgrade(upgrade, false, "", true, false, (CardState)null, (Action<UpgradeApplicationResult>)null, (TrainRoomAttachmentState)null, false);
CardState spawnerCard = reborn.GetSpawnerCard();
if (spawnerCard != null)
{
spawnerCard.GetTemporaryCardStateModifiers().AddUpgrade(upgrade, (CardStateModifiers)null);
}
core.GetMonsterManager().RefreshEquipmentUI();
core.GetMonsterManager().RefreshCharacterAbilityUI();
}
}
}