Decompiled source of PokemonTrainer v1.0.0

PokemonTrainer.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Commando;
using EntityStates.FlyingVermin.Mode;
using EntityStates.Merc;
using JetBrains.Annotations;
using KinematicCharacterController;
using On.RoR2;
using R2API;
using R2API.Utils;
using Rewired;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Navigation;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using ThreeEyedGames;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.UI;

[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 = "")]
[assembly: AssemblyCompany("PokemonTrainer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PokemonTrainer")]
[assembly: AssemblyTitle("PokemonTrainer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace PokemonTrainer;

internal class Assets
{
	public static AssetBundle MainAssetBundle;

	public static T Load<T>(string name) where T : Object
	{
		return MainAssetBundle.LoadAsset<T>(name);
	}

	public static void PopulateAssets()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		if ((Object)(object)MainAssetBundle == (Object)null)
		{
			using Stream stream = executingAssembly.GetManifestResourceStream("PokemonTrainer.AssetBundle." + "PokemonTrainer".ToLower() + "assets");
			MainAssetBundle = AssetBundle.LoadFromStream(stream);
		}
		using Stream stream2 = executingAssembly.GetManifestResourceStream("PokemonTrainer.PokemonTrainer.bnk");
		byte[] array = new byte[stream2.Length];
		stream2.Read(array, 0, array.Length);
		SoundBanks.Add(array);
	}
}
internal class HUDTracker : MonoBehaviour
{
	public struct PokeUI
	{
		public Image mainUI;

		public Image pokemonIcon;

		public TextMeshProUGUI pokemonName;

		public Image typeBG;

		public Image typeIcon;

		public GameObject CD;

		public TextMeshProUGUI Timer;

		public TooltipProvider tooltip;

		public PokeUI(GameObject main)
		{
			tooltip = main.AddComponent<TooltipProvider>();
			mainUI = main.GetComponent<Image>();
			ChildLocator component = ((Component)mainUI).GetComponent<ChildLocator>();
			pokemonIcon = ((Component)component.FindChild("Icon")).GetComponent<Image>();
			pokemonName = ((Component)component.FindChild("Name")).GetComponent<TextMeshProUGUI>();
			typeBG = ((Component)component.FindChild("TypeBG")).GetComponent<Image>();
			typeIcon = ((Component)component.FindChild("TypeIcon")).GetComponent<Image>();
			CD = ((Component)component.FindChild("CD")).gameObject;
			Timer = ((Component)component.FindChild("Timer")).GetComponent<TextMeshProUGUI>();
		}
	}

	public GameObject uiRoot;

	public HUD hud;

	private TrainerBehaviour behaviour;

	public int currentSelection;

	public Animator pokeball;

	public float pokeballSpeed = 8f;

	private Vector2 pokeballTargetPos;

	public bool released;

	public static float faintCD = MainPlugin.pokemonCD.Value;

	private float[] timers = new float[6] { faintCD, faintCD, faintCD, faintCD, faintCD, faintCD };

	private bool[] fainted = new bool[6];

	public PokeUI[] pokeUIs = new PokeUI[6];

	private Sprite[] typeIcons;

	private Color disabled = Color32.op_Implicit(new Color32((byte)166, (byte)166, (byte)166, byte.MaxValue));

	private Color typeEnabled = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)230));

	private Color typeDisabled = Color32.op_Implicit(new Color32((byte)166, (byte)166, (byte)166, (byte)230));

	private void PlaySound(string id)
	{
		if (Object.op_Implicit((Object)(object)behaviour) && ((NetworkBehaviour)((HuntressTracker)behaviour).characterBody).hasAuthority)
		{
			AkSoundEngine.PostEvent(id, ((Component)behaviour).gameObject);
		}
	}

	private void OnEnable()
	{
		PokemonDeathState.onPokemonDeath += Faint;
	}

	private void OnDisable()
	{
		PokemonDeathState.onPokemonDeath -= Faint;
	}

	public bool IsFainted()
	{
		return fainted[currentSelection];
	}

	public void Faint()
	{
		PokeUI pokeUI = pokeUIs[currentSelection];
		pokeUI.CD.SetActive(true);
		fainted[currentSelection] = true;
		released = false;
		pokeball.Play("Closed", 0);
		PlaySound("Play_PokemonTrainer_UI_Faint");
	}

	public bool UpdateSelection(int index)
	{
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		if (released || currentSelection == index)
		{
			return false;
		}
		bool flag = index < currentSelection;
		if (index < 0 || index > 5)
		{
			return false;
		}
		if (fainted[index])
		{
			bool flag2 = true;
			if (fainted[index])
			{
				if (flag)
				{
					for (int num = index; num > -1; num--)
					{
						if (!fainted[num])
						{
							index = num;
							flag2 = false;
							break;
						}
					}
				}
				else
				{
					for (int i = index; i < 6; i++)
					{
						if (!fainted[i])
						{
							index = i;
							flag2 = false;
							break;
						}
					}
				}
			}
			if (flag2)
			{
				return false;
			}
		}
		currentSelection = index;
		pokeball.Play(flag ? "RollUp" : "RollDown", 0);
		pokeballTargetPos = new Vector2(-363.2f, -9f - 96.17599f * (float)currentSelection);
		return true;
	}

	public void Release()
	{
		released = true;
		pokeball.Play("Open", 0);
	}

	private void Awake()
	{
		hud = ((Component)this).GetComponent<HUD>();
		typeIcons = (Sprite[])(object)new Sprite[19]
		{
			Assets.Load<Sprite>("icon_synchro_normal"),
			Assets.Load<Sprite>("icon_synchro_fighting"),
			Assets.Load<Sprite>("icon_synchro_flying"),
			Assets.Load<Sprite>("icon_synchro_poison"),
			Assets.Load<Sprite>("icon_synchro_ground"),
			Assets.Load<Sprite>("icon_synchro_rock"),
			Assets.Load<Sprite>("icon_synchro_bug"),
			Assets.Load<Sprite>("icon_synchro_ghost"),
			Assets.Load<Sprite>("icon_synchro_steel"),
			Assets.Load<Sprite>("icon_synchro_fire"),
			Assets.Load<Sprite>("icon_synchro_water"),
			Assets.Load<Sprite>("icon_synchro_grass"),
			Assets.Load<Sprite>("icon_synchro_electric"),
			Assets.Load<Sprite>("icon_synchro_psychic"),
			Assets.Load<Sprite>("icon_synchro_ice"),
			Assets.Load<Sprite>("icon_synchro_dragon"),
			Assets.Load<Sprite>("icon_synchro_dark"),
			Assets.Load<Sprite>("icon_synchro_fairy"),
			Assets.Load<Sprite>("icon_synchro_stellar")
		};
		ChildLocator component = uiRoot.GetComponent<ChildLocator>();
		for (int i = 1; i < 7; i++)
		{
			pokeUIs[i - 1] = new PokeUI(((Component)component.FindChild("pokemon" + i)).gameObject);
		}
		pokeball = ((Component)component.FindChild("pokeball")).GetComponent<Animator>();
	}

	private void FixedUpdate()
	{
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)behaviour))
		{
			if (Object.op_Implicit((Object)(object)hud) && Object.op_Implicit((Object)(object)hud.targetBodyObject) && Util.HasEffectiveAuthority(hud.targetBodyObject))
			{
				behaviour = hud.targetBodyObject.GetComponent<TrainerBehaviour>();
				if (Object.op_Implicit((Object)(object)behaviour))
				{
					uiRoot.SetActive(true);
					behaviour.uiRoot = uiRoot;
					behaviour.tracker = this;
					for (int i = 0; i < pokeUIs.Length; i++)
					{
						PokeUI pokeUI = pokeUIs[i];
						PokemonDef pokemonDef = behaviour.selectedPokemons[i];
						pokeUI.pokemonIcon.sprite = pokemonDef.sprite;
						((TMP_Text)pokeUI.pokemonName).text = ((Object)pokemonDef).name;
						pokeUI.typeIcon.sprite = typeIcons[(int)pokemonDef.type];
						TooltipProvider tooltip = pokeUI.tooltip;
						tooltip.titleToken = pokemonDef.body.baseNameToken;
						tooltip.titleColor = Color32.op_Implicit(PokemonDef.TypeColor[(int)pokemonDef.type]);
						tooltip.bodyToken = tooltip.titleToken.Replace("NAME", "DESC");
					}
				}
			}
			if (uiRoot.activeInHierarchy)
			{
				uiRoot.gameObject.SetActive(false);
			}
			return;
		}
		if (Object.op_Implicit((Object)(object)pokeball) && pokeballTargetPos != Vector2.zero)
		{
			((Component)pokeball).transform.localPosition = Vector3.Lerp(((Component)pokeball).transform.localPosition, Vector2.op_Implicit(pokeballTargetPos), Time.fixedDeltaTime * pokeballSpeed);
		}
		if (!uiRoot.activeInHierarchy)
		{
			uiRoot.SetActive(true);
		}
		for (int j = 0; j < pokeUIs.Length; j++)
		{
			PokeUI pokeUI2 = pokeUIs[j];
			bool flag = j == currentSelection && !fainted[j];
			((Graphic)pokeUI2.mainUI).color = (flag ? Color.white : disabled);
			((Graphic)pokeUI2.typeBG).color = (flag ? typeEnabled : typeDisabled);
			if (fainted[j])
			{
				timers[j] -= Time.fixedDeltaTime;
				if (timers[j] <= 0f)
				{
					fainted[j] = false;
					timers[j] = faintCD;
					pokeUI2.CD.SetActive(false);
					PlaySound("Play_PokemonTrainer_UI_Recover");
				}
				((TMP_Text)pokeUI2.Timer).text = Mathf.CeilToInt(timers[j]).ToString();
			}
		}
	}
}
internal class PokeBehaviour : MonoBehaviour
{
	private CharacterBody body;

	private CharacterBody ownerBody;

	private TrainerBehaviour behaviour;

	private CharacterMaster master;

	private BaseAI ai;

	public PokemonDef pokemonDef;

	public ChildLocator childLocator;

	public float deathScalingSpeed = 6f;

	public float snorlaxDuration = 1.2f;

	public float snorlaxJumpSpeed = 12f;

	public float snorlaxDownSpeed = 42f;

	public float snorlaxJumpAnimAddDuration = 0.85f;

	public float snorlaxJumpAnimAddDurationSpecial = 0.45f;

	public float snorlaxSecondarySlamRadius = 16f;

	public float snorlaxSecondaryDamage = 6.5f;

	public float snorlaxSpecialDuration = 2f;

	public float snorlaxSpecialDamage = 14f;

	public float snorlaxJumpSpeedSpecial = 48f;

	public float snorlaxDownSpeedSpecial = 95f;

	public float snorlaxJumpSpecialStopTime = 0.1f;

	public float snorlaxSpecialSlamRadius = 38f;

	public float snorlaxSpecialUpVelocity = 0f;

	public float pikachuAOERadius = 13f;

	public float pikachuDamage = 2f;

	public float pikachuBlastDamage = 2f;

	public float pikachuRandomBlastDamage = 5f;

	public float pikachuBlastRadius = 9f;

	public float pikachuBlastPosSearchRadius = 16f;

	public float megaCharizardSecondaryDuration = 1.5f;

	public float megaCharizardSecondaryDamage = 3.2f;

	public float megaCharizardSecondaryForwardVelocity = 40f;

	public float megaCharizardSpecialDuration = 3f;

	public float megaCharizardSpecialDamage = 1.5f;

	public float megaCharizardSpecialFireInterval = 0.125f;

	public float megaCharizardSpecialDistance = 30f;

	public float blastoiseSecondaryDuration = 4f;

	public float blastoiseSecondaryDamage = 0.85f;

	public float blastoiseSecondaryFireInterval = 0.2f;

	public float blastoiseSecondaryDistance = 24f;

	public float blastoiseSpecialDuration = 2f;

	public float blastoiseSpecialVelocity = 40f;

	public float blastoiseSpecialDamage = 8f;

	public float blastoiseSpecialRaycastForwardPos = 3f;

	public float blastoiseSpecialRaycastDistance = 15f;

	public float blastoiseSpecialHopAmount = 15f;

	public float venusaurSecondaryDuration = 2f;

	public float venusaurSecondaryDamage = 0.65f;

	public float venusaurSecondaryFireInterval = 0.08f;

	public float venusaurSecondaryMinSidePos = 0.5f;

	public float venusaurSecondaryMaxSidePos = 1f;

	public float venusaurSecondaryMinUpPos = 0.1f;

	public float venusaurSecondaryMaxUpPos = 1f;

	public float venusaurSecondaryDistance = 30f;

	public float venusaurSpecialDuration = 0.7f;

	public float venusaurSpecialDamage = 12f;

	public float venusaurSpecialDistance = 200f;

	public float venusaurSpecialFireDelay = 0.15f;

	public float glaceonSecondaryFireInterval = 0.275f;

	public float glaceonSecondaryMinSpread = 2.525f;

	public float glaceonSecondaryMaxSpread = 4.625f;

	public float glaceonSecondaryDistance = 48f;

	public float glaceonSecondaryDamage = 3.5f;

	public float glaceonSpecialRadius = 15f;

	public float glaceonSpecialDuration = 0.8f;

	public float glaceonSpecialDelay = 0.15f;

	private float stopwatch;

	public float maxOwnerDistance = 120f;

	public bool crystalMode;

	public TemporaryOverlayInstance overlay;

	private float lineStopwatch;

	private BezierCurveLine lineIndicator;

	private void Awake()
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		body = ((Component)this).GetComponent<CharacterBody>();
		childLocator = ((Component)body.modelLocator.modelTransform).GetComponent<ChildLocator>();
		Transform val = childLocator.FindChild("center");
		lineIndicator = Object.Instantiate<GameObject>(Prefabs.outRangeLineIndicator, val.position, Quaternion.identity, val).GetComponent<BezierCurveLine>();
		((Component)lineIndicator).gameObject.SetActive(false);
	}

	private void Start()
	{
		master = body.master;
		ai = ((Component)master).GetComponent<BaseAI>();
		if (Object.op_Implicit((Object)(object)body.master) && Object.op_Implicit((Object)(object)body.master.minionOwnership) && Object.op_Implicit((Object)(object)body.master.minionOwnership.ownerMaster) && Object.op_Implicit((Object)(object)(ownerBody = body.master.minionOwnership.ownerMaster.GetBody())))
		{
			behaviour = ((Component)ownerBody).GetComponent<TrainerBehaviour>();
			if (Object.op_Implicit((Object)(object)behaviour))
			{
				behaviour.pokemonAI = ai;
				behaviour.pokemonBody = body;
				behaviour.pokeBehaviour = this;
				lineIndicator.endTransform = ownerBody.coreTransform;
			}
		}
	}

	private void FixedUpdate()
	{
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: 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_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)ownerBody))
		{
			return;
		}
		lineStopwatch += Time.fixedDeltaTime;
		if (lineStopwatch >= 0.1f)
		{
			lineStopwatch = 0f;
			if (Object.op_Implicit((Object)(object)lineIndicator))
			{
				((Component)lineIndicator).gameObject.SetActive(Vector3.Distance(((Component)this).transform.position, ownerBody.coreTransform.position) > 45f);
			}
		}
		stopwatch += Time.fixedDeltaTime;
		if (stopwatch >= 1f)
		{
			stopwatch = 0f;
			if (Vector3.Distance(ownerBody.transform.position, ((Component)this).transform.position) > MainPlugin.pokemonMaxDistance.Value)
			{
				Vector3 val = Utils.FindNearestNodePosition(ownerBody.transform.position, (GraphType)0);
				if (NetworkServer.active)
				{
					TeleportHelper.TeleportGameObject(((Component)this).gameObject, val + Vector3.up * 2f);
				}
				EffectManager.SimpleEffect(Prefabs.Load<GameObject>("RoR2/Base/Huntress/HuntressBlinkEffect.prefab"), val, Quaternion.identity, false);
				AkSoundEngine.PostEvent("Play_huntress_shift_mini_blink", ((Component)this).gameObject);
			}
		}
		if (crystalMode && !body.HasBuff(Prefabs.gemBuff))
		{
			crystalMode = false;
			AkSoundEngine.PostEvent("Play_PokemonTrainer_CrystalMode_End", ((Component)this).gameObject);
			((Component)childLocator.FindChild("crown")).gameObject.SetActive(false);
		}
		if (overlay != null && Object.op_Implicit((Object)(object)overlay.materialInstance))
		{
			overlay.materialInstance.SetFloat("_IntersectionStrength", Util.Remap(Mathf.Clamp01(overlay.stopwatch / 15f), 0f, 1f, 1f, 20f));
		}
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)master) && !master.IsDeadAndOutOfLivesServer() && Object.op_Implicit((Object)(object)((Component)master).GetComponent<PlayerCharacterMasterController>()))
		{
		}
	}
}
internal class PokemonProjectileSpawner : MonoBehaviour
{
	private ProjectileController controller;

	private GameObject owner;

	private TrainerBehaviour behaviour;

	private Vector3 forward;

	private void Awake()
	{
		controller = ((Component)this).GetComponent<ProjectileController>();
	}

	private void Start()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		forward = ((Component)this).transform.forward;
		owner = controller.owner;
		if (Object.op_Implicit((Object)(object)owner))
		{
			behaviour = owner.GetComponent<TrainerBehaviour>();
		}
	}

	private void OnDisable()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)behaviour))
		{
			behaviour.Summon(((Component)this).transform.position, forward);
		}
	}
}
internal class TemporaryEffect : MonoBehaviour
{
	private ChildLocator childLocator;

	private float stopwatch;

	private void Awake()
	{
		childLocator = ((Component)this).GetComponent<ChildLocator>();
	}

	private void FixedUpdate()
	{
		stopwatch += Time.fixedDeltaTime;
		if (stopwatch >= 8f)
		{
			if (Object.op_Implicit((Object)(object)childLocator))
			{
				GameObject gameObject = ((Component)childLocator.FindChild("particles")).gameObject;
				gameObject.transform.parent = null;
				gameObject.GetComponent<ParticleSystem>().Play(true);
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
internal class TrainerBehaviour : HuntressTracker
{
	private CharacterBody body;

	public GameObject uiRoot;

	public PokemonDef[] selectedPokemons = new PokemonDef[6];

	public PokemonDef currentPokemon;

	public GenericSkill[] pokemonSkills;

	public BaseAI pokemonAI;

	public CharacterBody pokemonBody;

	public Player player;

	private HealthComponent targetHealth;

	public PokeBehaviour pokeBehaviour;

	public HUDTracker tracker;

	private Indicator targetIndicator;

	private int currentSelection => Object.op_Implicit((Object)(object)tracker) ? tracker.currentSelection : 0;

	private void Awake()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		base.indicator = new Indicator(((Component)this).gameObject, Prefabs.indicator);
		body = ((Component)this).GetComponent<CharacterBody>();
		targetIndicator = new Indicator(((Component)this).gameObject, Prefabs.targetIndicator);
	}

	public void Summon(Vector3 position, Vector3 forward)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Expected O, but got Unknown
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Expected O, but got Unknown
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Expected O, but got Unknown
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		if (NetworkServer.active)
		{
			MasterSummon val = new MasterSummon
			{
				masterPrefab = currentPokemon.masterPrefab,
				position = position,
				rotation = Quaternion.LookRotation(forward),
				summonerBodyObject = ((Component)this).gameObject,
				ignoreTeamMemberLimit = true,
				useAmbientLevel = true,
				inventoryToCopy = base.characterBody.inventory
			};
			CharacterMaster val2 = val.Perform();
			Deployable val3 = ((Component)val2).gameObject.AddComponent<Deployable>();
			val3.onUndeploy = new UnityEvent();
			val3.onUndeploy.AddListener(new UnityAction(val2.TrueKill));
			base.characterBody.master.AddDeployable(val3, Prefabs.pokemon);
		}
	}

	public bool IsPokemonFainted()
	{
		if (!Object.op_Implicit((Object)(object)tracker))
		{
			return false;
		}
		return tracker.IsFainted();
	}

	public void SetTarget()
	{
		if (!Object.op_Implicit((Object)(object)base.trackingTarget))
		{
			return;
		}
		if ((Object)(object)targetIndicator.targetTransform == (Object)(object)((Component)base.trackingTarget).transform)
		{
			targetIndicator.targetTransform = null;
			return;
		}
		targetHealth = base.trackingTarget.healthComponent;
		targetIndicator.targetTransform = ((Component)base.trackingTarget).transform;
		if (Object.op_Implicit((Object)(object)pokemonAI))
		{
			pokemonAI.currentEnemy.Reset();
			pokemonAI.currentEnemy.gameObject = ((Component)base.trackingTarget.healthComponent).gameObject;
			pokemonAI.currentEnemy.bestHurtBox = base.trackingTarget;
		}
	}

	private void Start()
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		((HuntressTracker)this).Start();
		for (int i = 0; i < pokemonSkills.Length; i++)
		{
			GenericSkill skill = pokemonSkills[i];
			int index = Array.IndexOf(skill.skillFamily.variants, Array.Find(skill.skillFamily.variants, (Variant x) => (Object)(object)x.skillDef == (Object)(object)skill.skillDef));
			selectedPokemons[i] = PokemonDef.pokemonList[index];
		}
		LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
		NetworkUser val = ((firstLocalUser != null) ? firstLocalUser.currentNetworkUser : null);
		if (Object.op_Implicit((Object)(object)val) && val.inputPlayer != null)
		{
			player = val.inputPlayer;
		}
		UpdateCurrentPokemon();
	}

	public void ResetTarget()
	{
		targetIndicator.targetTransform = null;
	}

	private void OnEnable()
	{
		((HuntressTracker)this).OnEnable();
		targetIndicator.active = true;
	}

	private void OnDisable()
	{
		((HuntressTracker)this).OnDisable();
		targetIndicator.active = false;
	}

	private void UpdateCurrentPokemon()
	{
		currentPokemon = selectedPokemons[currentSelection];
		AkSoundEngine.PostEvent("Play_PokemonTrainer_UI_Select", ((Component)this).gameObject);
	}

	private void Update()
	{
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)tracker))
		{
			return;
		}
		if (Object.op_Implicit((Object)(object)targetHealth) && targetIndicator.active && Object.op_Implicit((Object)(object)pokemonAI) && targetHealth.alive)
		{
			pokemonAI.currentEnemy.gameObject = ((Component)targetHealth).gameObject;
		}
		if (Object.op_Implicit((Object)(object)targetIndicator.targetTransform) && Object.op_Implicit((Object)(object)targetHealth) && (!targetHealth.alive || Vector3.Distance(targetIndicator.targetTransform.position, ((Component)this).transform.position) > 45f))
		{
			ResetTarget();
			if (Object.op_Implicit((Object)(object)pokemonAI))
			{
				pokemonAI.currentEnemy.Reset();
				pokemonAI.ForceAcquireNearestEnemyIfNoCurrentEnemy();
			}
		}
		if (((NetworkBehaviour)body).hasAuthority && !tracker.released)
		{
			if ((Input.GetAxis("Mouse ScrollWheel") > 0f || player.GetButtonDown(100)) && tracker.UpdateSelection(currentSelection - 1))
			{
				UpdateCurrentPokemon();
			}
			if ((Input.GetAxis("Mouse ScrollWheel") < 0f || player.GetButtonDown(102)) && tracker.UpdateSelection(currentSelection + 1))
			{
				UpdateCurrentPokemon();
			}
		}
	}
}
internal class CharacterBodySetup
{
	internal static GameObject baseBody = Prefabs.Load<GameObject>("RoR2/Base/Merc/MercBody.prefab");

	internal static GameObject baseMaster;

	private const string nameKey = "POKEMONTRAINER_";

	internal static void CreateCharacterBodies()
	{
		RegisterStates();
		CreateSurvivorPrefab();
	}

	internal static void CreateSurvivorPrefab()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = CreateBodyPrefab("Pokemon Trainer", Color32.op_Implicit(new Color32((byte)254, (byte)10, (byte)0, byte.MaxValue)), 90f, isPokemon: false);
		((HuntressTracker)val.AddComponent<TrainerBehaviour>()).maxTrackingDistance = 45f;
		CharacterBody component = val.GetComponent<CharacterBody>();
		component.baseMaxHealth = 80f;
		component.levelMaxHealth = 25f;
		component.sprintingSpeedMultiplier = 2f;
		val.GetComponent<HealthComponent>().health = component.baseMaxHealth;
		CreateSurvivorDef(val);
		PassiveSetup(val.gameObject);
		PrimarySetup(val.gameObject);
		SecondarySetup(val.gameObject);
		UtilitySetup(val.gameObject);
		SpecialSetup(val.gameObject);
		PokemonSkillSetup(val.gameObject);
	}

	internal static void CreateSurvivorDef(GameObject characterPrefab)
	{
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		CharacterBody component = characterPrefab.GetComponent<CharacterBody>();
		string text = ((Object)characterPrefab).name.Replace("Body", "");
		string text2 = text.Replace(" ", "").ToUpper();
		string text3 = " <style=cSub>\r\n\r\n< ! > \r\n\r\n< ! > \r\n\r\n< ! > \r\n\r\n< ! > \r\n\r\n";
		string text4 = "..and so they left, another journey on the horizon.";
		string text5 = "..and so they vanished, back to the PC.";
		string text6 = "";
		LanguageAPI.Add("POKEMONTRAINER_" + text2 + "_DESCRIPTION", text3);
		LanguageAPI.Add("POKEMONTRAINER_" + text2 + "_SUBTITLE", "League Champion");
		LanguageAPI.Add("POKEMONTRAINER_" + text2 + "_OUTRO", text4);
		LanguageAPI.Add("POKEMONTRAINER_" + text2 + "_FAIL", text5);
		SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>();
		val.cachedName = "POKEMONTRAINER_" + text2 + "_NAME";
		val.unlockableDef = null;
		val.descriptionToken = "POKEMONTRAINER__DESCRIPTION";
		val.primaryColor = component.bodyColor;
		val.bodyPrefab = characterPrefab;
		val.displayPrefab = Utils.NewDisplayModel(((Component)characterPrefab.GetComponent<ModelLocator>().modelBaseTransform).gameObject, text + "Display");
		val.outroFlavorToken = "POKEMONTRAINER__OUTRO";
		val.desiredSortPosition = 22f;
		val.mainEndingEscapeFailureFlavorToken = "POKEMONTRAINER__FAIL";
		ContentAddition.AddSurvivorDef(val);
	}

	internal static void RegisterStates()
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: 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_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: 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)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		bool flag = default(bool);
		ContentAddition.AddEntityState<Primary>(ref flag);
		ContentAddition.AddEntityState<Secondary>(ref flag);
		ContentAddition.AddEntityState<Utility>(ref flag);
		ContentAddition.AddEntityState<Special>(ref flag);
		ContentAddition.AddEntityState<Withdraw>(ref flag);
		ContentAddition.AddEntityState<CharacterMain>(ref flag);
		ContentAddition.AddEntityState<MeleeSkillState>(ref flag);
		ContentAddition.AddEntityState<BasicMeleeSkillState>(ref flag);
		ContentAddition.AddEntityState<BaseTrainerState>(ref flag);
		ContentAddition.AddEntityState<BasePokeState>(ref flag);
		ContentAddition.AddEntityState<PokemonExitState>(ref flag);
		ContentAddition.AddEntityState<PokemonSpawnState>(ref flag);
		ContentAddition.AddEntityState<PokemonDeathState>(ref flag);
		ContentAddition.AddEntityState<CrystalMode>(ref flag);
		ContentAddition.AddEntityState<SnorlaxSecondary>(ref flag);
		ContentAddition.AddEntityState<SnorlaxSpecial>(ref flag);
		ContentAddition.AddEntityState<PikachuSecondary>(ref flag);
		ContentAddition.AddEntityState<PikachuSpecial>(ref flag);
		ContentAddition.AddEntityState<MegaCharizardXSecondary>(ref flag);
		ContentAddition.AddEntityState<MegaCharizardXSpecial>(ref flag);
		ContentAddition.AddEntityState<BlastoiseSecondary>(ref flag);
		ContentAddition.AddEntityState<BlastoiseSpecial>(ref flag);
		ContentAddition.AddEntityState<VenusaurSecondary>(ref flag);
		ContentAddition.AddEntityState<VenusaurSpecial>(ref flag);
		ContentAddition.AddEntityState<GlaceonSecondary>(ref flag);
		ContentAddition.AddEntityState<GlaceonSpecial>(ref flag);
	}

	internal static void PassiveSetup(GameObject characterPrefab)
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("POKEMONTRAINER__PASSIVE_NAME", "Running Shoes");
		LanguageAPI.Add("POKEMONTRAINER__PASSIVE_DESCRIPTION", "<style=cIsUtility>Sprint</style> at twice the speed.");
		component.passiveSkill.enabled = true;
		component.passiveSkill.skillNameToken = "POKEMONTRAINER__PASSIVE_NAME";
		component.passiveSkill.skillDescriptionToken = "POKEMONTRAINER__PASSIVE_DESCRIPTION";
		component.passiveSkill.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("utility");
		LanguageAPI.Add("POKEMONTRAINER__PASSIVE2_NAME", "STAB");
		LanguageAPI.Add("POKEMONTRAINER__PASSIVE2_DESCRIPTION", "<style=cIsDamage>Pokemons</style> have a <style=cIsDamage>" + MainPlugin.STABChance.Value * 100f + "%</style> chance on hit to apply a <style=cIsDamage>status effect</style> and/or buffs and debuffs based on their type.");
		LanguageAPI.Add("POKEMONTRAINER__PASSIVE2_KEYWORD", "<style=cKeywordName>Normal</style><style=cSub><style=cIsDamage>Weakens</style> the target's damage by <style=cIsDamage>20%</style> and armor by <style=cIsDamage>20</style>.\r\n\r\n<style=cKeywordName>Fire</style><style=cSub><style=cIsDamage>Burns</style> the target for <style=cIsDamage>50% damage</style>.\r\n\r\n<style=cKeywordName>Water</style><style=cSub><style=cIsDamage>Slows</style> the target's <style=cIsUtility>movement speed</style> by <style=cIsDamage>80%</style> and buffs the attacker's damage by <style=cIsDamage>40%</style> for <style=cIsUtility>8s</style>.\r\n\r\n<style=cKeywordName>Grass</style><style=cSub><style=cIsHealing>Heals</style> the user for the damage dealt <style=cIsHealth>+25% health</style>.\r\n\r\n<style=cKeywordName>Electric</style><style=cSub><style=cIsDamage>Stuns</style> the target for <style=cIsUtility>3s</style>.\r\n\r\n<style=cKeywordName>Electric</style><style=cSub><style=cIsUtility>Freeze</style> the target for <style=cIsUtility>3s</style>.");
		SkillDef skill = Utils.NewSkillDef<SkillDef>(typeof(Primary), "Weapon", 0, 0f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: true, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: false, cancelSprintingOnActivation: true, 0, 0, 0, Assets.MainAssetBundle.LoadAsset<Sprite>("passive2"), "POKEMONTRAINER__PASSIVE2_DESCRIPTION", "POKEMONTRAINER__PASSIVE2_NAME", new string[1] { "POKEMONTRAINER__PASSIVE2_KEYWORD" });
		Utils.NewGenericSkill(characterPrefab, skill);
	}

	internal static void PrimarySetup(GameObject characterPrefab)
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("POKEMONTRAINER__M1", "Command");
		LanguageAPI.Add("POKEMONTRAINER__M1_DESCRIPTION", "Select a target.");
		SkillDef val = Utils.NewSkillDef<TrainerSkillDef>(typeof(Primary), "Weapon", 1, 1f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: true, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: true, 1, 1, 1, Assets.MainAssetBundle.LoadAsset<Sprite>("primary"), "POKEMONTRAINER__M1_DESCRIPTION", "POKEMONTRAINER__M1", Array.Empty<string>());
		((TrainerSkillDef)(object)val).isTracking = true;
		component.primary = Utils.NewGenericSkill(characterPrefab, val);
	}

	internal static void SecondarySetup(GameObject characterPrefab)
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("POKEMONTRAINER__M2", "Special Move");
		LanguageAPI.Add("POKEMONTRAINER__M2_DESCRIPTION", "Command your <style=cIsDamage>Pokemon</style> to use their special move.");
		SkillDef skill = Utils.NewSkillDef<TrainerSkillDef>(typeof(Secondary), "Weapon", 1, 12f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Assets.MainAssetBundle.LoadAsset<Sprite>("secondary"), "POKEMONTRAINER__M2_DESCRIPTION", "POKEMONTRAINER__M2", Array.Empty<string>());
		component.secondary = Utils.NewGenericSkill(characterPrefab, skill);
	}

	internal static void UtilitySetup(GameObject characterPrefab)
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("POKEMONTRAINER__UTIL", "Terastallization");
		LanguageAPI.Add("POKEMONTRAINER__UTIL_DESCRIPTION", "Your current <style=cIsDamage>Pokemon</style> enters a <style=cIsUtility>Terastallized</style> state, which <style=cIsHealing>fully heals</style> and <style=cIsHealing>cleanses</style> all negatives effects on it. Additionally, any projectiles near it are destroyed. While <style=cIsUtility>Terastallized</style>, it gains a <style=cIsDamage>" + MainPlugin.TeraStatMult.Value * 100f + "%</style> increase to all stats, and an additional <style=cIsDamage>" + MainPlugin.TeraAddSTABChance.Value * 100f + "% STAB chance</style>.");
		SkillDef val = Utils.NewSkillDef<TrainerSkillDef>(typeof(Utility), "Slide", 1, 18f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Assets.MainAssetBundle.LoadAsset<Sprite>("crystallization"), "POKEMONTRAINER__UTIL_DESCRIPTION", "POKEMONTRAINER__UTIL", Array.Empty<string>());
		(val as TrainerSkillDef).needsPokemonBody = true;
		component.utility = Utils.NewGenericSkill(characterPrefab, val);
	}

	internal static void SpecialSetup(GameObject characterPrefab)
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("POKEMONTRAINER__SPEC", "Release");
		LanguageAPI.Add("POKEMONTRAINER__SPEC_DESCRIPTION", "Release the selected <style=cIsDamage>Pokemon</style>. Pokemons <style=cIsUtility>inherit all your items</style>.");
		SkillDef val = Utils.NewSkillDef<TrainerSkillDef>(typeof(Special), "Release", 0, 0f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 0, 0, 0, Assets.MainAssetBundle.LoadAsset<Sprite>("special"), "POKEMONTRAINER__SPEC_DESCRIPTION", "POKEMONTRAINER__SPEC", Array.Empty<string>());
		((TrainerSkillDef)(object)val).needsPokemonAlive = true;
		component.special = Utils.NewGenericSkill(characterPrefab, val);
	}

	internal static GameObject CreateBodyPrefab(string characterName, Color bodyColor, float mass, bool isPokemon = true, bool large = false, bool flying = false)
	{
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Expected O, but got Unknown
		//IL_00fc: 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_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Expected O, but got Unknown
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: 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)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Unknown result type (might be due to invalid IL or missing references)
		//IL_032c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0359: Unknown result type (might be due to invalid IL or missing references)
		//IL_035e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0424: Unknown result type (might be due to invalid IL or missing references)
		//IL_0444: Unknown result type (might be due to invalid IL or missing references)
		//IL_0451: Unknown result type (might be due to invalid IL or missing references)
		//IL_052f: Unknown result type (might be due to invalid IL or missing references)
		//IL_056d: Unknown result type (might be due to invalid IL or missing references)
		//IL_057a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0697: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0700: Unknown result type (might be due to invalid IL or missing references)
		//IL_0723: Unknown result type (might be due to invalid IL or missing references)
		//IL_0746: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0839: Unknown result type (might be due to invalid IL or missing references)
		//IL_083e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c2c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c31: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c42: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c47: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c58: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c5d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bf5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bfa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c0b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c10: Unknown result type (might be due to invalid IL or missing references)
		string text = characterName.Replace(" ", "");
		string text2 = text.ToUpper();
		LanguageAPI.Add("POKEMONTRAINER_" + text2 + "_NAME", characterName);
		GameObject val = PrefabAPI.InstantiateClone(baseBody, text + "Body", true);
		val.GetComponent<NetworkIdentity>().localPlayerAuthority = true;
		Object.Destroy((Object)(object)((Component)val.transform.Find("ModelBase")).gameObject);
		Object.Destroy((Object)(object)((Component)val.transform.Find("CameraPivot")).gameObject);
		Object.Destroy((Object)(object)((Component)val.transform.Find("AimOrigin")).gameObject);
		GameObject val2 = Assets.MainAssetBundle.LoadAsset<GameObject>(text + "Mdl");
		val2.AddComponent<AnimationEvents>().soundCenter = val2;
		GameObject val3 = new GameObject("ModelBase");
		val3.transform.parent = val.transform;
		val3.transform.localPosition = new Vector3(0f, -0.94f, 0f);
		val3.transform.localRotation = Quaternion.identity;
		val3.transform.localScale = Vector3.one;
		GameObject val4 = new GameObject("AimOrigin");
		val4.transform.parent = val3.transform;
		val4.transform.localPosition = new Vector3(0f, 1.4f, 0f);
		val4.transform.localRotation = Quaternion.identity;
		val4.transform.localScale = Vector3.one;
		Transform transform = val2.transform;
		transform.parent = val3.transform;
		transform.localPosition = Vector3.zero;
		transform.localRotation = Quaternion.identity;
		CharacterDirection component = val.GetComponent<CharacterDirection>();
		component.targetTransform = val3.transform;
		component.modelAnimator = val2.GetComponentInChildren<Animator>();
		component.turnSpeed = 720f;
		CharacterBody component2 = val.GetComponent<CharacterBody>();
		((Object)component2).name = text + "Body";
		component2.baseNameToken = "POKEMONTRAINER_" + text2 + "_NAME";
		component2.subtitleNameToken = "POKEMONTRAINER_" + text2 + "_SUBTITLE";
		component2.bodyFlags = (BodyFlags)16;
		component2.aimOriginTransform = val4.transform;
		component2.hullClassification = (HullClassification)(large ? 1 : 0);
		Sprite val5 = Assets.MainAssetBundle.LoadAsset<Sprite>(text);
		component2.portraitIcon = (Texture)(object)(Object.op_Implicit((Object)(object)val5) ? val5.texture : null);
		component2.isChampion = false;
		component2.currentVehicle = null;
		component2.skinIndex = 0u;
		component2.bodyColor = bodyColor;
		HealthComponent component3 = val.GetComponent<HealthComponent>();
		component3.health = component2.baseMaxHealth;
		component3.shield = 0f;
		component3.barrier = 0f;
		CharacterMotor component4 = val.GetComponent<CharacterMotor>();
		component4.walkSpeedPenaltyCoefficient = 1f;
		component4.characterDirection = component;
		component4.muteWalkMotion = false;
		component4.mass = mass;
		component4.airControl = 0.25f;
		component4.disableAirControlUntilCollision = false;
		component4.generateParametersOnAwake = true;
		InputBankTest component5 = val.GetComponent<InputBankTest>();
		component5.moveVector = Vector3.zero;
		CameraTargetParams component6 = val.GetComponent<CameraTargetParams>();
		component6.cameraParams = baseBody.GetComponent<CameraTargetParams>().cameraParams;
		component6.cameraPivotTransform = null;
		component6.recoil = Vector2.zero;
		component6.dontRaycastToPivot = false;
		ModelLocator component7 = val.GetComponent<ModelLocator>();
		component7.modelTransform = transform;
		component7.modelBaseTransform = val3.transform;
		component7.dontReleaseModelOnDeath = false;
		component7.autoUpdateModelTransform = true;
		component7.dontDetatchFromParent = false;
		component7.noCorpse = false;
		component7.normalizeToFloor = false;
		component7.preserveModel = false;
		ChildLocator component8 = val2.GetComponent<ChildLocator>();
		CharacterModel val6 = val2.AddComponent<CharacterModel>();
		SkinnedMeshRenderer[] componentsInChildren = val2.GetComponentsInChildren<SkinnedMeshRenderer>(true);
		List<RendererInfo> list = new List<RendererInfo>();
		foreach (SkinnedMeshRenderer val7 in componentsInChildren)
		{
			string name = ((Object)val7).name;
			if (((Renderer)val7).materials.Length == 1)
			{
				((Renderer)val7).material = Utils.InstantiateMaterial(((Renderer)val7).material.mainTexture);
				list.Add(new RendererInfo
				{
					renderer = (Renderer)(object)val7,
					defaultMaterial = ((Renderer)val7).material,
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				});
			}
			((Component)val7).gameObject.SetActive(true);
			if (isPokemon && text == "MegaCharizardX" && (name == "Claws" || name == "FireA1"))
			{
				((Component)val7).gameObject.SetActive(false);
			}
			if (!isPokemon && !name.Contains("ash"))
			{
				((Component)val7).gameObject.SetActive(((Component)val7).gameObject.activeInHierarchy);
			}
		}
		if (isPokemon)
		{
			Renderer component9 = ((Component)component8.FindChild("crown")).GetComponent<Renderer>();
			((Component)component9).gameObject.SetActive(false);
			list.Add(new RendererInfo
			{
				renderer = component9,
				defaultMaterial = Prefabs.crownMaterials[((Object)component9).name.Replace("Crown", "").ToLower()],
				defaultShadowCastingMode = (ShadowCastingMode)1,
				ignoreOverlays = false
			});
		}
		RendererInfo[] array = list.ToArray();
		val6.body = component2;
		val6.baseRendererInfos = array;
		val6.autoPopulateLightInfos = true;
		val6.temporaryOverlays = new List<TemporaryOverlayInstance>();
		val6.mainSkinnedMeshRenderer = componentsInChildren[0];
		if (isPokemon)
		{
			component2.bodyFlags = (BodyFlags)(component2.bodyFlags | 1);
			component2.preferredPodPrefab = null;
			component7.dontDetatchFromParent = true;
		}
		else
		{
			ModelSkinController val8 = val2.AddComponent<ModelSkinController>();
			LanguageAPI.Add(text2 + "BODY_DEFAULT_SKIN_NAME", "Ash");
			LanguageAPI.Add(text2 + "BODY_SKIN01_NAME", "Red");
			LanguageAPI.Add(text2 + "BODY_SKIN02_NAME", "Misty");
			LanguageAPI.Add(text2 + "BODY_SKIN03_NAME", "May");
			LanguageAPI.Add(text2 + "BODY_SKIN04_NAME", "Dawn");
			LanguageAPI.Add(text2 + "BODY_SKIN05_NAME", "Veteran");
			val8.skins = (SkinDef[])(object)new SkinDef[6]
			{
				Skins.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, val2, text2 + "BODY_DEFAULT_SKIN_NAME", "ash", array)),
				Skins.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, val2, text2 + "BODY_SKIN01_NAME", "red", array)),
				Skins.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, val2, text2 + "BODY_SKIN02_NAME", "misty", array)),
				Skins.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, val2, text2 + "BODY_SKIN03_NAME", "may", array)),
				Skins.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, val2, text2 + "BODY_SKIN04_NAME", "dawn", array)),
				Skins.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, val2, text2 + "BODY_SKIN05_NAME", "veteran", array))
			};
		}
		Collider[] componentsInChildren2 = val2.GetComponentsInChildren<Collider>();
		HurtBoxGroup val9 = val2.AddComponent<HurtBoxGroup>();
		List<HurtBox> list2 = new List<HurtBox>();
		Collider[] array2 = componentsInChildren2;
		foreach (Collider val10 in array2)
		{
			HurtBox val11 = ((Component)val10).gameObject.AddComponent<HurtBox>();
			((Component)val11).gameObject.layer = LayerIndex.entityPrecise.intVal;
			val11.healthComponent = component3;
			val11.isBullseye = true;
			val11.damageModifier = (DamageModifier)0;
			val11.hurtBoxGroup = val9;
			val11.indexInGroup = 0;
			val9.mainHurtBox = val11;
			val9.bullseyeCount = 1;
			list2.Add(val11);
		}
		val9.hurtBoxes = list2.ToArray();
		KinematicCharacterMotor component10 = val.GetComponent<KinematicCharacterMotor>();
		component10.CharacterController = (ICharacterController)(object)component4;
		component10.playerCharacter = !isPokemon;
		if (!isPokemon)
		{
			PhysicMaterial val12 = Addressables.LoadAssetAsync<PhysicMaterial>((object)"RoR2/Base/Common/physmatRagdoll.physicMaterial").WaitForCompletion();
			List<Transform> list3 = new List<Transform>();
			List<string> list4 = new List<string>
			{
				"Hips", "Lthigh", "LLeg", "LFoot", "Rthigh", "RLeg", "RFoot", "stomach", "Spine0", "Spine1",
				"Neck", "Head", "LShoulder", "LArm", "LForeArm", "LHand", "RShoulder", "RArm", "RForeArm", "RHand"
			};
			Transform[] componentsInChildren3 = val2.GetComponentsInChildren<Transform>(true);
			foreach (Transform val13 in componentsInChildren3)
			{
				string name2 = ((Object)val13).name;
				if (list4.Contains(name2))
				{
					list3.Add(val13);
					GameObject gameObject = ((Component)val13).gameObject;
					gameObject.layer = LayerIndex.ragdoll.intVal;
					if (!Object.op_Implicit((Object)(object)gameObject.GetComponent<Rigidbody>()))
					{
						gameObject.AddComponent<Rigidbody>();
					}
					CapsuleCollider val14 = gameObject.AddComponent<CapsuleCollider>();
					val14.radius = 0.4f;
					val14.height = 3.5f;
					((Collider)val14).material = val12;
					((Collider)val14).sharedMaterial = val12;
					Rigidbody component11 = ((Component)val13.parent).GetComponent<Rigidbody>();
					if (Object.op_Implicit((Object)(object)component11))
					{
						CharacterJoint val15 = gameObject.AddComponent<CharacterJoint>();
						((Joint)val15).autoConfigureConnectedAnchor = true;
						((Joint)val15).enablePreprocessing = true;
						((Joint)val15).connectedBody = component11;
					}
				}
			}
			RagdollController val16 = val2.AddComponent<RagdollController>();
			val16.bones = list3.ToArray();
		}
		val.GetComponent<Interactor>().maxInteractionDistance = 3f;
		val.GetComponent<InteractionDriver>().highlightInteractor = true;
		SfxLocator component12 = val.GetComponent<SfxLocator>();
		component12.deathSound = (isPokemon ? "" : "Play_ui_player_death");
		component12.barkSound = "";
		component12.openSound = "";
		component12.landingSound = (large ? "Play_gravekeeper_land" : "Play_char_land");
		component12.fallDamageSound = "Play_char_land_fall_damage";
		component12.aliveLoopStart = "";
		component12.aliveLoopStop = "";
		val.GetComponent<Rigidbody>().mass = mass;
		FootstepHandler val17 = val2.AddComponent<FootstepHandler>();
		val17.baseFootstepString = (large ? "Play_beetle_queen_step" : "Play_player_footstep");
		val17.sprintFootstepOverrideString = "";
		val17.enableFootstepDust = true;
		val17.footstepDustPrefab = Prefabs.Load<GameObject>(large ? "RoR2/Base/Common/VFX/GenericHugeFootstepDust.prefab" : "RoR2/Base/Common/VFX/GenericFootstepDust.prefab");
		GenericSkill[] componentsInChildren4 = val.GetComponentsInChildren<GenericSkill>();
		foreach (GenericSkill val18 in componentsInChildren4)
		{
			Object.DestroyImmediate((Object)(object)val18);
		}
		EntityStateMachine component13 = ((Component)component2).GetComponent<EntityStateMachine>();
		Utils.NewStateMachine<Idle>(val, "Slide");
		Utils.NewStateMachine<Idle>(val, "Release");
		if (flying)
		{
			Utils.NewStateMachine<GrantFlight>(val, "Flight");
			component12.landingSound = "";
			component12.fallDamageSound = "";
		}
		CharacterDeathBehavior component14 = val.GetComponent<CharacterDeathBehavior>();
		component14.deathStateMachine = val.GetComponent<EntityStateMachine>();
		if (!isPokemon)
		{
			component14.deathState = new SerializableEntityStateType(typeof(DeathState));
			component13.mainStateType = new SerializableEntityStateType(typeof(CharacterMain));
		}
		else
		{
			val.AddComponent<PokeBehaviour>();
			component13.initialStateType = new SerializableEntityStateType(typeof(PokemonSpawnState));
			component13.mainStateType = new SerializableEntityStateType(typeof(GenericCharacterMain));
			component14.deathState = new SerializableEntityStateType(typeof(PokemonDeathState));
		}
		NetworkStateMachine component15 = ((Component)component2).GetComponent<NetworkStateMachine>();
		component15.stateMachines = ((Component)component2).GetComponents<EntityStateMachine>();
		ContentAddition.AddBody(val);
		return val;
	}

	internal static void PokemonSkillSetup(GameObject characterPrefab)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: 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_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Invalid comparison between Unknown and I4
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_039b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0353: Unknown result type (might be due to invalid IL or missing references)
		PokemonDef pokemon = PokemonDef.CreatePokemonDef(CreateBodyPrefab("Venusaur", Color32.op_Implicit(new Color32((byte)254, (byte)10, (byte)0, byte.MaxValue)), 205f, isPokemon: true, large: true), PokemonDef.Type.Grass);
		PokemonDef pokemon2 = PokemonDef.CreatePokemonDef(CreateBodyPrefab("Mega Charizard X", Color32.op_Implicit(new Color32((byte)254, (byte)10, (byte)0, byte.MaxValue)), 120f, isPokemon: true, large: true, flying: true), PokemonDef.Type.Fire);
		PokemonDef pokemon3 = PokemonDef.CreatePokemonDef(CreateBodyPrefab("Blastoise", Color32.op_Implicit(new Color32((byte)254, (byte)10, (byte)0, byte.MaxValue)), 180f, isPokemon: true, large: true), PokemonDef.Type.Water);
		PokemonDef pokemon4 = PokemonDef.CreatePokemonDef(CreateBodyPrefab("Pikachu", Color32.op_Implicit(new Color32((byte)254, (byte)10, (byte)0, byte.MaxValue)), 55f), PokemonDef.Type.Electric);
		PokemonDef pokemon5 = PokemonDef.CreatePokemonDef(CreateBodyPrefab("Snorlax", Color32.op_Implicit(new Color32((byte)254, (byte)10, (byte)0, byte.MaxValue)), 290f, isPokemon: true, large: true), PokemonDef.Type.Normal);
		PokemonDef pokemon6 = PokemonDef.CreatePokemonDef(CreateBodyPrefab("Glaceon", Color32.op_Implicit(new Color32((byte)254, (byte)10, (byte)0, byte.MaxValue)), 95f), PokemonDef.Type.Ice);
		GenericSkill[] array = (GenericSkill[])(object)new GenericSkill[6]
		{
			Utils.NewGenericSkill(characterPrefab),
			Utils.NewGenericSkill(characterPrefab),
			Utils.NewGenericSkill(characterPrefab),
			Utils.NewGenericSkill(characterPrefab),
			Utils.NewGenericSkill(characterPrefab),
			Utils.NewGenericSkill(characterPrefab)
		};
		GenericSkill[] array2 = array;
		foreach (GenericSkill val in array2)
		{
			foreach (SkillDef pokemonSkill in PokemonDef.pokemonSkills)
			{
				Utils.AddAlt(val.skillFamily, pokemonSkill);
			}
		}
		characterPrefab.GetComponent<TrainerBehaviour>().pokemonSkills = array;
		baseMaster = Prefabs.Instantiate("RoR2/Base/Drones/Drone1Master.prefab", "BasePokemonMaster", registerNetwork: true);
		Object.DestroyImmediate((Object)(object)baseMaster.GetComponent<SetDontDestroyOnLoad>());
		AISkillDriver[] components = baseMaster.GetComponents<AISkillDriver>();
		foreach (AISkillDriver val2 in components)
		{
			if ((int)val2.skillSlot == 0)
			{
				val2.skillSlot = (SkillSlot)1;
			}
			switch (val2.customName)
			{
			case "StrafeNearbyEnemies":
				val2.requireSkillReady = false;
				val2.buttonPressType = (ButtonPressType)1;
				val2.noRepeat = true;
				break;
			case "SoftLeashToLeader":
				val2.minDistance = 10f;
				val2.shouldSprint = true;
				break;
			case "ChaseFarEnemies":
				val2.shouldSprint = true;
				val2.minDistance = 20f;
				break;
			case "HardLeashToLeader":
				val2.shouldSprint = true;
				break;
			case "ChaseDownRandomEnemiesIfLeaderIsDead":
				val2.skillSlot = (SkillSlot)1;
				val2.movementType = (MovementType)2;
				break;
			case "IdleNearLeaderWhenNoEnemies":
			case "ReturnToLeaderWhenNoEnemies":
				((Behaviour)val2).enabled = false;
				val2.minDistance = 200f;
				break;
			}
		}
		ContentAddition.AddMaster(baseMaster);
		VenusaurSkillSetup(pokemon);
		CharizardSkillSetup(pokemon2);
		BlastoiseSkillSetup(pokemon3);
		PikachuSkillSetup(pokemon4);
		SnorlaxSkillSetup(pokemon5);
		GlaceonSkillSetup(pokemon6);
	}

	internal static void VenusaurSkillSetup(PokemonDef pokemon)
	{
		GameObject characterBodyPrefab = pokemon.characterBodyPrefab;
		CharacterBody component = characterBodyPrefab.GetComponent<CharacterBody>();
		component.mainRootSpeed = 0f;
		component.baseMaxHealth = 585f;
		component.levelMaxHealth = 176f;
		component.baseRegen = 4f;
		component.levelRegen = 1f;
		component.baseMaxShield = 0f;
		component.levelMaxShield = 0f;
		component.baseMoveSpeed = 7f;
		component.levelMoveSpeed = 0f;
		component.baseAcceleration = 110f;
		component.baseJumpPower = 15f;
		component.levelJumpPower = 0f;
		component.baseDamage = 16f;
		component.levelDamage = 3.2f;
		component.baseAttackSpeed = 1f;
		component.levelAttackSpeed = 0f;
		component.baseCrit = 1f;
		component.levelCrit = 0f;
		component.baseArmor = 0f;
		component.levelArmor = 0f;
		component.baseJumpCount = 1;
		component.sprintingSpeedMultiplier = 1.45f;
		string text = "<style=cKeywordName>Leaf Storm</style><style=cSub>The user whips up a storm of leaves around the target, dealing <style=cIsDamage>12x65% damage</style> per second.";
		string text2 = "<style=cKeywordName>Solar Beam</style><style=cSub>The user gathers light to blast the target with absorbed energy for <style=cIsDamage>1200% damage</style>.";
		LanguageAPI.Add(component.baseNameToken.Replace("NAME", "DESC"), text + "\r\n\r\n" + text2);
		SetPokemonSkills(pokemon, characterBodyPrefab.GetComponent<SkillLocator>(), typeof(VenusaurSecondary), typeof(VenusaurSpecial));
	}

	internal static void CharizardSkillSetup(PokemonDef pokemon)
	{
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		GameObject characterBodyPrefab = pokemon.characterBodyPrefab;
		CharacterBody component = characterBodyPrefab.GetComponent<CharacterBody>();
		component.mainRootSpeed = 0f;
		component.baseMaxHealth = 750f;
		component.levelMaxHealth = 225f;
		component.baseRegen = 2f;
		component.levelRegen = 0.2f;
		component.baseMaxShield = 0f;
		component.levelMaxShield = 0f;
		component.baseMoveSpeed = 13f;
		component.levelMoveSpeed = 0f;
		component.baseAcceleration = 110f;
		component.baseJumpPower = 15f;
		component.levelJumpPower = 0f;
		component.baseDamage = 15f;
		component.levelDamage = 3f;
		component.baseAttackSpeed = 1f;
		component.levelAttackSpeed = 0f;
		component.baseCrit = 1f;
		component.levelCrit = 0f;
		component.baseArmor = 0f;
		component.levelArmor = 0f;
		component.baseJumpCount = 1;
		component.sprintingSpeedMultiplier = 1f;
		string text = "<style=cKeywordName>Dragon Claw</style><style=cSub>The user slashes the target with huge, sharp claws for <style=cIsDamage>320% damage</style>.";
		string text2 = "<style=cKeywordName>Flamethrower</style><style=cSub>The target is scorched with an intense blast of fire for <style=cIsDamage>1000% damage</style> per second.";
		LanguageAPI.Add(component.baseNameToken.Replace("NAME", "DESC"), text + "\r\n\r\n" + text2);
		SetPokemonSkills(pokemon, characterBodyPrefab.GetComponent<SkillLocator>(), typeof(MegaCharizardXSecondary), typeof(MegaCharizardXSpecial), melee: true);
		ModelLocator component2 = characterBodyPrefab.GetComponent<ModelLocator>();
		ChildLocator component3 = ((Component)component2.modelTransform).GetComponent<ChildLocator>();
		Utils.CreateHitbox("Slash", ((Component)component2.modelTransform).gameObject, component3.FindChild("center"), new Vector3(850f, 500f, 500f), new Vector3(-300f, 0f, 0f), new Vector3(45f, 0f, 0f));
	}

	internal static void BlastoiseSkillSetup(PokemonDef pokemon)
	{
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		GameObject characterBodyPrefab = pokemon.characterBodyPrefab;
		CharacterBody component = characterBodyPrefab.GetComponent<CharacterBody>();
		component.mainRootSpeed = 0f;
		component.baseMaxHealth = 480f;
		component.levelMaxHealth = 144f;
		component.baseRegen = 2.5f;
		component.levelRegen = 0.25f;
		component.baseMaxShield = 0f;
		component.levelMaxShield = 0f;
		component.baseMoveSpeed = 7f;
		component.levelMoveSpeed = 0f;
		component.baseAcceleration = 110f;
		component.baseJumpPower = 15f;
		component.levelJumpPower = 0f;
		component.baseDamage = 20f;
		component.levelDamage = 4f;
		component.baseAttackSpeed = 1f;
		component.levelAttackSpeed = 0f;
		component.baseCrit = 1f;
		component.levelCrit = 0f;
		component.baseArmor = 0f;
		component.levelArmor = 0f;
		component.baseJumpCount = 1;
		component.sprintingSpeedMultiplier = 1.45f;
		string text = "<style=cKeywordName>Hydro Pump</style><style=cSub>The target is blasted by a huge volume of water launched under great pressure, dealing <style=cIsDamage>2x425% damage</style> per second.";
		string text2 = "<style=cKeywordName>Rapid Spin</style><style=cSub>Spins the body at high speed to strike target for <style=cIsDamage>800% damage</style>.";
		LanguageAPI.Add(component.baseNameToken.Replace("NAME", "DESC"), text + "\r\n\r\n" + text2);
		SetPokemonSkills(pokemon, characterBodyPrefab.GetComponent<SkillLocator>(), typeof(BlastoiseSecondary), typeof(BlastoiseSpecial));
		ModelLocator component2 = characterBodyPrefab.GetComponent<ModelLocator>();
		ChildLocator component3 = ((Component)component2.modelTransform).GetComponent<ChildLocator>();
		Utils.CreateHitbox("Spin", ((Component)component2.modelTransform).gameObject, component3.FindChild("center"), new Vector3(8f, 8f, 5f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f));
	}

	internal static void PikachuSkillSetup(PokemonDef pokemon)
	{
		GameObject characterBodyPrefab = pokemon.characterBodyPrefab;
		CharacterBody component = characterBodyPrefab.GetComponent<CharacterBody>();
		component.mainRootSpeed = 0f;
		component.baseMaxHealth = 300f;
		component.levelMaxHealth = 90f;
		component.baseRegen = 5f;
		component.levelRegen = 2.4f;
		component.baseMaxShield = 0f;
		component.levelMaxShield = 0f;
		component.baseMoveSpeed = 8f;
		component.levelMoveSpeed = 0f;
		component.baseAcceleration = 110f;
		component.baseJumpPower = 15f;
		component.levelJumpPower = 0f;
		component.baseDamage = 15f;
		component.levelDamage = 4f;
		component.baseAttackSpeed = 1f;
		component.levelAttackSpeed = 0f;
		component.baseCrit = 1f;
		component.levelCrit = 0f;
		component.baseArmor = 20f;
		component.levelArmor = 0f;
		component.baseJumpCount = 1;
		component.sprintingSpeedMultiplier = 1.45f;
		string text = "<style=cKeywordName>Thunder Shock</style><style=cSub>A jolt of electricity crashes down on the target to inflict <style=cIsDamage>200% damage</style>, chaining up to <style=cIsUtility>4</style> additional nearby targets.";
		string text2 = "<style=cKeywordName>Discharge</style><style=cSub>The user strikes everything around it by letting loose a flare of electricity, dealing <style=cIsDamage>1000% damage</style> per second. Additionally multiple strong electric blasts crash down all around, dealing <style=cIsDamage>5x500% damage</style>.";
		LanguageAPI.Add(component.baseNameToken.Replace("NAME", "DESC"), text + "\r\n\r\n" + text2);
		SetPokemonSkills(pokemon, characterBodyPrefab.GetComponent<SkillLocator>(), typeof(PikachuSecondary), typeof(PikachuSpecial));
	}

	internal static void SnorlaxSkillSetup(PokemonDef pokemon)
	{
		string text = pokemon.nameKey;
		GameObject characterBodyPrefab = pokemon.characterBodyPrefab;
		CharacterBody component = characterBodyPrefab.GetComponent<CharacterBody>();
		component.mainRootSpeed = 0f;
		component.baseMaxHealth = 900f;
		component.levelMaxHealth = 270f;
		component.baseRegen = 5f;
		component.levelRegen = 2.4f;
		component.baseMaxShield = 0f;
		component.levelMaxShield = 0f;
		component.baseMoveSpeed = 7f;
		component.levelMoveSpeed = 0f;
		component.baseAcceleration = 110f;
		component.baseJumpPower = 15f;
		component.levelJumpPower = 0f;
		component.baseDamage = 16f;
		component.levelDamage = 3.2f;
		component.baseAttackSpeed = 1f;
		component.levelAttackSpeed = 0f;
		component.baseCrit = 1f;
		component.levelCrit = 0f;
		component.baseArmor = 20f;
		component.levelArmor = 0f;
		component.baseJumpCount = 1;
		component.sprintingSpeedMultiplier = 1.45f;
		string text2 = "<style=cKeywordName>Body Slam</style><style=cSub>The user attacks by dropping onto the target with its full body weight, dealing <style=cIsDamage>650% damage</style>.";
		string text3 = "<style=cKeywordName>Giga Impact</style><style=cSub>The user charges at the target using every bit of its power, dealing <style=cIsDamage>1400% damage</style>.";
		LanguageAPI.Add(component.baseNameToken.Replace("NAME", "DESC"), text2 + "\r\n\r\n" + text3);
		SetPokemonSkills(pokemon, characterBodyPrefab.GetComponent<SkillLocator>(), typeof(SnorlaxSecondary), typeof(SnorlaxSpecial), melee: true);
	}

	internal static void GlaceonSkillSetup(PokemonDef pokemon)
	{
		GameObject characterBodyPrefab = pokemon.characterBodyPrefab;
		CharacterBody component = characterBodyPrefab.GetComponent<CharacterBody>();
		component.mainRootSpeed = 0f;
		component.baseMaxHealth = 425f;
		component.levelMaxHealth = 128f;
		component.baseRegen = 5f;
		component.levelRegen = 2.4f;
		component.baseMaxShield = 0f;
		component.levelMaxShield = 0f;
		component.baseMoveSpeed = 8f;
		component.levelMoveSpeed = 0f;
		component.baseAcceleration = 110f;
		component.baseJumpPower = 15f;
		component.levelJumpPower = 0f;
		component.baseDamage = 12f;
		component.levelDamage = 2.4f;
		component.baseAttackSpeed = 1f;
		component.levelAttackSpeed = 0f;
		component.baseCrit = 1f;
		component.levelCrit = 0f;
		component.baseArmor = 20f;
		component.levelArmor = 0f;
		component.baseJumpCount = 1;
		component.sprintingSpeedMultiplier = 1.45f;
		string text = "<style=cKeywordName>Icicle Spear</style><style=cSub>The user launches sharp icicles at the target two to five times in a row, dealing <style=cIsDamage>520%-1300% damage</style>.";
		string text2 = "<style=cKeywordName>Sheer Cold</style><style=cSub>A chilling blast of absolute-zero cold that deals <style=cIsDamage>1000% damage</style> in a large radius, leaving the ground frozen, <style=cIsUtility>heavily slowing</style> enemies that pass through.";
		LanguageAPI.Add(component.baseNameToken.Replace("NAME", "DESC"), text + "\r\n\r\n" + text2);
		SetPokemonSkills(pokemon, characterBodyPrefab.GetComponent<SkillLocator>(), typeof(GlaceonSecondary), typeof(GlaceonSpecial));
	}

	internal static void SetPokemonSkills(PokemonDef pokemon, SkillLocator skillLocator, Type secondary, Type special, bool melee = false)
	{
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Invalid comparison between Unknown and I4
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		CharacterBody component = ((Component)skillLocator).GetComponent<CharacterBody>();
		HealthComponent component2 = ((Component)skillLocator).GetComponent<HealthComponent>();
		component2.health = component.maxHealth;
		SkillDef skill = Utils.NewSkillDef<SkillDef>(secondary, "Body", 1, 5f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: true, 1, 1, 1, (Sprite)null, "", "", Array.Empty<string>());
		skillLocator.secondary = Utils.NewGenericSkill(((Component)skillLocator).gameObject, skill);
		skill = Utils.NewSkillDef<SkillDef>(special, "Body", 0, 0f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: true, 0, 0, 0, (Sprite)null, "", "", Array.Empty<string>());
		skillLocator.special = Utils.NewGenericSkill(((Component)skillLocator).gameObject, skill);
		GameObject val = Prefabs.Instantiate(baseMaster, ((Object)skillLocator).name + "Master", registerNetwork: true);
		val.GetComponent<CharacterMaster>().bodyPrefab = ((Component)skillLocator).gameObject;
		if (melee)
		{
			AISkillDriver[] components = val.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val2 in components)
			{
				if ((int)val2.skillSlot == 0)
				{
					val2.skillSlot = (SkillSlot)1;
				}
				switch (val2.customName)
				{
				case "StrafeNearbyEnemies":
				case "ChaseFarEnemies":
					val2.movementType = (MovementType)1;
					val2.moveTargetType = (TargetType)0;
					val2.minDistance = 0f;
					val2.maxDistance = 10f;
					break;
				case "ChaseDownRandomEnemiesIfLeaderIsDead":
					val2.movementType = (MovementType)1;
					val2.moveTargetType = (TargetType)0;
					break;
				}
			}
		}
		ContentAddition.AddMaster(val);
		pokemon.masterPrefab = val;
	}
}
internal class Hook
{
	internal static void Hooks()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
		GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
		HealthComponent.TakeDamageForce_DamageInfo_bool_bool += new hook_TakeDamageForce_DamageInfo_bool_bool(HealthComponent_TakeDamageForce_DamageInfo_bool_bool);
		HealthComponent.TakeDamageForce_Vector3_bool_bool += new hook_TakeDamageForce_Vector3_bool_bool(HealthComponent_TakeDamageForce_Vector3_bool_bool);
	}

	private static void HealthComponent_TakeDamageForce_Vector3_bool_bool(orig_TakeDamageForce_Vector3_bool_bool orig, HealthComponent self, Vector3 force, bool alwaysApply, bool disableAirControlUntilCollision)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)((Component)self.body).GetComponent<PokeBehaviour>()))
		{
			force = Vector3.zero;
			disableAirControlUntilCollision = false;
		}
		orig.Invoke(self, force, alwaysApply, disableAirControlUntilCollision);
	}

	private static void HealthComponent_TakeDamageForce_DamageInfo_bool_bool(orig_TakeDamageForce_DamageInfo_bool_bool orig, HealthComponent self, DamageInfo damageInfo, bool alwaysApply, bool disableAirControlUntilCollision)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)((Component)self.body).GetComponent<PokeBehaviour>()))
		{
			damageInfo.force = Vector3.zero;
			disableAirControlUntilCollision = false;
		}
		orig.Invoke(self, damageInfo, alwaysApply, disableAirControlUntilCollision);
	}

	private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
	{
		if (sender.HasBuff(Prefabs.gemBuff))
		{
			float value = MainPlugin.TeraStatMult.Value;
			args.damageMultAdd += value;
			args.healthMultAdd += value;
			args.moveSpeedMultAdd += value;
			args.attackSpeedMultAdd += value;
			args.armorTotalMult += value;
		}
		if (sender.HasBuff(Prefabs.waterStabBuff))
		{
			args.damageMultAdd += 0.4f;
		}
		if (sender.HasBuff(Prefabs.runningShoes))
		{
			args.moveSpeedMultAdd += 0.8f;
		}
	}

	private static void GlobalEventManager_onServerDamageDealt(DamageReport damageReport)
	{
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)damageReport.victim) || !Object.op_Implicit((Object)(object)damageReport.victimBody) || !Object.op_Implicit((Object)(object)damageReport.attacker) || !Object.op_Implicit((Object)(object)damageReport.attackerBody))
		{
			return;
		}
		DamageInfo damageInfo = damageReport.damageInfo;
		if (!(damageInfo.procCoefficient > 0f))
		{
			return;
		}
		float num = (damageReport.attackerBody.HasBuff(Prefabs.gemBuff) ? MainPlugin.TeraAddSTABChance.Value : 0f);
		PokeBehaviour component = damageReport.attacker.GetComponent<PokeBehaviour>();
		if (Object.op_Implicit((Object)(object)component) && RoR2Application.rng.RangeFloat(0f, 1f) <= MainPlugin.STABChance.Value + num)
		{
			switch (component.pokemonDef.type)
			{
			case PokemonDef.Type.Electric:
				SetStateOnHurt.SetStunOnObject(((Component)damageReport.victimBody).gameObject, 3f);
				break;
			case PokemonDef.Type.Normal:
				damageInfo.procCoefficient = 0f;
				damageReport.victim.TakeDamage(damageInfo);
				break;
			case PokemonDef.Type.Fire:
			{
				float num2 = 10f;
				InflictDotInfo val = default(InflictDotInfo);
				val.attackerObject = damageInfo.attacker;
				val.victimObject = ((Component)damageReport.victimBody).gameObject;
				val.totalDamage = damageInfo.damage * num2;
				val.damageMultiplier = num2;
				val.dotIndex = (DotIndex)1;
				val.maxStacksFromAttacker = 2147483647u;
				InflictDotInfo val2 = val;
				DotController.InflictDot(ref val2);
				break;
			}
			case PokemonDef.Type.Grass:
			{
				HealthComponent healthComponent = damageReport.attackerBody.healthComponent;
				healthComponent.Heal(damageInfo.damage + healthComponent.fullCombinedHealth * 0.25f, default(ProcChainMask), true);
				break;
			}
			case PokemonDef.Type.Water:
				damageReport.victimBody.AddTimedBuff(Buffs.Slow80, 8f);
				damageReport.attackerBody.AddTimedBuff(Prefabs.waterStabBuff, 8f);
				break;
			}
		}
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Dragonyck.PokemonTrainer", "PokemonTrainer", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.PokemonTrainer";

	public const string MODNAME = "PokemonTrainer";

	public const string VERSION = "1.0.0";

	internal static ConfigEntry<float> pokemonCD;

	internal static ConfigEntry<float> STABChance;

	internal static ConfigEntry<float> TeraAddSTABChance;

	internal static ConfigEntry<float> TeraStatMult;

	internal static ConfigEntry<float> pokemonMaxDistance;

	internal static ConfigEntry<float> pikachuSecondaryDamage;

	internal static ConfigEntry<float> pikachuSpecialDamage;

	internal static ConfigEntry<float> pikachuSpecialRandomDamage;

	internal static ConfigEntry<float> blastoiseSecondaryDamage;

	internal static ConfigEntry<float> blastoiseSpecialDamage;

	internal static ConfigEntry<float> venusaurSecondaryDamage;

	internal static ConfigEntry<float> venusaurSpecialDamage;

	internal static ConfigEntry<float> snorlaxSecondaryDamage;

	internal static ConfigEntry<float> snorlaxSpecialDamage;

	internal static ConfigEntry<float> megacharizardxSecondaryDamage;

	internal static ConfigEntry<float> megacharizardxSpecialDamage;

	internal static ConfigEntry<float> glaceonSecondaryDamage;

	internal static ConfigEntry<float> glaceonSpecialDamage;

	private void Awake()
	{
		STABChance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "STAB Chance", 0.1f, (ConfigDescription)null);
		TeraAddSTABChance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Tera Additional STAB Chance", 0.05f, (ConfigDescription)null);
		TeraStatMult = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Tera State Stat Mult", 0.2f, (ConfigDescription)null);
		pokemonCD = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Pokemon Cooldown", 180f, (ConfigDescription)null);
		pokemonMaxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Pokemon Max Distance", 120f, (ConfigDescription)null);
		pikachuSecondaryDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Pikachu", "Secondary Damage", 2f, (ConfigDescription)null);
		pikachuSpecialDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Pikachu", "Special Tick Damage", 2f, (ConfigDescription)null);
		pikachuSpecialRandomDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Pikachu", "Special Thunder Damage", 5f, (ConfigDescription)null);
		blastoiseSecondaryDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Blastoise", "Secondary Damage", 0.85f, (ConfigDescription)null);
		blastoiseSpecialDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Blastoise", "Special Damage", 8f, (ConfigDescription)null);
		venusaurSecondaryDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Venusaur", "Secondary Damage", 0.65f, (ConfigDescription)null);
		venusaurSpecialDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Venusaur", "Special Damage", 12f, (ConfigDescription)null);
		snorlaxSecondaryDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Snorlax", "Secondary Damage", 6.5f, (ConfigDescription)null);
		snorlaxSpecialDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Snorlax", "Special Damage", 14f, (ConfigDescription)null);
		megacharizardxSecondaryDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Mega Charizard X", "Secondary Damage", 3.2f, (ConfigDescription)null);
		megacharizardxSpecialDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Mega Charizard X", "Special Damage", 1.5f, (ConfigDescription)null);
		glaceonSecondaryDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Glaceon", "Secondary Damage", 2.6f, (ConfigDescription)null);
		glaceonSpecialDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Glaceon", "Special Damage", 10f, (ConfigDescription)null);
		Assets.PopulateAssets();
		Prefabs.CreatePrefabs();
		CharacterBodySetup.CreateCharacterBodies();
		Hook.Hooks();
	}
}
internal class PokemonDef : ScriptableObject
{
	internal enum Type
	{
		Normal,
		Fighting,
		Flying,
		Poison,
		Ground,
		Rock,
		Bug,
		Ghost,
		Steel,
		Fire,
		Water,
		Grass,
		Electric,
		Psychic,
		Ice,
		Dragon,
		Dark,
		Fairy,
		Stellar
	}

	internal static List<PokemonDef> pokemonList = new List<PokemonDef>();

	internal static Dictionary<string, PokemonDef> pokemonDict = new Dictionary<string, PokemonDef>();

	internal static List<SkillDef> pokemonSkills = new List<SkillDef>();

	internal static Color32[] TypeColor = (Color32[])(object)new Color32[19]
	{
		new Color32((byte)79, (byte)85, (byte)87, byte.MaxValue),
		new Color32((byte)204, (byte)102, (byte)20, byte.MaxValue),
		new Color32((byte)14, (byte)70, (byte)119, byte.MaxValue),
		new Color32((byte)108, (byte)49, (byte)151, byte.MaxValue),
		new Color32((byte)117, (byte)65, (byte)30, byte.MaxValue),
		new Color32((byte)81, (byte)76, (byte)52, byte.MaxValue),
		new Color32((byte)116, (byte)128, (byte)38, byte.MaxValue),
		new Color32((byte)91, (byte)52, (byte)88, byte.MaxValue),
		new Color32((byte)56, (byte)112, (byte)128, byte.MaxValue),
		new Color32((byte)176, (byte)23, (byte)21, byte.MaxValue),
		new Color32((byte)12, (byte)87, (byte)172, byte.MaxValue),
		new Color32((byte)48, (byte)129, (byte)47, byte.MaxValue),
		new Color32((byte)200, (byte)152, (byte)36, byte.MaxValue),
		new Color32((byte)162, (byte)19, (byte)60, byte.MaxValue),
		new Color32((byte)2, (byte)132, (byte)162, byte.MaxValue),
		new Color32((byte)25, (byte)45, (byte)144, byte.MaxValue),
		new Color32((byte)79, (byte)63, (byte)62, byte.MaxValue),
		new Color32((byte)132, (byte)25, (byte)129, byte.MaxValue),
		new Color32((byte)48, (byte)144, (byte)133, byte.MaxValue)
	};

	internal string nameKey;

	internal Sprite sprite;

	internal Sprite icon;

	internal CharacterBody body;

	internal GameObject characterBodyPrefab;

	internal Type type;

	internal GameObject masterPrefab;

	internal static PokemonDef CreatePokemonDef(GameObject bodyPrefab, Type typeIndex)
	{
		PokemonDef pokemonDef = ScriptableObject.CreateInstance<PokemonDef>();
		pokemonDef.body = bodyPrefab.GetComponent<CharacterBody>();
		((Object)pokemonDef).name = ((Object)pokemonDef.body).name.Replace("Body", "");
		pokemonDef.nameKey = ((Object)pokemonDef).name.ToUpper();
		pokemonDef.sprite = Assets.Load<Sprite>(((Object)pokemonDef).name.ToLower() + "_sprite");
		pokemonDef.icon = Assets.Load<Sprite>(((Object)pokemonDef).name);
		pokemonDef.characterBodyPrefab = bodyPrefab;
		pokemonDef.type = typeIndex;
		pokemonList.Add(pokemonDef);
		pokemonDict.Add(pokemonDef.body.baseNameToken, pokemonDef);
		SkillDef item = Utils.NewSkillDef<SkillDef>(typeof(Special), "Weapon", 0, 0f, beginSkillCooldownOnSkillEnd: false, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 0, 0, 0, pokemonDef.icon, pokemonDef.body.baseNameToken.Replace("NAME", "DESC"), pokemonDef.body.baseNameToken, Array.Empty<string>());
		pokemonSkills.Add(item);
		bodyPrefab.GetComponent<PokeBehaviour>().pokemonDef = pokemonDef;
		return pokemonDef;
	}
}
internal class Prefabs
{
	internal static Color mainColor = Color32.op_Implicit(new Color32((byte)230, (byte)120, (byte)95, byte.MaxValue));

	internal static GameObject spawnEffect;

	internal static GameObject spawnEffectShiny;

	internal static GameObject pokeball;

	internal static GameObject dischargeMuzzleEffect;

	internal static GameObject thundershockHitEffect;

	internal static GameObject thundershockMuzzleEffect;

	internal static GameObject thundershockOrbEffect;

	internal static GameObject dischargeHitEffect;

	internal static GameObject dischargeImpactEffect;

	internal static GameObject blueFireExplosion;

	internal static GameObject waterCannonEffect;

	internal static GameObject waterCannonHitEffect;

	internal static GameObject leafTracer;

	internal static GameObject megaBeamTracer;

	internal static GameObject megaBeamImpact;

	internal static GameObject indicator;

	internal static GameObject targetIndicator;

	internal static GameObject spinImpactEffect;

	internal static GameObject spinEffect;

	internal static GameObject gigaImpactEffect;

	internal static GameObject gigaImpactJump;

	internal static GameObject gigaImpactMuzzle;

	internal static GameObject pokeballProjectile;

	internal static GameObject pokeballProjectileGhost;

	internal static GameObject pokeballLine;

	internal static GameObject outRangeLineIndicator;

	internal static GameObject sterallizationEffect;

	internal static GameObject icicleSpearHitEffect;

	internal static GameObject icicleSpearTracer;

	internal static GameObject sheerColdEffect;

	internal static GameObject sheerColdWard;

	internal static Material faintMat;

	internal static Material crystalMat;

	internal static BuffDef runningShoes;

	internal static BuffDef waterStabBuff;

	internal static BuffDef gemBuff;

	internal static DeployableSlot pokemon;

	internal static Dictionary<string, Material> crownMaterials = new Dictionary<string, Material>();

	internal static int DeployableCount(CharacterMaster master, int count)
	{
		return 1;
	}

	internal static void CreatePrefabs()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Expected O, but got Unknown
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Expected O, but got Unknown
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_0374: Unknown result type (might be due to invalid IL or missing references)
		//IL_0379: Unknown result type (might be due to invalid IL or missing references)
		//IL_0399: Unknown result type (might be due to invalid IL or missing references)
		//IL_03af: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b9: Expected O, but got Unknown
		//IL_03b4: 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_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d2: Expected O, but got Unknown
		//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0561: Unknown result type (might be due to invalid IL or missing references)
		//IL_056b: Expected O, but got Unknown
		//IL_0582: Unknown result type (might be due to invalid IL or missing references)
		//IL_0640: Unknown result type (might be due to invalid IL or missing references)
		//IL_0645: Unknown result type (might be due to invalid IL or missing references)
		//IL_0765: Unknown result type (might be due to invalid IL or missing references)
		//IL_076f: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_08e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_08eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_094d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0957: Expected O, but got Unknown
		//IL_09b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a27: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a40: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a4a: Expected O, but got Unknown
		//IL_0a88: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a92: Expected O, but got Unknown
		//IL_0ab5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b00: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b0a: Expected O, but got Unknown
		//IL_0bf5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bff: Expected O, but got Unknown
		//IL_0c38: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c3d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c77: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c7c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ce9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cf3: Expected O, but got Unknown
		//IL_0d22: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d27: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d97: Unknown result type (might be due to invalid IL or missing references)
		//IL_0da1: Expected O, but got Unknown
		//IL_0dbf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dc4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f28: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f5b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f65: Unknown result type (might be due to invalid IL or missing references)
		//IL_1112: Unknown result type (might be due to invalid IL or missing references)
		//IL_1119: Expected O, but got Unknown
		//IL_112f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1134: Unknown result type (might be due to invalid IL or missing references)
		//IL_1141: Unknown result type (might be due to invalid IL or missing references)
		//IL_114b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1085: Unknown result type (might be due to invalid IL or missing references)
		crystalMat = Object.Instantiate<Material>(Load<Material>("RoR2/Base/Engi/matDefenseMatrix.mat"));
		crystalMat.SetTexture("_RemapTex", (Texture)(object)Assets.Load<Texture2D>("shieldRamp"));
		crystalMat.SetTexture("_Cloud1Tex", (Texture)(object)Assets.Load<Texture2D>("shieldTex"));
		crystalMat.SetTextureScale("_Cloud1Tex", Vector2.one * 10f);
		crystalMat.SetColor("_TintColor", Color32.op_Implicit(new Color32((byte)51, (byte)95, (byte)125, byte.MaxValue)));
		crystalMat.SetFloat("_SoftPower", 0f);
		crystalMat.SetFloat("_Boost", 0.6f);
		crystalMat.SetFloat("_RimPower", 0.1f);
		crystalMat.SetFloat("_InvFade", 0f);
		crystalMat.SetFloat("_SoftPower", 0f);
		crystalMat.SetFloat("_IntersectionStrength", 1f);
		crystalMat.SetFloat("_Boost", 0.6f);
		crystalMat.SetFloat("_AlphaBoost", 0.15f);
		Material val = new Material(Load<Material>("RoR2/Base/Icicle/matFrostRelic.mat"));
		val.SetColor("_Color", Color32.op_Implicit(new Color32((byte)225, (byte)225, (byte)225, byte.MaxValue)));
		val.SetTextureScale("_MainTex", Vector2.op_Implicit(Vector3.one));
		val.SetFloat("_Smoothness", 1f);
		val.SetFloat("_SpecularStrength", 1f);
		val.SetFloat("_SpecularExponent", 0.32f);
		val.SetFloat("_FresnelPower", 0.85f);
		val.SetFloat("_SplatmapTileScale", 0f);
		val.SetTexture("_FlowTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/texCloudDifferenceBW2.png"));
		val.SetTexture("_FlowHeightmap", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/texCloudSkulls.png"));
		string[] array = new string[18]
		{
			"bug", "dark", "dragon", "electric", "fairy", "fighting", "fire", "flying", "ghost", "grass",
			"ground", "ice", "normal", "poison", "psychic", "rock", "steel", "water"
		};
		string[] array2 = array;
		foreach (string text in array2)
		{
			Material val2 = new Material(val);
			((Object)val2).name = text + "Crown";
			val2.SetTexture("_MainTex", (Texture)(object)Assets.Load<Texture2D>(text + "Tex"));
			crownMaterials.Add(text, val2);
		}
		Shader shader = Load<Shader>("RoR2/Base/Shaders/HGStandard.shader");
		Assets.Load<Material>("pokeball").shader = shader;
		OrbAPI.AddOrb<ThundershockOrb>();
		gemBuff = Utils.NewBuffDef("Terastallization", stack: false, hidden: false, Assets.Load<Sprite>("gemBuffColored"), Color.white);
		waterStabBuff = Utils.NewBuffDef("Water STAB", stack: false, hidden: false, Assets.Load<Sprite>("buffUp"), Color32.op_Implicit(new Color32((byte)85, (byte)184, (byte)226, byte.MaxValue)));
		runningShoes = Utils.NewBuffDef("RunningShoes", stack: false, hidden: false, Assets.Load<Sprite>("runningShoesBuff"), mainColor);
		pokemon = DeployableAPI.RegisterDeployableSlot(new GetDeployableSameSlotLimit(DeployableCount));
		faintMat = new Material(Load<Material>("RoR2/Base/Huntress/matHuntressFlashBright.mat"));
		faintMat.SetColor("_TintColor", Color32.op_Implicit(new Color32((byte)187, (byte)0, (byte)6, byte.MaxValue)));
		Texture2D val3 = Load<Texture2D>("RoR2/DLC1/Common/ColorRamps/texRampAcidLarva.png");
		Texture2D val4 = Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampDefault.png");
		Material val5 = Load<Material>("RoR2/Base/ElementalRings/matIceRingGemstone.mat");
		val5.SetFloat("_Cull", 0f);
		val5.SetFloat("_FresnelBoost", 2.3f);
		sheerColdEffect = PrefabAPI.InstantiateClone(Assets.Load<GameObject>("SheerColdEffect"), "SheerColdEffect", false);
		ChildLocator component = sheerColdEffect.GetComponent<ChildLocator>();
		((Component)component.FindChild("flower")).GetComponent<Renderer>().materials = (Material[])(object)new Material[2]
		{
			val5,
			Load<Material>("RoR2/Base/ElementalRings/matIceRingSplash.mat")
		};
		DestroyOnTimer val6 = ((Component)component.FindChild("particles")).gameObject.AddComponent<DestroyOnTimer>();
		val6.duration = 0.85f;
		((Behaviour)val6).enabled = false;
		sheerColdEffect.AddComponent<TemporaryEffect>();
		sheerColdWard = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Icicle/IcicleAura.prefab"), "SheerColdWard", true);
		Object.Destroy((Object)(object)sheerColdWard.GetComponent<IcicleAuraController>());
		BuffWard component2 = sheerColdWard.GetComponent<BuffWard>();
		component2.expires = true;
		component2.expireDuration = 8f;
		component2.radius = 15f;
		icicleSpearTracer = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Commando/TracerCommandoShotgun.prefab"), "IcicleSpearTracer", false);
		LineRenderer component3 = icicleSpearTracer.GetComponent<LineRenderer>();
		component3.widthMultiplier = 5f;
		((Renderer)component3).material = new Material(Load<Material>("RoR2/DLC1/Railgunner/matRailgunChunksIce.mat"));
		((Renderer)component3).material.SetTextureScale("_MainTex", new Vector2(0.5f, 1f));
		Utils.RegisterEffect(icicleSpearTracer, -1f);
		icicleSpearHitEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Junk/Mage/MuzzleflashMageIce.prefab"), "IcicleSpearHitEffect", false);
		Utils.RegisterEffect(icicleSpearHitEffect, -1f, "Play_PokemonTrainer_IceHit");
		sterallizationEffect = PrefabAPI.InstantiateClone(Assets.Load<GameObject>("sterallizationEffect"), "SterallizationEffect", false);
		Utils.RegisterEffect(sterallizationEffect, 1.2f);
		outRangeLineIndicator = PrefabAPI.InstantiateClone(Assets.Load<GameObject>("outRangeLine"), "OutRangeLineIndicator", false);
		BezierCurveLine val7 = outRangeLineIndicator.AddComponent<BezierCurveLine>();
		val7.v0 = new Vector3(0f, 10f, 0f);
		spinEffect = Instantiate(Assets.Load<GameObject>("SpinEffect"), "SpinEffect");
		pokeballLine = Instantiate(Assets.Load<GameObject>("withdrawLine"), "PokeballLine");
		gigaImpactMuzzle = Instantiate(Assets.Load<GameObject>("GigaImpactMuzzle"), "GigaImpactMuzzle");
		Utils.RegisterEffect(gigaImpactMuzzle, 1f);
		gigaImpactJump = Instantiate(Assets.Load<GameObject>("GigaImpactJump"), "GigaImpactJump");
		Utils.RegisterEffect(gigaImpactJump, 0.6f);
		gigaImpactEffect = Instantiate(Assets.Load<GameObject>("GigaImpactEffect"), "GigaImpactEffect");
		Utils.RegisterEffect(gigaImpactEffect, 1.6f, "Play_PokemonTrainer_GigaImpact");
		spinImpactEffect = Instantiate("RoR2/Base/Common/VFX/OmniImpactVFXLarge.prefab", "SpinImpactEffect");
		Utils.RegisterEffect(spinImpactEffect, -1f, "Play_PokemonTrainer_RapidSpin_Impact");
		indicator = Instantiate(Assets.Load<GameObject>("indicator"), "Indicator");
		indicator.transform.localScale = Vector3.one * 0.05f;
		Utils.AddRotationComponent(((Component)indicator.transform.GetChild(0)).gameObject, -90f, (RotationAxis)2);
		pokeballProjectileGhost = Instantiate(Assets.Load<GameObject>("pokeballProjectile"), "PokeballProjectileGhost");
		pokeballProjectileGhost.AddComponent<ProjectileGhostController>();
		Utils.AddRotationComponent(((Component)pokeballProjectileGhost.transform.GetChild(0)).gameObject, 1440f, (RotationAxis)0);
		Utils.AddScaleComponent(pokeballProjectileGhost, 0.2f, AnimationCurve.EaseInOut(0f, 1f, 0f, 3f));
		pokeballProjectile = Instantiate("RoR2/Base/Commando/CommandoGrenadeProjectile.prefab", "PokeballProjectile", registerNetwork: true);
		pokeballProjectile.AddComponent<PokemonProjectileSpawner>();
		pokeballProjectile.GetComponent<ProjectileController>().ghostPrefab = pokeballProjectileGhost;
		pokeballProjectile.GetComponent<ProjectileSimple>().desiredForwardSpeed = 30f;
		ProjectileImpactExplosion component4 = pokeballProjectile.GetComponent<ProjectileImpactExplosion>();
		component4.lifetime = 1.4f;
		component4.lifetimeAfterImpact = 0.35f;
		((ProjectileExplosion)component4).explosionEffect = null;
		component4.impactEffect = null;
		((ProjectileExplosion)component4).blastRadius = 0f;
		((ProjectileExplosion)component4).blastDamageCoefficient = 0f;
		((ProjectileExplosion)component4).blastAttackerFiltering = (AttackerFiltering)2;
		((ProjectileExplosion)component4).bonusBlastForce = Vector3.zero;
		ContentAddition.AddProjectile(poke