using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Obeliskial_Essentials;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.shazixnar.ThreeElementMasterTraits")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("three element master Evelyn, made by Shazixnar")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("Three Element Master Evelyn")]
[assembly: AssemblyTitle("com.shazixnar.ThreeElementMasterTraits")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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 TraitMod
{
[HarmonyPatch]
internal class Traits
{
[HarmonyPostfix]
[HarmonyPatch(typeof(Character), "BeginTurnPerks")]
public static void BeginTurnPerksPostfix(ref Character __instance)
{
int auraCharges = __instance.GetAuraCharges("burn");
int auraCharges2 = __instance.GetAuraCharges("chill");
int auraCharges3 = __instance.GetAuraCharges("spark");
int value = Traverse.Create((object)__instance).Field("position").GetValue<int>();
if (!__instance.IsHero && auraCharges3 > 0 && auraCharges > 0 && auraCharges2 > 0 && AtOManager.Instance.TeamHaveTrait("evelynelementalweaver"))
{
List<NPC> nPCSides = MatchManager.Instance.GetNPCSides(value);
for (int i = 0; i < nPCSides.Count; i++)
{
((Character)nPCSides[i]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("burn"), Functions.FuncRoundToInt((float)auraCharges3 * 0.3f), false, (CardClass)11, true, true);
((Character)nPCSides[i]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("chill"), Functions.FuncRoundToInt((float)auraCharges3 * 0.3f), false, (CardClass)11, true, true);
}
__instance.SetAura((Character)null, Globals.Instance.GetAuraCurseData("burn"), Functions.FuncRoundToInt((float)auraCharges3 * 0.3f), false, (CardClass)11, true, true);
__instance.SetAura((Character)null, Globals.Instance.GetAuraCurseData("chill"), Functions.FuncRoundToInt((float)auraCharges3 * 0.3f), false, (CardClass)11, true, true);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Character), "SetAura")]
public static void SetAuraPostfix(ref Character __instance)
{
int auraCharges = __instance.GetAuraCharges("burn");
int auraCharges2 = __instance.GetAuraCharges("chill");
int auraCharges3 = __instance.GetAuraCharges("spark");
if (__instance.IsHero || auraCharges != 200 || auraCharges2 != 200 || auraCharges3 != 200 || !AtOManager.Instance.TeamHaveTrait("evelynelementalamplifier"))
{
return;
}
__instance.IndirectDamage((DamageType)4, 600, (AudioClip)null, "", "", "");
__instance.IndirectDamage((DamageType)5, 600, (AudioClip)null, "", "", "");
__instance.IndirectDamage((DamageType)6, 600, (AudioClip)null, "", "", "");
for (int num = __instance.AuraList.Count - 1; num >= 0; num--)
{
if (__instance.AuraList[num].ACData.Id == "burn" || __instance.AuraList[num].ACData.Id == "chill" || __instance.AuraList[num].ACData.Id == "spark")
{
__instance.AuraList.RemoveAt(num);
}
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Character), "SetEvent")]
public static void SetEventPrefix(ref Character __instance, ref EventActivation theEvent, Character target = null)
{
if ((int)theEvent == 3 && !__instance.IsHero && AtOManager.Instance.TeamHaveTrait("evelynelementalweaver") && __instance.HasEffect("burn"))
{
__instance.IndirectDamage((DamageType)4, Functions.FuncRoundToInt((float)__instance.GetAuraCharges("burn") * 0.15f), (AudioClip)null, "", "", "");
__instance.IndirectDamage((DamageType)6, Functions.FuncRoundToInt((float)__instance.GetAuraCharges("burn") * 0.15f), (AudioClip)null, "", "", "");
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(AtOManager), "GlobalAuraCurseModificationByTraitsAndItems")]
public static void GlobalAuraCurseModificationByTraitsAndItemsPostfix(ref AtOManager __instance, ref AuraCurseData __result, string _type, string _acId, Character _characterCaster, Character _characterTarget)
{
bool flag = false;
bool flag2 = false;
if (_characterCaster != null && _characterCaster.IsHero)
{
flag = _characterCaster.IsHero;
}
if (_characterTarget != null && _characterTarget.IsHero)
{
flag2 = true;
}
if (_acId == "burn" && _type == "consume" && !flag && __instance.TeamHavePerk("mainperkburn2d"))
{
__result.DoubleDamageIfCursesLessThan = 5;
}
if (_acId == "chill" && _type == "set" && !flag2 && __instance.TeamHaveTrait("evelynelementalweaver"))
{
__result.ResistModified3 = (DamageType)6;
__result.ResistModifiedPercentagePerStack3 = -0.3f;
}
}
}
}
namespace ThreeElementMasterEvelyn
{
[BepInPlugin("com.shazixnar.ThreeElementMasterTraits", "Three Element Master Evelyn", "1.0.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("AcrossTheObelisk.exe")]
public class Plugin : BaseUnityPlugin
{
internal const int ModDate = 20231217;
private readonly Harmony harmony = new Harmony("com.shazixnar.ThreeElementMasterTraits");
internal static ManualLogSource Log;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"com.shazixnar.ThreeElementMasterTraits 1.0.2 has loaded!");
Essentials.RegisterMod("Three Element Master Evelyn", "Shazixnar", "Redone Evelyn traits and element cards, as well as a perk.", "1.0.2", 20231217, "https://across-the-obelisk.thunderstore.io/package/Shazixnar/Three_Element_Master_Evelyn/", (string[])null, "Three Element Master Evelyn", 100, new string[5] { "content", "hero", "trait", "card", "perk" }, "", true);
Essentials.medsTexts["custommainperkburn2d"] = "Burn on enemies deals double damage if the target have 4 or less curses (Burn included)";
harmony.PatchAll();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "com.shazixnar.ThreeElementMasterTraits";
public const string PLUGIN_NAME = "Three Element Master Evelyn";
public const string PLUGIN_VERSION = "1.0.2";
}
}