using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
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.binbin.UnofficialBalancePatch")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.8.3.0")]
[assembly: AssemblyInformationalVersion("1.8.3+a7fd999ef6dad52671d0b23e7f5687d2e4030803")]
[assembly: AssemblyProduct("UnofficialBalancePatch")]
[assembly: AssemblyTitle("com.binbin.UnofficialBalancePatch")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.8.3.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 UnofficialBalancePatch
{
public class BalanceFunctions
{
public static string NumFormatItem(int num, bool plus = false, bool percent = false)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append(" <nobr>");
if (num > 0)
{
stringBuilder.Append("<color=#263ABC><size=+.1>");
if (plus)
{
stringBuilder.Append("+");
}
}
else
{
stringBuilder.Append("<color=#720070><size=+.1>");
if (plus)
{
stringBuilder.Append("-");
}
}
stringBuilder.Append(Mathf.Abs(num));
if (percent)
{
stringBuilder.Append("%");
}
stringBuilder.Append("</color></size></nobr>");
return stringBuilder.ToString();
}
public static void BinbinNormalizeDescription(ref CardData __instance, StringBuilder stringBuilder)
{
stringBuilder.Replace("<c>", "<color=#5E3016>");
stringBuilder.Replace("</c>", "</color>");
stringBuilder.Replace("<nb>", "<nobr>");
stringBuilder.Replace("</nb>", "</nobr>");
stringBuilder.Replace("<br1>", "<br><line-height=15%><br></line-height>");
stringBuilder.Replace("<br2>", "<br><line-height=30%><br></line-height>");
stringBuilder.Replace("<br3>", "<br><line-height=50%><br></line-height>");
string input = stringBuilder.ToString();
input = Regex.Replace(input, "[,][ ]*(<(.*?)>)*(.)", (Match m) => m.ToString().ToLower());
input = Regex.Replace(input, "<br>\\w", (Match m) => m.ToString().ToUpper());
Globals.Instance.CardsDescriptionNormalized[__instance.Id] = stringBuilder.ToString();
__instance.DescriptionNormalized = input;
Traverse.Create((object)__instance).Field("descriptionNormalized").SetValue((object)input);
}
public static void HandleDamagePercentDescription(ref StringBuilder stringBuilder, ItemData itemData, DamageType damageType, float percentIncrease)
{
//IL_0024: 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_002a: Invalid comparison between Unknown and I4
if (itemData.Id == "battleaxerare")
{
Plugin.LogDebug(" battleaxerare");
}
if ((int)damageType != 0 && (int)damageType != 10 && percentIncrease != 0f)
{
string text = ((object)(DamageType)(ref damageType)).ToString().ToLower();
int num = Functions.FuncRoundToInt(itemData.DamagePercentBonusValue);
string key = "item" + text + "Damages";
string value = string.Format(Essentials.medsTexts[key], NumFormatItem(num, plus: true, percent: true)) + "\n";
stringBuilder.Insert(0, value);
}
}
public static void HandleAllDamagePercentDescriptions(ref CardData __instance)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Invalid comparison between Unknown and I4
//IL_0071: 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)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
StringBuilder stringBuilder = new StringBuilder();
if (!((Object)(object)__instance.Item == (Object)null))
{
ItemData item = __instance.Item;
if ((int)item.DamagePercentBonus != 0 || (int)item.DamagePercentBonus2 != 0 || (int)item.DamagePercentBonus3 != 0)
{
stringBuilder.Append(Globals.Instance.CardsDescriptionNormalized[__instance.Id]);
HandleDamagePercentDescription(ref stringBuilder, item, __instance.Item.DamagePercentBonus, __instance.Item.DamagePercentBonusValue);
HandleDamagePercentDescription(ref stringBuilder, item, __instance.Item.DamagePercentBonus2, __instance.Item.DamagePercentBonusValue2);
HandleDamagePercentDescription(ref stringBuilder, item, __instance.Item.DamagePercentBonus3, __instance.Item.DamagePercentBonusValue3);
BinbinNormalizeDescription(ref __instance, stringBuilder);
}
}
}
public static void UpdateMaxMadnessChargesByItem(ref AuraCurseData __result, Character characterOfInterest, string itemID)
{
if ((Object)(object)__result == (Object)null)
{
Plugin.LogDebug("null AuraCurse");
return;
}
CustomFunctions.AppliesTo appliesTo = (__result.IsAura ? CustomFunctions.AppliesTo.Heroes : CustomFunctions.AppliesTo.Monsters);
if (CustomFunctions.IfCharacterHas(characterOfInterest, CustomFunctions.CharacterHas.Item, itemID + "rare", appliesTo))
{
Plugin.LogDebug("UpdateChargesByItem: " + itemID + "rare");
ItemData itemData = Globals.Instance.GetItemData(itemID + "rare");
if (!((Object)(object)itemData == (Object)null))
{
if (__result.MaxCharges != -1)
{
AuraCurseData obj = __result;
obj.MaxCharges += itemData.AuracurseCustomModValue1;
}
if (__result.MaxMadnessCharges != -1)
{
AuraCurseData obj2 = __result;
obj2.MaxMadnessCharges += itemData.AuracurseCustomModValue1;
}
}
}
else
{
if (!CustomFunctions.IfCharacterHas(characterOfInterest, CustomFunctions.CharacterHas.Item, itemID, appliesTo))
{
return;
}
Plugin.LogDebug("UpdateChargesByItem: " + itemID);
ItemData itemData2 = Globals.Instance.GetItemData(itemID);
if (!((Object)(object)itemData2 == (Object)null))
{
if (__result.MaxCharges != -1)
{
AuraCurseData obj3 = __result;
obj3.MaxCharges += itemData2.AuracurseCustomModValue1;
}
if (__result.MaxMadnessCharges != -1)
{
AuraCurseData obj4 = __result;
obj4.MaxMadnessCharges += itemData2.AuracurseCustomModValue1;
}
Plugin.LogDebug($"UpdateChargesByItem: {itemID} - post update max charges {__result.MaxMadnessCharges}");
}
}
}
public static string SpriteText(string sprite)
{
StringBuilder stringBuilder = new StringBuilder();
string text = sprite.ToLower().Replace(" ", "");
switch (text)
{
case "block":
case "card":
stringBuilder.Append("<space=.2>");
break;
case "piercing":
stringBuilder.Append("<space=.4>");
break;
case "bleed":
stringBuilder.Append("<space=.1>");
break;
case "bless":
stringBuilder.Append("<space=.1>");
break;
default:
stringBuilder.Append("<space=.3>");
break;
}
stringBuilder.Append(" <space=-.2>");
stringBuilder.Append("<size=+.1><sprite name=");
stringBuilder.Append(text);
stringBuilder.Append("></size>");
switch (text)
{
case "bleed":
stringBuilder.Append("<space=-.4>");
break;
case "card":
stringBuilder.Append("<space=-.2>");
break;
case "powerful":
case "fury":
stringBuilder.Append("<space=-.1>");
break;
default:
stringBuilder.Append("<space=-.2>");
break;
case "reinforce":
case "fire":
break;
}
return stringBuilder.ToString();
}
public static string ColorTextArray(string type, params string[] text)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("<nobr>");
if (type == null || type.Length != 0)
{
switch (type)
{
case "damage":
stringBuilder.Append("<color=#B00A00>");
break;
case "heal":
stringBuilder.Append("<color=#1E650F>");
break;
case "aura":
stringBuilder.Append("<color=#263ABC>");
break;
case "curse":
stringBuilder.Append("<color=#720070>");
break;
case "system":
stringBuilder.Append("<color=#5E3016>");
break;
default:
stringBuilder.Append("<color=#5E3016");
stringBuilder.Append(">");
break;
}
}
int num = 0;
foreach (string value in text)
{
if (num > 0)
{
stringBuilder.Append(" ");
}
stringBuilder.Append(value);
num++;
}
if (type != "")
{
stringBuilder.Append("</color>");
}
stringBuilder.Append("</nobr> ");
return stringBuilder.ToString();
}
public static void AppendDescriptionsToCards(CardData __instance, ref StringBuilder stringBuilder1)
{
if (BalancePatches.cardsToAppendDescription.Contains(__instance.Id))
{
Plugin.LogDebug("Creating description for " + __instance.Id);
Plugin.LogDebug($"Current description {__instance.Id}: {stringBuilder1}");
string text = Plugin.itemStem + __instance.Id;
stringBuilder1.Append(Functions.FormatStringCard(Texts.Instance.GetText(text, "")));
}
}
public static void PrependDescriptionsToCards(CardData __instance, ref StringBuilder stringBuilder1)
{
if (BalancePatches.cardsToPrependDescription.Contains(__instance.Id))
{
Plugin.LogDebug("Creating description for " + __instance.Id);
Plugin.LogDebug($"Current description {__instance.Id}: {stringBuilder1}");
string text = Plugin.itemStem + __instance.Id;
string value = Functions.FormatStringCard(Texts.Instance.GetText(text, ""));
stringBuilder1.Insert(0, value);
}
}
}
[HarmonyPatch]
public class BalancePatches
{
public static List<string> cardsWithCustomDescriptions = new List<string>(15)
{
"surprisebox", "surpriseboxrare", "surprisegiftbox", "surprisegiftboxrare", "bbbtreefellingaxe", "bbbtreefellingaxerare", "bbbcloakofthorns", "bbbcloakofthornsrare", "bbbportablewallofflames", "bbbportablewallofflamesrare",
"bbbslimepoison", "bbbslimepoisonrare", "bbbscrollofpetimmortality", "bbbscrollofpetimmortalityrare", "rocketbootsrare"
};
public static List<string> cardsToAppendDescription = new List<string>(8) { "bbbrustedshield", "bbbrustedshieldrare", "soullanternrare", "boneclawsrare", "mozzy", "mozzyrare", "bbbmelancholicarmor", "bbbmelancholicarmorare" };
public static List<string> cardsToPrependDescription = new List<string>(8) { "mimy", "mimyrare", "captainspresencered", "captainspresencereda", "captainspresenceredb", "captainspresenceblack", "captainspresenceblacka", "captainspresenceblackb" };
[HarmonyPrefix]
[HarmonyPatch(typeof(Item), "surprisebox")]
public static bool surpriseboxPrefix(Item __instance, Character theCharacter, bool isRare, string itemName)
{
Plugin.LogDebug("executing supriseboxPrefix");
if (!((Object)(object)MatchManager.Instance != (Object)null))
{
return false;
}
int randomIntRange = MatchManager.Instance.GetRandomIntRange(0, 9, "item", "");
int num = 4;
string text;
switch (randomIntRange)
{
case 0:
num = (isRare ? 8 : 4);
text = "fast";
break;
case 1:
num = (isRare ? 20 : 6);
text = "powerful";
break;
case 2:
num = (isRare ? 14 : 7);
text = "bless";
break;
case 3:
num = (isRare ? 20 : 10);
text = "sharp";
break;
case 4:
num = (isRare ? 12 : 5);
text = "fortify";
break;
case 5:
num = (isRare ? 5 : 3);
text = "evasion";
break;
case 6:
num = (isRare ? 20 : 10);
text = "regeneration";
break;
case 7:
num = (isRare ? 6 : 3);
text = "mitigate";
break;
default:
num = (isRare ? 24 : 12);
text = "vitality";
break;
}
theCharacter.SetAuraTrait(theCharacter, text, num);
((CharacterItem)theCharacter.HeroItem).ScrollCombatText(itemName, (CombatScrollEffectType)11);
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Item), "surprisegiftbox")]
public static bool surprisegiftboxPrefix(Item __instance, Character theCharacter, bool isRare, string itemName)
{
Plugin.LogDebug("executing surprisegiftbox prefix");
if (!((Object)(object)MatchManager.Instance != (Object)null))
{
return false;
}
int randomIntRange = MatchManager.Instance.GetRandomIntRange(0, 9, "item", "");
int num = 4;
string text;
switch (randomIntRange)
{
case 0:
num = (isRare ? 8 : 4);
text = "fast";
break;
case 1:
num = (isRare ? 20 : 6);
text = "powerful";
break;
case 2:
num = (isRare ? 10 : 5);
text = "bless";
break;
case 3:
num = (isRare ? 15 : 6);
text = "sharp";
break;
case 4:
num = (isRare ? 12 : 6);
text = "fortify";
break;
case 5:
num = (isRare ? 4 : 2);
text = "evasion";
break;
case 6:
num = (isRare ? 20 : 10);
text = "regeneration";
break;
case 7:
num = (isRare ? 6 : 3);
text = "mitigate";
break;
default:
num = (isRare ? 24 : 12);
text = "vitality";
break;
}
Hero[] teamHero = MatchManager.Instance.GetTeamHero();
for (int i = 0; i < teamHero.Length; i++)
{
if (teamHero[i] != null && (Object)(object)((Character)teamHero[i]).HeroData != (Object)null && ((Character)teamHero[i]).Alive)
{
((Character)teamHero[i]).SetAuraTrait(theCharacter, text, num);
}
}
((CharacterItem)theCharacter.HeroItem).ScrollCombatText(itemName, (CombatScrollEffectType)11);
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CardData), "SetDescriptionNew")]
public static void SetDescriptionNewPostfix(ref CardData __instance, bool forceDescription = false, Character character = null, bool includeInSearch = true)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Invalid comparison between Unknown and I4
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Invalid comparison between Unknown and I4
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Invalid comparison between Unknown and I4
if ((Object)(object)__instance == (Object)null)
{
Plugin.LogDebug("Null Card");
return;
}
StringBuilder stringBuilder = new StringBuilder();
string value = Globals.Instance.CardsDescriptionNormalized[__instance.Id];
stringBuilder.Append(value);
if ((Object)(object)__instance.Item != (Object)null && (int)__instance.Item.Activation == 22 && __instance.Item.ExactRound >= 2)
{
Plugin.LogDebug("Attempting to alter description for " + __instance.Id);
Plugin.LogDebug($"Current description {__instance.Id}: {stringBuilder}");
stringBuilder.Replace("Every turn", $"On turn {__instance.Item.ExactRound}");
}
if ((Object)(object)__instance.Item != (Object)null && (int)__instance.Item.Activation == 2 && __instance.Item.ExactRound >= 2)
{
Plugin.LogDebug("Attempting to alter description for " + __instance.Id);
stringBuilder.Replace("Every round", $"On round {__instance.Item.ExactRound}");
}
if (__instance.EnergyRecharge != 0 && (int)__instance.TargetSide == 0)
{
Plugin.LogDebug($"Current description for {__instance.Id}: {stringBuilder}");
stringBuilder.Replace("Grant", "Gain");
}
BalanceFunctions.BinbinNormalizeDescription(ref __instance, stringBuilder);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(AtOManager), "GlobalAuraCurseModificationByTraitsAndItems")]
public static void GlobalAuraCurseModificationByTraitsAndItemsPostfixGeneral(ref AtOManager __instance, ref AuraCurseData __result, string _type, string _acId, Character _characterCaster, Character _characterTarget)
{
Character val = ((_type == "set") ? _characterTarget : _characterCaster);
if (val == null || !val.Alive)
{
return;
}
switch (_acId)
{
case "bleed":
{
string itemID = "bloodstone";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "yoggercleaver";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, "bbbtreefellingaxe", CustomFunctions.AppliesTo.Monsters) || CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, "bbbtreefellingaxerare", CustomFunctions.AppliesTo.Monsters))
{
__result.Preventable = false;
}
itemID = "boneclawsrare";
if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, itemID, CustomFunctions.AppliesTo.ThisHero))
{
__result.DamageTypeWhenConsumed = (DamageType)0;
__result.DamageWhenConsumedPerCharge = 0f;
}
itemID = "mozzy";
if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, itemID, CustomFunctions.AppliesTo.ThisHero) || CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, itemID + "rare", CustomFunctions.AppliesTo.ThisHero))
{
__result.ConsumedAtTurn = true;
__result.ConsumedAtTurnBegin = false;
}
break;
}
case "bless":
{
string itemID = "topazring";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
break;
}
case "block":
{
string itemID = "crusaderhelmet";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
break;
}
case "burn":
{
string itemID = "solring";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "ringoffire";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "captainspresencered";
if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Enchantment, itemID, CustomFunctions.AppliesTo.ThisHero))
{
__result.Preventable = false;
__result.Removable = false;
}
break;
}
case "chill":
{
string itemID = "lunaring";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "neverfrost";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
break;
}
case "crack":
{
string itemID = "bronzegear";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "ironkanabo";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
break;
}
case "dark":
{
string itemID = "blackpyramid";
if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, itemID + "rare", CustomFunctions.AppliesTo.Monsters))
{
__result.ExplodeAtStacks = 34;
}
else if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, itemID, CustomFunctions.AppliesTo.Monsters))
{
__result.ExplodeAtStacks = 30;
}
itemID = "soullanternrare";
if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, itemID, CustomFunctions.AppliesTo.ThisHero))
{
__result.ExplodeAtStacks = 0;
__result.DamageTypeWhenConsumed = (DamageType)0;
__result.DamageWhenConsumedPerCharge = 0f;
}
break;
}
case "fast":
{
string itemID = "rocketbootsrare";
if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, itemID, CustomFunctions.AppliesTo.ThisHero))
{
__result.GainCharges = true;
__result.ConsumeAll = false;
}
break;
}
case "mark":
{
string itemID = "hellblade";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "redsteelcloack";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
break;
}
case "poison":
{
string itemID = "thepolluter";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "venomamulet";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, "bbbslimepoison", CustomFunctions.AppliesTo.Monsters) || CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, "bbbslimepoisonrare", CustomFunctions.AppliesTo.Monsters))
{
__result.Preventable = false;
}
break;
}
case "powerful":
{
string itemID = "mysticstaff";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "powergloverare";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
break;
}
case "sight":
{
string itemID = "eeriering";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
break;
}
case "scourge":
{
string itemID = "captainspresenceblack";
if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Enchantment, itemID, CustomFunctions.AppliesTo.ThisHero))
{
__result.GainCharges = true;
}
break;
}
case "thorns":
{
string itemID = "corruptedplateb";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "shieldofthorns";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "thornyring";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "yggdrasilroot";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "bbbthehedgehog";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "bbbphalanx";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "heartofthorns";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
if (CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, "bbbportablewallofflames", CustomFunctions.AppliesTo.ThisHero) || CustomFunctions.IfCharacterHas(val, CustomFunctions.CharacterHas.Item, "bbbportablewallofflamesrare", CustomFunctions.AppliesTo.ThisHero))
{
__result.DamageReflectedType = (DamageType)4;
}
break;
}
case "vitality":
{
string itemID = "heartamulet";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "bbbsausagelinknecklace";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
break;
}
case "wet":
{
string itemID = "bucket";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
itemID = "waterskin";
BalanceFunctions.UpdateMaxMadnessChargesByItem(ref __result, val, itemID);
break;
}
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Character), "IndirectDamage")]
public static void IndirectDamagePostfix(ref Character __instance, DamageType damageType, ref int damage, AudioClip sound = null, string effect = "", string sourceCharacterName = "", string sourceCharacterId = "")
{
if (!((Object)(object)MatchManager.Instance == (Object)null))
{
Character characterById = MatchManager.Instance.GetCharacterById(sourceCharacterId);
if (AtOManager.Instance.TeamHaveItem("bbbcloakofthornsrare", -1, false) && CustomFunctions.IsLivingHero(characterById) && characterById.HasEffect("mitigate") && effect == "thorns")
{
int auraCharges = characterById.GetAuraCharges("mitigate");
float num = 1f + 0.25f * (float)auraCharges;
damage = Mathf.RoundToInt((float)damage * num);
}
else if (AtOManager.Instance.TeamHaveItem("bbbcloakofthorns", -1, false) && CustomFunctions.IsLivingHero(characterById) && characterById.HasEffect("mitigate") && effect == "thorns")
{
int auraCharges2 = characterById.GetAuraCharges("mitigate");
float num2 = 1f + 0.15f * (float)auraCharges2;
damage = Mathf.RoundToInt((float)damage * num2);
}
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MatchManager), "DestroyedItemInThisTurn")]
public static bool DestroyedItemInThisTurnPrefix(MatchManager __instance, int _charIndex, string _cardId)
{
Plugin.LogDebug("DestroyedItemInThisTurnPrefix");
Hero hero = MatchManager.Instance.GetHero(_charIndex);
if (hero == null)
{
return true;
}
if (((Character)hero).HaveItem("bbbscrollofpetimmortality", -1, false))
{
Plugin.LogDebug("Protecting Pet!");
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MatchManager), "CreatePet")]
public static bool CreatePet(CardData cardPet, GameObject charGO, Hero _hero, NPC _npc, bool _fromEnchant = false, string _enchantName = "")
{
Plugin.LogDebug("CreatePet");
if ((Object)(object)cardPet == (Object)null)
{
return true;
}
if (cardPet.Id == "tombstone" && ((Character)_hero).HaveItem("bbbscrollofpetimmortality", -1, false))
{
Plugin.LogDebug("Protecting Pet!");
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Item), "DoItem")]
public static void DoItemPrefix(EventActivation _theEvent, CardData _cardData, string _item, Character _character, Character _target, int _auxInt, string _auxString, int order, CardData castedCard, ref bool onlyCheckItemActivation)
{
Plugin.LogDebug("DoItemPrefix");
if ((Object)(object)MatchManager.Instance == (Object)null)
{
return;
}
List<string> list = new List<string>(4) { "surprisebox", "surpriseboxrare", "surprisegiftbox", "surprisegiftboxrare" };
if (list.Contains(_item))
{
Plugin.LogDebug("DoItemPrefix - found surpriseboxes");
}
if (MatchManager.Instance.GetCurrentRound() != 3 && list.Contains(_item))
{
Plugin.LogDebug("DoItemPrefix - disabling surpriseboxes");
onlyCheckItemActivation = true;
return;
}
switch (_item)
{
default:
if (!(_item == "bbbchefskniferare"))
{
break;
}
goto case "bbbchefsapron";
case "bbbchefsapron":
case "bbbchefsapronrare":
case "bbbchefsknife":
_cardData.Item.CardToGainType = (CardType)29;
break;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Item), "DoItemData")]
public static void DoItemDataPrefix(ref Item __instance, Character target, string itemName, int auxInt, CardData cardItem, ref string itemType, ItemData itemData, Character character, int order, string castedCardId = "", EventActivation theEvent = 0)
{
Plugin.LogDebug("DoItemDataPrefix");
if ((Object)(object)itemData != (Object)null && (itemData.Id == "bbbfirestarter" || itemData.Id == "bbbfirestarterrare"))
{
Plugin.LogDebug("Changing Firestarter");
itemData.CardToGainType = (CardType)5;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(MatchManager), "CastCardAction")]
public static void CastCardActionPostfix(MatchManager __instance, CardData _cardActive, Transform targetTransformCast, CardItem theCardItem, string _uniqueCastId, bool _automatic = false, CardData _card = null, int _cardIterationTotal = 1)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Invalid comparison between Unknown and I4
Plugin.LogDebug("CastCardActionPostfix");
if ((Object)(object)_cardActive != (Object)null)
{
Plugin.LogDebug("Casted Card - " + _cardActive.Id);
Hero heroHeroActive = __instance.GetHeroHeroActive();
if ((Object)(object)_cardActive != (Object)null && _cardActive.EnergyRecharge > 0 && CustomFunctions.IsLivingHero((Character)(object)heroHeroActive) && (int)_cardActive.TargetSide == 0)
{
Plugin.LogDebug($"Energy Recharge - giving energy - {_cardActive.EnergyRecharge}");
int num = ((_cardActive.EffectRepeat != 0) ? (_cardActive.EnergyRecharge * _cardActive.EffectRepeat) : _cardActive.EnergyRecharge);
((Character)heroHeroActive).ModifyEnergy(num, true);
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Character), "DamageReflected")]
public static void DamageReflectedPostfix(ref Character __instance, Hero theCasterHero, NPC theCasterNPC)
{
if (CustomFunctions.IsLivingHero(__instance) && theCasterHero != null && theCasterNPC != null)
{
Plugin.LogDebug("DamageReflectedPostfix");
AuraCurseData auraCurseData = CustomFunctions.GetAuraCurseData("thorns");
if ((Object)(object)auraCurseData == (Object)null || auraCurseData.DamageReflectedPerStack <= 0)
{
Plugin.LogDebug("DamageReflectedPostfix - Null thorns data");
}
else if (CustomFunctions.IfCharacterHas(__instance, CustomFunctions.CharacterHas.Item, "bbbrustedshieldrare", CustomFunctions.AppliesTo.ThisHero))
{
Plugin.LogDebug("DamageReflectedPostfix - Applying bbbrustedshieldrare Poison");
((Character)theCasterNPC).SetAura(__instance, CustomFunctions.GetAuraCurseData("poison"), Functions.FuncRoundToInt((float)__instance.GetAuraCharges("thorns") * 0.75f), false, (CardClass)11, true, true);
}
else if (CustomFunctions.IfCharacterHas(__instance, CustomFunctions.CharacterHas.Item, "bbbrustedshield", CustomFunctions.AppliesTo.ThisHero) && __instance.HasEffect("rust"))
{
Plugin.LogDebug("DamageReflectedPostfix - Applying bbbrustedshield Poison");
((Character)theCasterNPC).SetAura(__instance, CustomFunctions.GetAuraCurseData("poison"), Functions.FuncRoundToInt((float)__instance.GetAuraCharges("thorns") * 0.5f), false, (CardClass)11, true, true);
}
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Functions), "GetRandomCardIdByTypeAndRandomRarity")]
public static bool GetRandomCardIdByTypeAndRandomRarityPrefix(ref string __result, CardType _cardType)
{
//IL_001c: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Invalid comparison between Unknown and I4
//IL_0089: 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_0099: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Invalid comparison between Unknown and I4
Plugin.LogDebug("GetRandomCardIdByTypeAndRandomRarityPrefix");
int randomIntRange = MatchManager.Instance.GetRandomIntRange(0, Globals.Instance.CardListByType[_cardType].Count, "default", "");
if (Globals.Instance.CardListByType[_cardType].Count == 0)
{
Plugin.LogDebug("No cards found");
return false;
}
if ((int)_cardType == 29)
{
Plugin.LogDebug("trying to generate food");
}
string text = Globals.Instance.CardListByType[_cardType][randomIntRange];
if ((int)_cardType == 29)
{
Plugin.LogDebug("Food we are trying to generate: " + text);
}
CardData cardData;
if ((int)_cardType == 29)
{
randomIntRange = MatchManager.Instance.GetRandomIntRange(0, 100, "default", "");
if (randomIntRange > 75)
{
cardData = Globals.Instance.GetCardData(text, false);
if ((Object)(object)cardData.UpgradesToRare != (Object)null)
{
__result = cardData.UpgradesToRare.Id;
}
else
{
__result = text;
}
}
else
{
__result = text;
}
return false;
}
cardData = Globals.Instance.GetCardData(text, false);
__result = Functions.GetCardByRarity(MatchManager.Instance.GetRandomIntRange(0, 100, "default", ""), cardData, false);
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(LootManager), "LootGold")]
public static void LootGoldPrefix(LootManager __instance, bool ___isMyLoot, bool[] ___looted, int ___activeCharacter, List<int> ___characterOrder, bool comingFromNet = false)
{
if ((comingFromNet || ___isMyLoot) && ___looted != null && ___activeCharacter <= ___looted.Length && ___activeCharacter < 4)
{
Hero hero = AtOManager.Instance.GetHero(___characterOrder[___activeCharacter]);
if (CustomFunctions.IfCharacterHas((Character)(object)hero, CustomFunctions.CharacterHas.Item, "mimyrare", CustomFunctions.AppliesTo.Heroes))
{
int num = 30;
AtOManager.Instance.GivePlayer(0, num, ((Character)hero).Owner, "", true, false);
}
else if (CustomFunctions.IfCharacterHas((Character)(object)hero, CustomFunctions.CharacterHas.Item, "mimy", CustomFunctions.AppliesTo.Heroes))
{
int num = 15;
AtOManager.Instance.GivePlayer(0, num, ((Character)hero).Owner, "", true, false);
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(MatchManager), "GenerateDecksNPCs")]
public static void GenerateDecksNPCsPostfix(MatchManager __instance, NPC[] ___TeamNPC, int _npcIndex = -1)
{
Plugin.LogDebug("GenerateDecksNPCsPostfix");
string text = "bbbsadm";
int num = 1;
if (AtOManager.Instance.TeamHaveItem("bbbmelancholicarmorare", -1, false))
{
text = "bbbsadma";
num = 2;
}
if (!AtOManager.Instance.TeamHaveItem("bbbmelancholicarmor", -1, false) && !AtOManager.Instance.TeamHaveItem("bbbmelancholicarmorare", -1, false))
{
return;
}
List<string>[] value = Traverse.Create((object)__instance).Field("NPCDeck").GetValue<List<string>[]>();
for (int i = 0; i < ___TeamNPC.Length; i++)
{
if ((_npcIndex <= -1 || i == _npcIndex) && ___TeamNPC[i] != null && !((Object)(object)((Character)___TeamNPC[i]).NpcData == (Object)null))
{
for (int j = 0; j < num; j++)
{
int randomIntRange = __instance.GetRandomIntRange(0, __instance.CountNPCDeck(i), "default", "");
Plugin.LogDebug($"Adding card {text} to NPC {___TeamNPC[i].InternalId} in index {i} with NPCindex {_npcIndex} at position {randomIntRange}");
value[i].Insert(randomIntRange, text);
}
}
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(NPC), "BeginRound")]
public static void BeginRoundPostfix(NPC __instance)
{
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Character), "DamageWithCharacterBonus")]
public static void DamageWithCharacterBonusPostfix(Character __instance, ref int __result, int value, DamageType DT, CardClass CC, int energyCost = 0, int additionalDamage = -1000)
{
if (!__instance.IsHero)
{
float num = 1f + 0.15f * (float)Plugin.difficultyLevelInt;
__result = Mathf.RoundToInt((float)__result * num);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(NPC), "InitData")]
public static void InitDataPostfix(ref NPC __instance)
{
if (((Character)__instance).IsHero)
{
return;
}
float num = 1f + 0.15f * (float)Plugin.difficultyLevelInt;
num += ((AtOManager.Instance.GetNgPlus(false) > 6 && AtOManager.Instance.GetActNumberForText("") > 2) ? 0.25f : 0f);
int num2 = Mathf.Max(40, 20 * Plugin.difficultyLevelInt);
NPC obj = __instance;
int hp = (((Character)__instance).HpCurrent = Mathf.RoundToInt((float)((Character)__instance).Hp * num) + num2);
((Character)obj).Hp = hp;
if (((Character)__instance).Speed < 16 && Plugin.difficultyLevelInt > 1)
{
NPC obj2 = __instance;
((Character)obj2).Speed = ((Character)obj2).Speed + 1;
}
List<(int, int, int)> list = new List<(int, int, int)>(3)
{
(((Character)__instance).ResistSlashing, ((Character)__instance).ResistPiercing, ((Character)__instance).ResistBlunt),
(((Character)__instance).ResistFire, ((Character)__instance).ResistCold, ((Character)__instance).ResistLightning),
(((Character)__instance).ResistHoly, ((Character)__instance).ResistShadow, ((Character)__instance).ResistMind)
};
List<int> list2 = new List<int>();
int num4 = 0;
int num5 = 5 * Plugin.difficultyLevelInt;
for (int i = 0; i < list.Count; i++)
{
(int, int, int) tuple = list[i];
int item = tuple.Item1;
int item2 = tuple.Item2;
int item3 = tuple.Item3;
int num6 = item + item2 + item3;
if (num6 >= num4)
{
num4 = num6;
list2.Add(i);
}
}
foreach (int item7 in list2)
{
(int, int, int) tuple2 = list[item7];
int item4 = tuple2.Item1;
int item5 = tuple2.Item2;
int item6 = tuple2.Item3;
list[item7] = (item4 + num5, item5 + num5, item6 + num5);
switch (item7)
{
case 0:
((Character)__instance).ResistSlashing = list[item7].Item1;
((Character)__instance).ResistPiercing = list[item7].Item2;
((Character)__instance).ResistBlunt = list[item7].Item3;
break;
case 1:
((Character)__instance).ResistFire = list[item7].Item1;
((Character)__instance).ResistCold = list[item7].Item2;
((Character)__instance).ResistLightning = list[item7].Item3;
break;
case 2:
((Character)__instance).ResistHoly = list[item7].Item1;
((Character)__instance).ResistShadow = list[item7].Item2;
((Character)__instance).ResistMind = list[item7].Item3;
break;
}
}
}
}
public class CustomFunctions
{
public enum AppliesTo
{
None,
Global,
Monsters,
Heroes,
ThisHero
}
public enum CharacterHas
{
Perk,
Item,
Trait,
Enchantment
}
public enum IsAuraOrCurse
{
Aura,
Curse,
Both
}
public static string perkBase = "<RenameThisForPerks>";
public static void PLog(string s)
{
Plugin.Log.LogDebug((object)(Plugin.debugBase + s));
}
public static void TraitHeal(ref Character _character, Character _target, int healAmount, string traitName)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
int num = healAmount;
if (_target.GetHpLeftForMax() < healAmount)
{
num = _target.GetHpLeftForMax();
}
if (num > 0)
{
_target.ModifyHp(num, true, true);
CastResolutionForCombatText val = new CastResolutionForCombatText();
val.heal = num;
if (_target.HeroItem != null)
{
((CharacterItem)_target.HeroItem).ScrollCombatTextDamageNew(val);
EffectsManager.Instance.PlayEffectAC("healimpactsmall", true, ((CharacterItem)_target.HeroItem).CharImageT, false, 0f);
}
else
{
((CharacterItem)_target.NPCItem).ScrollCombatTextDamageNew(val);
EffectsManager.Instance.PlayEffectAC("healimpactsmall", true, ((CharacterItem)_target.NPCItem).CharImageT, false, 0f);
}
_target.SetEvent((EventActivation)15, (Character)null, 0, "");
_character.SetEvent((EventActivation)14, _target, 0, "");
((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
}
}
public static void TraitHealHero(ref Character _character, ref Hero _target, int healAmount, string traitName)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
if (_target == null || !((Character)_target).IsHero || !((Character)_target).Alive)
{
return;
}
int num = healAmount;
if (((Character)_target).GetHpLeftForMax() < healAmount)
{
num = ((Character)_target).GetHpLeftForMax();
}
if (num > 0)
{
((Character)_target).ModifyHp(num, true, true);
CastResolutionForCombatText val = new CastResolutionForCombatText();
val.heal = num;
if (((Character)_target).HeroItem != null)
{
((CharacterItem)((Character)_target).HeroItem).ScrollCombatTextDamageNew(val);
EffectsManager.Instance.PlayEffectAC("healimpactsmall", true, ((CharacterItem)((Character)_target).HeroItem).CharImageT, false, 0f);
}
else
{
((CharacterItem)((Character)_target).NPCItem).ScrollCombatTextDamageNew(val);
EffectsManager.Instance.PlayEffectAC("healimpactsmall", true, ((CharacterItem)((Character)_target).NPCItem).CharImageT, false, 0f);
}
((Character)_target).SetEvent((EventActivation)15, (Character)null, 0, "");
_character.SetEvent((EventActivation)14, (Character)(object)_target, 0, "");
((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
}
}
public static void WhenYouGainXGainY(string ACGained, string targetAC, string ACtoApply, int nGained, int nToApply, float multiplier, ref Character _character, string traitName)
{
if ((!((Object)(object)MatchManager.Instance == (Object)null) || ACGained != null || IsLivingHero(_character)) && !(targetAC == ACtoApply) && ACGained == targetAC)
{
int num = Mathf.RoundToInt((float)(nGained + nToApply) * multiplier);
_character.SetAuraTrait(_character, ACtoApply, num);
((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
}
}
public static void WhenYouPlayXGainY(CardType desiredCardType, string desiredAuraCurse, int n_charges, CardData castedCard, ref Character _character, string traitName)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)MatchManager.Instance != (Object)null && (Object)(object)castedCard != (Object)null && (Object)(object)_character.HeroData != (Object)null && castedCard.GetCardTypes().Contains(desiredCardType))
{
_character.SetAuraTrait(_character, desiredAuraCurse, n_charges);
((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
}
}
public static void ReduceCostByStacks(CardType cardType, string auraCurseName, int nCharges, ref Character _character, ref List<string> heroHand, ref List<CardData> cardDataList, string traitName, bool applyToAllCards)
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_character.HeroData != (Object)null))
{
return;
}
int num = Mathf.FloorToInt((float)(_character.EffectCharges(auraCurseName) / nCharges));
if (num <= 0)
{
return;
}
for (int i = 0; i < heroHand.Count; i++)
{
CardData cardData = MatchManager.Instance.GetCardData(heroHand[i], true);
if (cardData.GetCardFinalCost() > 0 && (cardData.GetCardTypes().Contains(cardType) || applyToAllCards))
{
cardDataList.Add(cardData);
}
}
for (int j = 0; j < cardDataList.Count; j++)
{
CardData obj = cardDataList[j];
obj.EnergyReductionTemporal += num;
MatchManager.Instance.UpdateHandCards();
CardItem cardFromTableByIndex = MatchManager.Instance.GetCardFromTableByIndex(cardDataList[j].InternalId);
cardFromTableByIndex.PlayDissolveParticle();
cardFromTableByIndex.ShowEnergyModification(-num);
((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
MatchManager.Instance.CreateLogCardModification(cardDataList[j].InternalId, MatchManager.Instance.GetHero(_character.HeroIndex));
}
}
public static void ReduceCardTypeCostUntilDiscarded(CardType cardType, int amountToReduce, ref Character _character, ref List<string> heroHand, ref List<CardData> cardDataList, string traitName)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
if (_character.HeroData == null)
{
return;
}
if (amountToReduce <= 0)
{
return;
}
for (int i = 0; i < heroHand.Count; i++)
{
CardData cardData = MatchManager.Instance.GetCardData(heroHand[i], true);
if (cardData != null && cardData.GetCardFinalCost() > 0 && cardData.HasCardType(cardType))
{
cardDataList.Add(cardData);
}
}
for (int j = 0; j < cardDataList.Count; j++)
{
CardData val = cardDataList[j];
if (val != null)
{
val.EnergyReductionTemporal += amountToReduce;
MatchManager.Instance.UpdateHandCards();
CardItem cardFromTableByIndex = MatchManager.Instance.GetCardFromTableByIndex(val.InternalId);
cardFromTableByIndex.PlayDissolveParticle();
cardFromTableByIndex.ShowEnergyModification(-amountToReduce);
((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, ""), (CombatScrollEffectType)7);
MatchManager.Instance.CreateLogCardModification(val.InternalId, MatchManager.Instance.GetHero(_character.HeroIndex));
}
}
}
public static void AddImmunityToHero(string immunity, ref Hero _character)
{
if (_character != null && !((Character)_character).AuracurseImmune.Contains(immunity))
{
((Character)_character).AuracurseImmune.Add(immunity);
}
}
public static void IncreaseChargesByStacks(string auraCurseToModify, float stacks_per_bonus, string auraCurseDependent, ref Character _character, string traitName)
{
int auraCharges = _character.GetAuraCharges(auraCurseDependent);
int num = Mathf.FloorToInt((float)auraCharges / stacks_per_bonus);
_character.ModifyAuraCurseQuantity(auraCurseToModify, num);
}
public static AuraCurseData GetAuraCurseData(string auraCurse)
{
return Globals.Instance.GetAuraCurseData(auraCurse);
}
public static string TextChargesLeft(int currentCharges, int chargesTotal)
{
int num = currentCharges;
int num2 = chargesTotal;
return "<br><color=#FFF>" + num + "/" + num2 + "</color>";
}
public static void Duality(ref Character _character, ref CardData _castedCard, CardClass class1, CardClass class2, string _trait)
{
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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_0083: 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)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
if (MatchManager.Instance == null || _castedCard == null)
{
return;
}
TraitData traitData = Globals.Instance.GetTraitData(_trait);
if (MatchManager.Instance.activatedTraits != null && MatchManager.Instance.activatedTraits.ContainsKey(_trait) && MatchManager.Instance.activatedTraits[_trait] > traitData.TimesPerTurn - 1)
{
return;
}
for (int i = 0; i < 2; i++)
{
CardClass val;
CardClass val2;
if (i == 0)
{
val = class1;
val2 = class2;
}
else
{
val = class2;
val2 = class1;
}
if (_castedCard.CardClass != val)
{
continue;
}
if (MatchManager.Instance.CountHeroHand(-1) == 0 || _character.HeroData == null)
{
break;
}
List<CardData> list = new List<CardData>();
List<string> heroHand = MatchManager.Instance.GetHeroHand(_character.HeroIndex);
int num = 0;
for (int j = 0; j < heroHand.Count; j++)
{
CardData cardData = MatchManager.Instance.GetCardData(heroHand[j], true);
if (cardData != null && cardData.CardClass == val2 && _character.GetCardFinalCost(cardData) > num)
{
num = _character.GetCardFinalCost(cardData);
}
}
if (num <= 0)
{
break;
}
for (int k = 0; k < heroHand.Count; k++)
{
CardData cardData2 = MatchManager.Instance.GetCardData(heroHand[k], true);
if (cardData2 != null && cardData2.CardClass == val2 && _character.GetCardFinalCost(cardData2) >= num)
{
list.Add(cardData2);
}
}
if (list.Count <= 0)
{
break;
}
CardData val3 = ((list.Count != 1) ? list[MatchManager.Instance.GetRandomIntRange(0, list.Count, "trait", "")] : list[0]);
if (val3 != null)
{
if (!MatchManager.Instance.activatedTraits.ContainsKey(_trait))
{
MatchManager.Instance.activatedTraits.Add(_trait, 1);
}
else
{
Dictionary<string, int> activatedTraits = MatchManager.Instance.activatedTraits;
int value = activatedTraits[_trait] + 1;
activatedTraits[_trait] = value;
}
MatchManager.Instance.SetTraitInfoText();
int num2 = 1;
val3.EnergyReductionTemporal += num2;
MatchManager.Instance.GetCardFromTableByIndex(val3.InternalId).ShowEnergyModification(-num2);
MatchManager.Instance.UpdateHandCards();
((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitData.TraitName, "") + TextChargesLeft(MatchManager.Instance.activatedTraits[_trait], traitData.TimesPerTurn), (CombatScrollEffectType)7);
MatchManager.Instance.CreateLogCardModification(val3.InternalId, MatchManager.Instance.GetHero(_character.HeroIndex));
}
break;
}
}
public static void PermanentyReduceXWhenYouPlayY(ref Character _character, ref CardData _castedCard, CardType reduceThis, CardType whenYouPlayThis, int amountToReduce, string traitName)
{
//IL_0077: 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_00ca: Invalid comparison between Unknown and I4
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
if (MatchManager.Instance == null || _castedCard == null)
{
return;
}
TraitData traitData = Globals.Instance.GetTraitData(traitName);
if ((MatchManager.Instance.activatedTraits != null && MatchManager.Instance.activatedTraits.ContainsKey(traitName) && MatchManager.Instance.activatedTraits[traitName] > traitData.TimesPerTurn - 1) || !_castedCard.GetCardTypes().Contains(whenYouPlayThis) || MatchManager.Instance.CountHeroHand(-1) == 0 || _character.HeroData == null)
{
return;
}
List<CardData> list = new List<CardData>();
List<string> heroHand = MatchManager.Instance.GetHeroHand(_character.HeroIndex);
if ((int)reduceThis == 0)
{
for (int i = 0; i < heroHand.Count; i++)
{
CardData cardData = MatchManager.Instance.GetCardData(heroHand[i], true);
if (cardData != null)
{
list.Add(cardData);
}
}
}
else
{
for (int j = 0; j < heroHand.Count; j++)
{
CardData cardData2 = MatchManager.Instance.GetCardData(heroHand[j], true);
if (cardData2 != null && cardData2.GetCardTypes().Contains(reduceThis))
{
list.Add(cardData2);
}
}
}
if (!MatchManager.Instance.activatedTraits.ContainsKey(traitName))
{
MatchManager.Instance.activatedTraits.Add(traitName, 1);
}
else
{
Dictionary<string, int> activatedTraits = MatchManager.Instance.activatedTraits;
int value = activatedTraits[traitName] + 1;
activatedTraits[traitName] = value;
}
CardData val = list[MatchManager.Instance.GetRandomIntRange(0, list.Count, "trait", "")];
val.EnergyReductionPermanent += amountToReduce;
MatchManager.Instance.GetCardFromTableByIndex(val.InternalId).ShowEnergyModification(-amountToReduce);
MatchManager.Instance.UpdateHandCards();
((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitName, "") + TextChargesLeft(MatchManager.Instance.activatedTraits[traitName], traitData.TimesPerTurn), (CombatScrollEffectType)7);
MatchManager.Instance.CreateLogCardModification(val.InternalId, MatchManager.Instance.GetHero(_character.HeroIndex));
}
public static int CountAllStacks(string auraCurse, Hero[] teamHero = null, NPC[] teamNpc = null, bool includeHeroes = true, bool includeNpcs = true)
{
if ((Object)(object)MatchManager.Instance == (Object)null)
{
return 0;
}
if (teamHero == null)
{
teamHero = MatchManager.Instance.GetTeamHero();
}
if (teamNpc == null)
{
teamNpc = MatchManager.Instance.GetTeamNPC();
}
int num = 0;
if (includeHeroes)
{
for (int i = 0; i < teamHero.Length; i++)
{
if (IsLivingHero((Character)(object)teamHero[i]))
{
num += ((Character)teamHero[i]).GetAuraCharges(auraCurse);
}
}
}
if (includeNpcs)
{
for (int j = 0; j < teamNpc.Length; j++)
{
if (IsLivingNPC((Character)(object)teamNpc[j]))
{
num += ((Character)teamNpc[j]).GetAuraCharges(auraCurse);
}
}
}
return num;
}
public static void DealIndirectDamageToAllMonsters(DamageType damageType, int amount)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
Plugin.Log.LogDebug((object)(Plugin.debugBase + "Dealing Indirect Damage"));
if ((Object)(object)MatchManager.Instance == (Object)null)
{
return;
}
NPC[] teamNPC = MatchManager.Instance.GetTeamNPC();
foreach (NPC val in teamNPC)
{
if (IsLivingNPC((Character)(object)val))
{
((Character)val).IndirectDamage(damageType, amount, (AudioClip)null, "", "", "");
}
}
}
public static List<int> GetValidCharacters(Character[] characters)
{
List<int> list = new List<int>();
for (int i = 0; i < characters.Length; i++)
{
Character val = characters[i];
if (val.Alive && val != null)
{
list.Add(i);
}
}
return list;
}
public static Character GetFrontCharacter(Character[] characters)
{
List<int> validCharacters = GetValidCharacters(characters);
int num = validCharacters.First();
return characters[num];
}
public static Character GetBackCharacter(Character[] characters)
{
List<int> validCharacters = GetValidCharacters(characters);
int num = validCharacters.Last();
return characters[num];
}
public static Character GetRandomCharacter(Character[] array)
{
if (array == null)
{
Plugin.Log.LogDebug((object)(Plugin.debugBase + "Null Array"));
}
List<Character> list = new List<Character>();
for (int i = 0; i < array.Length; i++)
{
if (array[i] == null)
{
Plugin.Log.LogDebug((object)(Plugin.debugBase + "Null index"));
continue;
}
Character val = array[i];
if (val.Alive && val != null)
{
list.Add(val);
}
}
if (list.Count == 0)
{
return null;
}
int randomIntRange = MatchManager.Instance.GetRandomIntRange(0, list.Count, "default", "");
if (randomIntRange < list.Count)
{
return list[randomIntRange];
}
if (list[randomIntRange] == null)
{
return null;
}
return list[0];
}
public static bool IsLivingHero(Character _character)
{
return _character != null && _character.Alive && _character.IsHero;
}
public static bool IsLivingNPC(Character _character)
{
return _character != null && _character.Alive && !_character.IsHero;
}
public static bool CharacterHasPerkForSet(string perkName, bool flag, AtOManager __instance, Character _characterTarget)
{
return flag && _characterTarget != null && __instance.CharacterHavePerk(_characterTarget.SubclassName, perkBase + perkName);
}
public static bool CharacterHasPerkForConsume(string perkName, bool flag, AtOManager __instance, Character _characterCaster)
{
return flag && _characterCaster != null && __instance.CharacterHavePerk(_characterCaster.SubclassName, perkBase + perkName);
}
public static bool TeamHasPerk(string perkName)
{
if ((Object)(object)AtOManager.Instance == (Object)null)
{
return false;
}
return AtOManager.Instance.TeamHavePerk(perkBase + perkName) || AtOManager.Instance.TeamHavePerk(perkName);
}
public static bool IfCharacterHas(Character characterOfInterest, CharacterHas characterHas, string id, AppliesTo appliesTo = AppliesTo.Global, string _type = "", string onlyThisType = "")
{
if (appliesTo == AppliesTo.None || characterOfInterest == null || (Object)(object)AtOManager.Instance == (Object)null)
{
return false;
}
if (_type != "" && onlyThisType != _type)
{
return false;
}
bool flag = (characterOfInterest.IsHero && appliesTo == AppliesTo.Heroes) || (!characterOfInterest.IsHero && appliesTo == AppliesTo.Monsters) || appliesTo == AppliesTo.Global || (appliesTo == AppliesTo.ThisHero && characterOfInterest.IsHero);
bool flag2 = false;
if (appliesTo == AppliesTo.ThisHero)
{
switch (characterHas)
{
case CharacterHas.Item:
flag2 = AtOManager.Instance.CharacterHaveItem(characterOfInterest.SubclassName, perkBase + id) || AtOManager.Instance.CharacterHaveItem(characterOfInterest.SubclassName, id);
break;
case CharacterHas.Perk:
flag2 = AtOManager.Instance.CharacterHavePerk(characterOfInterest.SubclassName, perkBase + id) || AtOManager.Instance.CharacterHavePerk(characterOfInterest.SubclassName, id);
break;
case CharacterHas.Trait:
flag2 = AtOManager.Instance.CharacterHaveTrait(characterOfInterest.SubclassName, perkBase + id) || AtOManager.Instance.CharacterHaveTrait(characterOfInterest.SubclassName, id);
break;
case CharacterHas.Enchantment:
flag2 = CharacterHaveEnchantment(characterOfInterest, id);
break;
}
}
else
{
switch (characterHas)
{
case CharacterHas.Item:
flag2 = AtOManager.Instance.TeamHaveItem(perkBase + id, -1, false) || AtOManager.Instance.TeamHaveItem(id, -1, false);
break;
case CharacterHas.Perk:
flag2 = AtOManager.Instance.TeamHavePerk(perkBase + id) || AtOManager.Instance.TeamHavePerk(id);
break;
case CharacterHas.Trait:
flag2 = AtOManager.Instance.TeamHaveTrait(perkBase + id) || AtOManager.Instance.TeamHaveTrait(id);
break;
case CharacterHas.Enchantment:
flag2 = AtOManager.Instance.TeamHaveItem(Plugin.itemStem + id, -1, false) || AtOManager.Instance.TeamHaveItem(Plugin.itemStem + id + "a", -1, false) || AtOManager.Instance.TeamHaveItem(Plugin.itemStem + id + "b", -1, false) || AtOManager.Instance.TeamHaveItem(id, -1, false) || AtOManager.Instance.TeamHaveItem(id + "a", -1, false) || AtOManager.Instance.TeamHaveItem(id + "b", -1, false);
break;
}
}
return flag2 && flag;
}
public static bool TeamHasPerkGACM(Character characterOfInterest, string perkName, AppliesTo appliesTo = AppliesTo.Global, string _type = "", string onlyThisType = "")
{
if (appliesTo == AppliesTo.None || characterOfInterest == null || (Object)(object)AtOManager.Instance == (Object)null)
{
return false;
}
if (_type != "" && onlyThisType != _type)
{
return false;
}
bool flag = (characterOfInterest.IsHero && appliesTo == AppliesTo.Heroes) || (!characterOfInterest.IsHero && appliesTo == AppliesTo.Monsters) || appliesTo == AppliesTo.Global;
bool flag2 = AtOManager.Instance.TeamHavePerk(perkBase + perkName) || AtOManager.Instance.TeamHavePerk(perkName);
return flag2 && flag;
}
public static bool CharacterHasPerkGACM(Character characterOfInterest, string perkName, AppliesTo appliesTo = AppliesTo.Global)
{
if (appliesTo == AppliesTo.None || characterOfInterest == null || (Object)(object)AtOManager.Instance == (Object)null)
{
return false;
}
bool flag = (characterOfInterest.IsHero && appliesTo == AppliesTo.Heroes) || (!characterOfInterest.IsHero && appliesTo == AppliesTo.Monsters) || appliesTo == AppliesTo.Global;
bool flag2 = AtOManager.Instance.CharacterHavePerk(characterOfInterest.SubclassName, perkBase + perkName) || AtOManager.Instance.CharacterHavePerk(characterOfInterest.SubclassName, perkName);
return flag2 && flag;
}
public static bool TeamHasTraitGACM(Character characterOfInterest, string perkName, AppliesTo appliesTo = AppliesTo.Global, string _type = "", string onlyThisType = "")
{
if (appliesTo == AppliesTo.None || characterOfInterest == null || (Object)(object)AtOManager.Instance == (Object)null)
{
return false;
}
if (_type != "" && onlyThisType != _type)
{
return false;
}
bool flag = (characterOfInterest.IsHero && appliesTo == AppliesTo.Heroes) || (!characterOfInterest.IsHero && appliesTo == AppliesTo.Monsters) || appliesTo == AppliesTo.Global;
bool flag2 = AtOManager.Instance.TeamHaveTrait(perkBase + perkName) || AtOManager.Instance.TeamHavePerk(perkName);
return flag2 && flag;
}
public static bool CharacterHasTraitGACM(Character characterOfInterest, string perkName, AppliesTo appliesTo = AppliesTo.Global, string _type = "", string onlyThisType = "")
{
if (appliesTo == AppliesTo.None || characterOfInterest == null || (Object)(object)AtOManager.Instance == (Object)null)
{
return false;
}
if (_type != "" && onlyThisType != _type)
{
return false;
}
bool flag = (characterOfInterest.IsHero && appliesTo == AppliesTo.Heroes) || (!characterOfInterest.IsHero && appliesTo == AppliesTo.Monsters) || appliesTo == AppliesTo.Global;
bool flag2 = AtOManager.Instance.CharacterHaveTrait(characterOfInterest.SubclassName, perkBase + perkName) || AtOManager.Instance.TeamHavePerk(perkName);
return flag2 && flag;
}
public static bool TeamHasPerkForSet(string perkName, bool flag, AtOManager __instance, Character _characterTarget)
{
return _characterTarget != null && __instance.TeamHavePerk(perkBase + perkName) && flag;
}
public static bool TeamHasPerkForConsume(string perkName, bool flag, AtOManager __instance, Character _characterCaster)
{
if ((Object)(object)__instance == (Object)null)
{
return false;
}
return _characterCaster != null && (__instance.TeamHavePerk(perkBase + perkName) || __instance.TeamHavePerk(perkName)) && flag;
}
public static bool CharacterObjectHavePerk(Character _character, string _perkID)
{
if (_character == null || (Object)(object)AtOManager.Instance == (Object)null)
{
return false;
}
return AtOManager.Instance.CharacterHavePerk(_character.SubclassName, perkBase + _perkID) || AtOManager.Instance.CharacterHavePerk(_character.SubclassName, _perkID);
}
public static void PlayCardForFree(string cardToCast)
{
if (cardToCast != null && !((Object)(object)Globals.Instance == (Object)null))
{
CardData cardData = Globals.Instance.GetCardData(cardToCast, true);
if ((Object)(object)cardData == (Object)null)
{
PLog("Invalid CardName");
}
else
{
((MonoBehaviour)MatchManager.Instance).StartCoroutine(MatchManager.Instance.CastCard((CardItem)null, true, cardData, 0, -1, true));
}
}
}
public static void PlaySoundEffect(Character _character, string ACeffect)
{
if ((Object)(object)_character.HeroItem != (Object)null)
{
EffectsManager.Instance.PlayEffectAC(ACeffect, true, ((CharacterItem)_character.HeroItem).CharImageT, false, 0f);
}
}
public static void DisplayRemainingChargesForTrait(ref Character _character, TraitData traitData)
{
if ((Object)(object)_character.HeroItem != (Object)null)
{
((CharacterItem)_character.HeroItem).ScrollCombatText(Texts.Instance.GetText("traits_" + traitData.TraitName, "") + TextChargesLeft(MatchManager.Instance.activatedTraits[traitData.TraitName], traitData.TimesPerTurn), (CombatScrollEffectType)7);
}
}
public static void IncrementTraitActivations(TraitData traitData)
{
string id = traitData.Id;
if (CanIncrementTraitActivations(traitData))
{
if (!MatchManager.Instance.activatedTraits.ContainsKey(id))
{
MatchManager.Instance.activatedTraits.Add(id, 1);
}
else
{
MatchManager.Instance.activatedTraits[id]++;
}
MatchManager.Instance.SetTraitInfoText();
}
}
public static bool CanIncrementTraitActivations(TraitData traitData)
{
string id = traitData.Id;
if (!((Object)(object)MatchManager.Instance != (Object)null))
{
return false;
}
if (MatchManager.Instance.activatedTraits != null && MatchManager.Instance.activatedTraits.ContainsKey(id) && MatchManager.Instance.activatedTraits[id] > traitData.TimesPerTurn - 1)
{
return false;
}
return true;
}
public static void ModifyAllAurasOrCursesByPercent(int percentToModify, IsAuraOrCurse isAuraOrCurse, Character _characterTarget, Character _characterCaster)
{
if (percentToModify == 0 || _characterTarget == null || !_characterTarget.Alive)
{
return;
}
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
if ((isAuraOrCurse == IsAuraOrCurse.Aura || isAuraOrCurse == IsAuraOrCurse.Both) && percentToModify > 0)
{
num = percentToModify;
}
if ((isAuraOrCurse == IsAuraOrCurse.Aura || isAuraOrCurse == IsAuraOrCurse.Both) && percentToModify < 0)
{
num2 = Math.Abs(percentToModify);
}
if ((isAuraOrCurse == IsAuraOrCurse.Curse || isAuraOrCurse == IsAuraOrCurse.Both) && percentToModify > 0)
{
num3 = percentToModify;
}
if ((isAuraOrCurse == IsAuraOrCurse.Curse || isAuraOrCurse == IsAuraOrCurse.Both) && percentToModify < 0)
{
num4 = Math.Abs(percentToModify);
}
if (_characterTarget == null || !_characterTarget.Alive)
{
return;
}
for (int i = 0; i < 4; i++)
{
if ((i == 0 && num <= 0) || (i == 1 && num3 <= 0) || (i == 2 && num2 <= 0) || (i == 3 && num4 <= 0))
{
continue;
}
List<string> list = new List<string>();
List<int> list2 = new List<int>();
for (int j = 0; j < _characterTarget.AuraList.Count; j++)
{
if (_characterTarget.AuraList[j] != null && (Object)(object)_characterTarget.AuraList[j].ACData != (Object)null && _characterTarget.AuraList[j].GetCharges() > 0 && !(_characterTarget.AuraList[j].ACData.Id == "furnace"))
{
bool flag = false;
if ((i == 0 || i == 2) && _characterTarget.AuraList[j].ACData.IsAura)
{
flag = true;
}
else if ((i == 1 || i == 3) && !_characterTarget.AuraList[j].ACData.IsAura)
{
flag = true;
}
if (flag)
{
list.Add(_characterTarget.AuraList[j].ACData.Id);
list2.Add(_characterTarget.AuraList[j].GetCharges());
}
}
}
if (list.Count <= 0)
{
continue;
}
for (int k = 0; k < list.Count; k++)
{
int num5 = i switch
{
0 => Functions.FuncRoundToInt((float)((double)list2[k] * (double)num / 100.0)),
1 => Functions.FuncRoundToInt((float)((double)list2[k] * (double)num3 / 100.0)),
2 => list2[k] - Functions.FuncRoundToInt((float)((double)list2[k] * (double)num2 / 100.0)),
_ => list2[k] - Functions.FuncRoundToInt((float)((double)list2[k] * (double)num4 / 100.0)),
};
switch (i)
{
case 0:
case 1:
{
AuraCurseData val = AtOManager.Instance.GlobalAuraCurseModificationByTraitsAndItems("set", list[k], _characterCaster, _characterTarget);
if ((Object)(object)val != (Object)null)
{
int maxCharges = val.GetMaxCharges();
if (maxCharges > -1 && list2[k] + num5 > maxCharges)
{
num5 = maxCharges - list2[k];
}
_characterTarget.SetAura(_characterCaster, val, num5, false, (CardClass)11, false, false);
}
break;
}
case 2:
case 3:
if (num5 <= 0)
{
num5 = 1;
}
_characterTarget.ModifyAuraCurseCharges(list[k], num5);
_characterTarget.UpdateAuraCurseFunctions((AuraCurseData)null, 0, -1);
break;
}
}
}
}
public static bool CharacterHaveEnchantment(Character character, string id)
{
if ((Object)(object)AtOManager.Instance == (Object)null)
{
return false;
}
string subclassName = character.SubclassName;
return CharacterHaveEnchantment(subclassName, id);
}
public static bool CharacterHaveEnchantment(string characterId, string id)
{
if ((Object)(object)AtOManager.Instance == (Object)null)
{
return false;
}
return AtOManager.Instance.CharacterHaveItem(characterId, Plugin.itemStem + id) || AtOManager.Instance.CharacterHaveItem(characterId, Plugin.itemStem + id + "a") || AtOManager.Instance.CharacterHaveItem(characterId, Plugin.itemStem + id + "b") || AtOManager.Instance.CharacterHaveItem(characterId, id) || AtOManager.Instance.CharacterHaveItem(characterId, id + "a") || AtOManager.Instance.CharacterHaveItem(characterId, id + "b");
}
public static bool TeamHaveEnchantment(string id)
{
if ((Object)(object)AtOManager.Instance == (Object)null)
{
return false;
}
return AtOManager.Instance.TeamHaveItem(Plugin.itemStem + id, -1, false) || AtOManager.Instance.TeamHaveItem(Plugin.itemStem + id + "a", -1, false) || AtOManager.Instance.TeamHaveItem(Plugin.itemStem + id + "b", -1, false) || AtOManager.Instance.TeamHaveItem(id, -1, false) || AtOManager.Instance.TeamHaveItem(id + "a", -1, false) || AtOManager.Instance.TeamHaveItem(id + "b", -1, false);
}
}
[BepInPlugin("com.binbin.UnofficialBalancePatch", "UnofficialBalancePatch", "1.8.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("AcrossTheObelisk.exe")]
public class Plugin : BaseUnityPlugin
{
public enum DifficultyLevelEnum
{
Easy,
Normal,
Hard,
Extreme
}
internal const int ModDate = 20241206;
private readonly Harmony harmony = new Harmony("com.binbin.UnofficialBalancePatch");
internal static ManualLogSource Log;
public static DifficultyLevelEnum difficultyLevel = DifficultyLevelEnum.Hard;
public static int difficultyLevelInt = 1;
public static string itemStem = "binbin_balances_";
public static string debugBase = "Custom Descriptions - ";
public static ConfigEntry<bool> EnableMod { get; set; }
public static ConfigEntry<bool> EnableDebugging { get; set; }
public static ConfigEntry<string> DifficultyLevel { get; set; }
public static ConfigEntry<bool> EnableModuleBleed { get; set; }
public static ConfigEntry<bool> EnableModuleBlunt { get; set; }
public static ConfigEntry<bool> EnableModuleCold { get; set; }
public static ConfigEntry<bool> EnableModuleDark { get; set; }
public static ConfigEntry<bool> EnableModuleFire { get; set; }
public static ConfigEntry<bool> EnableModuleFlasks { get; set; }
public static ConfigEntry<bool> EnableModuleFood { get; set; }
public static ConfigEntry<bool> EnableModuleGeneratingItems { get; set; }
public static ConfigEntry<bool> EnableModuleHealing { get; set; }
public static ConfigEntry<bool> EnableModuleHoly { get; set; }
public static ConfigEntry<bool> EnableModuleLightning { get; set; }
public static ConfigEntry<bool> EnableModuleMark { get; set; }
public static ConfigEntry<bool> EnableModuleMeleeAttacks { get; set; }
public static ConfigEntry<bool> EnableModuleMind { get; set; }
public static ConfigEntry<bool> EnableModuleMiscellaneous { get; set; }
public static ConfigEntry<bool> EnableModuleMythicItems { get; set; }
public static ConfigEntry<bool> EnableModuleNerfs { get; set; }
public static ConfigEntry<bool> EnableModuleNPCs { get; set; }
public static ConfigEntry<bool> EnableModulePets { get; set; }
public static ConfigEntry<bool> EnableModulePoison { get; set; }
public static ConfigEntry<bool> EnableModuleRanged { get; set; }
public static ConfigEntry<bool> EnableModuleRareItemReworks { get; set; }
public static ConfigEntry<bool> EnableModuleRareItems { get; set; }
public static ConfigEntry<bool> EnableModuleRestrictedPower { get; set; }
public static ConfigEntry<bool> EnableModuleRust { get; set; }
public static ConfigEntry<bool> EnableModuleSahtiItems { get; set; }
public static ConfigEntry<bool> EnableModuleSkills { get; set; }
public static ConfigEntry<bool> EnableModuleSmallWeapons { get; set; }
public static ConfigEntry<bool> EnableModuleStealth { get; set; }
public static ConfigEntry<bool> EnableModuleSongs { get; set; }
public static ConfigEntry<bool> EnableModuleSongsNew { get; set; }
public static ConfigEntry<bool> EnableModuleSpeed { get; set; }
public static ConfigEntry<bool> EnableModuleThorns { get; set; }
public static ConfigEntry<bool> EnableModuleUncommonItems { get; set; }
private void Awake()
{
//IL_002c: 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_0047: Expected O, but got Unknown
//IL_0047: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_0078: Expected O, but got Unknown
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Expected O, but got Unknown
//IL_00d9: Expected O, but got Unknown
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Expected O, but got Unknown
//IL_0177: Expected O, but got Unknown
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Expected O, but got Unknown
//IL_01a8: Expected O, but got Unknown
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Expected O, but got Unknown
//IL_01d9: Expected O, but got Unknown
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Expected O, but got Unknown
//IL_020a: Expected O, but got Unknown
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Expected O, but got Unknown
//IL_023b: Expected O, but got Unknown
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Expected O, but got Unknown
//IL_026c: Expected O, but got Unknown
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Expected O, but got Unknown
//IL_029d: Expected O, but got Unknown
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Expected O, but got Unknown
//IL_02ce: Expected O, but got Unknown
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: Expected O, but got Unknown
//IL_02ff: Expected O, but got Unknown
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Expected O, but got Unknown
//IL_0330: Expected O, but got Unknown
//IL_0346: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Expected O, but got Unknown
//IL_0361: Expected O, but got Unknown
//IL_0377: Unknown result type (might be due to invalid IL or missing references)
//IL_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Expected O, but got Unknown
//IL_0392: Expected O, but got Unknown
//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Expected O, but got Unknown
//IL_03c3: Expected O, but got Unknown
//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
//IL_03f4: Expected O, but got Unknown
//IL_03f4: Expected O, but got Unknown
//IL_040a: Unknown result type (might be due to invalid IL or missing references)
//IL_041b: Unknown result type (might be due to invalid IL or missing references)
//IL_0425: Expected O, but got Unknown
//IL_0425: Expected O, but got Unknown
//IL_043b: Unknown result type (might be due to invalid IL or missing references)
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_0456: Expected O, but got Unknown
//IL_0456: Expected O, but got Unknown
//IL_046c: Unknown result type (might be due to invalid IL or missing references)
//IL_047d: Unknown result type (might be due to invalid IL or missing references)
//IL_0487: Expected O, but got Unknown
//IL_0487: Expected O, but got Unknown
//IL_049d: Unknown result type (might be due to invalid IL or missing references)
//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
//IL_04b8: Expected O, but got Unknown
//IL_04b8: Expected O, but got Unknown
//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
//IL_04df: Unknown result type (might be due to invalid IL or missing references)
//IL_04e9: Expected O, but got Unknown
//IL_04e9: Expected O, but got Unknown
//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0510: Unknown result type (might be due to invalid IL or missing references)
//IL_051a: Expected O, but got Unknown
//IL_051a: Expected O, but got Unknown
//IL_0530: Unknown result type (might be due to invalid IL or missing references)
//IL_0541: Unknown result type (might be due to invalid IL or missing references)
//IL_054b: Expected O, but got Unknown
//IL_054b: Expected O, but got Unknown
//IL_0561: Unknown result type (might be due to invalid IL or missing references)
//IL_0572: Unknown result type (might be due to invalid IL or missing references)
//IL_057c: Expected O, but got Unknown
//IL_057c: Expected O, but got Unknown
//IL_0592: Unknown result type (might be due to invalid IL or missing references)
//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
//IL_05ad: Expected O, but got Unknown
//IL_05ad: Expected O, but got Unknown
//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
//IL_05de: Expected O, but got Unknown
//IL_05de: Expected O, but got Unknown
//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0605: Unknown result type (might be due to invalid IL or missing references)
//IL_060f: Expected O, but got Unknown
//IL_060f: Expected O, but got Unknown
//IL_0625: Unknown result type (might be due to invalid IL or missing references)
//IL_0636: Unknown result type (might be due to invalid IL or missing references)
//IL_0640: Expected O, but got Unknown
//IL_0640: Expected O, but got Unknown
//IL_0656: Unknown result type (might be due to invalid IL or missing references)
//IL_0667: Unknown result type (might be due to invalid IL or missing references)
//IL_0671: Expected O, but got Unknown
//IL_0671: Expected O, but got Unknown
//IL_0687: Unknown result type (might be due to invalid IL or missing references)
//IL_0698: Unknown result type (might be due to invalid IL or missing references)
//IL_06a2: Expected O, but got Unknown
//IL_06a2: Expected O, but got Unknown
//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
//IL_06d3: Expected O, but got Unknown
//IL_06d3: Expected O, but got Unknown
//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
//IL_06fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0704: Expected O, but got Unknown
//IL_0704: Expected O, but got Unknown
//IL_071a: Unknown result type (might be due to invalid IL or missing references)
//IL_072b: Unknown result type (might be due to invalid IL or missing references)
//IL_0735: Expected O, but got Unknown
//IL_0735: Expected O, but got Unknown
//IL_074b: Unknown result type (might be due to invalid IL or missing references)
//IL_075c: Unknown result type (might be due to invalid IL or missing references)
//IL_0766: Expected O, but got Unknown
//IL_0766: Expected O, but got Unknown
//IL_077c: Unknown result type (might be due to invalid IL or missing references)
//IL_078d: Unknown result type (might be due to invalid IL or missing references)
//IL_0797: Expected O, but got Unknown
//IL_0797: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"com.binbin.UnofficialBalancePatch 1.8.3 has loaded!");
EnableMod = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "EnableMod"), true, new ConfigDescription("Enables the mod. If false, the mod will not work then next time you load the game.", (AcceptableValueBase)null, Array.Empty<object>()));
EnableDebugging = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "EnableDebugging"), false, new ConfigDescription("Enables the debugging", (AcceptableValueBase)null, Array.Empty<object>()));
AcceptableValueList<string> val = new AcceptableValueList<string>(new string[4] { "Easy", "Normal", "Hard", "Extreme" });
DifficultyLevel = ((BaseUnityPlugin)this).Config.Bind<string>(new ConfigDefinition("UnofficialBalancePatch", "StatModifiers"), "Normal", new ConfigDescription("Increases the stats of enemies to compensate for the increased card quality.", (AcceptableValueBase)(object)val, Array.Empty<object>()));
string value = DifficultyLevel.Value;
if (1 == 0)
{
}
DifficultyLevelEnum difficultyLevelEnum = value switch
{
"Easy" => DifficultyLevelEnum.Easy,
"Normal" => DifficultyLevelEnum.Normal,
"Hard" => DifficultyLevelEnum.Hard,
"Extreme" => DifficultyLevelEnum.Extreme,
_ => DifficultyLevelEnum.Normal,
};
if (1 == 0)
{
}
difficultyLevel = difficultyLevelEnum;
difficultyLevelInt = (int)difficultyLevel;
EnableModuleBleed = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Bleed Module"), true, new ConfigDescription("Enables the Bleed module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleBlunt = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Blunt Module"), true, new ConfigDescription("Enables the Blunt module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleCold = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Cold Module"), true, new ConfigDescription("Enables the Cold module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleDark = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Dark Module"), true, new ConfigDescription("Enables the Dark module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleFire = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Fire Module"), true, new ConfigDescription("Enables the Fire module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleFlasks = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Flasks Module"), true, new ConfigDescription("Enables the Flasks module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleFood = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Food Module"), true, new ConfigDescription("Enables the Food module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleGeneratingItems = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Generating Items Module"), true, new ConfigDescription("Enables the Generating Items module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleHealing = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Healing Module"), true, new ConfigDescription("Enables the Healing module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleHoly = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Holy Module"), true, new ConfigDescription("Enables the Holy module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleLightning = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Lightning Module"), true, new ConfigDescription("Enables the Lightning module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleMark = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Mark Module"), true, new ConfigDescription("Enables the Mark module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleMeleeAttacks = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Melee Attacks Module"), true, new ConfigDescription("Enables the Melee Attacks module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleMind = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Mind Module"), true, new ConfigDescription("Enables the Mind module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleMiscellaneous = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Miscellaneous Module"), true, new ConfigDescription("Enables the Miscellaneous module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleMythicItems = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Mythic Items Module"), true, new ConfigDescription("Enables the Mythic Items module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleNerfs = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Nerfs Module"), true, new ConfigDescription("Enables the Nerfs module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleNPCs = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "NPCs Module"), true, new ConfigDescription("Enables the NPCs module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModulePets = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Pets Module"), true, new ConfigDescription("Enables the Pets module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModulePoison = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Poison Module"), true, new ConfigDescription("Enables the Poison module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleRanged = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Ranged Misc Module"), true, new ConfigDescription("Enables the miscellaneous Ranged module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleRareItemReworks = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Item Reworks Module"), true, new ConfigDescription("Enables the Rare Item Reworks module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleRestrictedPower = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Restricted Power Module"), true, new ConfigDescription("Enables the Restricted Power Reworks module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleRust = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Rust Module"), true, new ConfigDescription("Enables the Rust Reworks module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleSahtiItems = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Sahti Items Module"), true, new ConfigDescription("Enables the Sahti Items Reworks module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleSkills = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Skills Module"), true, new ConfigDescription("Enables the Skills module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleStealth = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Stealth Module"), true, new ConfigDescription("Enables the Stealth module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleSmallWeapons = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Small Weapons Reworks Module"), true, new ConfigDescription("Enables the Small Weapons Reworks module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleSongs = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Songs Module"), true, new ConfigDescription("Enables the Songs module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleSongsNew = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Songs Module"), true, new ConfigDescription("Enables the New Cards for the Songs Module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Speed Module"), true, new ConfigDescription("Enables the Speed module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleThorns = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Thorns Module"), true, new ConfigDescription("Enables the Thorns module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModuleUncommonItems = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("UnofficialBalancePatch", "Uncommon Items Module"), true, new ConfigDescription("Enables the Uncommon Items module. Restart the game for this to take effect", (AcceptableValueBase)null, Array.Empty<object>()));
List<(ConfigEntry<bool>, string)> list = new List<(ConfigEntry<bool>, string)>(32)
{
(EnableModuleBleed, "Bleed"),
(EnableModuleBlunt, "Blunt"),
(EnableModuleCold, "Cold"),
(EnableModuleDark, "Dark"),
(EnableModuleFire, "Fire"),
(EnableModuleFlasks, "Flasks"),
(EnableModuleFood, "Food"),
(EnableModuleGeneratingItems, "Generating Items"),
(EnableModuleHealing, "Healing"),
(EnableModuleHoly, "Holy"),
(EnableModuleLightning, "Lightning"),
(EnableModuleMeleeAttacks, "Melee Attacks"),
(EnableModuleMind, "Mind"),
(EnableModuleMiscellaneous, "Miscellaneous"),
(EnableModuleMythicItems, "Mythic Items"),
(EnableModuleNerfs, "Nerfs"),
(EnableModuleNPCs, "NPCs"),
(EnableModulePets, "Pets"),
(EnableModulePoison, "Poison"),
(EnableModuleRanged, "Ranged Misc"),
(EnableModuleRareItemReworks, "Rare Item Reworks"),
(EnableModuleRestrictedPower, "Restricted Power"),
(EnableModuleRust, "Rust"),
(EnableModuleSahtiItems, "Sahti Items"),
(EnableModuleSkills, "Skills"),
(EnableModuleSmallWeapons, "Small Weapons"),
(EnableModuleStealth, "Stealth"),
(EnableModuleSongs, "Songs"),
(EnableModuleSongsNew, "Songs New"),
(EnableModuleSpeed, "Speed"),
(EnableModuleThorns, "Thorns"),
(EnableModuleUncommonItems, "Uncommon Items")
};
foreach (var (val2, text) in list)
{
if (val2.Value)
{
string text2 = "Binbin Balances - " + text;
Essentials.RegisterMod(text2, "binbin", "Unofficial Balance Patch - " + text, "1.8.3", 20241206, "https://github.com/binbinmods/Unofficial-AtO-Balance-Patch", (string[])null, text2, 100, (string[])null, "", true);
}
}
Essentials.RegisterMod("UnofficialBalancePatch", "binbin", "Unofficial Balance Patch", "1.8.3", 20241206, "https://github.com/binbinmods/Unofficial-AtO-Balance-Patch", (string[])null, "", 100, (string[])null, "", true);
LogDebug($"Current Difficulty Level: {difficultyLevel} ({difficultyLevelInt})");
AddCardTexts();
harmony.PatchAll();
}
internal static void LogDebug(string msg)
{
if (EnableDebugging.Value)
{
Log.LogDebug((object)(debugBase + msg));
}
}
internal static void LogInfo(string msg)
{
Log.LogInfo((object)(debugBase + msg));
}
internal static void LogError(string msg)
{
Log.LogError((object)(debugBase + msg));
}
internal static void AddCardTexts()
{
string text = "surprisebox";
string text2 = "At the start of the third round, gain a significant random buff.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, false);
text = "surpriseboxrare";
text2 = "At the start of the third round, gain a more significant random buff.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, false);
text = "surprisegiftbox";
text2 = "At the start of the third round, all heroes gain a significant random buff.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, false);
text = "surprisegiftboxrare";
text2 = "At the start of the third round, all heroes gain a more significant random buff.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, false);
text = "bbbportablewallofflames";
text2 = BalanceFunctions.SpriteText("thorns") + " on this character deal " + BalanceFunctions.SpriteText("fire") + " damage.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)28, text, false, true);
text = "bbbtreefellingaxe";
text2 = BalanceFunctions.SpriteText("bleed") + " on enemies cannot be prevented by Buffer or Immunities.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, true);
text = "bbbslimepoison";
text2 = BalanceFunctions.SpriteText("poison") + " on enemies cannot be prevented by Buffer or Immunities.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, true);
text = "bbbcloakofthorns";
text2 = BalanceFunctions.SpriteText("thorns") + " on heroes increases Thorns damage by 15% per charge.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, false);
text = "bbbcloakofthornsrare";
text2 = BalanceFunctions.SpriteText("thorns") + " on heroes increases Thorns damage by 25% per charge.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, false);
text = "bbbscrollofpetimmortality";
text2 = "Your pet is Immortal!";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, true);
text = "bbbrustedshield";
text2 = "If this hero has " + BalanceFunctions.SpriteText("rust") + ", " + BalanceFunctions.SpriteText("thorns") + " applies 50% of its charges as " + BalanceFunctions.SpriteText("poison") + " in addition to its normal effects.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)28, text, false, false);
text = "bbbrustedshieldrare";
text2 = "If this hero has " + BalanceFunctions.SpriteText("rust") + ", " + BalanceFunctions.SpriteText("thorns") + " applies 75% of its charges as " + BalanceFunctions.SpriteText("poison") + " in addition to its normal effects.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)28, text, false, false);
text = "soullanternrare";
text2 = BalanceFunctions.SpriteText("Dark") + " does not explode on this hero.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)16, text, false, false);
text = "rocketbootsrare";
text2 = BalanceFunctions.SpriteText("Fast") + " on this hero can stack.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, false);
text = "boneclawsrare";
text2 = BalanceFunctions.SpriteText("bleed") + " does not damage this hero.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)16, text, false, false);
text = "mimy";
text2 = "When you choose not to take an item, gain an extra 15 " + BalanceFunctions.SpriteText("currency");
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, false);
text = "mimyrare";
text2 = "When you choose not to take an item, gain an extra 30 " + BalanceFunctions.SpriteText("currency");
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, false);
text = "mozzy";
text2 = BalanceFunctions.SpriteText("bleed") + " on this hero deals damage at the end of turn";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)16, text, false, true);
text = "bbbmelancholicarmor";
text2 = "At the start of combat, shuffle " + BalanceFunctions.ColorTextArray("", BalanceFunctions.NumFormatItem(1), BalanceFunctions.SpriteText("card")) + "<color=#5E3016>Sad</color> into each monster's Draw Pile";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, false);
text = "bbbmelancholicarmorare";
text2 = "At the start of combat, shuffle " + BalanceFunctions.ColorTextArray("", BalanceFunctions.NumFormatItem(2), BalanceFunctions.SpriteText("card")) + "<color=#5E3016>Sad</color> into each monster's Draw Pile";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)9, text, false, false);
text = "captainspresenceblack";
text2 = BalanceFunctions.SpriteText("scourge") + " on this hero can stack.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)16, text, true, false);
text = "captainspresencered";
text2 = BalanceFunctions.SpriteText("burn") + " on this hero cannot be dispelled or prevented.";
CardDescriptionNew.AddTextToCardDescription(text2, (TextLocation)16, text, true, false);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "com.binbin.UnofficialBalancePatch";
public const string PLUGIN_NAME = "UnofficialBalancePatch";
public const string PLUGIN_VERSION = "1.8.3";
}
}