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;
using yokai.Plugin.code.RoomModifiers;
[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("yokai.Plugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+571ca6cf17b6cf36ddd9f4b63903642f9cb8e1b9")]
[assembly: AssemblyProduct("yokai.Plugin")]
[assembly: AssemblyTitle("yokai.Plugin")]
[assembly: AssemblyVersion("1.0.3.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;
}
}
}
namespace yokai.Plugin
{
public class CardTraitUpgradeByStatusScaling : 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 class StatusEffectHauntState : StatusEffectState
{
private RoomStateHauntModifier? damageModifier;
protected override void CopyStateForPreviewInternal(StatusEffectState dest, List<IRoomStateModifier> characterRoomStateModifiers)
{
if (dest is StatusEffectHauntState statusEffectHauntState)
{
statusEffectHauntState.damageModifier = damageModifier?.CopyForPreview();
int num = ((damageModifier != null) ? characterRoomStateModifiers.IndexOf((IRoomStateModifier)(object)damageModifier) : (-1));
if (num >= 0)
{
characterRoomStateModifiers[num] = (IRoomStateModifier)(object)statusEffectHauntState.damageModifier;
}
}
}
public override void OnStacksAdded(CharacterState character, int numStacksAdded, AddStatusEffectParams addStatusEffectParams, ICoreGameManagers coreGameManagers)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//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)
if (coreGameManagers.GetSaveManager().PreviewMode == ((StatusEffectState)this).IsPreviewModeCopy())
{
if (damageModifier == null)
{
RoomModifierData val = new RoomModifierData();
damageModifier = new RoomStateHauntModifier();
((RoomStateModifierBase)damageModifier).Initialize(val, coreGameManagers);
damageModifier.IsPreviewModeCopy = ((StatusEffectState)this).IsPreviewModeCopy();
damageModifier.TeamType = character.GetTeamType();
character.AddNewCharacterRoomModifierState((IRoomStateModifier)(object)damageModifier);
}
if (damageModifier != null)
{
damageModifier.DamageModifier = ((StatusEffectState)this).GetAssociatedCharacter().GetStatusEffectStacks(((StatusEffectState)this).GetStatusId());
RoomManager roomManager = coreGameManagers.GetRoomManager();
RoomState currentRoom = character.GetCurrentRoom(false);
bool flag = roomManager.CurrentSelectedRoom == currentRoom.GetRoomIndex();
currentRoom.UpdateRoomSelectedRoomStateModifiers(flag, coreGameManagers);
}
}
}
public override void OnStacksRemoved(CharacterState character, int numStacksRemoved, ICoreGameManagers coreGameManagers)
{
if (damageModifier != null)
{
damageModifier.DamageModifier = ((StatusEffectState)this).GetAssociatedCharacter().GetStatusEffectStacks(((StatusEffectState)this).GetStatusId());
}
}
}
internal class StatusEffectPanicState : 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 StatusEffectPanicState <>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_004f: 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_0091: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
StatusEffectPanicState statusEffectPanicState = <>4__this;
switch (num)
{
default:
return false;
case 0:
{
<>1__state = -1;
CoreSignals.DamageAppliedPlaySound.Dispatch((Type)2);
CombatManager combatManager = coreGameManagers.GetCombatManager();
int damageAmount = statusEffectPanicState.GetDamageAmount(statusEffectPanicState.stacks);
CharacterState associatedCharacter = statusEffectPanicState.associatedCharacter;
ApplyDamageToTargetParameters val = default(ApplyDamageToTargetParameters);
val.damageType = (Type)2;
StatusEffectData sourceStatusEffectData = ((StatusEffectState)statusEffectPanicState).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 = "panic";
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)
{
return GetDamageAmount(stacks);
}
private int GetDamageAmount(int stacks)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
return (((StatusEffectState)this).GetParamInt() + base.relicManager.GetModifiedStatusMagnitudePerStack("yokai.plugin_panic", ((StatusEffectState)this).GetAssociatedCharacter().GetTeamType())) * stacks;
}
}
[BepInPlugin("yokai.Plugin", "yokai.Plugin", "1.0.3")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger = new ManualLogSource("yokai.Plugin");
public void Awake()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
Railhead.GetBuilder().Configure("yokai.Plugin", (Action<IConfigurationBuilder>)delegate(IConfigurationBuilder c)
{
ConfigurationExtensions.AddMergedJsonFile(c, new List<string>(58)
{
"json/global.json", "json/class.json", "json/champions/champion_kitsune.json", "json/champions/champion_tengu.json", "json/units/unit_boroboroton.json", "json/units/unit_ippondatara.json", "json/units/unit_kodama.json", "json/units/unit_oni.json", "json/units/unit_wanyudo.json", "json/units/unit_qilin.json",
"json/units/unit_kasaobake.json", "json/units/unit_nurikabe.json", "json/units/unit_umibozu.json", "json/units/unit_yukionna.json", "json/units/unit_orochi.json", "json/units/unit_chochinobake.json", "json/units/unit_kappa.json", "json/units/unit_shogoro.json", "json/spells/spell_darkness.json", "json/spells/spell_parade.json",
"json/spells/spell_possession.json", "json/spells/spell_shudder.json", "json/spells/spell_tanukicharm.json", "json/spells/spell_wailingecho.json", "json/spells/spell_purityritual.json", "json/spells/spell_furiousanger.json", "json/spells/spell_sacredtrees.json", "json/spells/spell_nightmare.json", "json/spells/spell_frightfullaughter.json", "json/spells/spell_thunderingdrums.json",
"json/spells/spell_bagofwind.json", "json/spells/spell_shrinedance.json", "json/spells/spell_thousanddemonmarch.json", "json/spells/spell_onmyojitome.json", "json/spells/spell_sesshosekispike.json", "json/spells/spell_itsumadeitsumade.json", "json/spells/spell_gashadokurosstride.json", "json/spells/spell_draconictyphoon.json", "json/spells/spell_heartstopper.json", "json/enhancers/enhancer_Fearstone.json",
"json/equipment/equipment_divinebranch.json", "json/equipment/equipment_kusarigama.json", "json/rooms/room_demonparade.json", "json/rooms/room_toriigate.json", "json/rooms/room_snaketrail.json", "json/relics/dojigourd.json", "json/relics/noblepurse.json", "json/relics/sudamaseal.json", "json/relics/tengufeather.json", "json/relics/yokaiincense.json",
"json/relics/paradebanner.json", "json/relics/scampuss.json", "json/relics/hannyamask.json", "json/relics/grudge.json", "json/relics/onimask.json", "json/relics/relic11.json", "json/status_effects/haunt.json", "json/status_effects/panic.json"
});
});
Logger.LogInfo((object)"Plugin yokai.Plugin is loaded!");
new Harmony("yokai.Plugin").PatchAll();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "yokai.Plugin";
public const string PLUGIN_NAME = "yokai.Plugin";
public const string PLUGIN_VERSION = "1.0.3";
}
}
namespace yokai.Plugin.code.RoomModifiers
{
public class RoomStateHauntModifier : RoomStateModifierBase, IRoomStateModifier, ILocalizationParamInt, ILocalizationParameterContext, IRoomStateDamageModifier
{
public int DamageModifier;
public Type TeamType;
public bool IsPreviewModeCopy { get; set; }
public RoomStateHauntModifier CopyForPreview()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
RoomStateHauntModifier roomStateHauntModifier = new RoomStateHauntModifier();
((RoomStateModifierBase)this).CopyBaseStateForPreview((RoomStateModifierBase)(object)roomStateHauntModifier);
roomStateHauntModifier.DamageModifier = DamageModifier;
roomStateHauntModifier.TeamType = TeamType;
roomStateHauntModifier.IsPreviewModeCopy = true;
return roomStateHauntModifier;
}
public int GetModifiedAttackDamage(Type damageType, CharacterState attackerState, bool requestingForCharacterStats, ICoreGameManagers coreGameManagers)
{
if (requestingForCharacterStats)
{
return ((RoomStateModifierBase)this).GetDynamicInt(attackerState);
}
return 0;
}
public int GetModifiedMagicPowerDamage(ICoreGameManagers coreGameManagers)
{
return 0;
}
public override int GetDynamicInt(CharacterState characterContext)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)characterContext.GetTeamType() == 2)
{
return DamageModifier;
}
return 0;
}
public override bool GetShowTooltip()
{
return false;
}
}
}