using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.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.morescarabs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f0f4b80087ac3e7a4ba8e291a7c861d6fd8e9b99")]
[assembly: AssemblyProduct("More Scarabs")]
[assembly: AssemblyTitle("com.binbin.morescarabs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace MoreScarabs
{
public class CustomFunctions
{
public static string debugBase = "MoreScarabs Testing - ";
public static string perkBase = "<RenameThisForPerks>";
public static void PLog(string s)
{
Plugin.Log.LogInfo((object)(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_0066: 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]);
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 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 traitName)
{
//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_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: 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)
{
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]);
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]);
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(traitName))
{
MatchManager.Instance.activatedTraits.Add(traitName, 1);
}
else
{
Dictionary<string, int> activatedTraits = MatchManager.Instance.activatedTraits;
int value = activatedTraits[traitName] + 1;
activatedTraits[traitName] = 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_" + traitName, "") + TextChargesLeft(MatchManager.Instance.activatedTraits[traitName], 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_0141: 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]);
if (cardData != null)
{
list.Add(cardData);
}
}
}
else
{
for (int j = 0; j < heroHand.Count; j++)
{
CardData cardData2 = MatchManager.Instance.GetCardData(heroHand[j]);
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)(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 Character GetRandomCharacter(Character[] array)
{
if (array == null)
{
Plugin.Log.LogDebug((object)(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)(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 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));
}
}
}
}
[HarmonyPatch]
public class MoreScarabPatches
{
public static int i = 1;
public static void CreateNPCLocal(NPCData _npcData, string effectTarget = "", int _position = -1, bool generateFromReload = false, string internalId = "", CardData _cardActive = null)
{
MatchManager instance = MatchManager.Instance;
CustomFunctions.PLog("Testing Reflection version before code");
MethodInfo method = ((object)instance).GetType().GetMethod("CreateNPC", BindingFlags.Instance | BindingFlags.NonPublic);
object[] parameters = new object[6] { _npcData, effectTarget, _position, generateFromReload, internalId, _cardActive };
method.Invoke(instance, parameters);
CustomFunctions.PLog("Testing Reflection version after code");
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MatchManager), "EndTurn")]
public static void EndTurnPrefix(MatchManager __instance, bool forceIt = false)
{
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Expected I4, but got Unknown
//IL_03be: Unknown result type (might be due to invalid IL or missing references)
//IL_03c4: Invalid comparison between Unknown and I4
//IL_039c: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Invalid comparison between Unknown and I4
//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
//IL_03cd: Invalid comparison between Unknown and I4
//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ab: Invalid comparison between Unknown and I4
CustomFunctions.PLog("End Turn Prefix for Jades - START");
CustomFunctions.PLog("Jade START");
if ((Object)(object)__instance == (Object)null || __instance.MatchIsOver || (Traverse.Create((object)__instance).Field("gameStatus").GetValue<string>() == "EndTurn" && !forceIt))
{
return;
}
string value = Traverse.Create((object)__instance).Field("scarabSpawned").GetValue<string>();
CombatData value2 = Traverse.Create((object)__instance).Field("combatData").GetValue<CombatData>();
int value3 = Traverse.Create((object)__instance).Field("currentRound").GetValue<int>();
NPC[] value4 = Traverse.Create((object)__instance).Field("TeamNPC").GetValue<NPC[]>();
if (value3 == 0 || value != "" || (Object)(object)value2 == (Object)null || (Object)(object)Globals.Instance.GetNodeData(AtOManager.Instance.currentMapNode) == (Object)null)
{
if (value3 == 0)
{
CustomFunctions.PLog("Round = 0");
}
if (value != "")
{
CustomFunctions.PLog("Scarab Spawned: " + value);
}
if ((Object)(object)value2 == (Object)null)
{
CustomFunctions.PLog("null combat");
}
if ((Object)(object)Globals.Instance.GetNodeData(AtOManager.Instance.currentMapNode) == (Object)null)
{
CustomFunctions.PLog("null mapNode");
}
return;
}
bool value5 = Plugin.GuaranteedSpawn.Value;
bool value6 = Plugin.OnlySpawnJades.Value;
int value7 = Plugin.PercentChanceToSpawn.Value;
CustomFunctions.PLog("Guaranteed Spawn " + value5);
CustomFunctions.PLog("Guaranteed Jade " + value6);
int num = (value5 ? 100 : value7);
int num2 = (value6 ? 2 : __instance.GetRandomIntRange(0, 4, "default", ""));
value = num2 switch
{
0 => "crystalscarab",
1 => "goldenscarab",
2 => "jadescarab",
_ => "scourgescarab",
};
bool flag = false;
CombatTier nodeCombatTier = Globals.Instance.GetNodeData(AtOManager.Instance.currentMapNode).NodeCombatTier;
CombatTier val = nodeCombatTier;
switch (val - 2)
{
case 0:
if (GameManager.Instance.IsObeliskChallenge())
{
flag = true;
}
break;
case 1:
flag = true;
break;
case 2:
flag = true;
break;
case 3:
flag = true;
break;
case 4:
if (GameManager.Instance.IsObeliskChallenge())
{
flag = true;
}
break;
case 5:
if (GameManager.Instance.IsObeliskChallenge())
{
flag = true;
}
break;
}
CustomFunctions.PLog("Is it a valid combat: " + flag);
if (flag)
{
int nPCAvailablePosition = __instance.GetNPCAvailablePosition();
if (nPCAvailablePosition > -1)
{
int randomIntRange = __instance.GetRandomIntRange(0, 100, "default", "");
if (randomIntRange < num)
{
string text = "";
if (!GameManager.Instance.IsObeliskChallenge())
{
if (AtOManager.Instance.GetTownTier() == 2)
{
text = ((AtOManager.Instance.GetNgPlus(false) <= 0) ? "_b" : "_plus_b");
}
else if (AtOManager.Instance.GetNgPlus(false) > 0)
{
text = "_plus";
}
}
else if (AtOManager.Instance.GetObeliskMadness() > 8)
{
text = (((int)value2.CombatTier == 6 || (int)value2.CombatTier == 7) ? "_plus_b" : "_plus");
}
else if ((int)value2.CombatTier == 6 || (int)value2.CombatTier == 7)
{
text = "_b";
}
NPCData nPC = Globals.Instance.GetNPC(value + text);
if ((Object)(object)nPC == (Object)null)
{
CustomFunctions.PLog("scarabData Null for scarab => " + value + text);
}
else
{
CreateNPCLocal(nPC, "", nPCAvailablePosition);
Globals.Instance.WaitForSeconds(0.5f);
if (num2 != 3)
{
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("luckyscarab"), 1, false, (CardClass)11, true, true);
}
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("sight"), 3, false, (CardClass)11, true, true);
switch (num2)
{
case 1:
if (AtOManager.Instance.GetNgPlus(false) == 0)
{
if (AtOManager.Instance.GetTownTier() == 1)
{
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("zeal"), 5, false, (CardClass)11, true, true);
}
else
{
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("zeal"), 7, false, (CardClass)11, true, true);
}
}
else if (AtOManager.Instance.GetTownTier() == 1)
{
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("zeal"), 6, false, (CardClass)11, true, true);
}
else
{
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("zeal"), 7, false, (CardClass)11, true, true);
}
break;
case 2:
if (AtOManager.Instance.GetNgPlus(false) == 0)
{
if (AtOManager.Instance.GetTownTier() == 1)
{
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("evasion"), 5, false, (CardClass)11, true, true);
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("buffer"), 5, false, (CardClass)11, true, true);
}
else
{
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("evasion"), 7, false, (CardClass)11, true, true);
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("buffer"), 7, false, (CardClass)11, true, true);
}
}
else if (AtOManager.Instance.GetTownTier() == 1)
{
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("evasion"), 6, false, (CardClass)11, true, true);
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("buffer"), 6, false, (CardClass)11, true, true);
}
else
{
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("evasion"), 7, false, (CardClass)11, true, true);
((Character)value4[nPCAvailablePosition]).SetAura((Character)null, Globals.Instance.GetAuraCurseData("buffer"), 7, false, (CardClass)11, true, true);
}
break;
}
GameManager.Instance.PlayLibraryAudio("glitter", 0.25f);
Globals.Instance.WaitForSeconds(0.5f);
}
}
}
}
Traverse.Create((object)__instance).Field("scarabSpawned").SetValue((object)value);
Traverse.Create((object)__instance).Field("combatData").SetValue((object)value2);
Traverse.Create((object)__instance).Field("teamNPC").SetValue((object)value4);
CustomFunctions.PLog("End Turn Prefix for Jades - END");
}
}
[BepInPlugin("com.binbin.morescarabs", "More Scarabs", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("AcrossTheObelisk.exe")]
public class Plugin : BaseUnityPlugin
{
internal int ModDate = 20241024;
private readonly Harmony harmony = new Harmony("com.binbin.morescarabs");
internal static ManualLogSource Log;
public static ConfigEntry<bool> GuaranteedSpawn { get; set; }
public static ConfigEntry<bool> OnlySpawnJades { get; set; }
public static ConfigEntry<int> PercentChanceToSpawn { 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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Expected O, but got Unknown
//IL_00a9: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"com.binbin.morescarabs 1.0.0 has loaded!");
GuaranteedSpawn = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Debug", "Guaranteed Spawn"), true, new ConfigDescription("It true, will guarantee 1 Scarab to spawn at the start of round 2.", (AcceptableValueBase)null, Array.Empty<object>()));
OnlySpawnJades = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Debug", "Only Spawn Jades"), true, new ConfigDescription("If true, will force all scarabs spawned to be Jade", (AcceptableValueBase)null, Array.Empty<object>()));
PercentChanceToSpawn = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Debug", "Percent Chance to Spawn"), 7, new ConfigDescription("Set the percent chance for a scarab to spawn, overwritten by Guaranteed Spawn)", (AcceptableValueBase)null, Array.Empty<object>()));
Essentials.RegisterMod("More Scarabs", "binbin", "More Scarabs", "1.0.0", ModDate, "https://github.com/binbinmods/MoreScarabs", (string[])null, "", 100, (string[])null, "", true);
harmony.PatchAll();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "com.binbin.morescarabs";
public const string PLUGIN_NAME = "More Scarabs";
public const string PLUGIN_VERSION = "1.0.0";
}
}