using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using COTL_API.CustomTarotCard;
using COTL_API.Helpers;
using HarmonyLib;
using Lamb.UI;
using Microsoft.CodeAnalysis;
using SuperchargedTarotsUA.Tarots;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("SuperchargedTarotsUA")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SuperchargedTarotsUA")]
[assembly: AssemblyTitle("SuperchargedTarotsUA")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SuperchargedTarotsUA
{
[BepInPlugin("InfernoDragon0.cotl.SuperchargedTarotsUA", "SuperchargedTarotsUA", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[HarmonyPatch]
public class Plugin : BaseUnityPlugin
{
public const string PluginGuid = "InfernoDragon0.cotl.SuperchargedTarotsUA";
public const string PluginName = "SuperchargedTarotsUA";
public const string PluginVer = "1.0.0";
internal static ManualLogSource Log;
internal static readonly Harmony Harmony = new Harmony("InfernoDragon0.cotl.SuperchargedTarotsUA");
internal static string PluginPath;
public static Card secondWind;
public static Card finalStand;
public static Card reinforcement;
public static Card bloodForBlood;
public static Card staticElectricity;
public static Card duality;
public static Card transference;
public static Card wardingBond;
public static Card deathContract;
public static Card ignite;
internal static ConfigEntry<bool> tarotSecondWindConfig;
internal static ConfigEntry<bool> tarotFinalStandConfig;
internal static ConfigEntry<bool> tarotReinforcementConfig;
internal static ConfigEntry<bool> tarotBloodForBloodConfig;
internal static ConfigEntry<bool> tarotStaticElectricityConfig;
internal static ConfigEntry<bool> tarotDualityConfig;
internal static ConfigEntry<bool> tarotTransferenceConfig;
internal static ConfigEntry<bool> tarotWardingBondConfig;
internal static ConfigEntry<bool> tarotDeathContractConfig;
internal static ConfigEntry<bool> tarotIgniteConfig;
internal static ConfigEntry<bool> shouldAddCardConfig;
public static List<Card> coopCards = new List<Card>();
public static List<Card> soloCards = new List<Card>();
private void Awake()
{
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_0338: Unknown result type (might be due to invalid IL or missing references)
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
PluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
tarotSecondWindConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarotsUA", "Second Wind", true, "Enable this card?");
tarotFinalStandConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarotsUA", "Final Stand", true, "Enable this card?");
tarotReinforcementConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarotsUA", "Reinforcement", true, "Enable this card?");
tarotBloodForBloodConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarotsUA", "Blood For Blood", true, "Enable this card?");
tarotStaticElectricityConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarotsUA", "Static Electricity", true, "Enable this card?");
tarotDualityConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarotsUA", "Duality", true, "Enable this card?");
tarotTransferenceConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SupercargedTarotsUA", "Transference", true, "Enable this card?");
tarotWardingBondConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarotsUA", "Warding Bond", true, "Enable this card?");
tarotDeathContractConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarotsUA", "Death Contract", true, "Enable this card?");
tarotIgniteConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarotsUA", "Ignite", true, "Enable this card?");
shouldAddCardConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarotsUA", "EnableCoopSoloEffects", false, "Set to true if you would like effects of coop cards to apply in solo mode.");
if (tarotSecondWindConfig.Value)
{
secondWind = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_SecondWind());
}
if (tarotFinalStandConfig.Value)
{
finalStand = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_FinalStand());
}
if (tarotReinforcementConfig.Value)
{
reinforcement = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_Reinforcement());
}
if (tarotBloodForBloodConfig.Value)
{
bloodForBlood = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_BloodForBlood());
}
if (tarotStaticElectricityConfig.Value)
{
staticElectricity = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_StaticElectricity());
}
if (tarotDualityConfig.Value)
{
duality = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_Duality());
}
if (tarotTransferenceConfig.Value)
{
transference = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_Transference());
}
if (tarotWardingBondConfig.Value)
{
wardingBond = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_WardingBond());
}
if (tarotDeathContractConfig.Value)
{
deathContract = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_DeathContract());
}
if (tarotIgniteConfig.Value)
{
ignite = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_Ignite());
}
coopCards.Add(staticElectricity);
coopCards.Add(duality);
coopCards.Add(transference);
coopCards.Add(wardingBond);
coopCards.Add(deathContract);
coopCards.Add(ignite);
soloCards.Add(secondWind);
soloCards.Add(finalStand);
soloCards.Add(reinforcement);
soloCards.Add(bloodForBlood);
}
private void OnEnable()
{
Harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded SuperchargedTarotsUA!");
}
private void OnDisable()
{
Harmony.UnpatchSelf();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Unloaded SuperchargedTarotsUA!");
}
}
}
namespace SuperchargedTarotsUA.Tarots
{
internal class Tarot_BloodForBlood : CustomTarotCard
{
public override string InternalName => "TAROT_BLOODFORBLOOD_X";
public override Sprite CustomSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/tarot_bloodforblood.png"));
public override Sprite CustomBackSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cardback.png"));
public override string LocalisedName(int upgradeIndex)
{
return "<color=\"red\">Blood For Blood</color>";
}
public override string LocalisedLore()
{
return "<color=\"yellow\">[Supercharged Tarots: Unholy Alliance]</color>";
}
public override string LocalisedDescription(int upgradeIndex)
{
return "Killing an enemy grants you half a spirit heart.";
}
}
internal class Tarot_DeathContract : CustomTarotCard
{
public override string InternalName => "TAROT_DEATHCONTRACT_X";
public override Sprite CustomSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/tarot_deathcontract.png"));
public override Sprite CustomBackSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cardback.png"));
public override string LocalisedName(int upgradeIndex)
{
return "<color=\"red\">Death Contract</color>";
}
public override string LocalisedLore()
{
return "<color=\"yellow\">[Supercharged Tarots: Unholy Alliance]</color>";
}
public override string LocalisedDescription(int upgradeIndex)
{
return "Taking damage to red hearts transfers damage taken as blue hearts to the other player.";
}
}
internal class Tarot_Duality : CustomTarotCard
{
public override string InternalName => "TAROT_DUALITY_X";
public override Sprite CustomSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/tarot_duality.png"));
public override Sprite CustomBackSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cardback.png"));
public override string LocalisedName(int upgradeIndex)
{
return "<color=\"red\">Duality</color>";
}
public override string LocalisedLore()
{
return "<color=\"yellow\">[Supercharged Tarots: Unholy Alliance]</color>";
}
public override string LocalisedDescription(int upgradeIndex)
{
return "Attacking an enemy heals the other player for half a heart.";
}
}
internal class Tarot_FinalStand : CustomTarotCard
{
public override string InternalName => "TAROT_FINALSTAND_X";
public override Sprite CustomSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/tarot_finalstand.png"));
public override Sprite CustomBackSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cardback.png"));
public override string LocalisedName(int upgradeIndex)
{
return "<color=\"red\">Final Stand</color>";
}
public override string LocalisedLore()
{
return "<color=\"yellow\">[Supercharged Tarots: Unholy Alliance]</color>";
}
public override string LocalisedDescription(int upgradeIndex)
{
return "For every dead follower you own, increase weapon damage by 10%.";
}
public override float GetWeaponDamageMultiplerIncrease(TarotCard card)
{
int count = DataManager.instance.Followers_Dead.Count;
Plugin.Log.LogInfo((object)("Granting final stand bonus using " + count + " dead followers."));
return 1f + (float)count * 0.1f;
}
}
internal class Tarot_Ignite : CustomTarotCard
{
public override string InternalName => "TAROT_IGNITE_X";
public override Sprite CustomSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/tarot_ignite.png"));
public override Sprite CustomBackSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cardback.png"));
public override string LocalisedName(int upgradeIndex)
{
return "<color=\"red\">Ignite</color>";
}
public override string LocalisedLore()
{
return "<color=\"yellow\">[Supercharged Tarots: Unholy Alliance]</color>";
}
public override string LocalisedDescription(int upgradeIndex)
{
return "Both players explode when pressing Attack at the same time.";
}
}
internal class Tarot_Reinforcement : CustomTarotCard
{
public override string InternalName => "TAROT_REINFORCEMENT_X";
public override Sprite CustomSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/tarot_reinforcement.png"));
public override Sprite CustomBackSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cardback.png"));
public override string LocalisedName(int upgradeIndex)
{
return "<color=\"red\">Reinforcement</color>";
}
public override string LocalisedLore()
{
return "<color=\"yellow\">[Supercharged Tarots: Unholy Alliance]</color>";
}
public override string LocalisedDescription(int upgradeIndex)
{
return "You are immune to traps. Each time you take damage, summon a combat follower to fight for you.";
}
public override void ApplyInstantEffects(TarotCard card)
{
((Health)PlayerFarming.Instance.health).ImmuneToTraps = true;
}
}
internal class Tarot_SecondWind : CustomTarotCard
{
public override string InternalName => "TAROT_SECONDWIND_X";
public override Sprite CustomSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/tarot_secondwind.png"));
public override Sprite CustomBackSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cardback.png"));
public override string LocalisedName(int upgradeIndex)
{
return "<color=\"red\">Second Wind</color>";
}
public override string LocalisedLore()
{
return "<color=\"yellow\">[Supercharged Tarots: Unholy Alliance]</color>";
}
public override string LocalisedDescription(int upgradeIndex)
{
return "Gain 2 Blue Hearts for each heart you currently have.";
}
public override void ApplyInstantEffects(TarotCard card)
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
float totalSpiritHearts = ((Health)((Component)PlayerFarming.Instance).GetComponent<HealthPlayer>()).TotalSpiritHearts;
float blackHearts = ((Health)((Component)PlayerFarming.Instance).GetComponent<HealthPlayer>()).BlackHearts;
float blueHearts = ((Health)((Component)PlayerFarming.Instance).GetComponent<HealthPlayer>()).BlueHearts;
float totalHP = ((Health)((Component)PlayerFarming.Instance).GetComponent<HealthPlayer>()).totalHP;
float num = (totalSpiritHearts + blackHearts + blueHearts + totalHP) * 2f;
HealthPlayer component = ((Component)PlayerFarming.Instance).GetComponent<HealthPlayer>();
((Health)component).BlueHearts = ((Health)component).BlueHearts + num;
Vector3 position = PlayerFarming.Instance.CameraBone.transform.position;
BiomeConstants.Instance.EmitHeartPickUpVFX(position, 0f, "red", "burst_big", true);
}
}
internal class Tarot_StaticElectricity : CustomTarotCard
{
public override string InternalName => "TAROT_STATICELECTRICITY_X";
public override Sprite CustomSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/tarot_staticelectricity.png"));
public override Sprite CustomBackSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cardback.png"));
public override string LocalisedName(int upgradeIndex)
{
return "<color=\"red\">Static Electricity</color>";
}
public override string LocalisedLore()
{
return "<color=\"yellow\">[Supercharged Tarots: Unholy Alliance]</color>";
}
public override string LocalisedDescription(int upgradeIndex)
{
return "While near each other, pressing Attack generate lightning strikes.";
}
}
internal class Tarot_Transference : CustomTarotCard
{
public override string InternalName => "TAROT_TRANSFERENCE_X";
public override Sprite CustomSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/tarot_transference.png"));
public override Sprite CustomBackSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cardback.png"));
public override string LocalisedName(int upgradeIndex)
{
return "<color=\"red\">Transference</color>";
}
public override string LocalisedLore()
{
return "<color=\"yellow\">[Supercharged Tarots: Unholy Alliance]</color>";
}
public override string LocalisedDescription(int upgradeIndex)
{
return "Taking damage will make the other player explode in a large radius.";
}
}
internal class Tarot_WardingBond : CustomTarotCard
{
public override string InternalName => "TAROT_WARDINGBOND_X";
public override Sprite CustomSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/tarot_wardingbond.png"));
public override Sprite CustomBackSprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cardback.png"));
public override string LocalisedName(int upgradeIndex)
{
return "<color=\"red\">Warding Bond</color>";
}
public override string LocalisedLore()
{
return "<color=\"yellow\">[Supercharged Tarots: Unholy Alliance]</color>";
}
public override string LocalisedDescription(int upgradeIndex)
{
return "While near each other, negate damage taken at a 70% chance.";
}
}
}
namespace SuperchargedTarotsUA.Patches
{
[HarmonyPatch]
internal class PerfectCastPatch
{
[HarmonyPatch(typeof(UITarotChoiceOverlayController), "Show")]
[HarmonyPrefix]
public static bool UITarotChoiceOverlayController_Show(UITarotChoiceOverlayController __instance, TarotCard card1, TarotCard card2, bool instant)
{
if (Chainloader.PluginInfos.ContainsKey("InfernoDragon0.cotl.SuperchargedTarots"))
{
if (Random.value > 0.5f)
{
Plugin.Log.LogInfo((object)"Let SuperchargedTarots decide the cards.");
return true;
}
Plugin.Log.LogInfo((object)"We decide our own cards.");
}
__instance._card1 = GetCard();
__instance._card2 = GetCard(customFirst: false);
__instance._uiCard1.Play(__instance._card1);
__instance._uiCard2.Play(__instance._card2);
__instance.OnTarotCardSelected = (Action<TarotCard>)Delegate.Combine(__instance.OnTarotCardSelected, (Action<TarotCard>)delegate(TarotCard card)
{
Plugin.Log.LogInfo((object)("keeping " + ((object)(Card)(ref card.CardType)).ToString()));
});
((UIMenuBase)__instance).Show(instant);
return false;
}
private static TarotCard GetCard(bool customFirst = true)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
TarotCard val = null;
bool flag = false;
if (customFirst)
{
Card val2 = Plugin.soloCards[Random.Range(0, Plugin.soloCards.Count)];
if (CoopManager.CoopActive || Plugin.shouldAddCardConfig.Value)
{
if (Random.value > 0.4f)
{
Plugin.Log.LogInfo((object)"Giving Supercharged UA CO OP Card");
val2 = Plugin.coopCards[Random.Range(0, Plugin.coopCards.Count)];
}
else
{
Plugin.Log.LogInfo((object)"Giving Supercharged UA SOLO Card");
}
}
val = new TarotCard(val2, 0);
Plugin.Log.LogInfo((object)("Giving Supercharged UA Card " + ((object)(Card)(ref val2)).ToString()));
}
if (DataManager.Instance.PlayerRunTrinketsContains(val, PlayerFarming.Instance))
{
Plugin.Log.LogInfo((object)"custom already taken");
flag = true;
}
if (PlayerFarming.playersCount > 1 && DataManager.Instance.PlayerRunTrinketsContains(val, PlayerFarming.players[1]))
{
Plugin.Log.LogInfo((object)"custom already taken by other player");
flag = true;
}
if (flag || val == null)
{
val = TarotCards.DrawRandomCard(PlayerFarming.Instance, true);
}
Plugin.Log.LogInfo((object)("Giving Supercharged UA Card second " + ((object)(Card)(ref val.CardType)).ToString()));
return val;
}
[HarmonyPatch(typeof(Health), "HandleDamageModifierBuff")]
[HarmonyPrefix]
public static bool Health_HandleDamageModifierBuff(Health __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (TrinketManager.HasTrinket(Plugin.bloodForBlood))
{
HealthPlayer health = PlayerFarming.Instance.health;
float totalSpiritHearts = ((Health)health).TotalSpiritHearts;
((Health)health).TotalSpiritHearts = totalSpiritHearts + 1f;
Plugin.Log.LogInfo((object)"Blood for Blood: Gained 1 Empty Spirit Heart");
}
if (TrinketManager.HasTrinket(Plugin.duality))
{
Plugin.Log.LogInfo((object)"Heal both players");
((Health)PlayerFarming.Instance.health).Heal(1f);
if (PlayerFarming.playersCount > 1)
{
((Health)PlayerFarming.players[1].health).Heal(1f);
}
}
return true;
}
[HarmonyPatch(typeof(HealthPlayer), "DealDamage")]
[HarmonyPrefix]
public static bool HealthPlayer_DealDamage_Prefix(HealthPlayer __instance, out float __state)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
__state = ((Health)__instance).HP;
if (TrinketManager.HasTrinket(Plugin.deathContract))
{
Plugin.Log.LogInfo((object)("Death Contract: Pre Damage HP " + __state));
}
return true;
}
[HarmonyPatch(typeof(HealthPlayer), "DealDamage")]
[HarmonyPostfix]
public static void HealthPlayer_DealDamage(HealthPlayer __instance, ref bool __result, float __state)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
if (TrinketManager.HasTrinket(Plugin.reinforcement) && __result)
{
if ((Object)(object)PlayerFarming.Instance.playerRelic != (Object)null)
{
Plugin.Log.LogInfo((object)"Has Relic");
VFXSequence val = EquipmentManager.GetRelicData((RelicType)42).VFXData.PlayNewSequence(((Component)PlayerFarming.Instance).transform, (Transform[])(object)new Transform[1] { ((Component)PlayerFarming.Instance).transform }, (Transform)null, true);
val.OnImpact = (Action<VFXObject, int>)Delegate.Combine(val.OnImpact, new Action<VFXObject, int>(PlayerFarming.Instance.playerRelic.SpawnFriendlyEnemy));
}
else
{
Plugin.Log.LogInfo((object)"No Relic");
}
}
if (TrinketManager.HasTrinket(Plugin.transference) && __result)
{
Plugin.Log.LogInfo((object)"Other player explodes.");
if (PlayerFarming.playersCount > 1)
{
if ((Object)(object)PlayerFarming.players[0].health == (Object)(object)__instance)
{
Explosion.CreateExplosion(((Component)PlayerFarming.players[1]).transform.position, (Team)1, (Health)(object)PlayerFarming.players[1].health, 12f, 4f, -1f, false, 1f, (AttackFlags)0, false);
}
else
{
Explosion.CreateExplosion(((Component)PlayerFarming.players[0]).transform.position, (Team)1, (Health)(object)PlayerFarming.players[0].health, 12f, 4f, -1f, false, 1f, (AttackFlags)0, false);
}
}
else
{
if (Plugin.shouldAddCardConfig.Value)
{
Explosion.CreateExplosion(((Component)PlayerFarming.players[0]).transform.position, (Team)1, (Health)(object)PlayerFarming.players[0].health, 4f, 2f, -1f, false, 1f, (AttackFlags)0, false);
}
Plugin.Log.LogInfo((object)"Transference: Not multiplayer");
}
}
if (!TrinketManager.HasTrinket(Plugin.deathContract) || !__result)
{
return;
}
if (((Health)__instance).HP < __state)
{
if (PlayerFarming.playersCount > 1)
{
if ((Object)(object)PlayerFarming.players[0].health == (Object)(object)__instance)
{
HealthPlayer health = PlayerFarming.players[1].health;
float blueHearts = ((Health)health).BlueHearts;
((Health)health).BlueHearts = blueHearts + 1f;
Plugin.Log.LogInfo((object)"Death Contract: Give P2 Health");
}
else
{
HealthPlayer health2 = PlayerFarming.players[0].health;
float blueHearts = ((Health)health2).BlueHearts;
((Health)health2).BlueHearts = blueHearts + 1f;
Plugin.Log.LogInfo((object)"Death Contract: Give P1 Health");
}
}
else
{
if (Plugin.shouldAddCardConfig.Value)
{
HealthPlayer health3 = PlayerFarming.players[0].health;
float blueHearts = ((Health)health3).BlueHearts;
((Health)health3).BlueHearts = blueHearts + 1f;
}
Plugin.Log.LogInfo((object)"Death Contract: Not multiplayer");
}
Plugin.Log.LogInfo((object)("Death Contract: Post Damage HP Loss " + __state));
}
else
{
Plugin.Log.LogInfo((object)("Death Contract: No HP Loss " + __state));
}
}
[HarmonyPatch(typeof(TrinketManager), "CanNegateDamage")]
[HarmonyPrefix]
public static bool TrinketManager_CanNegateDamage(TrinketManager __instance, ref bool __result)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (TrinketManager.HasTrinket(Plugin.wardingBond))
{
__result = true;
Plugin.Log.LogInfo((object)"Warding Bond: Negate Damage possible");
return false;
}
return true;
}
[HarmonyPatch(typeof(Health), "ChanceToNegateDamage")]
[HarmonyPrefix]
public static bool Health_ChanceToNegateDamage(Health __instance, ref bool __result)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if (TrinketManager.HasTrinket(Plugin.wardingBond))
{
bool flag = Random.value > 0.3f;
if (PlayerFarming.playersCount > 1)
{
if ((double)Vector3.Distance(((Component)PlayerFarming.players[0]).transform.position, ((Component)PlayerFarming.players[1]).transform.position) >= 3.0)
{
Plugin.Log.LogInfo((object)("Warding Bond: Not near each other or single player - " + __result));
}
else if (flag)
{
__result = true;
Plugin.Log.LogInfo((object)"Warding Bond: Near each other, negate");
}
else
{
Plugin.Log.LogInfo((object)"Warding Bond: no negate");
}
}
else if (flag && Plugin.shouldAddCardConfig.Value)
{
__result = true;
Plugin.Log.LogInfo((object)"Warding Bond: Negate Damage Solo");
}
return false;
}
return true;
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPostfix]
public static void PlayerWeapon_DoAttackRoutine(PlayerWeapon __instance)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
if (!InputManager.Gameplay.GetAttackButtonDown((PlayerFarming)null) && !InputManager.Gameplay.GetHeavyAttackButtonDown((PlayerFarming)null))
{
return;
}
if (TrinketManager.HasTrinket(Plugin.staticElectricity))
{
if (PlayerFarming.playersCount <= 1 || (double)Vector3.Distance(((Component)PlayerFarming.players[0]).transform.position, ((Component)PlayerFarming.players[1]).transform.position) >= 3.0)
{
if (PlayerFarming.playersCount <= 1 && Plugin.shouldAddCardConfig.Value)
{
new LightningStrikeAbility(1).Play(((Component)PlayerFarming.players[0]).gameObject, (Team)2, 12f, PlayerFarming.players[0], true, (List<Health>)null);
}
Plugin.Log.LogInfo((object)"Static Electricity: Not near each other or single player");
}
else
{
Plugin.Log.LogInfo((object)"Static Electricity: creating lightning strikes");
new LightningStrikeAbility(1).Play(((Component)PlayerFarming.players[0]).gameObject, (Team)2, 12f, PlayerFarming.players[0], true, (List<Health>)null);
new LightningStrikeAbility(1).Play(((Component)PlayerFarming.players[1]).gameObject, (Team)2, 12f, PlayerFarming.players[1], true, (List<Health>)null);
}
}
if (!TrinketManager.HasTrinket(Plugin.ignite))
{
return;
}
if (PlayerFarming.playersCount > 1)
{
if ((double)Mathf.Abs(PlayerFarming.players[0].playerWeapon.TimeOfAttack - PlayerFarming.players[1].playerWeapon.TimeOfAttack) < 0.2)
{
Explosion.CreateExplosion(((Component)PlayerFarming.players[0]).transform.position, (Team)1, (Health)(object)PlayerFarming.players[0].health, 3f, -1f, -1f, false, 1f, (AttackFlags)0, false);
Explosion.CreateExplosion(((Component)PlayerFarming.players[1]).transform.position, (Team)1, (Health)(object)PlayerFarming.players[1].health, 3f, -1f, -1f, false, 1f, (AttackFlags)0, false);
Plugin.Log.LogInfo((object)"Ignite: creating explosion");
}
}
else
{
if (Plugin.shouldAddCardConfig.Value)
{
Explosion.CreateExplosion(((Component)PlayerFarming.players[0]).transform.position, (Team)1, (Health)(object)PlayerFarming.players[0].health, 3f, -1f, -1f, false, 1f, (AttackFlags)0, false);
}
Plugin.Log.LogInfo((object)"Ignite: not multiplayer");
}
}
}
}