using System;
using System.Collections;
using System.Collections.Generic;
using DarkTonic.MasterAudio;
using Pathfinding;
using UnityEngine;

// Token: 0x02000011 RID: 17
public class Actions : MonoBehaviour
{
	// Token: 0x06000111 RID: 273 RVA: 0x00013EC1 File Offset: 0x000120C1
	private void Start()
	{
	}

	// Token: 0x06000112 RID: 274 RVA: 0x00013EC3 File Offset: 0x000120C3
	public void SetSelectedTarget(bool state, Character t, GameObject obj, GameObject objAI)
	{
		this.hasTarget = state;
		this.selectedTarget = t;
		this.selectedTargetInteractive = obj;
		this.selectedAITargetInteractive = objAI;
	}

	// Token: 0x06000113 RID: 275 RVA: 0x00013EE4 File Offset: 0x000120E4
	public void ChooseAction()
	{
		if (this.character.dead || this.character.stunned)
		{
			this.EndTurn(false);
			this.EndActions();
			return;
		}
		bool flag = false;
		this.spellScroll = null;
		if (Links.x.combat.inRally && this.character == Links.x.combat.rallyCharacter)
		{
			flag = true;
		}
		this.ResetAction();
		if (this.hasTarget && this.character.mainSelected)
		{
			if (!this.character.mainSelected && !flag)
			{
				this.SetSelectedTarget(false, null, null, null);
			}
			if (this.selectedTarget && (this.selectedTarget.dead || (!Records.x.kill && this.selectedTarget.stunned)))
			{
				this.SetSelectedTarget(false, null, null, null);
			}
			if (this.selectedTargetInteractive || this.selectedAITargetInteractive)
			{
				GameObject gameObject = this.selectedTargetInteractive;
				if (this.selectedAITargetInteractive)
				{
					gameObject = this.selectedAITargetInteractive;
				}
				if (!gameObject.activeSelf)
				{
					this.SetSelectedTarget(false, null, null, null);
				}
				else
				{
					BreakableActions component = gameObject.GetComponent<BreakableActions>();
					ChestActions component2 = gameObject.GetComponent<ChestActions>();
					DoorActions component3 = gameObject.GetComponent<DoorActions>();
					PuzzleActions component4 = gameObject.GetComponent<PuzzleActions>();
					if (component && component.destroyed)
					{
						this.SetSelectedTarget(false, null, null, null);
					}
					if (component2 && component2.destroyed)
					{
						this.SetSelectedTarget(false, null, null, null);
					}
					if (component3 && component3.destroyed)
					{
						this.SetSelectedTarget(false, null, null, null);
					}
					if (component4 && component4.destroyed)
					{
						this.SetSelectedTarget(false, null, null, null);
					}
				}
			}
		}
		if (Records.x.combatConsoleDebugging)
		{
			string[] array = new string[8];
			array[0] = "Choosing action for ";
			int num = 1;
			Character character = this.character;
			array[num] = ((character != null) ? character.ToString() : null);
			array[2] = ", has target: ";
			array[3] = this.hasTarget.ToString();
			array[4] = ", selected target is: ";
			int num2 = 5;
			Character character2 = this.selectedTarget;
			array[num2] = ((character2 != null) ? character2.ToString() : null);
			array[6] = " ";
			int num3 = 7;
			GameObject gameObject2 = this.selectedTargetInteractive;
			array[num3] = ((gameObject2 != null) ? gameObject2.ToString() : null);
			Debug.Log(string.Concat(array));
		}
		if (!this.character.mainSelected)
		{
			this.moveAttempts = 1;
			this.character.StartTurn();
			this.ai.DoSomething1();
			return;
		}
		this.choosingTurn = false;
	}

	// Token: 0x06000114 RID: 276 RVA: 0x00014168 File Offset: 0x00012368
	public void SelectActionRealTime(Character target, GameObject targetInteractive)
	{
		this.lastMainActionTime = Time.timeSinceLevelLoad;
		if (this.channeling)
		{
			this.EndChanneling(false);
		}
		this.EndVine();
		this.quickAttack = false;
		this.character.animator.SetBool("Combat", true);
		if ((target || targetInteractive) && Records.x.pocketPause)
		{
			Links.x.hudControl.ToggleAttackTimer(false);
		}
		this.character.timelineIcon.overridePause = true;
		if (this.character.mainSelected)
		{
			this.character.portrait.skillBag.SetSelectedState();
		}
		this.ClearTargetCharacters();
		if (this.character.moving)
		{
			this.character.TargetReached();
			this.character.waypoint.transform.position = Links.x.gameplay.farPosition;
		}
		if (Links.x.pocketWheel.selected.Contains("Special Attack"))
		{
			bool mainSelected = this.character.mainSelected;
		}
		this.specialAttack1 = false;
		this.specialAttack2 = false;
		this.specialAttack3 = false;
		if (Links.x.pocketWheel.selected.Contains("Special Attack 1"))
		{
			this.specialAttack1 = true;
			Links.x.pocketWheel.SelectLightAttack();
			Links.x.hudControl.RemoveRallyBar((float)Records.x.GetRallyAttackCosts(1, this.character));
		}
		if (!this.specialAttack1)
		{
			Links.x.pocketWheel.Close(false);
		}
		if (Links.x.combat.pickingRally && this.character != Links.x.combat.rallyCharacter)
		{
			Links.x.combat.inRally = true;
			Links.x.combat.rallyCharacter.OverridePocketPause();
			Links.x.combat.rallyCharacter.TargetReached();
			Links.x.combat.rallyCharacter.actions.CheckIfRunningAI();
			Links.x.combat.rallyCharacter.actions.ClearSelectedActionRealTime();
			Links.x.combat.RemoveFromNeedsTurn(Links.x.combat.rallyCharacter);
			if (Links.x.combat.rallyCharacter.moving)
			{
				Links.x.combat.rallyCharacter.EndPath();
			}
			Links.x.combat.rallyCharacter.actions.SelectActionRealTime(target, targetInteractive);
			Links.x.combat.pickingRally = false;
			this.ClearDamageLists();
			Links.x.combat.rallyCharacter.actions.ClearDamageLists();
		}
		if (this.character.mainSelected && !Links.x.combat.inRally && Records.x.pocketPause && !Links.x.pocketWheel.Charming())
		{
			Links.x.combat.pocketTarget = target;
			if (target)
			{
				Links.x.combat.pocketTargetPosition = target.currentPosition;
			}
		}
		this.readyToAttack = false;
		this.secondAttack = false;
		if (target)
		{
			target.HoverOut(false);
			if (Records.x.pocketPause)
			{
				target.body.Hover(false, true);
			}
			this.rallyInteractiveTarget = null;
		}
		else if (targetInteractive)
		{
			if (this.specialAttack1)
			{
				this.rallyInteractiveTarget = targetInteractive;
			}
			else
			{
				this.rallyInteractiveTarget = null;
			}
		}
		Links.x.combat.RemoveFromNeedsTurn(this.character);
		this.QueueIcon(false);
		this.character.inAction = false;
		if (targetInteractive)
		{
			target = targetInteractive.gameObject.GetComponent<Character>();
		}
		this.AddTarget(target);
		this.QueueIcon(true);
		this.readyToAttack = true;
		this.secondAttack = false;
		if (!targetInteractive && !Links.x.pocketWheel.Charming() && Records.x.pocketPause)
		{
			Links.x.rtsCamera.Zoom(true, "Combat");
		}
		Links.x.gameplay.joystickTarget.SetActive(false);
		Links.x.combat.ClearPossibleTargets();
		Shader.SetGlobalFloat("_NoCharacterFX", 1f);
		this.ResetItemActions();
		if (Links.x.pocketWheel.Charming())
		{
			this.StartAction("Charm");
			return;
		}
		if (this.charging)
		{
			this.charging = false;
			if (targetInteractive)
			{
				this.ai.ChargeTarget(targetInteractive.GetComponent<Character>());
			}
			else
			{
				this.ai.ChargeTarget(target);
			}
			Links.x.pocketWheel.SelectLightAttack();
			return;
		}
		if (this.pinning)
		{
			this.ai.PinTarget(target);
			this.pinning = false;
			Links.x.pocketWheel.SelectLightAttack();
			return;
		}
		if (this.specialAttack1)
		{
			base.StartCoroutine(this.Pocket());
			return;
		}
		this.StartAction("Attack");
	}

	// Token: 0x06000115 RID: 277 RVA: 0x0001466A File Offset: 0x0001286A
	public void SelectCharge(Character target)
	{
		this.charging = true;
		if (target.interactiveObject)
		{
			this.SelectActionRealTime(null, target.gameObject);
			return;
		}
		this.SelectActionRealTime(target, null);
	}

	// Token: 0x06000116 RID: 278 RVA: 0x00014691 File Offset: 0x00012891
	public void SelectPin(Character target)
	{
		this.pinning = true;
		this.SelectActionRealTime(target, null);
	}

	// Token: 0x06000117 RID: 279 RVA: 0x000146A4 File Offset: 0x000128A4
	public void Interrupt()
	{
		this.EndVine();
		this.castingSpell = false;
		this.movingToPin = false;
		this.givingItem = false;
		this.spellScroll = null;
		if (this.channeling)
		{
			this.EndChanneling(false);
		}
		this.readyToAttack = false;
		this.choosingTurn = false;
		this.character.inRecovery = false;
		if (this.character.timelineIcon)
		{
			this.character.timelineIcon.Clear();
			this.character.timelineIcon.overridePause = false;
		}
		if (this.spellCasterFX)
		{
			Links.x.cellar.ReturnPooledGameObject(69, this.spellCasterFX);
			this.spellCasterFX = null;
		}
		if (this.spellWaveFX)
		{
			Links.x.cellar.ReturnPooledGameObject(88, this.spellWaveFX);
			this.spellWaveFX = null;
		}
		if (this.spellCasterTargetFX)
		{
			Links.x.cellar.ReturnPooledGameObject(70, this.spellCasterTargetFX);
			this.spellCasterTargetFX = null;
		}
		if (this.chargeUpFX)
		{
			Links.x.cellar.ReturnPooledGameObject(this.chargeUpNum, this.chargeUpFX);
			this.chargeUpFX = null;
			MasterAudio.StopSoundGroupOfTransform(this.character.tr, "SpecialAttacks");
		}
		this.character.body.EndBlink();
		this.QueueIcon(false);
		if (!this.character.npc && !this.character.summoned)
		{
			this.character.portrait.skillBag.RemoveSelectedButton();
		}
		if (this.character.inAction)
		{
			this.character.PlayIdle();
		}
		this.ClearTargetCharacters();
		if (this.character.party)
		{
			Links.x.gameplay.ClearWaypointEffect(this.character);
		}
		if (this.startAttackCoroutine != null)
		{
			base.StopCoroutine(this.startAttackCoroutine);
			this.startAttackCoroutine = null;
		}
		if (this.castCompleteCoroutine != null)
		{
			base.StopCoroutine(this.castCompleteCoroutine);
			this.castCompleteCoroutine = null;
		}
		if (this.actionCoroutine != null)
		{
			base.StopCoroutine(this.actionCoroutine);
			this.actionCoroutine = null;
		}
		if (this.wordCoroutine != null)
		{
			base.StopCoroutine(this.wordCoroutine);
			this.wordCoroutine = null;
		}
		this.character.inAction = false;
		if (this.character.animID == 14)
		{
			this.character.animID = 0;
		}
		this.ai.lastAction = "";
		if (this.character.npc && this.ai.findingAction)
		{
			this.ai.StopLookingForAction();
		}
		this.RemoveAbility();
		this.ResetItemActions();
		if (this.canEndAttackTime)
		{
			this.EndAttackTime(0f);
		}
		this.canEndAttackTime = false;
		if (!this.character.moving)
		{
			this.EndTurn(true);
		}
		if (Records.x.paused)
		{
			Links.x.combat.GetTargets(false, false, null);
		}
		this.hasWaypoint = false;
	}

	// Token: 0x06000118 RID: 280 RVA: 0x000149A4 File Offset: 0x00012BA4
	public void StopAction()
	{
		if (this.channeling)
		{
			this.EndChanneling(false);
		}
		this.EndVine();
		this.castingSpell = false;
		this.movingToPin = false;
		this.givingItem = false;
		if (this.spellWaveFX)
		{
			Links.x.cellar.ReturnPooledGameObject(88, this.spellWaveFX);
			this.spellWaveFX = null;
		}
		if (this.spellCasterFX)
		{
			Links.x.cellar.ReturnPooledGameObject(69, this.spellCasterFX);
			this.spellCasterFX = null;
		}
		if (this.spellCasterTargetFX)
		{
			Links.x.cellar.ReturnPooledGameObject(70, this.spellCasterTargetFX);
			this.spellCasterTargetFX = null;
		}
		if (this.chargeUpFX)
		{
			Links.x.cellar.ReturnPooledGameObject(this.chargeUpNum, this.chargeUpFX);
			this.chargeUpFX = null;
			MasterAudio.StopSoundGroupOfTransform(this.character.tr, "SpecialAttacks");
		}
		this.spellScroll = null;
		if (this.playingMusic)
		{
			this.EndPlayingInstrument();
		}
		this.ai.lastAction = "";
		if (this.character.party && this.character.timelineIcon)
		{
			this.character.timelineIcon.overridePause = false;
		}
		this.readyToAttack = false;
		if (!this.character.waitingToUseItem)
		{
			this.QueueIcon(false);
		}
		else
		{
			this.QueueIcon(true);
		}
		this.ClearTargetCharacters();
		this.character.PlayIdle();
		if (this.startAttackCoroutine != null)
		{
			base.StopCoroutine(this.startAttackCoroutine);
			this.startAttackCoroutine = null;
		}
		if (this.castCompleteCoroutine != null)
		{
			base.StopCoroutine(this.castCompleteCoroutine);
			this.castCompleteCoroutine = null;
		}
		if (this.actionCoroutine != null)
		{
			base.StopCoroutine(this.actionCoroutine);
			this.actionCoroutine = null;
		}
		if (this.instrumentCoroutine != null)
		{
			this.EndPlayingInstrument();
			base.StopCoroutine(this.instrumentCoroutine);
			this.instrumentCoroutine = null;
		}
		if (this.wordCoroutine != null)
		{
			base.StopCoroutine(this.wordCoroutine);
			this.wordCoroutine = null;
		}
		this.character.inAction = false;
		this.ResetItemActions();
		if (Records.x.paused)
		{
			Links.x.combat.GetTargets(false, false, null);
		}
		this.ClearInteractiveSheen();
		this.hasWaypoint = false;
		if (this.canEndAttackTime)
		{
			this.EndAttackTime(0f);
		}
		this.canEndAttackTime = false;
		this.RemoveAbility();
		this.EndTurn(false);
	}

	// Token: 0x06000119 RID: 281 RVA: 0x00014C1C File Offset: 0x00012E1C
	public void ClearSelectedActionRealTime()
	{
		this.canEndAttackTime = false;
		this.ai.lastAction = "";
		this.SetSelectedTarget(false, null, null, null);
		this.ClearTargetCharacters();
		if (this.playingMusic)
		{
			this.EndPlayingInstrument();
		}
		if (this.channeling)
		{
			this.EndChanneling(false);
		}
		this.EndVine();
		this.castingSpell = false;
		if (this.spellWaveFX)
		{
			Links.x.cellar.ReturnPooledGameObject(88, this.spellWaveFX);
			this.spellWaveFX = null;
		}
		if (this.spellCasterFX)
		{
			Links.x.cellar.ReturnPooledGameObject(69, this.spellCasterFX);
			this.spellCasterFX = null;
		}
		if (this.spellCasterTargetFX)
		{
			Links.x.cellar.ReturnPooledGameObject(70, this.spellCasterTargetFX);
			this.spellCasterTargetFX = null;
		}
		if (this.spellCasterTargetFailFX)
		{
			Links.x.cellar.ReturnPooledGameObject(78, this.spellCasterTargetFailFX);
			this.spellCasterTargetFailFX = null;
		}
		if (this.chargeUpFX)
		{
			Links.x.cellar.ReturnPooledGameObject(this.chargeUpNum, this.chargeUpFX);
			this.chargeUpFX = null;
			MasterAudio.StopSoundGroupOfTransform(this.character.tr, "SpecialAttacks");
		}
		if (!this.character.waitingToUseItem)
		{
			this.QueueIcon(false);
		}
		else
		{
			this.QueueIcon(true);
		}
		Links.x.combat.GetTargets(false, false, null);
		this.ClearInteractiveSheen();
		this.hasWaypoint = false;
	}

	// Token: 0x0600011A RID: 282 RVA: 0x00014DA8 File Offset: 0x00012FA8
	public void ClearInteractiveSheen()
	{
		if (this.prevSelectedTargetInteractive)
		{
			BreakableActions component = this.prevSelectedTargetInteractive.GetComponent<BreakableActions>();
			ChestActions component2 = this.prevSelectedTargetInteractive.GetComponent<ChestActions>();
			DoorActions component3 = this.prevSelectedTargetInteractive.GetComponent<DoorActions>();
			PuzzleActions component4 = this.prevSelectedTargetInteractive.GetComponent<PuzzleActions>();
			if (component && !component.destroyed)
			{
				component.CombatSheen(0);
			}
			if (component2 && !component2.destroyed)
			{
				component2.CombatSheen(0);
			}
			if (component3 && !component3.destroyed)
			{
				component3.CombatSheen(0);
			}
			if (component4 && !component4.destroyed)
			{
				component4.CombatSheen(0);
			}
			this.prevSelectedTargetInteractive = null;
		}
	}

	// Token: 0x0600011B RID: 283 RVA: 0x00014E60 File Offset: 0x00013060
	public void ResetItemActions()
	{
		this.givingItem = false;
		this.movingToPin = false;
		this.usingItem = false;
		this.movingToPlaySong = false;
		this.pickingUpItem = false;
	}

	// Token: 0x0600011C RID: 284 RVA: 0x00014E88 File Offset: 0x00013088
	public void ResetAction()
	{
		this.ResetItemActions();
		this.abilities.Clear();
		this.choosingTurn = true;
		this.character.inAction = false;
		this.character.inRecovery = false;
		if (this.character.timelineIcon)
		{
			this.character.timelineIcon.overridePause = false;
		}
		this.character.body.lookAtController.EndLook();
		this.targetMovePosition = null;
		if (this.character.inactive)
		{
			this.character.TurnScriptsOn();
		}
	}

	// Token: 0x0600011D RID: 285 RVA: 0x00014F1C File Offset: 0x0001311C
	public void TryingToInterruptInventoryWait()
	{
		this.str.Clear();
		this.str.Append(Links.x.gameFeed.GetPartyColorText(this.character));
		this.str.Append(this.character.stats.GetName());
		this.str.Append("</color>");
		this.str.Append(" cannot do this while arranging equipment");
		Links.x.gameFeed.AddFeed(this.str.ToString());
		this.character.StartQuip("I'm adjusting my bag");
		string text = "Inventory wait ";
		Character character = this.character;
		Debug.Log(text + ((character != null) ? character.ToString() : null));
	}

	// Token: 0x0600011E RID: 286 RVA: 0x00014FE0 File Offset: 0x000131E0
	public void EndTurn(bool setIconAtBeginning)
	{
		if (this.ai.busy)
		{
			return;
		}
		this.damageBonus = 0f;
		this.effectBonus = 0f;
		this.currentAction = "";
		if (this.songsWordsQueued.Count <= 0)
		{
			if (this)
			{
				if (this.actionCoroutine != null)
				{
					base.StopCoroutine(this.actionCoroutine);
					this.actionCoroutine = null;
				}
				if (this.startAttackCoroutine != null)
				{
					base.StopCoroutine(this.startAttackCoroutine);
					this.startAttackCoroutine = null;
				}
				if (this.spellCasterFX)
				{
					Links.x.cellar.ReturnPooledGameObject(69, this.spellCasterFX);
					this.spellCasterFX = null;
				}
				if (this.spellWaveFX)
				{
					Links.x.cellar.ReturnPooledGameObject(88, this.spellWaveFX);
					this.spellWaveFX = null;
				}
				if (this.spellCasterTargetFX)
				{
					Links.x.cellar.ReturnPooledGameObject(70, this.spellCasterTargetFX);
					this.spellCasterTargetFX = null;
				}
				if (this.chargeUpFX)
				{
					Links.x.cellar.ReturnPooledGameObject(this.chargeUpNum, this.chargeUpFX);
					this.chargeUpFX = null;
					MasterAudio.StopSoundGroupOfTransform(this.character.tr, "SpecialAttacks");
				}
			}
			if (this.character.mainSelected)
			{
				this.EndAttackTime(0f);
				Links.x.combat.pocketTarget = null;
			}
			this.character.inQueuedAbility = false;
			if (this.cannotInterrupt)
			{
				Debug.Log("Resetting cannot interrupt " + ((this != null) ? this.ToString() : null));
			}
			this.choosingTurn = false;
			if (this.character.party && this.character.timelineIcon)
			{
				this.character.timelineIcon.overridePause = false;
			}
			this.character.inRecovery = false;
			this.character.actionNumber -= 1f;
			this.ClearTargetCharacters();
			this.character.inAction = false;
			this.channeling = false;
			this.currentTileEffect = null;
			this.ammoRow = null;
			this.castingSpell = false;
			this.character.body.EndBlink();
			this.character.stats.lastActionModifier = 1f;
			this.charming = false;
			if (this.playingMusic)
			{
				this.EndPlayingInstrument();
			}
			this.moveAttempts = 0;
			if (this.character.mainSelected || this.character == Links.x.combat.rallyCharacter)
			{
				this.character.body.CombatSheen(0);
				Links.x.cameraEffects.RemoveCombatCharacters();
			}
			this.queueInterrupt = false;
			if (this.character.overlapping)
			{
				Links.x.combat.EndEnemyTurnFromOverlap(this.character);
			}
			else if (this.character.npc)
			{
				Links.x.combat.EndEnemyTurn(this.character, setIconAtBeginning);
			}
			if (this.character.party)
			{
				if (Records.x.InCombat(false) && Records.x.turnBased)
				{
					Records.x.RemoveControls(true);
				}
				if (Records.x.turnBased)
				{
					Records.x.playerTurn = false;
				}
				if (Records.x.InCombat(false) || this.selectedTarget || this.selectedTargetInteractive)
				{
					Links.x.combat.EndTurn(true, this.character, setIconAtBeginning);
				}
			}
			else if (!this.character.npc)
			{
				Links.x.combat.EndTurn(true, this.character, setIconAtBeginning);
			}
			this.character.overlapping = false;
			this.character.centerOfAttention = false;
			this.character.CircleAnimation("");
			if (!Records.x.combat && !this.selectedTarget && !this.selectedTargetInteractive)
			{
				this.EndActions();
			}
			return;
		}
		if (this.character.inQueuedAbility && this.instrumentCoroutine == null)
		{
			this.StartAbilityQueue();
			return;
		}
		this.StartSongsWordsQueued(true, false);
	}

	// Token: 0x0600011F RID: 287 RVA: 0x00015410 File Offset: 0x00013610
	public void AddTarget(Character target)
	{
		if (!target)
		{
			this.actionTargets.Add(null);
			return;
		}
		if (target.interactiveObject)
		{
			if (this.actionInteractives.IndexOf(target.gameObject) == -1)
			{
				this.actionInteractives.Add(target.gameObject);
				return;
			}
		}
		else if (this.actionTargets.IndexOf(target) == -1)
		{
			this.actionTargets.Add(target);
		}
	}

	// Token: 0x06000120 RID: 288 RVA: 0x0001547B File Offset: 0x0001367B
	public void StartAttackFromDelay()
	{
		this.StartAction("Attack");
	}

	// Token: 0x06000121 RID: 289 RVA: 0x00015488 File Offset: 0x00013688
	public void ClearTargetCharacters()
	{
		this.actionTargets.Clear();
		this.actionInteractives.Clear();
		this.ClearInteractiveSheen();
	}

	// Token: 0x06000122 RID: 290 RVA: 0x000154A8 File Offset: 0x000136A8
	public bool CheckForRepathWhileWaitingToAttack()
	{
		if (this.ai.findingAction || this.castingSpell || this.character.mainSelected || Links.x.combat.inPocketAttack)
		{
			return false;
		}
		if (this.repathing)
		{
			return true;
		}
		if (this.actionTargets.Count > 0)
		{
			Character character = this.actionTargets[0];
			if (character)
			{
				if (this.InAttackRange(character))
				{
					return false;
				}
				if (this.character.timelineIcon.doingAction)
				{
					return false;
				}
				if (Records.x.combatConsoleDebugging)
				{
					Character character2 = this.character;
					Debug.Log(((character2 != null) ? character2.ToString() : null) + " needs to repath");
				}
				this.readyToAttack = true;
				this.repathing = true;
				this.ChooseAction();
				return true;
			}
		}
		if (this.actionInteractives.Count > 0)
		{
			GameObject gameObject = this.actionInteractives[0];
			if (gameObject)
			{
				if (this.InAttackRangeObject(gameObject))
				{
					return false;
				}
				if (this.character.timelineIcon.doingAction)
				{
					return false;
				}
				if (Records.x.combatConsoleDebugging)
				{
					Character character3 = this.character;
					Debug.Log(((character3 != null) ? character3.ToString() : null) + " needs to repath");
				}
				this.readyToAttack = true;
				this.repathing = true;
				this.ChooseAction();
				return true;
			}
		}
		return false;
	}

	// Token: 0x06000123 RID: 291 RVA: 0x00015604 File Offset: 0x00013804
	public bool CheckIfMoveComplete()
	{
		if (this.castingSpell)
		{
			return true;
		}
		Character character = null;
		GameObject gameObject = null;
		if (this.actionTargets.Count > 0)
		{
			character = this.actionTargets[0];
		}
		if (this.actionInteractives.Count > 0)
		{
			gameObject = this.actionInteractives[0];
		}
		if (this.character.inCircle && this.ai.circleMovement)
		{
			return false;
		}
		if (this.character.mainSelected || (Links.x.combat.inPocketAttack && Links.x.pocketWheel.selectedRallyCharacter == this.character))
		{
			return false;
		}
		if (Links.x.combat.inPocketAttack && this.character.party && Links.x.pocketWheel.selectedRallyCharacter == this.character)
		{
			return false;
		}
		if (this.character.CanChooseActions())
		{
			if (this.character.fleeing || this.character.stats.Stuck() > 0)
			{
				if (!this.cannotInterrupt)
				{
					this.EndTurn(true);
				}
				return true;
			}
			if (Records.x.combatConsoleDebugging && this.character.node != null && this.character.sphere)
			{
				string[] array = new string[14];
				array[0] = "Move complete: ";
				int num = 1;
				Character character2 = this.character;
				array[num] = ((character2 != null) ? character2.ToString() : null);
				array[2] = " ";
				array[3] = ((Vector3)this.character.node.position).ToString();
				array[4] = " ";
				array[5] = this.character.sphere.transform.position.ToString();
				array[6] = " ";
				array[7] = this.readyToAttack.ToString();
				array[8] = " ";
				int num2 = 9;
				Character character3 = character;
				array[num2] = ((character3 != null) ? character3.ToString() : null);
				array[10] = " ";
				array[11] = this.movingToPlaySong.ToString();
				array[12] = " ";
				array[13] = this.character.moving.ToString();
				Debug.Log(string.Concat(array));
			}
			bool flag3;
			if (character && !this.movingToPlaySong && !this.givingItem && !this.pickingUpItem && !this.movingToPin)
			{
				bool flag = false;
				if (character)
				{
					flag = this.InAttackRange(character);
				}
				if (gameObject)
				{
					flag = this.InAttackRangeObject(gameObject);
				}
				if (flag)
				{
					if (this.character.moving)
					{
						this.character.sphere.transform.position = this.character.tr.position;
						this.character.TargetReached();
					}
					this.StartAction("Attack");
					return true;
				}
				bool flag2 = false;
				if (!this.character.moving)
				{
					flag2 = true;
					if (Records.x.combatConsoleDebugging)
					{
						string text = "target too far from planned waypoint, repathing ";
						Character character4 = this.character;
						string text2 = ((character4 != null) ? character4.ToString() : null);
						string text3 = " ";
						Character character5 = character;
						Debug.Log(text + text2 + text3 + ((character5 != null) ? character5.ToString() : null));
					}
				}
				else if (this.character.savedPathTarget != null && character && (this.TargetOutOfSight(character) || (this.GetPosition(character) - (Vector3)this.character.savedPathTarget.position).sqrMagnitude > (this.AttackRange(character) + 4f) * (this.AttackRange(character) + 4f)))
				{
					flag2 = true;
					if (Records.x.combatConsoleDebugging)
					{
						string[] array2 = new string[8];
						array2[0] = "target out of sight or attack range, repathing ";
						int num3 = 1;
						Character character6 = this.character;
						array2[num3] = ((character6 != null) ? character6.ToString() : null);
						array2[2] = " ";
						int num4 = 3;
						Character character7 = character;
						array2[num4] = ((character7 != null) ? character7.ToString() : null);
						array2[4] = ", saved path position is: ";
						array2[5] = ((Vector3)this.character.savedPathTarget.position).ToString();
						array2[6] = ", attack range is : ";
						array2[7] = this.AttackRange(character).ToString();
						Debug.Log(string.Concat(array2));
					}
				}
				if (!flag2)
				{
					return false;
				}
				flag3 = true;
			}
			else
			{
				if (this.movingToPlaySong)
				{
					if (!this.cannotInterrupt)
					{
						this.EndTurn(true);
					}
					this.movingToPlaySong = false;
					return true;
				}
				if (this.pickingUpItem)
				{
					if (this.InItemRange(this.character, this.pickupItem.tr.position))
					{
						this.StartAction("Use");
						return true;
					}
					flag3 = true;
				}
				else if (this.movingToPin)
				{
					if (this.InItemRange(this.character, this.pinTarget))
					{
						this.ai.PinTarget(this.pinTarget);
						this.movingToPin = false;
						return true;
					}
					flag3 = true;
				}
				else if (this.givingItem)
				{
					if (this.giveCharacter)
					{
						if (this.InItemRange(this.giveCharacter, this.character))
						{
							if (!this.actionTargets.Contains(this.giveCharacter))
							{
								this.ClearTargetCharacters();
								this.AddTarget(this.giveCharacter);
							}
							this.StartAction("Use");
							return true;
						}
						Debug.Log(((this != null) ? this.ToString() : null) + " target missing for giving item");
						this.givingItem = false;
						flag3 = true;
					}
					else
					{
						flag3 = true;
					}
				}
				else
				{
					if (character || gameObject)
					{
						this.EndTurn(true);
						return true;
					}
					if (this.character.moving)
					{
						return false;
					}
					float num5 = 6.25f;
					if (this.character.radius > 1f)
					{
						num5 = 9f;
					}
					if (this.character.sailing)
					{
						num5 = 25f;
					}
					if ((this.GetPosition(this.character) - this.character.sphere.transform.position).sqrMagnitude <= num5)
					{
						this.EndTurn(true);
						return true;
					}
					flag3 = true;
				}
			}
			if (flag3)
			{
				if (character || gameObject)
				{
					this.Repath();
					return false;
				}
				this.moveAttempts++;
				if (this.moveAttempts > 3)
				{
					this.Repath();
					return true;
				}
				Vector3 position = this.character.sphere.transform.position;
				GraphNode graphNode = this.character.NearNode(position, true, 0, -1, this.character.CheckCircleID());
				if (graphNode != null)
				{
					this.character.MoveBackEmpty();
					this.character.MakePath(graphNode, 100, false, false, true);
					return false;
				}
				this.Repath();
				return true;
			}
		}
		else if (this.character.GetNodeCount() > 0)
		{
			this.character.TargetReached();
		}
		return false;
	}

	// Token: 0x06000124 RID: 292 RVA: 0x00015CEE File Offset: 0x00013EEE
	public void Repath()
	{
		if (this.character.mainSelected)
		{
			return;
		}
		this.readyToAttack = true;
		this.ChooseAction();
	}

	// Token: 0x06000125 RID: 293 RVA: 0x00015D0C File Offset: 0x00013F0C
	public void StartSearch(Character target)
	{
		Links.x.sensory.LookAtObject(base.transform, 30f, false, this.character, 4f, 0.5f, null, 3);
		this.startSearchTime = Links.x.gameplay.seconds;
		this.character.searching = true;
		if (!this.character.inCircle)
		{
			this.character.SetRotation(Quaternion.LookRotation(target.tr.position - this.character.tr.position), true, false);
			this.character.StartGetPathToTarget(target.node, target, null, null, null, null, null, null, this.character, null, false, false, true, "Searching", false);
		}
		this.character.noiseImmune = false;
		this.character.CircleAnimation("");
		this.currentTarget = target;
		if (Records.x.combatConsoleDebugging)
		{
			Character character = this.character;
			Debug.Log(((character != null) ? character.ToString() : null) + " starting search");
		}
	}

	// Token: 0x06000126 RID: 294 RVA: 0x00015E20 File Offset: 0x00014020
	public void CheckSearchTime()
	{
		if (!this.character.moving && !this.character && !this.character.inCircle)
		{
			this.character.StartGetPathToTarget(this.currentTarget.node, this.currentTarget, null, null, null, null, null, null, this.character, null, false, false, true, "Searching", false);
		}
		if (Links.x.gameplay.seconds >= this.startSearchTime + 500f && this.startSearchTime > 0f && !this.character.inCombat)
		{
			this.EndSearch();
		}
		if (Records.x.InCombat(false))
		{
			this.character.centerOfAttention = false;
		}
	}

	// Token: 0x06000127 RID: 295 RVA: 0x00015EDC File Offset: 0x000140DC
	public void EndSearch()
	{
		if (Records.x.combatConsoleDebugging)
		{
			Debug.Log(((this != null) ? this.ToString() : null) + " ending search");
		}
		string quip = Links.x.quips.GetQuip("End Search", this.character.quipIndex);
		this.character.StartQuip(quip);
		this.character.searching = false;
		this.character.inCombat = false;
		this.character.creatures.ReturnToPatrol(this.character);
		this.character.noiseImmune = true;
		this.EndActions();
		this.character.centerOfAttention = false;
		this.character.CircleAnimation("");
		if (Records.x.combatConsoleDebugging)
		{
			Character character = this.character;
			Debug.Log(((character != null) ? character.ToString() : null) + " ending search");
		}
	}

	// Token: 0x06000128 RID: 296 RVA: 0x00015FC8 File Offset: 0x000141C8
	public void Ability(string abilityName, string spellName, bool needNodes, bool fromAI)
	{
		Library.Abilities abilityRow = Links.x.library.GetAbilityRow(abilityName);
		this.abilities.Add(abilityRow);
		bool isSpell = abilityRow._IsSpell;
		Links.x.library.GetEffectRow(abilityName);
		this.currentSpellName = spellName;
		if (isSpell)
		{
			this.spell = abilityRow;
		}
		this.QueueIcon(true);
	}

	// Token: 0x06000129 RID: 297 RVA: 0x00016020 File Offset: 0x00014220
	public void SongWordTriggered(string n, string triggerType, Library.Abilities row, out int returnMultiTargets)
	{
		returnMultiTargets = 0;
		this.songsWordsQueued.Add(n);
		if (row._AddsToAttack)
		{
			bool flag = false;
			if (this.targetsInteractive.Count > 0 && this.targetsInteractive[0] != null)
			{
				flag = true;
			}
			if (flag)
			{
				this.saveTargets = new GameObject[this.targetsInteractive.Count];
				for (int i = 0; i < this.targetsInteractive.Count; i++)
				{
					this.saveTargets[i] = this.targetsInteractive[i];
				}
			}
			else
			{
				this.saveTargets = new GameObject[this.targets.Count];
				for (int j = 0; j < this.targets.Count; j++)
				{
					this.saveTargets[j] = this.targets[j].gameObject;
				}
			}
			this.queuedSongWordsTargets.Add(this.saveTargets);
		}
		else
		{
			this.queuedSongWordsTargets.Add(null);
		}
		bool flag2 = false;
		if (this.character.inAction || this.character.inRecovery || this.character.inQueuedAbility)
		{
			flag2 = true;
		}
		if (!(triggerType == "CombatStart") && !(triggerType == "OnHit") && !(triggerType == "OnEvade") && !row._AddsToAttack && (!(triggerType == "OnPartyKill") || flag2) && (!(triggerType == "OnFriendDown") || flag2))
		{
			if (triggerType == "PreAttack")
			{
				returnMultiTargets = row._MultiTarget;
				if (row._AddsToAttack)
				{
					this.songsWordsQueuedTrigger.Add(false);
					return;
				}
				int num = this.queuedSongWordsTargets.Count - 1;
				this.songsWordsQueued.RemoveAt(num);
				this.queuedSongWordsTargets.RemoveAt(num);
				if (!row._IsSong)
				{
					this.character.emphasizeQuip = true;
					this.character.StartQuip(row._DisplayName + "!");
					return;
				}
			}
			else
			{
				this.songsWordsQueuedTrigger.Add(false);
			}
			return;
		}
		this.songsWordsQueuedTrigger.Add(true);
		if (!this.character.inQueuedAbility && !Records.x.pocketPause && !this.character.inRecovery && !this.character.inAction && this.instrumentCoroutine == null)
		{
			this.StartSongsWordsQueued(false, true);
			return;
		}
		this.StartAbilityQueue();
	}

	// Token: 0x0600012A RID: 298 RVA: 0x00016278 File Offset: 0x00014478
	public bool WaitingForQueuedAbility()
	{
		return this.checkAbilityQueues != null;
	}

	// Token: 0x0600012B RID: 299 RVA: 0x00016285 File Offset: 0x00014485
	private void StartAbilityQueue()
	{
		if (this.checkAbilityQueues == null)
		{
			this.checkAbilityQueues = this.CheckAbilityQueues();
			base.StartCoroutine(this.checkAbilityQueues);
		}
	}

	// Token: 0x0600012C RID: 300 RVA: 0x000162A8 File Offset: 0x000144A8
	private IEnumerator CheckAbilityQueues()
	{
		while (this.character.inQueuedAbility || this.character.inRecovery || this.character.stunned || !this.character.IsSentient() || Records.x.pocketPause || Records.x.paused || this.character.dead || this.instrumentCoroutine != null || this.ai.findingAction || this.character.jumping || this.character.evading || this.character.isHit || this.character.stats.pinned || this.character.stats.pinning || Links.x.combat.inPocketAttack)
		{
			yield return null;
		}
		int num = 0;
		int num2 = -1;
		for (int i = 0; i < this.songsWordsQueuedTrigger.Count; i++)
		{
			if (this.songsWordsQueuedTrigger[i])
			{
				num++;
				num2 = i;
			}
		}
		if (num2 > -1 && this.instrumentCoroutine == null)
		{
			this.StartSongsWordsQueued(false, true);
		}
		if (num > 1)
		{
			this.checkAbilityQueues = null;
			yield return new WaitForSeconds(0.1f);
			this.StartAbilityQueue();
		}
		else
		{
			this.checkAbilityQueues = null;
		}
		yield break;
	}

	// Token: 0x0600012D RID: 301 RVA: 0x000162B8 File Offset: 0x000144B8
	public void StartSongsWordsQueued(bool all, bool immediate)
	{
		bool flag = false;
		int count = this.songsWordsQueued.Count;
		string text = "";
		int num = -1;
		for (int i = 0; i < count; i++)
		{
			if (all)
			{
				if (!flag)
				{
					text = this.songsWordsQueued[i];
					flag = true;
					num = i;
				}
				else
				{
					this.songsWordsQueuedTrigger[i] = true;
				}
			}
			else if (this.songsWordsQueuedTrigger[i])
			{
				text = this.songsWordsQueued[i];
				flag = true;
				num = i;
			}
		}
		if (flag && this.character.IsSentient())
		{
			Library.Abilities abilityRow = Links.x.library.GetAbilityRow(text);
			this.StartSong(abilityRow, false);
			this.songsWordsQueued.RemoveAt(num);
			this.songsWordsQueuedTrigger.RemoveAt(num);
			this.queuedSongWordsTargets.RemoveAt(num);
		}
	}

	// Token: 0x0600012E RID: 302 RVA: 0x00016387 File Offset: 0x00014587
	public void RemoveAbility()
	{
		if (this.character.party)
		{
			Links.x.gameplay.ClearWaypointEffect(this.character);
		}
		this.abilities.Clear();
	}

	// Token: 0x0600012F RID: 303 RVA: 0x000163B8 File Offset: 0x000145B8
	public void StartAction(string type)
	{
		this.canEndAttackTime = true;
		if (Records.x.turnBased)
		{
			this.ContinueAction();
			return;
		}
		this.repathing = false;
		this.QueueIcon(true);
		this.character.attackSpeed = 1f;
		this.character.ClearNodePath();
		this.character.waitingForPath = 0;
		this.currentAction = type;
		if (this.startAttackCoroutine != null)
		{
			base.StopCoroutine(this.startAttackCoroutine);
			this.startAttackCoroutine = null;
		}
		this.startAttackCoroutine = this.StartingAction(type);
		base.StartCoroutine(this.startAttackCoroutine);
	}

	// Token: 0x06000130 RID: 304 RVA: 0x00016450 File Offset: 0x00014650
	private IEnumerator StartingAction(string type)
	{
		this.rolling = true;
		this.secondAttack = false;
		this.damageBonus = 0f;
		this.effectBonus = 0f;
		bool canAttack = true;
		this.character.moveBackTarget = null;
		if (this.character.dodging)
		{
			this.character.EndDodge();
		}
		this.character.inAction = true;
		this.character.inActionTime = Links.x.gameplay.seconds;
		bool needsToTurn = false;
		Quaternion look = this.character.rot;
		if (!this.character.mainSelected)
		{
			while (this.character.turning)
			{
				yield return null;
			}
			while (this.character.moving)
			{
				yield return null;
			}
			while (this.character.body.IsHit())
			{
				yield return null;
			}
		}
		if (this.character.mainSelected)
		{
			Links.x.combat.ClearPossibleTargets();
		}
		if (this.actionTargets.Count > 0 && type != "Charm" && !this.givingItem && !this.pickingUpItem && this.actionTargets[0] && this.character)
		{
			if (!this.InAttackRange(this.actionTargets[0]) && !this.character.mainSelected)
			{
				if (this.combatCharacters == null)
				{
					this.combatCharacters = Links.x.diorama.characters;
				}
				Character character = this.actionTargets[0];
				bool flag = false;
				for (int i = 0; i < this.combatCharacters.Count; i++)
				{
					Character character2 = this.combatCharacters[i];
					if (character2 && character2 != character && this.ai.CanAttack(character2) && this.InAttackRange(character2) && this.InAttackDirection(character2))
					{
						this.actionTargets[0] = character2;
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					canAttack = false;
				}
			}
			if (canAttack)
			{
				look = Quaternion.LookRotation(this.actionTargets[0].tr.position - this.character.tr.position);
				this.character.alwaysTurn = true;
				this.character.SetRotation(look, false, this.character.mainSelected);
				if (this.character.GetRotationAngle(look, this.character.body.tr.rotation) >= 40f)
				{
					needsToTurn = true;
				}
			}
			this.quickAttack = false;
		}
		if (this.character.npc && this.hasTarget && this.selectedTarget)
		{
			this.SetSelectedTarget(false, null, null, null);
		}
		if (this.actionInteractives.Count > 0 && this.actionInteractives[0] && this.character)
		{
			look = Quaternion.LookRotation(this.actionInteractives[0].transform.position - this.character.tr.position);
			this.character.alwaysTurn = true;
			this.character.SetRotation(look, false, this.character.mainSelected);
			if (this.character.GetRotationAngle(look, this.character.body.tr.rotation) >= 40f && !this.character.mainSelected)
			{
				needsToTurn = true;
			}
		}
		if (type == "Charm" && this.actionTargets.Count > 0)
		{
			if (this.actionTargets[0])
			{
				this.charming = true;
				look = Quaternion.LookRotation(this.actionTargets[0].tr.position - this.character.tr.position);
				this.character.alwaysTurn = true;
				this.character.SetRotation(look, false, false);
				canAttack = true;
			}
			else
			{
				this.charming = false;
			}
		}
		else
		{
			this.charming = false;
		}
		if (canAttack)
		{
			if (needsToTurn && !this.character.mainSelected)
			{
				yield return new WaitForSeconds(0.1f);
			}
			float startTime = Time.time;
			while (this.character.turning && !this.character.mainSelected)
			{
				if (Time.time > startTime + 1f)
				{
					this.character.SetRotation(look, false, false);
					startTime = Time.time;
				}
				yield return null;
			}
			if (this.character.timelineIcon)
			{
				if (this.character.mainSelected || this.character == Links.x.combat.rallyCharacter)
				{
					this.character.timelineIcon.WaitForAction(0.01f, true, this.readyToAttack);
				}
				else
				{
					this.character.timelineIcon.WaitForAction(this.GetActionSpeed(type), true, this.readyToAttack);
				}
			}
		}
		else
		{
			if (Records.x.combatConsoleDebugging)
			{
				Character character3 = this.character;
				Debug.Log(((character3 != null) ? character3.ToString() : null) + " cannot attack ");
			}
			yield return new WaitForSeconds(0.01f);
			this.ClearDamageLists();
			this.ClearTargetCharacters();
			this.canEndAttackTime = true;
			this.readyToAttack = false;
			this.character.inAction = false;
			this.character.inRecovery = false;
			if (this.character.timelineIcon)
			{
				this.character.timelineIcon.overridePause = false;
				this.character.timelineIcon.Clear();
			}
			this.rolling = false;
			this.startAttackCoroutine = null;
			this.EndTurn(true);
		}
		this.startAttackCoroutine = null;
		yield break;
	}

	// Token: 0x06000131 RID: 305 RVA: 0x00016468 File Offset: 0x00014668
	public int GetHand()
	{
		this.currentHand = 0;
		this.invRow = this.character.invRow1;
		if (!this.firstAttack)
		{
			if (this.character.GetInvNum(2) > 1)
			{
				if (this.character.invRow2._EquipSlotID == 0)
				{
					this.currentHand = 1;
					this.invRow = this.character.invRow2;
				}
			}
			else if (this.character.stats.GetSkill(9) >= 50f && this.character.GetInvNum(0) <= 1)
			{
				this.currentHand = 1;
				this.invRow = this.character.invRow2;
			}
		}
		return this.currentHand;
	}

	// Token: 0x06000132 RID: 306 RVA: 0x00016518 File Offset: 0x00014718
	public void ContinueAction()
	{
		this.readyToAttack = false;
		this.character.inAction = true;
		this.character.inActionTime = Links.x.gameplay.seconds;
		this.rangeIndex = -1;
		this.ammoRow = null;
		bool flag = false;
		for (int i = 0; i < this.abilities.Count; i++)
		{
			Library.Abilities abilities = this.abilities[i];
			if (abilities != null)
			{
				if (this.IsInstrument(abilities._WeaponReq) || this.IsWord(abilities._MainSkill) || abilities._IsSpell || abilities._WeaponReq.Contains("Elixir") || abilities._MainSkill.Contains("Charm"))
				{
					flag = true;
				}
				if (abilities._IsSpell)
				{
					this.spell = abilities;
				}
			}
		}
		this.ClearDamageLists();
		this.character.doingAction = true;
		if (Records.x.combatConsoleDebugging)
		{
			string[] array = new string[17];
			int num = 0;
			Character character = this.character;
			array[num] = ((character != null) ? character.ToString() : null);
			array[1] = ": using items is ";
			array[2] = this.usingItem.ToString();
			array[3] = ", giving item is ";
			array[4] = this.givingItem.ToString();
			array[5] = ", picking up item is ";
			array[6] = this.pickingUpItem.ToString();
			array[7] = ", action targets count is ";
			array[8] = this.actionTargets.Count.ToString();
			array[9] = ", abilities count is ";
			array[10] = this.abilities.Count.ToString();
			array[11] = ", ability to target ground is ";
			array[12] = flag.ToString();
			array[13] = ", weapon is ";
			array[14] = this.character.invRow1._DisplayName;
			array[15] = " moving to pin ";
			array[16] = this.movingToPin.ToString();
			Debug.Log(string.Concat(array));
		}
		if (this.givingItem)
		{
			this.GiveItem();
			return;
		}
		if (this.usingItem)
		{
			this.UsingItem();
			this.canEndAttackTime = true;
			this.EndAttackTime(0f);
			return;
		}
		if (this.pickingUpItem)
		{
			this.PickUpItem();
			this.canEndAttackTime = true;
			this.EndAttackTime(0f);
			return;
		}
		if (this.charming)
		{
			this.character.CheckForCharm(this.actionTargets[0]);
			this.charming = false;
			this.character.ZeroAttackTime(0f);
			this.EndTurn(true);
			return;
		}
		if (!this.character.stats.pinned && this.character.IsSentient() && (this.actionTargets.Count > 0 || this.actionInteractives.Count > 0 || flag))
		{
			if (!Links.x.combat.inRally)
			{
				if (this.character.mainSelected && (this.specialAttack1 || this.specialAttack2 || this.specialAttack3))
				{
					base.StartCoroutine(this.Pocket());
					return;
				}
				this.firstAttack = true;
				if (this.doBubbleAttack && this.bubbleTarget)
				{
					this.ClearDamageLists();
					this.ClearTargetCharacters();
					this.AddTarget(this.bubbleTarget);
				}
				this.ActionRolls(false, false, null, null);
				return;
			}
		}
		else
		{
			if (Records.x.combatConsoleDebugging)
			{
				Character character2 = this.character;
				Debug.Log(((character2 != null) ? character2.ToString() : null) + " cannot attack, has no targets ");
			}
			this.canEndAttackTime = true;
			this.EndAttackTime(0f);
			this.EndTurn(true);
		}
	}

	// Token: 0x06000133 RID: 307 RVA: 0x00016898 File Offset: 0x00014A98
	public void ClearDamageLists()
	{
		this.hits.Clear();
		this.targets.Clear();
		this.targetsInteractive.Clear();
		this.hitText.Clear();
		this.attackTotal.Clear();
		this.defenseTotal.Clear();
		this.damages.Clear();
	}

	// Token: 0x06000134 RID: 308 RVA: 0x000168F4 File Offset: 0x00014AF4
	public void RallyClearLists()
	{
		this.hits.Clear();
		this.targets.Clear();
		this.targetsInteractive.Clear();
		this.hitText.Clear();
		this.attackTotal.Clear();
		this.defenseTotal.Clear();
		this.damages.Clear();
	}

	// Token: 0x06000135 RID: 309 RVA: 0x00016950 File Offset: 0x00014B50
	public void CheckIfRunningAI()
	{
		if (this.ai.findingAction)
		{
			if (this.character.npc)
			{
				this.ai.StopAI();
			}
			else
			{
				this.ai.StopLookingForAction();
			}
		}
		Links.x.combat.RemoveFromNeedsTurn(this.character);
	}

	// Token: 0x06000136 RID: 310 RVA: 0x000169A4 File Offset: 0x00014BA4
	public void StartSong(Library.Abilities song, bool fromAI)
	{
		this.rolling = true;
		if (!fromAI)
		{
			this.CheckIfRunningAI();
			Links.x.combat.RemoveFromNeedsTurn(this.character);
			this.character.animator.SetBool("Combat", true);
			Links.x.pocketWheel.Close(false);
			Links.x.gameplay.joystickTarget.SetActive(false);
			Links.x.combat.ClearPossibleTargets();
			Shader.SetGlobalFloat("_NoCharacterFX", 1f);
			this.character.body.CombatSheen(1);
		}
		if (this.character.npc)
		{
			Links.x.sensory.AddNoise(this.character.gameObject, this.character.node, "Combat Aggro", this.character);
		}
		this.actionTargets.Clear();
		if (Records.x.combatConsoleDebugging)
		{
			string[] array = new string[6];
			array[0] = "Starting song ";
			int num = 1;
			Character character = this.character;
			array[num] = ((character != null) ? character.ToString() : null);
			array[2] = " for ";
			array[3] = song._Name;
			array[4] = " tiles, ability count is ";
			array[5] = this.abilities.Count.ToString();
			Debug.Log(string.Concat(array));
		}
		if (this.character.timelineIcon)
		{
			this.character.timelineIcon.overridePause = false;
		}
		if (this.instrumentCoroutine == null)
		{
			Library.Inventory instrumentType = this.character.GetInstrumentType(song._WeaponReq);
			GraphNode graphNode = this.character.node;
			if (graphNode == null)
			{
				this.character.FindCurrentNode(false);
				graphNode = this.character.node;
			}
			if (song != null && graphNode != null && instrumentType != null)
			{
				this.UpdateSoundAlerts(null);
				this.character.inQueuedAbility = true;
				this.character.inQueuedAbilityTime = Time.timeSinceLevelLoad;
				bool flag = true;
				float num2 = 0f;
				this.character.CreateEquippedItems(instrumentType._ID, 1, Vector3.zero, Vector3.zero, 0, false);
				if (song._WeaponReq == "Flute")
				{
					this.character.PlayAnimation("Instrument", 0f);
				}
				else if (song._WeaponReq == "Horn")
				{
					this.character.PlayAnimation("Instrument_Horn", 0f);
				}
				else
				{
					this.character.PlayAnimation("Instrument_Pipes", 0f);
				}
				this.instrumentCoroutine = this.InstrumentWait(flag, song._Name, song, instrumentType, graphNode, num2);
				base.StartCoroutine(this.instrumentCoroutine);
			}
		}
		this.abilities.Clear();
		this.rolling = false;
	}

	// Token: 0x06000137 RID: 311 RVA: 0x00016C58 File Offset: 0x00014E58
	private IEnumerator InstrumentWait(bool passedRoll, string uniqueName, Library.Abilities songRow, Library.Inventory instrumentRow, GraphNode startNode, float severity)
	{
		this.character.inQueuedAbility = true;
		this.character.inQueuedAbilityTime = Time.timeSinceLevelLoad;
		float radius = 0f;
		this.playingMusic = true;
		int num = 34;
		if (songRow._WeaponReq != "Horn")
		{
			num = 72;
		}
		GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(num);
		if (pooledGameObject)
		{
			pooledGameObject.transform.position = this.character.body.GetNeck().position + new Vector3(0f, 1.25f, 0f) + Links.x.worldCamera.transform.right * 1.25f;
			pooledGameObject.SetActive(true);
		}
		while (Records.x.removeControls || Records.x.pocketPause)
		{
			yield return null;
		}
		if (passedRoll)
		{
			TileEffects tileEffects = Links.x.tileEffects.AddComponent<TileEffects>();
			tileEffects.gameObject.SetActive(true);
			tileEffects.severity = severity;
			tileEffects.spellIndex = this.spellIndex;
			tileEffects.paganRow = null;
			tileEffects.mainSkill = songRow._MainSkill;
			tileEffects.spellScroll = null;
			tileEffects.isSong = true;
			float num2;
			if (songRow._WeaponReq == "Flute")
			{
				num2 = this.character.stats.GetSkill(26);
			}
			else if (songRow._WeaponReq == "Horn")
			{
				num2 = this.character.stats.GetSkill(27);
			}
			else
			{
				num2 = this.character.stats.GetSkill(29);
			}
			tileEffects.sourceLevel = num2;
			tileEffects.itemInfo = instrumentRow._Effect;
			tileEffects.radius = radius;
			tileEffects.startNode = startNode;
			tileEffects.Setup(songRow, null, null, null, null, this.character);
		}
		int overallTime = songRow._OverallTime;
		this.character.inRecovery = false;
		if (this.character.timelineIcon)
		{
			this.character.timelineIcon.overridePause = false;
		}
		this.character.inAction = true;
		this.character.inActionTime = Links.x.gameplay.seconds;
		Library.Effects effectRow = Links.x.library.GetEffectRow(songRow._Name);
		this.character.stats.AddSkillProgress(this.character.stats.GetCombatSkillID(songRow._MainSkill), songRow._Difficulty, null);
		if (passedRoll)
		{
			MasterAudio.PlaySound3DAtTransform("Instruments", this.character.tr, 1f, new float?(1f), 0f, effectRow._Sound, null, false, false);
		}
		else if (songRow._WeaponReq == "Flute")
		{
			MasterAudio.PlaySound3DAtTransform("Instruments", this.character.tr, 1f, new float?(1f), 0f, "Flute Fail", null, false, false);
		}
		else if (songRow._WeaponReq == "Horn")
		{
			MasterAudio.PlaySound3DAtTransform("Instruments", this.character.tr, 1f, new float?(1f), 0f, "Horn Fail", null, false, false);
		}
		else
		{
			MasterAudio.PlaySound3DAtTransform("Instruments", this.character.tr, 1f, new float?(1f), 0f, "Pipes Fail", null, false, false);
		}
		float timeToLerp = 0.75f;
		float percentage = 0f;
		float startTime = Time.time;
		if (this.character.npc)
		{
			timeToLerp = 1f;
		}
		while (percentage < 1f)
		{
			percentage = (Time.time - startTime) / timeToLerp;
			yield return null;
		}
		this.EndPlayingInstrument();
		if (this.character.mainSelected)
		{
			Shader.SetGlobalFloat("_NoCharacterFX", 0f);
			this.character.body.CombatSheen(0);
		}
		this.character.inRecovery = false;
		if (!Records.x.combat)
		{
			this.endActionsAfterTurn = true;
			if (!this.cannotInterrupt)
			{
				this.EndTurnAfterAction();
			}
		}
		else
		{
			this.endActionsAfterTurn = false;
			if (!this.cannotInterrupt)
			{
				this.EndTurn(true);
			}
		}
		this.pocketQueued = false;
		yield break;
	}

	// Token: 0x06000138 RID: 312 RVA: 0x00016C90 File Offset: 0x00014E90
	public void EndPlayingInstrument()
	{
		this.instrumentCoroutine = null;
		this.character.inQueuedAbility = false;
		this.character.CreateEquippedItems(this.character.GetInvNum(0), this.character.GetInvNum(1), this.character.GetSocketNum(0), this.character.GetSocketNum(1), 0, false);
		this.character.doingAction = false;
		this.character.inRecovery = false;
		this.character.inAction = false;
		if (this.character.timelineIcon)
		{
			this.character.timelineIcon.overridePause = false;
		}
		this.playingMusic = false;
		if (this.character.IsSentient())
		{
			this.character.PlayAnimation("Idle", 0f);
		}
	}

	// Token: 0x06000139 RID: 313 RVA: 0x00016D60 File Offset: 0x00014F60
	public void CastSpell(Character targetingCharacter, bool fromAI, GraphNode centerNode, Vector3 centerPoint, bool singleTarget, bool immediate)
	{
		this.rolling = true;
		if (!this.character.timelineIcon)
		{
			this.EndTurn(true);
		}
		if (!fromAI)
		{
			Links.x.hudControl.ToggleAttackTimer(false);
			this.CheckIfRunningAI();
			this.ClearSelectedActionRealTime();
			Links.x.combat.RemoveFromNeedsTurn(this.character);
			this.character.timelineIcon.overridePause = true;
		}
		this.castingSpell = true;
		this.spellNode = centerNode;
		if (Records.x.combatConsoleDebugging)
		{
			Character character = this.character;
			Debug.Log(((character != null) ? character.ToString() : null) + " casting spell " + this.abilities[0]._Name);
		}
		if (!Records.x.banquetIsle && !this.character.stats.semizenMagic && this.character.stats.magicPointsBase > 0)
		{
			MasterAudio.PlaySound3DAtVector3AndForget("SpellcastingVol", this.character.tr.position, 1f, new float?(1f), 0.25f, "", null);
			if (!this.spellCasterFX)
			{
				this.spellCasterFX = Links.x.cellar.GetPooledGameObject(69);
			}
			this.spellCasterFX.transform.position = this.character.tr.position + new Vector3(0f, 0.2f, 0f);
			this.spellCasterFX.SetActive(true);
			this.spellCasterFX.transform.rotation = this.character.circleRot;
		}
		if (!Records.x.banquetIsle && this.character.stats.magicPointsBase <= 0 && !this.character.party)
		{
			this.chargeUpNum = 109;
			if (!this.character.stats.xmlName.Contains("Poison"))
			{
				this.chargeUpNum = 114;
			}
			if (!this.chargeUpFX)
			{
				this.chargeUpFX = Links.x.cellar.GetPooledGameObject(this.chargeUpNum);
			}
			this.chargeUpFX.transform.SetParent(this.character.body.GetNeck(), true);
			this.chargeUpFX.transform.localPosition = Vector3.zero;
			this.chargeUpFX.SetActive(true);
			MasterAudio.PlaySound3DAtTransform("SpecialAttacks", this.character.tr, 0.2f, new float?(1f), 0f, "ChargeUp", null, false, false);
		}
		if ((Records.x.banquetIsle || this.character.stats.semizenMagic) && (targetingCharacter || this.spellNode != null))
		{
			if (!this.spellWaveFX)
			{
				this.spellWaveFX = Links.x.cellar.GetPooledGameObject(88);
			}
			Transform transform = this.character.body.GetSlot(1);
			if (!transform)
			{
				transform = this.character.body.headBone;
			}
			this.spellWaveFX.transform.SetParent(transform);
			this.spellWaveFX.transform.localPosition = new Vector3(0f, 0f, 0f);
			this.spellWaveFX.transform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f));
			this.spellWaveFX.transform.localScale = Vector3.one;
			LineWave component = this.spellWaveFX.GetComponent<LineWave>();
			Library.Pagan pagan = Links.x.library.GetPaganRow(this.abilities[0]._Name);
			if (pagan._LineColor == "Red")
			{
				component.traceMaterial = component.redMaterial;
			}
			else if (pagan._LineColor == "Green")
			{
				component.traceMaterial = component.greenMaterial;
			}
			else
			{
				component.traceMaterial = component.blueMaterial;
			}
			this.spellWaveFX.SetActive(true);
			if (targetingCharacter)
			{
				component.targetOptional = targetingCharacter.gameObject;
			}
			else
			{
				component.targetOptional = this.spellCasterTargetFX.gameObject;
			}
			MasterAudio.PlaySound3DAtVector3AndForget("Semizen Magic", this.character.tr.position, 1f, new float?(1f), 0f, "", null);
		}
		if (this.character.npc)
		{
			if (targetingCharacter)
			{
				Links.x.sensory.AddNoise(targetingCharacter.gameObject, this.character.node, "Combat Aggro", targetingCharacter);
			}
			else
			{
				Links.x.sensory.AddNoise(this.character.gameObject, this.character.node, "Combat Aggro", this.character);
			}
		}
		this.actionTargets.Clear();
		if (targetingCharacter && singleTarget)
		{
			this.actionTargets.Add(targetingCharacter);
		}
		if (Records.x.combatConsoleDebugging)
		{
			string[] array = new string[8];
			array[0] = "Ground spell starting from ";
			int num = 1;
			Character character2 = this.character;
			array[num] = ((character2 != null) ? character2.ToString() : null);
			array[2] = " for ";
			int num2 = 3;
			GraphNode graphNode = this.spellNode;
			array[num2] = ((graphNode != null) ? graphNode.ToString() : null);
			array[4] = " tiles, ability count is ";
			array[5] = this.abilities.Count.ToString();
			array[6] = " ";
			array[7] = ((targetingCharacter != null) ? targetingCharacter.ToString() : null);
			Debug.Log(string.Concat(array));
		}
		if (this.spellNode != null)
		{
			Vector3 vector = (Vector3)this.spellNode.position;
			if (this.castCompleteCoroutine != null)
			{
				base.StopCoroutine(this.castCompleteCoroutine);
				this.castCompleteCoroutine = null;
			}
			this.castCompleteCoroutine = this.CastWait(vector, immediate);
			base.StartCoroutine(this.castCompleteCoroutine);
		}
		else
		{
			Character character3 = this.character;
			Debug.Log(((character3 != null) ? character3.ToString() : null) + " has no spell nodes");
			this.EndTurn(false);
			this.castingSpell = false;
		}
		if (Links.x.gameplay.actionCharacter == this.character)
		{
			Links.x.gameplay.actionCharacter = null;
			Links.x.gameplay.currentAbility = "";
		}
		if (this.character.mainSelected)
		{
			Links.x.pocketWheel.Close(false);
		}
	}

	// Token: 0x0600013A RID: 314 RVA: 0x000173FC File Offset: 0x000155FC
	private IEnumerator CastWait(Vector3 pt, bool immediate)
	{
		if (!immediate)
		{
			if (this.actionTargets.Count > 0 && this.actionTargets[0])
			{
				pt = this.actionTargets[0].currentPosition;
			}
			Quaternion look = Quaternion.LookRotation(pt - this.character.tr.position);
			if (this.character.moving)
			{
				this.character.ClearNodePath();
			}
			while (this.character.moving || (Records.x.pocketPause && !this.character.mainSelected))
			{
				yield return null;
			}
			this.character.alwaysTurn = true;
			this.character.SetRotation(look, false, true);
			float sTime = Time.timeSinceLevelLoad;
			yield return new WaitForSeconds(0.05f);
			while (this.character.turning && Time.timeSinceLevelLoad < sTime + 2f)
			{
				yield return null;
			}
			this.character.EndTurning(false);
			this.character.PlayAnimation("Cast", 0f);
			this.character.timelineIcon.WaitForAction(this.GetActionSpeed("Spell"), true, false);
			this.character.inAction = true;
			look = default(Quaternion);
		}
		this.castCompleteCoroutine = null;
		if (immediate)
		{
			this.TriggerCastFromCastAnimation();
		}
		yield break;
	}

	// Token: 0x0600013B RID: 315 RVA: 0x0001741C File Offset: 0x0001561C
	public void AddActionRoll(Character t, GameObject ti, int h, float d, string atk, string def, string txt)
	{
		this.damages.Add(d);
		this.targets.Add(t);
		this.targetsInteractive.Add(ti);
		this.hits.Add(h);
		this.attackTotal.Add(atk);
		this.defenseTotal.Add(def);
		this.hitText.Add(txt);
	}

	// Token: 0x0600013C RID: 316 RVA: 0x00017481 File Offset: 0x00015681
	private IEnumerator Pocket()
	{
		this.rolling = true;
		Records.x.RemoveControls(true);
		this.ClearDamageLists();
		Links.x.combat.inPocketAttack = true;
		this.readyToAttack = false;
		this.character.inAction = true;
		this.character.inActionTime = Links.x.gameplay.seconds;
		this.rangeIndex = -1;
		this.ammoRow = null;
		this.repathing = false;
		Links.x.combat.lastRallyTarget = null;
		this.QueueIcon(true);
		this.character.attackSpeed = 1f;
		this.character.ClearNodePath();
		this.character.waitingForPath = 0;
		this.character.moveBackTarget = null;
		if (this.character.dodging)
		{
			this.character.EndDodge();
		}
		this.character.inAction = true;
		this.character.inActionTime = Links.x.gameplay.seconds;
		Links.x.combat.ClearPossibleTargets();
		this.character.doingAction = true;
		this.character.ChangePocketPauseState();
		Links.x.pocketWheel.Close(false);
		Links.x.attackDome.SetActive(false);
		if (this.rallyInteractiveTarget)
		{
			Links.x.combat.rallyTarget = this.rallyInteractiveTarget.GetComponent<Character>();
			if (this.actionInteractives.Count == 0)
			{
				this.AddTarget(this.rallyInteractiveTarget.GetComponent<Character>());
			}
		}
		else
		{
			Links.x.combat.rallyTarget = this.actionTargets[0];
			Links.x.combat.rallyTarget.body.CombatSheen(0);
		}
		Links.x.hudControl.ChangeHudVisibility(false, true);
		Shader.SetGlobalFloat("_NoCharacterFX", 1f);
		Character c = this.character;
		Character cTarget = null;
		Character rallyFriend = null;
		Character rallyFriend2 = null;
		GraphNode rallyNode = null;
		bool movedRally = false;
		bool movedRally2 = false;
		bool zoomed = false;
		if (this.actionTargets.Count > 0)
		{
			cTarget = this.actionTargets[0];
			Links.x.combat.rallyTarget = cTarget;
		}
		if (!cTarget)
		{
			cTarget = this.actionInteractives[0].GetComponent<Character>();
		}
		Links.x.combat.rallyStartPosition = Links.x.combat.rallyTarget.tr.position;
		Vector3 position = cTarget.tr.position;
		List<Character> ditheredCharacters = new List<Character>();
		c.MoveBackEmpty();
		c.ignoreRemoveControls = true;
		c.inRecovery = false;
		c.isHit = false;
		c.inAction = false;
		c.body.CombatSheen(1);
		c.SetActiveStateWorldUI(0);
		Quaternion quaternion = Quaternion.LookRotation(new Vector3(cTarget.tr.position.x, this.character.tr.position.y, cTarget.tr.position.z) - this.character.tr.position);
		int currentProjectileCount = this.projectiles.Count;
		Links.x.rtsCamera.pocketPoint = Vector3.Lerp(c.tr.position, cTarget.tr.position, 0.25f);
		c.SetRotation(Quaternion.LookRotation(cTarget.tr.position - c.tr.position), false, true);
		if (!Links.x.pocketWheel.selectedRally.Contains("Both"))
		{
			if (c.invRow1._MeleeRangeEnd > 5f)
			{
				Links.x.rtsCamera.Zoom(true, "MainCharacterQTERange");
			}
			else
			{
				Links.x.rtsCamera.Zoom(true, "MainCharacterQTE");
			}
			zoomed = true;
		}
		this.allCharacters = Links.x.diorama.characters;
		for (int j = 0; j < this.allCharacters.Count; j++)
		{
			Character character = this.allCharacters[j];
			if (character && character != c && character != cTarget && (!character.inactive || character.party))
			{
				character.SetMeshState(false);
				ditheredCharacters.Add(character);
			}
		}
		Records.x.StartUIFade(true, false);
		yield return new WaitForSeconds(0.1f);
		if (this.pocketAttackRoutine == null)
		{
			this.pocketAttackRoutine = this.PocketAttack(c, cTarget, this.rallyInteractiveTarget);
			base.StartCoroutine(this.pocketAttackRoutine);
			while (this.pocketAttackRoutine != null)
			{
				yield return null;
			}
		}
		if (this.specialAttack3)
		{
			while (Links.x.rallyStage.playing)
			{
				yield return null;
			}
			yield return new WaitForSeconds(0.75f);
		}
		else
		{
			yield return new WaitForSeconds(0.25f);
			if (this.character.stats.HandCount() > 1f)
			{
				yield return new WaitForSeconds(0.25f);
			}
			float startRallyTime = Time.timeSinceLevelLoad;
			while (this.projectiles.Count - currentProjectileCount > 0 && Time.timeSinceLevelLoad < startRallyTime + 1f)
			{
				yield return null;
			}
		}
		c.ignoreRemoveControls = false;
		c.ignoreNodeIDs = false;
		bool comboBreakable = false;
		if (this.rallyInteractiveTarget)
		{
			comboBreakable = true;
			Links.x.combat.lastRallyTarget = this.rallyInteractiveTarget;
		}
		bool canceledCombo = false;
		int num5;
		for (int i = 0; i < 2; i = num5 + 1)
		{
			if (Links.x.fellowship.rally + Links.x.fellowship.rallyBoost >= Links.x.hudControl.rallyInterval && !canceledCombo)
			{
				Character pastRallyFriend = this.character;
				if (i == 1)
				{
					pastRallyFriend = rallyFriend;
				}
				for (int k = 0; k < this.allCharacters.Count; k++)
				{
					Character character2 = this.allCharacters[k];
					if (character2 && character2.party)
					{
						character2.SetMeshState(true);
						character2.PlayAnimation("Idle", 0f);
						character2.SetAnimatorSpeed(1f);
					}
				}
				bool flag = true;
				if (cTarget.dead || cTarget.stunned)
				{
					flag = false;
					for (int l = 0; l < this.allCharacters.Count; l++)
					{
						if (!flag)
						{
							Character character3 = this.allCharacters[l];
							if (pastRallyFriend.actions.ai.CanAttack(character3) && !character3.dead && !character3.stunned && Links.x.combat.NearAnyParty(character3.currentPosition, 100f))
							{
								flag = true;
								break;
							}
						}
					}
					if (comboBreakable)
					{
						flag = true;
					}
					if (flag)
					{
						cTarget.SetMeshState(false);
					}
				}
				if (i == 0)
				{
					Links.x.pocketWheel.rally1 = pastRallyFriend;
					Links.x.pocketWheel.rally2 = null;
				}
				else
				{
					Links.x.pocketWheel.rally2 = pastRallyFriend;
				}
				if (flag)
				{
					this.party = Links.x.portraitOrder;
					bool flag2 = false;
					for (int m = 0; m < this.party.Count; m++)
					{
						if (flag)
						{
							if (comboBreakable)
							{
								if (Links.x.pocketWheel.CanRally(this.party[m], false))
								{
									flag2 = true;
								}
							}
							else if (Links.x.pocketWheel.CanRally(this.party[m], true))
							{
								flag2 = true;
							}
						}
					}
					if (!flag2)
					{
						flag = false;
					}
				}
				if (flag)
				{
					Shader.SetGlobalFloat("_NoCharacterFX", 0f);
					Links.x.pocketWheel.OpenRallyWheel(true);
					Links.x.rtsCamera.Zoom(true, "MainCharacterQTERallyPick");
					if (pastRallyFriend)
					{
						pastRallyFriend.body.CombatSheen(0);
						for (int n = 0; n < this.allCharacters.Count; n++)
						{
							Character character4 = this.allCharacters[n];
							if (pastRallyFriend.actions.ai.CanAttack(character4) && !character4.dead && !character4.stunned && Links.x.combat.NearAnyParty(character4.currentPosition, 100f))
							{
								character4.SetMeshState(true);
							}
						}
					}
					this.rallyInteractiveTarget = null;
					Links.x.hudControl.gameCardAnimator.Play("WindowsIn");
					Links.x.hudControl.cardCanvasGroup.interactable = true;
					yield return new WaitForSeconds(0.001f);
					Links.x.gameplay.rallyTargetSelected = null;
					Links.x.gameplay.rallyTargetInteractiveSelected = null;
					for (int num = 0; num < ditheredCharacters.Count; num++)
					{
						Character character5 = ditheredCharacters[num];
						if (character5 && character5 != cTarget && !character5.party)
						{
							character5.ChangePocketPauseState();
						}
					}
					while (!Links.x.gameplay.rallyTargetSelected && !Links.x.gameplay.rallyTargetInteractiveSelected && Links.x.pocketWheel.rallyWheelOpen)
					{
						yield return null;
					}
					if (Links.x.gameplay.rallyTargetSelected || Links.x.gameplay.rallyTargetInteractiveSelected)
					{
						Shader.SetGlobalFloat("_NoCharacterFX", 1f);
						if (!Links.x.gameplay.rallyTargetInteractiveSelected)
						{
							cTarget = Links.x.gameplay.rallyTargetSelected;
							Links.x.combat.rallyTarget = cTarget;
							cTarget.body.CombatSheen(0);
						}
						else
						{
							Links.x.combat.rallyTarget = Links.x.gameplay.rallyTargetInteractiveSelected.GetComponent<Character>();
							Links.x.gameplay.rallyTargetInteractiveSelected = null;
						}
						for (int num2 = 0; num2 < ditheredCharacters.Count; num2++)
						{
							Character character6 = ditheredCharacters[num2];
							if (character6 && character6 != cTarget && !character6.party)
							{
								character6.SetMeshState(false);
								character6.ChangePocketPauseState();
							}
						}
						if (Links.x.pocketWheel.rallyWheelOpen && Links.x.pocketWheel.selectedRallyCharacter && Links.x.pocketWheel.selectedRally != "")
						{
							Links.x.pocketWheel.Close(false);
							yield return new WaitForSeconds(0.001f);
							Character rallyFriend3 = Links.x.pocketWheel.selectedRallyCharacter;
							if (i == 0)
							{
								rallyFriend = rallyFriend3;
							}
							if (i == 1)
							{
								rallyFriend2 = rallyFriend3;
							}
							if (pastRallyFriend)
							{
								pastRallyFriend.ChangePocketPauseState();
							}
							if (!rallyFriend3.actions)
							{
								Links.x.combat.GivePartyActions(rallyFriend3, false);
							}
							rallyFriend3.slideNode = null;
							rallyFriend3.actions.CheckIfRunningAI();
							rallyFriend3.ChangePocketPauseState();
							rallyFriend3.SetMeshState(true);
							rallyFriend3.EndDodge();
							rallyFriend3.StopEvading();
							rallyFriend3.ForceEndJump();
							rallyFriend3.ClearNodePath();
							rallyFriend3.timelineIcon.Clear();
							rallyNode = rallyFriend3.node;
							List<Projectile> rallyProjectiles = rallyFriend3.actions.projectiles;
							currentProjectileCount = rallyProjectiles.Count;
							for (int num3 = 0; num3 < this.allCharacters.Count; num3++)
							{
								Character character7 = this.allCharacters[num3];
								if (character7 && character7 != rallyFriend3 && character7 != cTarget && !character7.inactive)
								{
									character7.SetMeshState(false);
								}
							}
							rallyFriend3.SetActiveStateWorldUI(0);
							float num4 = rallyFriend3.AttackRange();
							if (Vector3.Distance(rallyFriend3.tr.position, cTarget.currentPosition) > num4 + 0.5f && !Links.x.pocketWheel.selectedRally.Contains("Both") && !rallyFriend3.sailing)
							{
								quaternion = Quaternion.LookRotation(new Vector3(cTarget.tr.position.x, rallyFriend3.tr.position.y, cTarget.tr.position.z) - rallyFriend3.tr.position);
								Vector3 newPosition = cTarget.tr.position + quaternion * Vector3.forward * ((num4 - 0.5f) * -1f);
								RaycastHit raycastHit;
								if (Physics.Raycast(newPosition + new Vector3(0f, 20f, 0f), Vector3.up * -1f, out raycastHit, 100f, 4194305))
								{
									newPosition.y = raycastHit.point.y;
								}
								GraphNode openNode = rallyFriend3.NearNode(newPosition, false, 0, -1, 0);
								if (openNode == null)
								{
									openNode = cTarget.node;
								}
								if ((rallyFriend3.tr.position - newPosition).sqrMagnitude > 1600f || rallyFriend3.inCircle)
								{
									rallyFriend3.SetMeshState(false);
									yield return new WaitForSeconds(0.001f);
									float startRallyTime = Time.timeSinceLevelLoad;
									while (rallyFriend3.body.dithering && Time.timeSinceLevelLoad < startRallyTime + 1f)
									{
										yield return null;
									}
									rallyFriend3.SetPosition(newPosition, null);
									rallyFriend3.ClaimNode(openNode, newPosition, false);
									rallyFriend3.SetMeshState(true);
									rallyFriend3.SetRotation(Quaternion.LookRotation(cTarget.tr.position - rallyFriend3.tr.position), false, true);
									yield return new WaitForSeconds(0.001f);
									startRallyTime = Time.timeSinceLevelLoad;
									while (rallyFriend3.body.dithering)
									{
										if (Time.timeSinceLevelLoad >= startRallyTime + 1f)
										{
											break;
										}
										rallyFriend3.SetRotation(Quaternion.LookRotation(cTarget.tr.position - rallyFriend3.tr.position), false, true);
										yield return null;
									}
								}
								else
								{
									rallyFriend3.ignoreNodeIDs = true;
									rallyFriend3.ignoreRemoveControls = true;
									rallyFriend3.inAction = false;
									rallyFriend3.inRecovery = false;
									rallyFriend3.running = true;
									rallyFriend3.SetMeshState(true);
									rallyFriend3.MakePath(openNode, 100, false, false, true);
									float startRallyTime = Time.timeSinceLevelLoad;
									while (!rallyFriend3.moving && Time.timeSinceLevelLoad < startRallyTime + 1f)
									{
										yield return null;
									}
									startRallyTime = Time.timeSinceLevelLoad;
									while (rallyFriend3.moving && Time.timeSinceLevelLoad < startRallyTime + 3f)
									{
										yield return null;
									}
									rallyFriend3.ignoreNodeIDs = false;
									rallyFriend3.ignoreRemoveControls = false;
									rallyFriend3.SetRotation(Quaternion.LookRotation(cTarget.tr.position - rallyFriend3.tr.position), false, true);
									if ((rallyFriend3.tr.position - newPosition).sqrMagnitude > 25f)
									{
										rallyFriend3.SetPosition(newPosition, null);
										rallyFriend3.ClaimNode(openNode, newPosition, false);
										rallyFriend3.SetMeshState(true);
										rallyFriend3.SetRotation(Quaternion.LookRotation(cTarget.tr.position - rallyFriend3.tr.position), false, true);
									}
								}
								if (i == 0)
								{
									movedRally = true;
								}
								else
								{
									movedRally2 = true;
								}
								newPosition = default(Vector3);
								openNode = null;
							}
							rallyFriend3.SetRotation(Quaternion.LookRotation(cTarget.tr.position - rallyFriend3.tr.position), false, true);
							if (!Links.x.pocketWheel.selectedRally.Contains("Both"))
							{
								Links.x.rtsCamera.pocketPoint = Vector3.Lerp(rallyFriend3.tr.position, cTarget.tr.position, 0.25f);
								if (rallyFriend3.invRow1._MeleeRangeEnd > 5f)
								{
									Links.x.rtsCamera.Zoom(true, "MainCharacterQTERange");
								}
								else
								{
									Links.x.rtsCamera.Zoom(true, "MainCharacterQTE");
								}
								zoomed = true;
							}
							if (this.pocketAttackRoutine == null)
							{
								this.pocketAttackRoutine = this.PocketAttack(rallyFriend3, cTarget, this.rallyInteractiveTarget);
								base.StartCoroutine(this.pocketAttackRoutine);
								while (this.pocketAttackRoutine != null)
								{
									yield return null;
								}
							}
							Links.x.hudControl.RemoveRallyBar((float)Records.x.GetRallyAttackCosts(1, rallyFriend3));
							if (this.specialAttack3)
							{
								while (Links.x.rallyStage.playing)
								{
									yield return null;
								}
							}
							else
							{
								yield return new WaitForSeconds(0.25f);
								float startRallyTime = Time.timeSinceLevelLoad;
								while (rallyProjectiles.Count - currentProjectileCount > 0 && Time.timeSinceLevelLoad < startRallyTime + 2f)
								{
									yield return null;
								}
							}
							if (i == 0 && !this.specialAttack3)
							{
								if (movedRally)
								{
									float startRallyTime = Time.timeSinceLevelLoad;
									rallyFriend3.ClaimNode(null, rallyFriend3.tr.position, false);
									while (rallyFriend3.IsAttacking(rallyFriend3.body.currentHash) && Time.timeSinceLevelLoad < startRallyTime + 2f)
									{
										yield return null;
									}
									if (rallyFriend3.inCircle)
									{
										rallyFriend3.SetMeshState(false);
										yield return new WaitForSeconds(0.25f);
										rallyFriend3.SetPosition((Vector3)rallyNode.position, rallyNode);
										rallyFriend3.ClaimNode(rallyNode, (Vector3)rallyNode.position, false);
										yield return new WaitForSeconds(0.25f);
										rallyFriend3.SetMeshState(true);
										movedRally = false;
									}
									else
									{
										rallyFriend3.ignoreNodeIDs = true;
										rallyFriend3.ignoreRemoveControls = true;
										rallyFriend3.inAction = false;
										rallyFriend3.inRecovery = false;
										rallyFriend3.running = true;
										rallyFriend3.MakePath(rallyNode, 100, false, false, true);
									}
								}
								rallyFriend3.ignoreNodeIDs = false;
								rallyFriend3.ignoreRemoveControls = false;
								if (movedRally && Links.x.fellowship.rally + Links.x.fellowship.rallyBoost < Links.x.hudControl.rallyInterval)
								{
									float startRallyTime = Time.timeSinceLevelLoad;
									while (!rallyFriend3.moving && Time.timeSinceLevelLoad < startRallyTime + 0.5f)
									{
										yield return null;
									}
									startRallyTime = Time.timeSinceLevelLoad;
									while (rallyFriend3.moving && Time.timeSinceLevelLoad < startRallyTime + 0.75f)
									{
										yield return null;
									}
									rallyFriend3.SetPosition((Vector3)rallyNode.position, rallyNode);
								}
							}
							if (i == 1 && !this.specialAttack3)
							{
								if (movedRally2)
								{
									float startRallyTime = Time.timeSinceLevelLoad;
									rallyFriend3.ClaimNode(null, rallyFriend3.tr.position, false);
									while (rallyFriend3.IsAttacking(rallyFriend3.body.currentHash) && Time.timeSinceLevelLoad < startRallyTime + 2f)
									{
										yield return null;
									}
									rallyFriend3.ignoreNodeIDs = true;
									rallyFriend3.ignoreRemoveControls = true;
									rallyFriend3.inAction = false;
									rallyFriend3.inRecovery = false;
									rallyFriend3.running = true;
									rallyFriend3.MakePath(rallyNode, 100, false, false, true);
									float startMoveTime = Time.timeSinceLevelLoad;
									while (!rallyFriend3.moving && Time.timeSinceLevelLoad < startMoveTime + 0.5f)
									{
										yield return null;
									}
									startMoveTime = Time.timeSinceLevelLoad;
									while (rallyFriend3.moving && Time.timeSinceLevelLoad < startMoveTime + 0.75f)
									{
										yield return null;
									}
									rallyFriend3.SetPosition((Vector3)rallyNode.position, rallyNode);
								}
								else
								{
									yield return new WaitForSeconds(0.5f);
								}
							}
							rallyFriend3 = null;
							rallyProjectiles = null;
						}
					}
					else
					{
						canceledCombo = true;
					}
				}
				else
				{
					canceledCombo = true;
					if (i == 0)
					{
						yield return new WaitForSeconds(0.5f);
					}
				}
				pastRallyFriend = null;
			}
			num5 = i;
		}
		if (zoomed)
		{
			Links.x.rtsCamera.Zoom(false, "MainCharacterQTE");
		}
		Links.x.combat.inRally = false;
		Links.x.combat.rallyTarget = null;
		Shader.SetGlobalFloat("_NoCharacterFX", 0f);
		for (int num6 = 0; num6 < ditheredCharacters.Count; num6++)
		{
			Character character8 = ditheredCharacters[num6];
			if (character8)
			{
				character8.SetMeshState(true);
			}
		}
		c = this.character;
		c.SetActiveStateWorldUI(1);
		c.actions.damageBonus = 0f;
		c.actions.effectBonus = 0f;
		c.actions.specialAttack1 = false;
		c.actions.specialAttack2 = false;
		c.actions.specialAttack3 = false;
		if (rallyFriend)
		{
			rallyFriend.SetActiveStateWorldUI(1);
			if (rallyFriend.actions)
			{
				rallyFriend.actions.damageBonus = 0f;
				rallyFriend.actions.effectBonus = 0f;
				rallyFriend.actions.specialAttack1 = false;
				rallyFriend.actions.specialAttack2 = false;
				rallyFriend.actions.specialAttack3 = false;
			}
		}
		if (rallyFriend2)
		{
			rallyFriend2.SetActiveStateWorldUI(1);
			if (rallyFriend2.actions)
			{
				rallyFriend2.actions.damageBonus = 0f;
				rallyFriend2.actions.effectBonus = 0f;
				rallyFriend2.actions.specialAttack1 = false;
				rallyFriend2.actions.specialAttack2 = false;
				rallyFriend2.actions.specialAttack3 = false;
			}
		}
		if (cTarget && cTarget.body)
		{
			cTarget.body.SetDeadRendererLayers(20);
		}
		Links.x.sensory.SetDeadRendererLayers(20);
		Links.x.hudControl.ChangeHudVisibility(true, true);
		Records.x.StartUIFade(false, false);
		Records.x.RemoveControls(false);
		Links.x.rtsCamera.pocketPoint = Vector3.zero;
		Links.x.hudControl.ScaleRallyBar(false);
		Links.x.gameCard.badgesCanvasGroup.alpha = 1f;
		Links.x.gameplay.rallyTargetInteractiveSelected = null;
		Links.x.gameplay.rallyTargetSelected = null;
		Links.x.pocketWheel.SelectLightAttack();
		Links.x.combat.lastRallyTarget = null;
		Links.x.combat.inPocketAttack = false;
		Links.x.combat.pocketTarget = null;
		Links.x.pocketWheel.rally1 = null;
		Links.x.pocketWheel.rally2 = null;
		this.character.ZeroAttackTime(0f);
		Links.x.gameplay.PocketPause(false);
		yield return new WaitForSeconds(0.001f);
		if (Records.x.InCombat(false))
		{
			Links.x.hudControl.ToggleAttackTimer(true);
		}
		Links.x.pocketWheel.Open(this.character);
		yield break;
	}

	// Token: 0x0600013D RID: 317 RVA: 0x00017490 File Offset: 0x00015690
	private IEnumerator PocketAttack(Character c1, Character cTarget, GameObject interactiveTarget)
	{
		this.rolling = true;
		c1.MoveBackEmpty();
		if (c1.stats.pinning)
		{
			c1.stats.pinning = false;
			c1.stats.HealEffect("Pinning");
		}
		c1.ignoreRemoveControls = true;
		c1.inRecovery = false;
		c1.isHit = false;
		c1.inAction = false;
		c1.body.CombatSheen(1);
		Links.x.combat.rallyCharacterStartPosition = c1.tr.position;
		while (Links.x.qte.Holding2())
		{
			yield return null;
		}
		bool rallyStage = false;
		c1.actions.specialAttack2 = false;
		c1.actions.specialAttack3 = false;
		if (!Links.x.pocketWheel.selectedRally.Contains("Damage") && !Links.x.pocketWheel.selectedRally.Contains("Both"))
		{
			c1.actions.specialAttack2 = true;
		}
		if (Links.x.pocketWheel.selectedRally.Contains("Both"))
		{
			c1.actions.specialAttack3 = true;
			rallyStage = true;
		}
		bool flag = false;
		if (!Records.x.editor)
		{
			flag = false;
		}
		if (flag)
		{
			Links.x.pocketWheel.selectedRally = "Both";
			rallyStage = true;
			this.specialAttack3 = true;
		}
		if (rallyStage)
		{
			if (interactiveTarget)
			{
				rallyStage = false;
			}
			if (rallyStage)
			{
				Library.Inventory invRow = c1.invRow1;
				string text = "";
				if (c1.stats.race != "Yeti")
				{
					if (invRow._MainSkill == "Scepter")
					{
						if (invRow._TwoHanded)
						{
							text = "Impact";
						}
						else
						{
							text = "ScepterSingle";
						}
					}
					if (invRow._MainSkill == "Whip")
					{
						text = "Whip";
					}
					if (invRow._MainSkill == "Pole")
					{
						text = "Pole";
					}
					if (invRow._MainSkill == "ShortSword")
					{
						text = "ShortSword";
					}
					if (invRow._MainSkill == "Sword")
					{
						text = "LongSword";
					}
					if (invRow._MainSkill == "Sling")
					{
						text = "Sling";
					}
					if (invRow._MainSkill == "Ax")
					{
						text = "Ax";
					}
					if (invRow._MainSkill == "Bow")
					{
						text = "Bow";
					}
					if (invRow._MainSkill == "Elixir")
					{
						text = "Elyxir";
					}
					if (invRow._MainSkill == "Hand-to-Hand")
					{
						text = "Unarmed";
					}
				}
				else
				{
					if (invRow._MainSkill == "Pole")
					{
						text = "Yeti_Spear";
					}
					if (invRow._MainSkill == "Hand-to-Hand")
					{
						text = "Yeti_Unarmed";
					}
					if (invRow._MainSkill == "Scepter")
					{
						text = "Yeti_Scepter";
					}
					if (text == "")
					{
						text = "Yeti_Sword";
					}
				}
				Links.x.rallyStage.SetupStage(text, c1, cTarget);
			}
			cTarget.ChangePocketPauseState();
		}
		else
		{
			MasterAudio.PlaySoundAndForget("Feedback", 1f, new float?(1f), 0f, "RallyDamage2", null);
			Links.x.combat.pocketParticle.transform.position = c1.tr.position + new Vector3(0f, 5f, 0f);
			Links.x.combat.pocketParticle.SetActive(true);
		}
		c1.actions.firstAttack = true;
		c1.attackSpeed = 1f;
		c1.actions.specialAttack1 = true;
		if (!rallyStage)
		{
			if (this.specialAttack2)
			{
				c1.PlayAnimation("SynergyAttack2", 0f);
			}
			else
			{
				c1.PlayAnimation("SynergyAttack1", 0f);
			}
		}
		if (cTarget)
		{
			c1.SetRotation(Quaternion.LookRotation(cTarget.tr.position - c1.tr.position), false, true);
		}
		else
		{
			c1.SetRotation(Quaternion.LookRotation(interactiveTarget.transform.position - c1.tr.position), false, true);
		}
		if (!rallyStage)
		{
			this.damageBonus = 0f;
			this.effectBonus = 0f;
			if (this.specialAttack2)
			{
				Links.x.qte.bonusType = "Effects";
			}
			else
			{
				Links.x.qte.bonusType = "";
			}
			Links.x.qte.playing = true;
			Links.x.qte.StartQTE("MoonPunch", 4f);
			float startTimeScale = Time.timeScale;
			float timeToLerp = 0.25f;
			float percentage = 0f;
			float startTime = Time.realtimeSinceStartup;
			while (percentage < 1f)
			{
				percentage = (Time.realtimeSinceStartup - startTime) / timeToLerp;
				Time.timeScale = Mathf.Lerp(startTimeScale, 0.25f, percentage);
				if (cTarget)
				{
					c1.SetRotation(Quaternion.LookRotation(cTarget.tr.position - c1.tr.position), false, true);
				}
				else
				{
					c1.SetRotation(Quaternion.LookRotation(interactiveTarget.transform.position - c1.tr.position), false, true);
				}
				yield return null;
			}
			while (Links.x.qte.playing)
			{
				yield return null;
			}
		}
		else
		{
			this.damageBonus = 0f;
			this.effectBonus = 0f;
		}
		if (Links.x.pocketWheel.selectedRally.Contains("Damage"))
		{
			c1.actions.damageBonus = Links.x.qte.bonus;
		}
		else
		{
			c1.actions.effectBonus = Links.x.qte.bonus;
		}
		c1.actions.ClearDamageLists();
		c1.actions.ClearTargetCharacters();
		if (interactiveTarget)
		{
			c1.actions.AddTarget(interactiveTarget.GetComponent<Character>());
		}
		else
		{
			c1.actions.AddTarget(cTarget);
		}
		c1.actions.firstAttack = true;
		c1.actions.secondAttack = false;
		c1.actions.ActionRolls(false, false, null, null);
		c1.actions.rolling = false;
		if (rallyStage)
		{
			float num = this.damages[0];
			bool flag2 = Records.x.kill;
			if (cTarget.summoned)
			{
				flag2 = true;
			}
			if (cTarget.ghost)
			{
				flag2 = true;
			}
			if (cTarget.name.Contains("LocalGraveKeeper") && Links.x.diorama.mapCanResurrect)
			{
				flag2 = true;
			}
			if ((float)cTarget.stats.HealthCurrent() - num <= 0f && flag2)
			{
				Links.x.rallyStage.targetDies = true;
			}
		}
		else
		{
			MasterAudio.PlaySoundAndForget("Synergy Pass", 1f, new float?(1f), 0f, "", null);
			Links.x.rtsCamera.pocketPoint = cTarget.tr.position;
			Links.x.rtsCamera.MinOrtho = 7f;
			Links.x.rtsCamera.Ortho = 7f;
			float startTime = Time.timeScale;
			float percentage = 0.5f;
			float timeToLerp = 0f;
			float startTimeScale = Time.realtimeSinceStartup;
			while (timeToLerp < 1f)
			{
				timeToLerp = (Time.realtimeSinceStartup - startTimeScale) / percentage;
				Time.timeScale = Mathf.Lerp(startTime, 1f, timeToLerp);
				yield return null;
			}
			yield return new WaitForSeconds(0.75f);
			while (!this.character.inRecovery)
			{
				yield return null;
			}
			Links.x.combat.pocketParticle.SetActive(false);
		}
		if (rallyStage)
		{
			while (Links.x.rallyStage.playing)
			{
				yield return null;
			}
			this.MultiHit(cTarget, interactiveTarget, false, false, false, false, c1.invRow1);
		}
		this.pocketAttackRoutine = null;
		yield break;
	}

	// Token: 0x0600013E RID: 318 RVA: 0x000174B4 File Offset: 0x000156B4
	public void StartMiniEvent(Character target, Character ally, string type, bool stopGameplay)
	{
		if (this.miniCoroutine == null && !Links.x.combat.miniEvent)
		{
			this.miniCoroutine = this.MiniEvent(target, ally, type, stopGameplay);
			base.StartCoroutine(this.miniCoroutine);
		}
	}

	// Token: 0x0600013F RID: 319 RVA: 0x000174ED File Offset: 0x000156ED
	private IEnumerator MiniEvent(Character target, Character ally, string type, bool stopGameplay)
	{
		this.ai.busy = true;
		bool canDoEvent = true;
		while (Links.x.combat.inPocketAttack)
		{
			yield return null;
		}
		if (canDoEvent)
		{
			this.rolling = true;
			if (stopGameplay)
			{
				Links.x.combat.miniEvent = true;
			}
			if (type.Contains("Bubble Evade") || type == "Bubble Attack")
			{
				if (stopGameplay)
				{
					Links.x.combat.bubbleEvent = true;
					Links.x.combat.bubbleEventTarget = this.character;
					Links.x.combat.bubbleEventTargetPosition = this.character.tr.position;
				}
				this.character.meshAlwaysOn = true;
				this.character.SetMeshState(true);
			}
			if (stopGameplay)
			{
				Records.x.RemoveControls(true);
				Links.x.gameplay.PocketPause(true);
				Links.x.hudControl.ChangeHudVisibility(false, true);
				Shader.SetGlobalFloat("_NoCharacterFX", 1f);
				Shader.SetGlobalVector("_CinematicRevealPosition", this.character.gameObject.transform.position);
			}
			Character c = this.character;
			new List<Character>();
			if (type == "Free Attack")
			{
				target.body.StartBlink2(13, "");
			}
			if (type != "Bubble Evade" && type != "Bubble Attack" && type != "Dragoon")
			{
				this.ClearDamageLists();
				this.ClearTargetCharacters();
				this.AddTarget(target);
			}
			MasterAudio.PlaySoundAndForget("Synergy Pass", 1f, new float?(1f), 0f, "", null);
			c.MoveBackEmpty();
			if (type == "Dodge" || type.Contains("Dragoon"))
			{
				c.ClearNodePath();
				c.EndDodge();
				if (!c.jumping)
				{
					c.StopEvading();
				}
			}
			c.ignoreRemoveControls = true;
			c.inRecovery = false;
			c.isHit = false;
			if (!type.Contains("Bubble Evade") && type != "Bubble Attack")
			{
				c.inAction = false;
				c.body.CombatSheen(1);
				c.actions.firstAttack = true;
			}
			if (!type.Contains("Bubble Evade"))
			{
				this.character.SetRotation(Quaternion.LookRotation(target.currentPosition - this.character.currentPosition), false, true);
			}
			string camZoom = "TargetSelect";
			if (type != "Free Attack")
			{
				camZoom = "MainCharacterQTE";
			}
			if (type != "Bubble Attack" && stopGameplay && !type.Contains("Dragoon"))
			{
				Links.x.rtsCamera.Zoom(true, camZoom);
			}
			int currentProjectileCount = this.projectiles.Count;
			this.allCharacters = Links.x.diorama.characters;
			if (stopGameplay)
			{
				Records.x.StartUIFade(true, false);
			}
			Links.x.qte.Reset();
			c.attackSpeed = 1f;
			if (type == "Free Attack")
			{
				c.PlayAnimation("BasicAttack", 0f);
				Links.x.combat.StartSlowTime("Synergy");
			}
			else if (type == "Dodge")
			{
				c.PlayAnimation("BasicAttack", 0f);
			}
			else if (type.Contains("Dragoon"))
			{
				c.PlayAnimation("Idle", 0f);
			}
			if (type == "Dodge" || type.Contains("Bubble Evade") || type == "Bubble Attack")
			{
				yield return new WaitForSeconds(0.001f);
				float num = 0.2f;
				this.m_CurrentClipInfo = this.character.animator.GetCurrentAnimatorClipInfo(0);
				if (this.m_CurrentClipInfo != null && this.m_CurrentClipInfo.Length != 0)
				{
					AnimationClip clip = this.m_CurrentClipInfo[0].clip;
					if (clip != null)
					{
						this.events = clip.events;
						if (this.events != null)
						{
							for (int i = 0; i < this.events.Length; i++)
							{
								if (this.events[i].functionName.Contains("ttack"))
								{
									num = this.events[i].time - 0.3f;
								}
							}
						}
					}
				}
				if (type.Contains("Bubble Evade"))
				{
					if (type.Contains("Dragoon"))
					{
						Vector3 jumpTo = target.tr.position + Quaternion.LookRotation((Vector3)this.ai.jumpNode.position - target.tr.position) * Vector3.forward * 2.5f;
						Vector3 jumpToHold = jumpTo;
						jumpToHold.y += 20f;
						Links.x.rtsCamera.Zoom(true, "MainCharacterQTE");
						float startValue = 0f;
						float endValue = 1f;
						float timeToLerp = 0.5f;
						float percentage = 0f;
						float startTime = Time.time;
						while (percentage < 1f)
						{
							percentage = (Time.time - startTime) / timeToLerp;
							this.character.SetRotation(Quaternion.LookRotation(target.tr.position - this.character.currentPosition), false, true);
							yield return null;
						}
						this.character.PlayAnimation("SynergyAttack1", 0f);
						Vector3 position = this.character.tr.position;
						this.character.tr.position + new Vector3(0f, 20f, 0f);
						bool dithered = false;
						startValue = 0f;
						endValue = 1f;
						timeToLerp = 1f;
						percentage = 0f;
						startTime = Time.time;
						while (percentage < 1f)
						{
							percentage = (Time.time - startTime) / timeToLerp;
							if (percentage > 0.2f && (!dithered || this.character.visible == 1))
							{
								this.character.meshAlwaysOn = false;
								this.character.SetMeshState(false);
								dithered = true;
							}
							yield return null;
						}
						Links.x.rtsCamera.Zoom(true, "MainCharacterQTERange");
						Links.x.combat.bubbleEventTargetPosition = jumpTo;
						this.character.SetPosition(jumpToHold, null);
						this.damageBonus = 0f;
						this.effectBonus = 0f;
						Links.x.qte.playing = true;
						Links.x.qte.bonusType = "Evasion";
						Links.x.qte.StartQTE("MoonPunch", 1f);
						timeToLerp = 1f;
						percentage = 0f;
						startTime = Time.time;
						while (percentage < 1f)
						{
							percentage = (Time.time - startTime) / timeToLerp;
							this.character.SetPosition(jumpToHold, null);
							yield return null;
						}
						this.character.PlayAnimation("SynergyAttack2", 0f);
						this.character.animator.Update(0f);
						this.character.SetPosition(jumpTo, null);
						this.character.meshAlwaysOn = true;
						this.character.SetMeshState(true);
						this.character.body.SetMeshState(true, false);
						startValue = 0f;
						endValue = 1f;
						timeToLerp = 0.233f;
						percentage = 0f;
						startTime = Time.time;
						while (percentage < 1f)
						{
							this.character.SetRotation(Quaternion.LookRotation(target.tr.position - jumpTo), false, true);
							percentage = (Time.time - startTime) / timeToLerp;
							Mathf.Lerp(startValue, endValue, percentage);
							yield return null;
						}
						this.evasionBonus = Links.x.qte.bonus;
						this.firstAttack = true;
						this.rolling = true;
						this.ActionRolls(false, false, null, null);
						this.rolling = false;
						target.OverridePocketPause();
						this.TriggerHitFromAttackAnimation();
						this.AttackAnimationDone();
						this.character.ClaimNode(this.ai.jumpNode, jumpTo, true);
						timeToLerp = 1.5f;
						percentage = 0f;
						startTime = Time.time;
						while (percentage < 1f)
						{
							percentage = (Time.time - startTime) / timeToLerp;
							yield return null;
						}
						this.character.alwaysOn = false;
						jumpTo = default(Vector3);
						jumpToHold = default(Vector3);
					}
					else
					{
						c.body.hold();
						if (type == "Bubble Evade")
						{
							yield return new WaitForSeconds(0.5f);
						}
						this.damageBonus = 0f;
						this.effectBonus = 0f;
						Links.x.qte.playing = true;
						Links.x.qte.StartQTE("MoonPunch", 1f);
						while (Links.x.qte.playing)
						{
							yield return null;
						}
						yield return new WaitForSeconds(0.5f);
						c.body.animationHold = false;
						c.SetAnimatorSpeed(1f);
						this.doSlowTime = true;
						target.OverridePocketPause();
						yield return new WaitForSeconds(0.25f);
					}
				}
				else
				{
					yield return new WaitForSeconds(num);
					if (stopGameplay)
					{
						target.OverridePocketPause();
					}
					if (stopGameplay)
					{
						this.doSlowTime = true;
					}
				}
			}
			if (type != "Bubble Evade" && type != "Bubble Attack" && type != "Dragoon Bubble Evade")
			{
				this.firstAttack = true;
				this.rolling = true;
				this.ActionRolls(false, false, null, null);
				this.rolling = false;
			}
			if (type == "Bubble Attack")
			{
				yield return new WaitForSeconds(0.5f);
				if (stopGameplay)
				{
					Links.x.combat.bubbleEventTarget = target;
				}
				int count = this.projectiles.Count;
				float startTime = Time.timeSinceLevelLoad;
				while (this.projectiles.Count - currentProjectileCount > 0 && Time.timeSinceLevelLoad < startTime + 3f)
				{
					yield return null;
				}
				yield return new WaitForSeconds(1f);
			}
			if (type == "Free Attack")
			{
				float startTime = 1f;
				float percentage = 0f;
				float timeToLerp = Time.time;
				while (percentage < 1f)
				{
					percentage = (Time.time - timeToLerp) / startTime;
					this.character.SetRotation(Quaternion.LookRotation(target.currentPosition - this.character.currentPosition), false, true);
					yield return null;
				}
				target.body.EndBlink2();
			}
			else if (type == "Dodge")
			{
				float timeToLerp = 0.3f;
				float percentage = 0f;
				float startTime = Time.time;
				while (percentage < 1f)
				{
					percentage = (Time.time - startTime) / timeToLerp;
					this.character.SetRotation(Quaternion.LookRotation(target.currentPosition - this.character.currentPosition), false, true);
					yield return null;
				}
			}
			else if (type.Contains("Bubble Evade") || type == "Bubble Attack")
			{
				float startTime = 0.5f;
				float percentage = 0f;
				float timeToLerp = Time.time;
				while (percentage < 1f)
				{
					percentage = (Time.time - timeToLerp) / startTime;
					yield return null;
				}
				this.character.ZeroAttackTime(0f);
			}
			if (false)
			{
				this.character.ignoreNodeIDs = true;
				this.character.ignoreRemoveControls = true;
				this.character.inAction = false;
				this.character.inRecovery = false;
				this.character.running = false;
				this.character.Jump(this.ai.jumpNode, (Vector3)this.ai.jumpNode.position, true, false);
				float timeToLerp = Time.timeSinceLevelLoad;
				while (!this.character.moving && Time.timeSinceLevelLoad < timeToLerp + 1f)
				{
					this.character.SetRotation(Quaternion.LookRotation(target.tr.position - this.character.tr.position), false, true);
					yield return null;
				}
				timeToLerp = Time.timeSinceLevelLoad;
				while (this.character.moving && Time.timeSinceLevelLoad < timeToLerp + 3f)
				{
					this.character.SetRotation(Quaternion.LookRotation(target.tr.position - this.character.tr.position), false, true);
					yield return null;
				}
				this.character.ignoreNodeIDs = false;
				this.character.ignoreRemoveControls = false;
				this.character.SetRotation(Quaternion.LookRotation(target.tr.position - this.character.tr.position), false, true);
			}
			if (stopGameplay)
			{
				Shader.SetGlobalFloat("_NoCharacterFX", 0f);
				Records.x.StartUIFade(false, false);
				Links.x.hudControl.ChangeHudVisibility(true, true);
				Records.x.RemoveControls(false);
			}
			Links.x.combat.miniEvent = false;
			Links.x.combat.bubbleEvent = false;
			Links.x.combat.bubbleEventTarget = null;
			if (stopGameplay)
			{
				Links.x.gameplay.PocketPause(false);
				Links.x.rtsCamera.Zoom(false, camZoom);
				Shader.SetGlobalVector("_CinematicRevealPosition", new Vector3(-100000f, -100000f, -100000f));
			}
			this.character.inRecovery = false;
			this.character.inAction = false;
			this.character.meshAlwaysOn = false;
			c = null;
			camZoom = null;
		}
		this.doBubbleAttack = false;
		this.savedEnemy = null;
		this.ai.busy = false;
		this.miniCoroutine = null;
		yield break;
	}

	// Token: 0x06000140 RID: 320 RVA: 0x00017512 File Offset: 0x00015712
	public void ActionRolls(bool grazing, bool afterAnimationFlag, Character onlyTarget, GameObject onlyInteractive)
	{
		if (this.actionCoroutine != null)
		{
			base.StopCoroutine(this.actionCoroutine);
			this.actionCoroutine = null;
		}
		this.actionCoroutine = this.Action(grazing, afterAnimationFlag, onlyTarget, onlyInteractive);
		base.StartCoroutine(this.actionCoroutine);
	}

	// Token: 0x06000141 RID: 321 RVA: 0x0001754D File Offset: 0x0001574D
	private IEnumerator Action(bool grazing, bool afterAnimationFlag, Character onlyTarget, GameObject onlyInteractive)
	{
		this.rolling = true;
		bool flag = false;
		this.canEndAttackTime = true;
		if (this.channeling)
		{
			flag = true;
		}
		if (this.abilities.Count > 0 && !afterAnimationFlag)
		{
			if (this.abilities[0]._IsSpell)
			{
				flag = true;
			}
			if (this.character.party)
			{
				Links.x.gameplay.ClearWaypointEffect(this.character);
			}
		}
		Character rallyCharacter = Links.x.combat.rallyCharacter;
		int num = 0;
		for (int i = 0; i < this.actionTargets.Count; i++)
		{
			if (this.actionTargets[i] && (this.actionTargets[i].dead || (this.actionTargets[i].stunned && !Records.x.kill)))
			{
				num++;
			}
		}
		bool flag2 = false;
		if (num == this.actionTargets.Count && this.actionTargets.Count > 0 && !flag)
		{
			flag2 = true;
			if (!this.cannotInterrupt)
			{
				this.EndTurn(true);
			}
		}
		this.character.StopMoveToRoutine();
		float num2 = 0f;
		float num3 = 0f;
		if (flag)
		{
			num2 = this.character.stats.PaganHitChance(false, this.spell._MainSkill);
			float num4;
			float num5;
			this.character.stats.PaganSpellCost(this.currentSpellName, true, out num4, out num5);
		}
		bool flag3 = false;
		if (this.firstAttack)
		{
			if (this.character.mainSelected)
			{
				this.lightAttack = true;
				this.heavyAttack = false;
				if (this.character.invRow1._MeleeRangeEnd < 5f)
				{
					this.lightAttack = false;
				}
			}
			else
			{
				bool flag4 = true;
				if (!afterAnimationFlag && flag4)
				{
					if (this.character.npc)
					{
						if (this.character.invRow1._MeleeRangeEnd < 5f)
						{
							this.lightAttack = false;
						}
					}
					else if (this.character.party)
					{
						flag4 = true;
						if (this.character.invRow1._MeleeRangeEnd < 5f)
						{
							this.lightAttack = false;
						}
					}
				}
				if (!flag4)
				{
					this.lightAttack = true;
					this.heavyAttack = false;
				}
			}
		}
		if (this.character.stats.onlyLightAtks > 0)
		{
			this.lightAttack = true;
		}
		string text = "Attack";
		if (!this.lightAttack && !this.quickAttack && !this.heavyAttack)
		{
			text = "Multi Attack";
			flag3 = true;
		}
		if (afterAnimationFlag && flag3)
		{
			this.heavyAttack = false;
		}
		if (this.lightAttack)
		{
			text = "Attack";
		}
		if (this.heavyAttack)
		{
			text = "Heavy Attack";
		}
		if (this.specialAttack1)
		{
			text = "Spirit Attack 1";
		}
		if (!flag2)
		{
			if (flag)
			{
				if (this.character.IsCasting(this.character.body.currentHash))
				{
					GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(10);
					pooledGameObject.transform.position = this.character.body.HeadPosition(0f);
					pooledGameObject.SetActive(true);
				}
				else
				{
					this.character.PlayAnimation("Cast", 0f);
				}
			}
			else if (!afterAnimationFlag)
			{
				this.character.body.ignoreAttackEvent = false;
				this.character.attackSpeed = 1f;
				this.GetHand();
				if (this.firstAttack || this.character.stats.HandCount() < 1f || this.character.summoned)
				{
					bool flag5 = false;
					if (this.character.invRow1._MeleeRangeEnd >= 5f)
					{
						if (this.specialAttack2 && this.character.invRow1._MainSkill != "Bow")
						{
							int selectedAmmoID = Links.x.pocketWheel.GetSelectedAmmoID();
							if (selectedAmmoID > -1)
							{
								this.ammoRow = Links.x.library.GetInvRowByIndex(selectedAmmoID);
							}
						}
						else
						{
							int ammoIndex = this.character.GetAmmoIndex(this.character.invRow1);
							if (ammoIndex > -1)
							{
								this.ammoRow = Links.x.library.GetInvRowByIndex(this.character.GetInvNum(ammoIndex));
								if (this.ammoRow._DmgMax <= 0 && this.ammoRow._Effect != "")
								{
									this.chargeUpNum = 109;
									if (!this.character.stats.xmlName.Contains("Poison"))
									{
										this.chargeUpNum = 114;
									}
									if (!this.chargeUpFX)
									{
										this.chargeUpFX = Links.x.cellar.GetPooledGameObject(this.chargeUpNum);
									}
									this.chargeUpFX.transform.SetParent(this.character.body.GetNeck(), true);
									this.chargeUpFX.transform.localPosition = Vector3.zero;
									this.chargeUpFX.SetActive(true);
									MasterAudio.PlaySound3DAtTransform("SpecialAttacks", this.character.tr, 0.2f, new float?(1f), 0f, "ChargeUp", null, false, false);
									this.character.PlayAnimation("SynergyAttack2", 0f);
									flag5 = true;
								}
							}
						}
					}
					if ((!this.character.party || !Links.x.combat.inPocketAttack) && !flag5)
					{
						if (flag3 && !this.character.summoned && !this.character.stats.animal && !this.specialAttack1 && !this.specialAttack2)
						{
							this.character.PlayAnimation("BasicAttackMulti", 0f);
						}
						else if (!Links.x.combat.miniEvent || !this.character.mainSelected)
						{
							this.character.PlayAnimation("BasicAttack", 0f);
						}
					}
				}
				else
				{
					this.secondAttack = true;
					this.character.PlayAnimation("SecondAttack", 0f);
				}
				if (this.character.invRow1._MainSkill == "Elixir")
				{
					MasterAudio.PlaySound3DAtVector3AndForget("Elixir Start", this.character.tr.position, Random.Range(0.8f, 1f), new float?(1f), 0f, "", null);
				}
			}
		}
		else
		{
			this.character.inAction = false;
		}
		if (Records.x.pocketPause && (this.character.mainSelected || this.character == Links.x.combat.rallyCharacter) && !afterAnimationFlag)
		{
			this.character.body.CombatSheen(1);
		}
		for (int j = 0; j < this.actionTargets.Count; j++)
		{
			if (this.actionTargets[j] && (!onlyTarget || onlyTarget == this.actionTargets[j]))
			{
				if (this.firstAttack && !Links.x.combat.inPocketAttack && !afterAnimationFlag)
				{
					this.character.SetRotation(Quaternion.LookRotation(this.actionTargets[j].tr.position - this.character.tr.position), false, true);
				}
				string text2 = "0";
				num2 = this.character.stats.WeaponHitChance(false, this.currentHand);
				string text3 = this.character.stats.HitChanceCalculation(this.currentHand);
				int count = this.damages.Count;
				if ((j >= this.damages.Count || !afterAnimationFlag || this.addDamageBonus || this.reroll) && !this.actionTargets[j].dead && (!this.actionTargets[j].stunned || (this.actionTargets[j].stunned && Records.x.kill)))
				{
					Character character = this.actionTargets[j];
					float num6 = 0f;
					bool flag6 = false;
					if (!this.character.HasAmmoOrMelee(this.character.invRow1, false) && !this.specialAttack2)
					{
						if (!this.cannotInterrupt)
						{
							this.EndTurn(true);
						}
						flag2 = true;
						flag6 = true;
					}
					if (!flag2)
					{
						if (!flag6 || (flag6 && afterAnimationFlag))
						{
							bool flag7 = false;
							if (character)
							{
								bool flag8 = true;
								if (this.character.body.sneaking)
								{
									flag8 = false;
								}
								if (character.stats.pinned)
								{
									flag8 = false;
								}
								if (character.jumping && !character.evading && !character.dodging)
								{
									flag8 = false;
								}
								if (character.isHit && (character.body.downStartHash == character.body.currentHash || character.body.downHash == character.body.currentHash || character.body.bounceHash == character.body.currentHash))
								{
									flag8 = false;
								}
								if (!flag && flag8)
								{
									float num7 = 0f;
									if (this.firstAttack && character.dazedCount > 0)
									{
										num7 = (float)character.dazedCount;
									}
									float num8 = 0f;
									num6 = character.stats.EvasionChance(false, num7, out num8);
									if (this.evasionBonus > 1f)
									{
										num6 *= this.evasionBonus;
									}
									else
									{
										this.evasionBonus = 0f;
									}
									text2 = character.stats.EvadeChanceCalculation(this.evasionBonus, num8, false);
									this.evasionBonus = 0f;
									if (Records.x.showRuleset)
									{
										string[] array = new string[9];
										int num9 = 0;
										Character character2 = this.character;
										array[num9] = ((character2 != null) ? character2.ToString() : null);
										array[1] = " attacking ";
										int num10 = 2;
										Character character3 = character;
										array[num10] = ((character3 != null) ? character3.ToString() : null);
										array[3] = ", atk roll: ";
										array[4] = num2.ToString();
										array[5] = ", evade roll: ";
										array[6] = num6.ToString();
										array[7] = " attack type modifier ";
										array[8] = num3.ToString();
										Debug.Log(string.Concat(array));
									}
								}
							}
							float num11 = num2 - num6;
							float num12 = 0f;
							string text4 = "";
							if (Records.x.showRuleset && !flag)
							{
								string[] array2 = new string[9];
								int num13 = 0;
								Character character4 = this.character;
								array2[num13] = ((character4 != null) ? character4.ToString() : null);
								array2[1] = " attacking ";
								int num14 = 2;
								Character character5 = character;
								array2[num14] = ((character5 != null) ? character5.ToString() : null);
								array2[3] = " with hand ";
								array2[4] = this.currentHand.ToString();
								array2[5] = " , severity: ";
								array2[6] = num11.ToString();
								array2[7] = " pass ";
								array2[8] = j.ToString();
								Debug.Log(string.Concat(array2));
							}
							bool flag9 = false;
							this.blocked = false;
							if (character.GetInvNum(2) > 1)
							{
								flag9 = true;
							}
							if (character.stats.HasEffect("VineCocoon"))
							{
								flag7 = true;
							}
							if (num11 > 0f && !flag)
							{
								if (!afterAnimationFlag)
								{
									if (this.firstAttack)
									{
										this.character.stats.AddSkillProgress(this.character.stats.MainSkillIndex(0), (float)character.combatLevel / 2f, character);
									}
									if (this.secondAttack && this.currentHand > 0)
									{
										this.character.stats.AddSkillProgress(9, (float)character.combatLevel / 2f, character);
									}
								}
								float num15 = 0f;
								bool flag10 = false;
								bool flag11 = false;
								if (this.lightAttack)
								{
									flag11 = true;
								}
								if (character.dazedCount > 0)
								{
									flag10 = true;
								}
								num12 = this.character.stats.DamageRoll(false, this.currentHand, out num15, flag11, flag10, character);
								float num16 = 1f;
								if (this.heavyAttack)
								{
									num16 = 0.25f;
								}
								if (grazing)
								{
									num16 = 0.5f;
								}
								if (this.damageBonus > 0f && (this.addDamageBonus || !afterAnimationFlag))
								{
									num16 = this.damageBonus;
								}
								if (this.damageBonus > 0f && afterAnimationFlag && !this.addDamageBonus)
								{
									num16 = this.damageBonus * 0.5f;
								}
								float num17 = character.stats.ArmorNumber(false, true);
								num17 /= 10f;
								num17 = character.stats.R1(num17 + character.stats.ArmorAura(1) / 100f);
								num17 = 1f - num17;
								bool flag12 = this.character.stats.AttackIsPoison(this.firstAttack, this.ammoRow);
								if (flag12)
								{
									num17 = 1f;
								}
								if (Records.x.showRuleset)
								{
									string[] array3 = new string[15];
									int num18 = 0;
									Character character6 = this.character;
									array3[num18] = ((character6 != null) ? character6.ToString() : null);
									array3[1] = " damages ";
									int num19 = 2;
									Character character7 = character;
									array3[num19] = ((character7 != null) ? character7.ToString() : null);
									array3[3] = " for ";
									array3[4] = (num12 * num11 - num17).ToString();
									array3[5] = ", dmg: ";
									array3[6] = num12.ToString();
									array3[7] = ", armor: ";
									array3[8] = num17.ToString();
									array3[9] = ", severity is: ";
									array3[10] = num11.ToString();
									array3[11] = ", is heavy attack? ";
									array3[12] = this.heavyAttack.ToString();
									array3[13] = ", is light attack? ";
									array3[14] = num16.ToString();
									Debug.Log(string.Concat(array3));
								}
								num12 += num11;
								num12 *= num17;
								if (grazing && this.damageBonus == 0f)
								{
									text = "Grazing";
								}
								bool flag13 = false;
								if (this.currentHand > 0 && this.secondAttack)
								{
									num12 *= 0.5f;
									flag13 = true;
								}
								num12 *= num16;
								text4 = this.character.stats.DamageCalculation(false, num15, num11, num17, flag13, num16, text, false, flag12, character);
							}
							else if (flag9 || flag7)
							{
								this.blocked = true;
							}
							if ((flag9 || flag7) && !afterAnimationFlag)
							{
								Library.Inventory inventory = Links.x.library.GetInvRowByIndex(character.GetInvNum(2));
								if (inventory != null && inventory._EquipSlotID == 1)
								{
									int durabilityLoss = inventory._DurabilityLoss;
									character.UpdateDurability(1, durabilityLoss, true, true);
								}
								if (flag7)
								{
									Effects existingEffect = character.stats.GetExistingEffect("VineCocoon");
									string text5 = "Has cocoon ";
									Effects effects = existingEffect;
									Debug.Log(text5 + ((effects != null) ? effects.ToString() : null));
									if (existingEffect)
									{
										existingEffect.UpdateEffectDurability(1f);
									}
								}
								else
								{
									inventory = Links.x.library.GetInvRowByIndex(character.GetInvNum(2));
									character.stats.AddSkillProgress(character.stats.GetCombatSkillID(inventory._MainSkill), (float)this.character.combatLevel / 2f, character);
								}
							}
							num12 = Mathf.Round(num12);
							if (j >= this.damages.Count)
							{
								this.attackTotal.Add(text3);
								this.defenseTotal.Add(text2);
								if (num12 >= 0.5f && num11 > 0f)
								{
									this.hits.Add(0);
									this.hitText.Add(text4);
								}
								else if (num11 > 0f)
								{
									this.hits.Add(2);
									this.hitText.Add(text4);
								}
								else
								{
									this.hits.Add(1);
									this.hitText.Add("");
								}
								this.targets.Add(character);
								this.targetsInteractive.Add(null);
								this.damages.Add(Mathf.Round(num12));
							}
							else
							{
								this.attackTotal[j] = text3;
								this.defenseTotal[j] = text2;
								if (num12 >= 0.5f && num11 > 0f)
								{
									this.hits[j] = 0;
									this.hitText[j] = text4;
								}
								else if (num11 > 0f)
								{
									this.hits[j] = 2;
									this.hitText[j] = text4;
								}
								else
								{
									this.hits[j] = 1;
									this.hitText[j] = "";
								}
								this.targets[j] = character;
								this.targetsInteractive[j] = null;
								this.damages[j] = Mathf.Round(num12);
							}
							if (Records.x.showRuleset)
							{
								string[] array4 = new string[5];
								int num20 = 0;
								Character character8 = this.character;
								array4[num20] = ((character8 != null) ? character8.ToString() : null);
								array4[1] = " damages ";
								int num21 = 2;
								Character character9 = character;
								array4[num21] = ((character9 != null) ? character9.ToString() : null);
								array4[3] = " for ";
								array4[4] = num12.ToString();
								Debug.Log(string.Concat(array4));
							}
							if (j == 0)
							{
								this.ai.previouslyAttacked = character;
							}
							if (this.secondAttack)
							{
								this.secondAttackIndex = this.damages.Count - 1;
							}
							if ((this.character.stats.hasEveryAttackAI || this.doBubbleAttack) && (character.mainSelected || this.doBubbleAttack) && this.firstAttack && !afterAnimationFlag)
							{
								if (num12 > 0f && (this.character.stats.characterRow._EveryAttackAI == "BubbleEvade" || this.doBubbleAttack))
								{
									if (this.doBubbleAttack)
									{
										this.StartMiniEvent(character, null, "Bubble Attack", this.bubbleAttackStopsGameplay);
									}
									else
									{
										this.StartMiniEvent(character, null, "Bubble Evade", true);
									}
									this.bubbleTarget = null;
									this.bubbleAttackStopsGameplay = false;
								}
								if (this.character.stats.characterRow._EveryAttackAI == "ShroomBomb")
								{
									this.character.Explode();
									this.hits[0] = 0;
									this.damages[0] = 5f;
									this.attackTotal[0] = "";
									this.defenseTotal[0] = "";
									this.hitText[0] = "";
									this.targets[j] = this.character;
									this.targetsInteractive[j] = null;
									this.OnAttackComplete(this.targets[0], this.targetsInteractive[0], (float)this.hits[0], this.damages[0], this.attackTotal[0], this.defenseTotal[0], this.hitText[0], false, this.character.invRow1, j, false);
									this.ClearDamageLists();
								}
							}
						}
					}
					else
					{
						this.str.Clear();
						if (!this.character.npc)
						{
							this.str.Append(Links.x.gameFeed.GetPartyColorText(this.character));
						}
						this.str.Append(this.character.stats.GetName());
						if (!this.character.npc)
						{
							this.str.Append("</color>");
						}
						this.str.Append("'s attack failed, ");
						this.str.Append(" out of ammunition");
						Links.x.gameFeed.AddFeed(this.str.ToString());
					}
				}
			}
		}
		for (int k = 0; k < this.actionInteractives.Count; k++)
		{
			bool flag14 = false;
			if (onlyInteractive && onlyInteractive == this.actionInteractives[k])
			{
				flag14 = true;
			}
			if (this.actionInteractives[k] && (!onlyInteractive || flag14))
			{
				GameObject gameObject = this.actionInteractives[k];
				num2 = this.character.stats.WeaponHitChance(false, this.currentHand);
				string text6 = this.character.stats.HitChanceCalculation(this.currentHand);
				bool flag15 = false;
				BreakableActions component = gameObject.GetComponent<BreakableActions>();
				ChestActions component2 = gameObject.GetComponent<ChestActions>();
				DoorActions component3 = gameObject.GetComponent<DoorActions>();
				PuzzleActions component4 = gameObject.GetComponent<PuzzleActions>();
				if (gameObject)
				{
					Vector3 position = gameObject.transform.position;
					if (component3)
					{
						Vector3 lockColliderPosition = component3.lockColliderPosition;
					}
				}
				if (!this.character.HasAmmoOrMelee(this.character.invRow1, false))
				{
					gameObject = null;
					if (!this.cannotInterrupt)
					{
						this.EndTurn(true);
					}
					flag2 = true;
				}
				if (!flag2)
				{
					float num22 = 0f;
					if (Records.x.showRuleset && !flag)
					{
						string[] array5 = new string[7];
						int num23 = 0;
						Character character10 = this.character;
						array5[num23] = ((character10 != null) ? character10.ToString() : null);
						array5[1] = " attacking ";
						int num24 = 2;
						GameObject gameObject2 = gameObject;
						array5[num24] = ((gameObject2 != null) ? gameObject2.ToString() : null);
						array5[3] = " with hand ";
						array5[4] = this.currentHand.ToString();
						array5[5] = " , severity: ";
						array5[6] = num22.ToString();
						Debug.Log(string.Concat(array5));
					}
					bool flag16 = true;
					float num25 = 0f;
					if (component2)
					{
						num25 = (float)component2.chest.health / 10f;
					}
					else if (component3)
					{
						num25 = (float)component3.door.health / 10f;
					}
					else if (component)
					{
						num25 = (float)component.breakable.health / 10f;
					}
					else if (component4)
					{
						num25 = (float)component4.puzzle.health / 10f;
					}
					float num26 = 0f;
					float num27 = this.character.stats.DamageRoll(false, this.currentHand, out num26, false, false, null);
					if (num27 > 0f)
					{
						if (!afterAnimationFlag)
						{
							this.character.stats.AddSkillProgress(this.character.stats.MainSkillIndex(this.currentHand), num25, null);
						}
						if (this.secondAttack && this.currentHand > 0 && !afterAnimationFlag)
						{
							this.character.stats.AddSkillProgress(9, num25 / 2f, null);
						}
					}
					if (Records.x.showRuleset)
					{
						string[] array6 = new string[5];
						int num28 = 0;
						Character character11 = this.character;
						array6[num28] = ((character11 != null) ? character11.ToString() : null);
						array6[1] = " attacking ";
						int num29 = 2;
						GameObject gameObject3 = gameObject;
						array6[num29] = ((gameObject3 != null) ? gameObject3.ToString() : null);
						array6[3] = " dmg ";
						array6[4] = num27.ToString();
						Debug.Log(string.Concat(array6));
					}
					float num30 = 0f;
					Breakable.BreakableEffectRequired breakableEffectRequired = Breakable.BreakableEffectRequired.Damage;
					if (component2)
					{
						num30 = (float)component2.chest.armor;
						breakableEffectRequired = component2.chest.effectRequired;
					}
					if (component3)
					{
						num30 = (float)component3.door.armor;
						breakableEffectRequired = component3.door.effectRequired;
					}
					if (component)
					{
						num30 = (float)component.breakable.armor;
						breakableEffectRequired = component.breakable.effectRequired;
					}
					if (component4)
					{
						num30 = 0f;
						breakableEffectRequired = Breakable.BreakableEffectRequired.Damage;
					}
					float num31 = 1f;
					if (this.damageBonus > 0f && (this.addDamageBonus || !afterAnimationFlag))
					{
						num31 = this.character.stats.R1(this.damageBonus);
					}
					if (this.specialAttack1 && grazing)
					{
						num31 = 1f;
					}
					num30 /= 20f;
					num30 = 1f - num30;
					num30 = this.character.stats.R1(num30);
					if (Records.x.showRuleset)
					{
						string[] array7 = new string[11];
						int num32 = 0;
						Character character12 = this.character;
						array7[num32] = ((character12 != null) ? character12.ToString() : null);
						array7[1] = " damages ";
						int num33 = 2;
						GameObject gameObject4 = gameObject;
						array7[num33] = ((gameObject4 != null) ? gameObject4.ToString() : null);
						array7[3] = " for ";
						array7[4] = (num27 * num30).ToString();
						array7[5] = ", dmg: ";
						array7[6] = num27.ToString();
						array7[7] = ", armor: ";
						array7[8] = num30.ToString();
						array7[9] = ", effect required: ";
						array7[10] = breakableEffectRequired.ToString();
						Debug.Log(string.Concat(array7));
					}
					string text7 = this.character.stats.DamageCalculation(false, num26, 0f, num30, this.secondAttack, num31, text, true, false, null);
					num27 *= num30;
					if (this.secondAttack && this.currentHand > 0)
					{
						num27 *= 0.5f;
					}
					num27 *= num31;
					if (num27 < 0.5f)
					{
						flag16 = false;
						flag15 = true;
					}
					if (breakableEffectRequired != Breakable.BreakableEffectRequired.Damage)
					{
						flag16 = false;
						flag15 = false;
					}
					this.attackTotal.Add(text6);
					this.defenseTotal.Add("");
					if (flag16)
					{
						this.hits.Add(0);
						num27 = Mathf.Round(num27);
						if (num27 <= 0f)
						{
							num27 = 1f;
						}
						this.hitText.Add(text7);
					}
					else if (flag15)
					{
						this.hits.Add(1);
						this.hitText.Add(text7);
					}
					else
					{
						this.hits.Add(2);
						this.hitText.Add("");
					}
					this.targets.Add(null);
					this.targetsInteractive.Add(gameObject);
					this.damages.Add(num27);
					if (this.secondAttack)
					{
						this.secondAttackIndex = this.damages.Count - 1;
					}
				}
			}
		}
		if (!flag2)
		{
			if (this.actionTargets.Count == 0 && this.targetsInteractive.Count == 0)
			{
				this.hits.Add(0);
				this.hitText.Add("");
				this.targets.Add(null);
				this.targetsInteractive.Add(null);
				this.damages.Add(0f);
				this.attackTotal.Add(num2.ToString());
				this.defenseTotal.Add("0");
			}
			this.rolling = false;
		}
		if (this.secondAttack)
		{
			yield return new WaitForSeconds(0.0001f);
			if (this.character.timelineIcon)
			{
				this.character.timelineIcon.AddSecondAttack();
			}
		}
		this.actionCoroutine = null;
		yield break;
	}

	// Token: 0x06000142 RID: 322 RVA: 0x0001757C File Offset: 0x0001577C
	public void GetLastListSet(out float h, out float d, out string at, out string dt, out string ht)
	{
		int num = 0;
		if (this.hits.Count > 0)
		{
			num = this.hits.Count - 1;
		}
		if (this.hits.Count == 0)
		{
			num = -1;
		}
		if (num > -1)
		{
			h = (float)this.hits[num];
			d = this.damages[num];
			at = this.attackTotal[num];
			dt = this.defenseTotal[num];
			ht = this.hitText[num];
			return;
		}
		h = 4f;
		d = 0f;
		at = "0";
		dt = "0";
		ht = "";
	}

	// Token: 0x06000143 RID: 323 RVA: 0x0001762C File Offset: 0x0001582C
	public void GetListSet(Character c, out float h, out float d, out string at, out string dt, out string ht)
	{
		int num = this.targets.IndexOf(c);
		h = (float)this.hits[num];
		d = this.damages[num];
		at = this.attackTotal[num];
		dt = this.defenseTotal[num];
		ht = this.hitText[num];
	}

	// Token: 0x06000144 RID: 324 RVA: 0x00017690 File Offset: 0x00015890
	public bool HasListTarget(Character c)
	{
		return this.targets.IndexOf(c) > -1;
	}

	// Token: 0x06000145 RID: 325 RVA: 0x000176A4 File Offset: 0x000158A4
	public int SpellCount()
	{
		return this.abilities.Count;
	}

	// Token: 0x06000146 RID: 326 RVA: 0x000176B4 File Offset: 0x000158B4
	public void TriggerCastFromCastAnimation()
	{
		if (Records.x.combatConsoleDebugging)
		{
			Debug.Log("Cast start " + ((this != null) ? this.ToString() : null));
		}
		this.character.inAction = false;
		this.character.inRecovery = true;
		this.character.inRecoveryTime = Links.x.gameplay.seconds;
		this.currentAction = "";
		this.OnCastComplete();
		if (this.pocketQueued && this.character.mainSelected && !Records.x.pocketPause)
		{
			Links.x.gameplay.PocketPause(true);
		}
		this.pocketQueued = false;
		if (this.character.npc && this.character.stats.magicPointsBase > 0)
		{
			this.character.stats.AddSpirit(Random.Range(15, 20));
		}
	}

	// Token: 0x06000147 RID: 327 RVA: 0x000177A0 File Offset: 0x000159A0
	public void OnCastComplete()
	{
		if (Records.x.combatConsoleDebugging)
		{
			Debug.Log("Cast complete " + ((this != null) ? this.ToString() : null));
		}
		if (!Records.x.combat)
		{
			this.endActionsAfterTurn = true;
		}
		else
		{
			this.endActionsAfterTurn = false;
		}
		float num = 0f;
		float num2 = 0f;
		if (this.spellScrollID <= 0)
		{
			num2 = this.character.stats.SpellDifficulty(this.currentSpellName, out num);
		}
		float num3 = this.character.stats.PaganHitChance(false, this.spell._MainSkill);
		if (Records.x.showRuleset)
		{
			string[] array = new string[7];
			array[0] = this.character.stats.GetName();
			array[1] = "'s spell difficulty: ";
			array[2] = num2.ToString();
			array[3] = " vs. hit chance: ";
			array[4] = num3.ToString();
			array[5] = " ";
			int num4 = 6;
			Library.Inventory inventory = this.spellScroll;
			array[num4] = ((inventory != null) ? inventory.ToString() : null);
			Debug.Log(string.Concat(array));
		}
		if (!Records.x.banquetIsle && !this.character.stats.semizenMagic)
		{
			this.RemoveAbility();
		}
		if (num3 >= num2 || this.character.npc || this.spellScrollID > 0)
		{
			if (this.character.party)
			{
				this.character.portrait.UpdateMP();
			}
			this.vineComplete = false;
			this.castingSpell = false;
			if (this.spellNode != null)
			{
				if (this.actionTargets.Count > 0)
				{
					this.UpdateSoundAlerts(this.actionTargets[0]);
				}
				else
				{
					this.UpdateSoundAlerts(null);
				}
				this.character.stats.UpdateAbilityTriggers();
				Character character = null;
				if (this.actionTargets.Count > 0)
				{
					character = this.actionTargets[0];
				}
				this.spellCoroutine = this.SpellEnd(this.spell, 0f, num, character, null, true, this.currentSpellName);
				base.StartCoroutine(this.spellCoroutine);
			}
			else
			{
				string text = "No spell nodes ";
				Character character2 = this.character;
				Debug.Log(text + ((character2 != null) ? character2.ToString() : null));
				if (!this.cannotInterrupt)
				{
					this.EndTurnAfterAction();
				}
			}
		}
		else
		{
			if (this.spellCasterTargetFailFX == null)
			{
				this.spellCasterTargetFailFX = Links.x.cellar.GetPooledGameObject(78);
			}
			this.spellCasterTargetFailFX.transform.position = (Vector3)this.spellNode.position + new Vector3(0f, 1f, 0f);
			this.spellCasterTargetFailFX.SetActive(true);
			if (this.character.mainSelected)
			{
				Links.x.cellar.GetAnimatedText("NPCDmg", "Failed", true).gameObject.transform.position = this.character.body.HeadPosition(0f) + new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), 0f);
			}
			this.vineComplete = false;
			this.castingSpell = false;
			this.spellCoroutine = this.SpellEnd(this.spell, num3 - num2, num, null, null, false, this.currentSpellName);
			base.StartCoroutine(this.spellCoroutine);
		}
		this.ClearTargetCharacters();
		if (this.character)
		{
			this.character.animID = 0;
			this.character.stats.UpdateAbilityTriggers();
		}
	}

	// Token: 0x06000148 RID: 328 RVA: 0x00017B30 File Offset: 0x00015D30
	private void AddSpellTiles(Library.Abilities vineSpell, float tether, Character spellTarget, GameObject targetInteractive)
	{
		this.currentTileEffect = Links.x.tileEffects.AddComponent<TileEffects>();
		this.currentTileEffect.startNode = this.spellNode;
		this.currentTileEffect.gameObject.SetActive(true);
		this.currentTileEffect.severity = 0f;
		this.currentTileEffect.spellTarget = spellTarget;
		this.currentTileEffect.spellIndex = this.spellIndex;
		this.currentTileEffect.paganRow = this.paganRow;
		this.currentTileEffect.mainSkill = vineSpell._MainSkill;
		this.currentTileEffect.tether = tether;
		this.currentTileEffect.sourceLevel = 0f;
		this.currentTileEffect.doSpellScroll = false;
		if (this.spellScrollID > 0)
		{
			this.currentTileEffect.doSpellScroll = true;
		}
		this.currentTileEffect.spellScroll = this.spellScroll;
		if (this.actionTargets.Count > 0 && (vineSpell._RadiusCenter.Contains("Target") || vineSpell._RadiusCenter.Contains("Self")))
		{
			this.currentTileEffect.singleTarget = this.actionTargets[0];
		}
		if (this.actionInteractives.Count > 0)
		{
			this.currentTileEffect.singleTargetInteractive = this.actionInteractives[0];
		}
		this.currentTileEffect.Setup(vineSpell, null, this, null, null, this.character);
	}

	// Token: 0x06000149 RID: 329 RVA: 0x00017C95 File Offset: 0x00015E95
	private IEnumerator SpellEnd(Library.Abilities vineSpell, float severity, float tether, Character target, GameObject targetInteractive, bool passed, string currentSpellName)
	{
		this.EndVine();
		this.vine = null;
		this.character.SetIdle(true);
		if (this.chargeUpFX)
		{
			Links.x.cellar.ReturnPooledGameObject(this.chargeUpNum, this.chargeUpFX);
			this.chargeUpFX = null;
			MasterAudio.StopSoundGroupOfTransform(this.character.tr, "SpecialAttacks");
		}
		if (passed)
		{
			this.character.stats.UpdateRallyCount(true, 0f);
			if (this.character.stats.hasCustomAI && target)
			{
				Quaternion quaternion = Quaternion.LookRotation(target.tr.position - this.character.tr.position);
				this.character.SetRotation(quaternion, false, true);
			}
			this.AddSpellTiles(vineSpell, tether, target, targetInteractive);
			if (this.character.stats.semizenMagic && vineSpell._Name == "RainSpell")
			{
				this.party = Links.x.party;
				for (int i = 0; i < this.party.Count; i++)
				{
					if (this.party[i] && this.party[i] != target && this.character.GetLKPlayerBool(this.party[i]))
					{
						if (this.actionTargets.Count > 0)
						{
							this.actionTargets[0] = this.party[i];
						}
						this.AddSpellTiles(vineSpell, tether, this.party[i], null);
					}
				}
			}
			this.spellScroll = null;
			if (this.spellScrollID > 0)
			{
				Links.x.inventory.RemoveBeltItem(this.spellScrollID, this.character);
			}
			this.spellScrollID = 0;
			this.channeling = vineSpell._Channel;
		}
		if (!this.character.npc && this.character.portrait)
		{
			this.character.portrait.skillBag.RemoveSelectedButton();
		}
		this.character.stats.UpdateAbilityTriggers();
		this.character.doingAction = false;
		this.castCompleteCoroutine = null;
		this.ClearDamageLists();
		if (this.character.mainSelected)
		{
			yield return new WaitForSeconds(0.1f);
			this.canEndAttackTime = true;
			this.EndAttackTime(0f);
		}
		else
		{
			this.canEndAttackTime = true;
			this.EndAttackTime(0f);
		}
		this.spellCoroutine = null;
		if (!Records.x.combat)
		{
			this.endActionsAfterTurn = true;
			if (!this.cannotInterrupt)
			{
				this.EndTurnAfterAction();
			}
		}
		yield break;
	}

	// Token: 0x0600014A RID: 330 RVA: 0x00017CCA File Offset: 0x00015ECA
	public void ReturnChargeUpFX()
	{
		if (this.chargeUpFX)
		{
			Links.x.cellar.ReturnPooledGameObject(this.chargeUpNum, this.chargeUpFX);
			this.chargeUpFX = null;
		}
	}

	// Token: 0x0600014B RID: 331 RVA: 0x00017CFC File Offset: 0x00015EFC
	public void EndAttackTime(float attackTimeReduction)
	{
		if (!this.canEndAttackTime)
		{
			return;
		}
		this.canEndAttackTime = false;
		if (this.pocketAttack)
		{
			return;
		}
		if (Records.x.pocketPause && this.character.mainSelected && !Links.x.combat.rallyTarget)
		{
			Links.x.gameplay.PocketPause(false);
		}
		if (this.character.party && this.character.timelineIcon)
		{
			this.character.timelineIcon.overridePause = false;
		}
		if (this.character.mainSelected)
		{
			this.character.body.CombatSheen(0);
			Links.x.cameraEffects.RemoveCombatCharacters();
			if (Records.x.InCombat(false) && Links.x.combat.npcCount > 0)
			{
				Links.x.hudControl.ToggleAttackTimer(true);
				return;
			}
			if (!Links.x.combat.attackingInteractiveOutsideOfCombat)
			{
				Links.x.hudControl.ToggleAttackTimer(false);
			}
		}
	}

	// Token: 0x0600014C RID: 332 RVA: 0x00017E10 File Offset: 0x00016010
	public void FireRangeWeapon()
	{
		if (this.character.mainSelected)
		{
			MasterAudio.PlaySoundAndForget("Main Attacking", 1f, new float?(1f), 0f, "", null);
		}
		int num = 0;
		if (this.specialAttack2 && this.character.invRow1._MainSkill != "Bow")
		{
			int selectedAmmoID = Links.x.pocketWheel.GetSelectedAmmoID();
			this.ammoRow = Links.x.library.GetInvRowByIndex(selectedAmmoID);
			if (this.ammoRow != null)
			{
				this.character.RemoveItem(this.ammoRow._ID, 1);
			}
		}
		else
		{
			num = this.character.GetAmmoIndex(this.character.invRow1);
		}
		this.character.inRecovery = true;
		this.character.inRecoveryTime = Links.x.gameplay.seconds;
		this.character.ZeroAttackTime(0f);
		if (num > -1 || this.specialAttack2)
		{
			if (!this.specialAttack2 || (this.specialAttack2 && this.character.invRow1._MainSkill == "Bow"))
			{
				this.ammoRow = Links.x.library.GetInvRowByIndex(this.character.GetInvNum(num));
			}
			else
			{
				int selectedAmmoID2 = Links.x.pocketWheel.GetSelectedAmmoID();
				this.ammoRow = Links.x.library.GetInvRowByIndex(selectedAmmoID2);
			}
			bool flag = false;
			if (this.ammoRow != null)
			{
				for (int i = 0; i < this.targetsInteractive.Count; i++)
				{
					if (this.targetsInteractive[i])
					{
						this.CreateAmmo(this.ammoRow, i, null, this.targetsInteractive[i]);
						if (!this.specialAttack2)
						{
							this.character.UseAmmo(num);
						}
						flag = true;
					}
				}
				for (int j = 0; j < this.targets.Count; j++)
				{
					if ((this.targets[j] || (Records.x.freeAttack && this.quickAttack && this.firstAttack && this.character.mainSelected)) && (j == 0 || this.character.party))
					{
						this.CreateAmmo(this.ammoRow, j, this.targets[j], null);
						if (!this.specialAttack2)
						{
							this.character.UseAmmo(num);
						}
						flag = true;
					}
				}
				bool flag2 = false;
				if (this.firstAttack && !this.lightAttack && !this.heavyAttack && (this.targets.Count > 0 || this.targetsInteractive.Count > 0) && flag2)
				{
					Character character = null;
					GameObject gameObject = null;
					Vector3 vector = Vector3.zero;
					if (this.targetsInteractive.Count > 0)
					{
						gameObject = this.targetsInteractive[0];
					}
					if (this.targets.Count > 0 && !gameObject)
					{
						character = this.targets[0];
					}
					if (character)
					{
						vector = character.currentPosition;
					}
					if (gameObject)
					{
						vector = gameObject.transform.position;
					}
					if (vector != Vector3.zero && this.character.invRow1._MainSkill != "Sling")
					{
						this.MultiHitObjects(vector, character, gameObject, true, false, false, true, this.ammoRow, num);
					}
				}
			}
			if (!flag)
			{
				if (Records.x.editor)
				{
					Debug.Log(((this != null) ? this.ToString() : null) + " no range target found");
				}
				this.EndTurn(true);
				return;
			}
		}
		else
		{
			Character character2 = this.character;
			Debug.LogWarning(((character2 != null) ? character2.ToString() : null) + " is trying to use range weapon mistake");
		}
	}

	// Token: 0x0600014D RID: 333 RVA: 0x000181F8 File Offset: 0x000163F8
	private void CreateAmmo(Library.Inventory ammoRow, int i, Character target, GameObject targetInteractive)
	{
		GameObject gameObject = Links.x.archives.GetItemPrefabBody(ammoRow._CharacterModel);
		if (!gameObject)
		{
			gameObject = Links.x.archives.GetItemPrefabBody(ammoRow._CharacterModel + "_projectile");
		}
		Vector3 localScale = gameObject.transform.localScale;
		Transform transform = this.character.body.GetSlot(2);
		if (ammoRow._MainSkill == "Bow")
		{
			transform = this.character.body.GetSlot(0);
		}
		if (ammoRow._Name.Contains("PoisonBubble") || this.character.stats.animal)
		{
			transform = this.character.body.GetHead();
		}
		if (transform == null)
		{
			transform = this.character.body.GetHand();
		}
		if (this.chargeUpFX)
		{
			Links.x.cellar.ReturnPooledGameObject(this.chargeUpNum, this.chargeUpFX);
			this.chargeUpFX = null;
			MasterAudio.StopSoundGroupOfTransform(this.character.tr, "SpecialAttacks");
		}
		gameObject.gameObject.transform.SetParent(transform, false);
		gameObject.gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
		gameObject.gameObject.transform.localRotation = Quaternion.Euler(Vector3.zero);
		gameObject.gameObject.transform.SetParent(Links.x.archives.transform, true);
		gameObject.gameObject.transform.localScale = localScale;
		gameObject.SetActive(true);
		Projectile projectile = gameObject.gameObject.AddComponent<Projectile>();
		this.projectiles.Add(projectile);
		projectile.item = gameObject.transform;
		projectile.action = this;
		if (target)
		{
			if (ammoRow._MainSkill == "Bow")
			{
				projectile.targetPosition = target.torsoPosition;
			}
			else
			{
				projectile.targetPosition = target.body.HeadPosition(-0.4f);
			}
			projectile.targetNode = target.node;
		}
		else if (targetInteractive)
		{
			Vector3 vector = targetInteractive.transform.position;
			DoorActions component = targetInteractive.GetComponent<DoorActions>();
			if (component)
			{
				vector = component.lockColliderPosition;
			}
			projectile.targetPosition = vector;
		}
		else if (this.character.invRow1._Ammo1.Contains("Vial"))
		{
			projectile.targetPosition = this.character.currentPosition + this.character.tr.forward * 5f;
		}
		else if (Links.x.mk)
		{
			projectile.targetPosition = gameObject.gameObject.transform.position + this.character.tr.forward * Mathf.Clamp(Vector3.Distance(this.character.currentPosition, Links.x.gameplay.mousePoint), 2f, 30f);
		}
		else
		{
			projectile.targetPosition = gameObject.gameObject.transform.position + this.character.tr.forward * 10f;
		}
		projectile.inventoryRow = ammoRow;
		projectile.index = i;
		projectile.hasEffect = false;
		if (this.character.invRow1._Ammo1.Contains("Dart"))
		{
			projectile.type = 1;
			MasterAudio.PlaySound3DAtVector3AndForget("Dart Start", this.character.tr.position, Random.Range(0.8f, 1f), new float?(1f), 0f, "", null);
		}
		else if (this.character.invRow1._Ammo1.Contains("Arrow"))
		{
			projectile.type = 0;
			MasterAudio.PlaySound3DAtVector3AndForget("Bow Start", this.character.tr.position, Random.Range(0.8f, 1f), new float?(1f), 0f, "", null);
		}
		else if (this.character.invRow1._Ammo1.Contains("Vial"))
		{
			projectile.type = 2;
		}
		else
		{
			projectile.type = 3;
		}
		if (i == -1)
		{
			projectile.SetInfo(this.actionTargets[0], null, -1f, 0f, "", "", "", this.hasPowerDraw);
			return;
		}
		if (i < this.targets.Count)
		{
			projectile.SetInfo(this.targets[i], this.targetsInteractive[i], (float)this.hits[i], this.damages[i], this.attackTotal[i], this.defenseTotal[i], this.hitText[i], this.hasPowerDraw);
		}
	}

	// Token: 0x0600014E RID: 334 RVA: 0x00018710 File Offset: 0x00016910
	public void TriggerHitFromAttackAnimation()
	{
		if (this.character.mainSelected)
		{
			MasterAudio.PlaySoundAndForget("Main Attacking", 1f, new float?(1f), 0f, "", null);
		}
		this.character.inAction = false;
		this.character.inRecovery = true;
		this.character.inRecoveryTime = Links.x.gameplay.seconds;
		this.character.ZeroAttackTime(0f);
		this.currentAction = "";
		this.character.SetAnimatorSpeed(1f);
		int num = 0;
		if (this.secondAttack)
		{
			num = this.secondAttackIndex;
		}
		GameObject gameObject = null;
		Vector3 zero = Vector3.zero;
		if (this.targetsInteractive.Count > 0)
		{
			gameObject = this.targetsInteractive[0];
		}
		if (this.targets.Count > 0 && !gameObject)
		{
			Character character = this.targets[0];
		}
		if (num > -1 && num < this.damages.Count)
		{
			this.OnAttackComplete(this.targets[num], this.targetsInteractive[num], (float)this.hits[num], this.damages[num], this.attackTotal[num], this.defenseTotal[num], this.hitText[num], false, this.character.invRow1, num, false);
		}
		if (this.pocketQueued && this.character.mainSelected && !Records.x.pocketPause)
		{
			Links.x.gameplay.PocketPause(true);
		}
		this.pocketQueued = false;
		if (this.character.party && !this.character.mainSelected && this.character != Links.x.combat.rallyCharacter)
		{
			this.character.SetAnimatorSpeed(1f);
		}
		if (this.quickAttack && this.character.attackTime < 1f)
		{
			this.character.UpdateAtkTime(-0.5f);
		}
		if (this.character.npc)
		{
			if (this.character.stats.magicPointsBase > 0)
			{
				this.character.stats.AddSpirit(Random.Range(5, 10));
			}
			this.character.stats.AddStamina(-6f);
		}
	}

	// Token: 0x0600014F RID: 335 RVA: 0x0001897C File Offset: 0x00016B7C
	private void SpecialAttack2(Character target, GameObject targetInteractive, Library.Inventory itemRow, bool fromMultiHit)
	{
		if (target)
		{
			string text = "";
			Library.Inventory invRow = this.character.invRow1;
			float num = this.effectBonus;
			if (Links.x.rallyStage.playing)
			{
				this.effectBonus = (Links.x.qte.bonus - 1f) * (float)this.character.stats.level;
				if (this.effectBonus < 0f)
				{
					this.effectBonus = 0f;
				}
			}
			if (fromMultiHit)
			{
				num *= 0.5f;
			}
			if (invRow._MainSkill == "Sling" || invRow._MainSkill == "Elixir")
			{
				Effects effects = target.gameObject.AddComponent<Effects>();
				Links.x.cellar.AddEffects(effects);
				effects.gameObject.SetActive(true);
				effects.source = this.character;
				effects.target = target;
				effects.fromLoad = false;
				effects.effectName = itemRow._Effect;
				effects.sourceLevel = num;
				effects.Inflicted(false);
				return;
			}
			if (invRow._MainSkill == "Scepter")
			{
				text = "CripplingScepter";
			}
			if (invRow._MainSkill == "Whip")
			{
				text = "CripplingWhip";
			}
			if (invRow._MainSkill == "Pole")
			{
				text = "CripplingPole";
			}
			if (invRow._MainSkill == "ShortSword")
			{
				text = "CripplingShortSword";
			}
			if (invRow._MainSkill == "Sword")
			{
				text = "CripplingLongSword";
			}
			if (invRow._MainSkill == "Ax")
			{
				text = "CripplingAx";
			}
			if (invRow._MainSkill == "Bow")
			{
				if (Links.x.rallyStage.playing)
				{
					text = "CripplingArrowPin";
				}
				else
				{
					text = "CripplingArrow";
				}
			}
			if (invRow._MainSkill == "Elixir")
			{
				text = "";
			}
			if (invRow._MainSkill == "Unarmed")
			{
				text = "CripplingUnarmed";
			}
			if (Records.x.editor)
			{
				Debug.Log(text);
			}
			Effects effects2 = target.gameObject.AddComponent<Effects>();
			Links.x.cellar.AddEffects(effects2);
			effects2.gameObject.SetActive(true);
			effects2.source = this.character;
			effects2.target = target;
			effects2.fromLoad = false;
			effects2.effectName = text;
			effects2.sourceLevel = num;
			effects2.Inflicted(false);
		}
	}

	// Token: 0x06000150 RID: 336 RVA: 0x00018BF5 File Offset: 0x00016DF5
	public void AttackAnimationDone()
	{
		this.ai.SetMoveTargetAsAttack();
		this.character.doingAction = false;
	}

	// Token: 0x06000151 RID: 337 RVA: 0x00018C10 File Offset: 0x00016E10
	private void UpdateSoundAlerts(Character target)
	{
		Links.x.sensory.AddFootstep(this.character);
		if (target)
		{
			Links.x.sensory.AddFootstep(target);
			if (target.npc && target.creatures.inGroup)
			{
				Links.x.sensory.AlertGroupFromCombatSounds(target, this.character);
			}
			if (this.character.npc && this.character.creatures.inGroup)
			{
				Links.x.sensory.AlertGroupFromCombatSounds(this.character, target);
			}
		}
	}

	// Token: 0x06000152 RID: 338 RVA: 0x00018CAA File Offset: 0x00016EAA
	public void RemoveProjectile(Projectile projectile)
	{
		if (this.projectiles.Contains(projectile))
		{
			this.projectiles.Remove(projectile);
		}
		if (this.endActionsAfterTurn)
		{
			this.EndActions();
		}
	}

	// Token: 0x06000153 RID: 339 RVA: 0x00018CD5 File Offset: 0x00016ED5
	public void AddBlood()
	{
		if (this.targets.Count > 0 && this.targets[0])
		{
			this.character.AddBlood(this.targets[0]);
		}
	}

	// Token: 0x06000154 RID: 340 RVA: 0x00018D10 File Offset: 0x00016F10
	public void OnAttackComplete(Character target, GameObject targetInteractive, float hit, float damage, string attackTotals, string defenseTotals, string hitTexts, bool fromProjectile, Library.Inventory itemRow, int index, bool checkingMultiTarget)
	{
		bool flag = false;
		if (itemRow._DmgMax <= 0 && itemRow._Effect != "")
		{
			flag = true;
		}
		bool flag2 = false;
		if (Records.x.combatConsoleDebugging)
		{
			string[] array = new string[6];
			array[0] = "Attack complete for ";
			int num = 1;
			Character character = this.character;
			array[num] = ((character != null) ? character.ToString() : null);
			array[2] = " against ";
			array[3] = ((target != null) ? target.ToString() : null);
			array[4] = " hit is ";
			array[5] = hit.ToString();
			Debug.Log(string.Concat(array));
		}
		if (this.character.mainSelected && Records.x.pocketPause)
		{
			if (!Links.x.combat.npcsInCombat && targetInteractive)
			{
				Links.x.combat.attackingInteractiveOutsideOfCombat = true;
			}
			Links.x.combat.npcsInCombat = true;
			Links.x.combat.preDome = false;
			Links.x.combat.playerStartedCombat = false;
			if (Links.x.gaia.boroControls && !Links.x.combat.attackingInteractiveOutsideOfCombat && Links.x.combat.npcCount > 0)
			{
				Links.x.gaia.boroControls.LeavingForCombat();
			}
		}
		if (target && !fromProjectile && !checkingMultiTarget && !targetInteractive && !Records.x.pocketPause && !this.character.mainSelected && !this.specialAttack1 && !this.specialAttack2 && !this.specialAttack3 && (!this.InAttackRange(target) || !this.InAttackDirection(target)))
		{
			hit = 4f;
			if (target.evading || target.dodging)
			{
				bool flag3 = true;
				if (!Records.x.editor)
				{
					flag3 = false;
				}
				float num2 = this.DodgeCalculation(target);
				if (num2 < 1f)
				{
					int num3;
					target.stats.CheckForSongsAndWords("OnEvade", out num3);
				}
				if (((flag3 && num2 <= 1f) || num2 == 0f) && target.mainSelected)
				{
					Links.x.cellar.GetAnimatedText("Defend", "", Records.x.IsTextLeft(this.character, target)).gameObject.transform.position = target.body.HeadPosition(0f) + new Vector3(0f, 3f, 0f);
					MasterAudio.PlaySoundAndForget("Main Block", 1f, new float?(1f), 0f, "", null);
					Links.x.combat.PerfectDodge(target, this.character);
				}
			}
		}
		if (target && (this.firstAttack || this.secondAttack) && !Links.x.combat.inPocketAttack && !checkingMultiTarget && hit != 4f && !this.specialAttack1)
		{
			this.reroll = true;
			this.ActionRolls(false, true, target, null);
			if (this.targets.Contains(target))
			{
				this.GetListSet(target, out hit, out damage, out attackTotals, out defenseTotals, out hitTexts);
			}
			this.reroll = false;
		}
		if (hit == 0f && target && !flag)
		{
			if (Links.x.combat.bubbleEvent && target.mainSelected)
			{
				if (Links.x.qte.bonus > 1f)
				{
					damage = 0f;
					hit = 1f;
				}
			}
			else if ((target.evading || target.dodging) && !this.specialAttack3)
			{
				float num4 = this.DodgeCalculation(target);
				damage *= num4;
				if (damage <= 1f && target.npc)
				{
					damage = 1f;
				}
				if (damage < 0.5f && !target.npc)
				{
					damage = 0f;
					hit = 1f;
				}
				bool flag4 = true;
				if (!Records.x.editor)
				{
					flag4 = false;
				}
				if (num4 < 1f || flag4)
				{
					string text = hitTexts;
					hitTexts = this.character.stats.DefenseStance(text, num4);
					int num5;
					target.stats.CheckForSongsAndWords("OnEvade", out num5);
					if (target.mainSelected && (damage == 0f || (flag4 && num4 < 1f)))
					{
						flag2 = true;
						Links.x.cellar.GetAnimatedText("Defend", "", Records.x.IsTextLeft(this.character, target)).gameObject.transform.position = target.body.HeadPosition(0f) + new Vector3(0f, 3f, 0f);
						MasterAudio.PlaySoundAndForget("Main Block", 1f, new float?(1f), 0f, "", null);
						Links.x.combat.PerfectDodge(target, this.character);
					}
				}
			}
			if ((checkingMultiTarget || this.secondAttack) && Links.x.combat.inPocketAttack && !Links.x.rallyStage.playing)
			{
				target.SetMeshState(true);
				target.OverridePocketPause();
			}
		}
		if (target)
		{
			if ((this.character.mainSelected || (this.character.party && Links.x.combat.inPocketAttack)) && Records.x.pocketPause)
			{
				if (target.hasActions && target.inAction)
				{
					target.actions.Interrupt();
				}
				if (!Links.x.rallyStage.playing)
				{
					target.OverridePocketPause();
				}
			}
			if (Links.x.rallyStage.playing && !this.specialAttack2 && this.firstAttack && !checkingMultiTarget)
			{
				if (Records.x.editor)
				{
					Debug.Log(string.Concat(new string[]
					{
						damage.ToString(),
						" ",
						hitTexts,
						" ",
						(target != null) ? target.ToString() : null,
						" ",
						Links.x.qte.bonus.ToString(),
						" ",
						this.specialAttack3.ToString()
					}));
				}
				this.damageBonus = Links.x.qte.bonus;
				if (this.specialAttack3)
				{
					this.damageBonus *= 1.5f;
				}
				this.addDamageBonus = true;
				this.ActionRolls(false, true, target, null);
				this.addDamageBonus = false;
				this.GetLastListSet(out hit, out damage, out attackTotals, out defenseTotals, out hitTexts);
				if (Records.x.editor)
				{
					Debug.Log(string.Concat(new string[]
					{
						damage.ToString(),
						" ",
						hitTexts,
						" ",
						(target != null) ? target.ToString() : null
					}));
				}
			}
		}
		if ((hit == 3f || hit == 2f) && targetInteractive)
		{
			GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(86);
			pooledGameObject.transform.position = targetInteractive.transform.position + new Vector3(0f, 0.5f, 0f);
			pooledGameObject.SetActive(true);
		}
		Vector3 vector = this.character.tr.position;
		if (target)
		{
			vector = target.tr.position;
		}
		if (hit != 1f && hit != 4f && !flag)
		{
			if (this.character.stats.animal && itemRow._MeleeRangeEnd < 5f)
			{
				MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedAttackSound, this.character.tr.position, 1f, new float?(1f), 0f, "", null);
			}
			else if (itemRow._MeleeRangeEnd < 5f)
			{
				if (itemRow._MainSkill == "ShortSword")
				{
					if (!this.quickAttack)
					{
						MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedAttackSound, vector, Random.Range(0.5f, 0.6f), new float?(1f), 0f, "", null);
					}
					MasterAudio.PlaySound3DAtVector3AndForget("Sword Hit", vector, Random.Range(0.3f, 0.4f), new float?(1f), 0f, "", null);
				}
				else if (itemRow._MainSkill == "Whip")
				{
					if (!this.quickAttack)
					{
						MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedAttackSound, vector, Random.Range(0.5f, 0.6f), new float?(1f), 0f, "", null);
					}
					MasterAudio.PlaySound3DAtVector3AndForget("Whip Hit", vector, Random.Range(0.5f, 0.7f), new float?(1f), 0f, "", null);
				}
				else if (itemRow._MainSkill == "Pole")
				{
					if (!this.quickAttack)
					{
						MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedAttackSound, vector, Random.Range(0.5f, 0.6f), new float?(1f), 0f, "", null);
					}
					MasterAudio.PlaySound3DAtVector3AndForget("Spear Hit", vector, Random.Range(0.6f, 0.7f), new float?(1f), 0f, "", null);
				}
				else if (itemRow._MainSkill == "Scepter")
				{
					MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedAttackSound, vector, Random.Range(0.5f, 0.6f), new float?(1f), 0f, "", null);
					MasterAudio.PlaySound3DAtVector3AndForget("Blunt Hit", vector, Random.Range(0.6f, 0.8f), new float?(1f), 0f, "", null);
				}
				else if (itemRow._MainSkill == "Sword")
				{
					if (!this.quickAttack)
					{
						MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedAttackSound, vector, Random.Range(0.5f, 0.6f), new float?(1f), 0f, "", null);
					}
					MasterAudio.PlaySound3DAtVector3AndForget("Sword Hit", vector, Random.Range(0.3f, 0.4f), new float?(1f), 0f, "", null);
				}
				else if (itemRow._MainSkill.Contains("Dagger"))
				{
					if (!this.quickAttack)
					{
						MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedAttackSound, vector, Random.Range(0.5f, 0.6f), new float?(1f), 0f, "", null);
					}
					MasterAudio.PlaySound3DAtVector3AndForget("Dagger Hit", vector, Random.Range(0.6f, 0.7f), new float?(1f), 0f, "", null);
				}
				else
				{
					MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedAttackSound, vector, Random.Range(0.6f, 0.8f), new float?(1f), 0f, "", null);
				}
			}
			else if (itemRow._MainSkill == "Sling")
			{
				MasterAudio.PlaySound3DAtVector3AndForget("Dart Hit", vector, Random.Range(0.2f, 0.35f), new float?(1f), 0f, "", null);
			}
			else if (itemRow._MainSkill == "Bow")
			{
				MasterAudio.PlaySound3DAtVector3AndForget("Arrow Hit", vector, Random.Range(0.3f, 0.35f), new float?(1f), 0f, "", null);
			}
			else if (!(itemRow._MainSkill == "Elixir"))
			{
				MasterAudio.PlaySound3DAtVector3AndForget("Skull Crush", vector, Random.Range(0.3f, 0.35f), new float?(1f), 0f, "", null);
			}
		}
		this.AddPlayerToCombat(target);
		bool flag5 = false;
		if (hit == 0f && target && !flag)
		{
			if (Records.x.showRuleset)
			{
				Debug.Log(string.Concat(new string[]
				{
					this.character.stats.GetName(),
					" attack complete ",
					damage.ToString(),
					" ",
					hit.ToString(),
					" ",
					(target != null) ? target.ToString() : null
				}));
			}
			if (target.party && !Records.x.banquetIsle && target.GetInvNum(18) > 1)
			{
				Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(target.GetInvNum(18));
				target.stats.AddSkillProgress(target.stats.GetArmorSkillID(invRowByIndex._MainSkill), (float)this.character.combatLevel / 2f, target);
			}
			if (this.character.body.sneaking && this.character.mainSelected)
			{
				Links.x.cellar.GetAnimatedText("Text", "Stealth", Records.x.IsTextLeft(this.character, target)).gameObject.transform.position = target.body.HeadPosition(0f) + new Vector3(Random.Range(0f, 1f), 2f, 0f);
			}
			if (this.firstAttack && (this.specialAttack3 || this.specialAttack2))
			{
				bool flag6 = false;
				if (checkingMultiTarget)
				{
					flag6 = true;
				}
				this.SpecialAttack2(target, targetInteractive, itemRow, flag6);
			}
			if (this.character.stats.characterRow._UnarmedImpactSound != "")
			{
				MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedImpactSound, target.tr.position, Random.Range(0.9f, 1f), new float?(1f), 0f, "", null);
			}
			if (this.firstAttack)
			{
				int num6;
				this.character.stats.CheckForSongsAndWords("Attack", out num6);
			}
			int num7 = this.currentHand;
			int num8 = this.character.invRow1._DurabilityLoss;
			if (num7 == 1)
			{
				num8 = this.character.invRow2._DurabilityLoss;
			}
			this.character.UpdateDurability(num7, num8, false, true);
			if (!target.dead && (!target.stunned || (target.stunned && Records.x.kill)) && target.actions)
			{
				int num9;
				target.stats.CheckForSongsAndWords("OnHit", out num9);
				target.actions.ai.hitBy = this.character;
			}
			bool flag7 = true;
			if (!this.firstAttack && !this.secondAttack)
			{
				flag7 = false;
			}
			string text2 = "None";
			if (this.firstAttack)
			{
				text2 = "Bounce";
			}
			float num10 = itemRow._HitTimeIncrease;
			float num11 = itemRow._StaminaReduction;
			if (this.character.invRow1._MeleeRangeEnd >= 5f)
			{
				num10 += this.character.invRow1._HitTimeIncrease;
				num11 += this.character.invRow1._StaminaReduction;
			}
			this.character.AddDamage(target, damage, true, false, flag7, text2, num10, num11);
			this.DamageFX(target, damage, hit);
			if (this.character.party && Links.x.rallyStage.playing && this.firstAttack)
			{
				Links.x.rallyStage.targetDamage = damage;
			}
			if (!target.dead && !target.stunned && this.firstAttack)
			{
				this.savedEnemy = target;
			}
			if (target && !checkingMultiTarget)
			{
				int num12;
				this.CheckForEnchantedWeapon("Attack", target, null, target.node, out num12);
			}
			if (this.doSlowTime)
			{
				Links.x.combat.StartSlowTime("Synergy");
			}
			if (this.firstAttack && !checkingMultiTarget && !this.quickAttack && !this.specialAttack1 && !this.specialAttack2)
			{
				this.character.stats.UpdateRallyCount(true, 0f);
			}
			if (!checkingMultiTarget)
			{
				int num13 = 9;
				if (target.GetInvNum(18) > 1)
				{
					float num14 = itemRow._DurabilityReductionBonus + 1f + target.stats.EqArmorReduction();
					if (this.character.invRow1._MeleeRangeEnd >= 5f)
					{
						num14 += this.character.invRow1._DurabilityReductionBonus;
					}
					target.UpdateDurability(num13, (int)num14, false, true);
				}
			}
			this.doSlowTime = false;
			Links.x.sensory.AddNoise(target.gameObject, target.node, "Hit", this.character);
			if (target.dead || target.stunned)
			{
				int num15;
				this.character.stats.CheckForSongsAndWords("OnKill", out num15);
				Links.x.fellowship.CheckForPartySongs("OnPartyKill");
				if (target.party)
				{
					Links.x.fellowship.CheckForPartySongs("OnFriendDown");
				}
				Links.x.sensory.AddNoise(target.gameObject, target.node, "Death", this.character);
			}
		}
		else if (target && !flag)
		{
			if (this.character.party && Links.x.rallyStage.playing)
			{
				Links.x.rallyStage.targetDamage = 0f;
			}
			if (hit == 4f)
			{
				if (!fromProjectile)
				{
					MasterAudio.PlaySound3DAtVector3AndForget("Swing", this.character.tr.position, 1f, new float?(1f), 0f, "", null);
				}
				this.str.Clear();
				if (!target.npc)
				{
					this.str.Append(Links.x.gameFeed.GetPartyColorText(target));
				}
				this.str.Append(target.stats.GetName());
				if (!target.npc)
				{
					this.str.Append("</color>");
				}
				this.str.Append(" moved out of range of ");
				if (!this.character.npc)
				{
					this.str.Append(Links.x.gameFeed.GetPartyColorText(this.character));
				}
				this.str.Append(this.character.stats.GetName());
				if (!this.character.npc)
				{
					this.str.Append("</color>'s attack");
				}
				else
				{
					this.str.Append("'s attack");
				}
				Links.x.gameFeed.AddFeed(this.str.ToString());
			}
			else
			{
				if (target.body.lookAtController)
				{
					target.body.lookAtController.SetNewTarget(this.character.body.headBone, 2f, 0f, false);
				}
				if (hit == 1f)
				{
					MasterAudio.PlaySound3DAtVector3AndForget("Block Dodge", this.character.tr.position, 1f, new float?(1f), 0.3f, "", null);
					MasterAudio.PlaySound3DAtVector3AndForget("Swing", this.character.tr.position, 1f, new float?(1f), 0f, "", null);
					if (!target.moving || Records.x.pocketPause)
					{
						target.PlayAnimation("Block_dodge", 0f);
					}
					if (!flag2)
					{
						this.DamageFX(target, 0f, hit);
					}
					int num16;
					target.stats.CheckForSongsAndWords("OnEvade", out num16);
					if ((target.mainSelected || this.character.mainSelected) && !flag2)
					{
						if (this.blocked)
						{
							Links.x.cellar.GetAnimatedText("Blocked", "", Records.x.IsTextLeft(this.character, target)).gameObject.transform.position = target.body.HeadPosition(0f) + new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), 0f);
						}
						else
						{
							Links.x.cellar.GetAnimatedText("Evaded", "", Records.x.IsTextLeft(this.character, target)).gameObject.transform.position = target.body.HeadPosition(0f) + new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), 0f);
						}
					}
				}
				else if (hit == 2f || hit == 3f)
				{
					MasterAudio.PlaySound3DAtVector3AndForget("Block Armor", this.character.tr.position, 1f, new float?(1f), 0.3f, "", null);
					if (!target.moving || Records.x.pocketPause)
					{
						target.PlayAnimation("Block_armor", 0f);
					}
					if (this.character.mainSelected)
					{
						Links.x.cellar.GetAnimatedText("Absorbed", "", Records.x.IsTextLeft(this.character, target)).gameObject.transform.position = target.body.HeadPosition(0f) + new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), 0f);
					}
					if (this.firstAttack && (this.specialAttack3 || this.specialAttack2))
					{
						bool flag8 = false;
						if (checkingMultiTarget)
						{
							flag8 = true;
						}
						this.SpecialAttack2(target, targetInteractive, itemRow, flag8);
					}
					this.DamageFX(target, 0f, hit);
					if (!checkingMultiTarget)
					{
						int num17 = 9;
						if (target.GetInvNum(18) > 1)
						{
							float num18 = itemRow._DurabilityReductionBonus + 1f + target.stats.EqArmorReduction();
							if (this.character.invRow1._MeleeRangeEnd >= 5f)
							{
								num18 += this.character.invRow1._DurabilityReductionBonus;
							}
							target.UpdateDurability(num17, (int)num18, false, true);
						}
					}
				}
			}
		}
		if (hit == 0f && targetInteractive && !flag)
		{
			BreakableActions component = targetInteractive.GetComponent<BreakableActions>();
			ChestActions component2 = targetInteractive.GetComponent<ChestActions>();
			DoorActions component3 = targetInteractive.GetComponent<DoorActions>();
			PuzzleActions component4 = targetInteractive.GetComponent<PuzzleActions>();
			string text3 = "";
			int num19 = 0;
			Vector3 vector2 = targetInteractive.transform.position;
			if (component)
			{
				vector2 = component.mainCollider.bounds.center + new Vector3(0f, 1f, 0f);
			}
			if (component3)
			{
				vector2 = component3.lockColliderPosition;
			}
			if (component2)
			{
				vector2 = component2.tr.position + new Vector3(0f, 2.5f, 0f);
			}
			if (component4)
			{
				vector2 = component4.gameObject.transform.position + new Vector3(0f, component4.interactionPointY, 0f);
			}
			if (targetInteractive)
			{
				int num20;
				this.CheckForEnchantedWeapon("Attack", null, targetInteractive, null, out num20);
			}
			if (targetInteractive.GetComponent<Character>())
			{
				Links.x.sensory.AddNoise(targetInteractive.gameObject, targetInteractive.GetComponent<Character>().node, "Hit", this.character);
			}
			if (component2)
			{
				component2.currentHealth -= (int)damage;
				if (component2.currentHealth <= 0)
				{
					component2.ClickToBreak(this.character, false);
				}
				else
				{
					component2.Damage(this.character);
				}
				text3 = "Chest";
				num19 = component2.currentHealth;
				component2.AlertOwner(true, this.character);
			}
			if (component3)
			{
				component3.currentHealth -= (int)damage;
				if (component3.currentHealth <= 0)
				{
					component3.ClickToBreak(this.character, false);
				}
				else
				{
					component3.Damage(this.character);
				}
				text3 = "Door";
				num19 = component3.currentHealth;
				component3.AlertOwner(true, this.character);
			}
			if (component)
			{
				component.currentHealth -= (int)damage;
				if (component.currentHealth <= 0)
				{
					component.ClickToBreak(this.character, false, false);
				}
				else
				{
					component.Damage(this.character);
				}
				text3 = component.breakable.type.ToString();
				num19 = component.currentHealth;
			}
			if (component4)
			{
				component4.currentHealth -= (int)damage;
				if (component4.currentHealth <= 0)
				{
					component4.ClickToBreak();
				}
				else
				{
					component4.Damage();
				}
				text3 = component4.puzzle.displayNameIfHoverable;
				num19 = component4.currentHealth;
			}
			Animator animatedText = Links.x.cellar.GetAnimatedText("NPCDmg", Mathf.Round(damage).ToString(), false);
			animatedText.gameObject.transform.position = vector2 + new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), 0f);
			animatedText.gameObject.SetActive(true);
			Links.x.sensory.AddNoise(this.character.gameObject, this.character.node, "Break", this.character);
			int num21 = this.currentHand;
			int num22 = this.character.invRow1._DurabilityLoss;
			if (num21 == 1)
			{
				num22 = this.character.invRow2._DurabilityLoss;
			}
			if (num21 == 2)
			{
				num22 = this.character.invRow3._DurabilityLoss;
			}
			if (num21 == 3)
			{
				num22 = this.character.invRow4._DurabilityLoss;
			}
			this.character.UpdateDurability(num21, num22, false, true);
			MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedAttackSound, this.character.tr.position, 1f, new float?(1f), 0f, "", null);
			MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedImpactSound, targetInteractive.transform.position, 1f, new float?(1f), 0f, "", null);
			this.str.Clear();
			if (!this.character.npc)
			{
				this.str.Append(Links.x.gameFeed.GetPartyColorText(this.character));
			}
			this.str.Append(this.character.stats.GetName());
			if (!this.character.npc)
			{
				this.str.Append("</color>");
			}
			this.str.Append(" hit ");
			this.str.Append(text3);
			if (Records.x.showRulesetInfo)
			{
				this.str.Append(" <color #857C6C>... ");
				this.str.Append(attackTotals);
				this.str.Append("</color>");
			}
			Links.x.gameFeed.AddFeed(this.str.ToString());
			if (damage > 0f)
			{
				this.str.Clear();
				this.str.Append(text3);
				this.str.Append(" took ");
				this.str.Append(damage);
				this.str.Append(" breaking damage");
				if (Records.x.showRulesetInfo)
				{
					this.str.Append(" <color #857C6C>... ");
					this.str.Append(hitTexts);
					this.str.Append("</color>");
				}
				Links.x.gameFeed.AddFeed(this.str.ToString());
			}
			if (num19 <= 0)
			{
				this.str.Clear();
				this.str.Append(text3);
				this.str.Append(" is broken");
				Links.x.gameFeed.AddFeed(this.str.ToString());
			}
			this.SetSelectedTarget(false, null, null, null);
		}
		else if (targetInteractive && hit != 0f && !flag)
		{
			BreakableActions component5 = targetInteractive.GetComponent<BreakableActions>();
			ChestActions component6 = targetInteractive.GetComponent<ChestActions>();
			DoorActions component7 = targetInteractive.GetComponent<DoorActions>();
			PuzzleActions component8 = targetInteractive.GetComponent<PuzzleActions>();
			string text4 = "";
			if (component6)
			{
				text4 = "Chest";
			}
			if (component7)
			{
				text4 = "Door";
			}
			if (component5)
			{
				text4 = component5.breakable.type.ToString();
			}
			if (component8)
			{
				text4 = component8.puzzle.displayNameIfHoverable;
			}
			Vector3 vector3 = targetInteractive.transform.position;
			if (component5)
			{
				vector3 = component5.mainCollider.bounds.center;
			}
			if (component7)
			{
				vector3 = component7.lockColliderPosition;
			}
			if (component6)
			{
				vector3 = component6.tr.position + new Vector3(0f, 2.5f, 0f);
			}
			if (component8)
			{
				vector3 = component8.gameObject.transform.position + new Vector3(0f, component8.interactionPointY, 0f);
			}
			if (hit == 1f || hit == 4f)
			{
				MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedAttackSound, this.character.tr.position, 1f, new float?(1f), 0f, "", null);
				MasterAudio.PlaySound3DAtVector3AndForget("Block Armor", this.character.tr.position, 1f, new float?(1f), 0.3f, "", null);
				Animator animatedText2 = Links.x.cellar.GetAnimatedText("Blocked", "", false);
				animatedText2.gameObject.transform.position = vector3 + new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), 0f) + new Vector3(0f, 2f, 0f);
				animatedText2.gameObject.SetActive(true);
				this.str.Clear();
				if (!this.character.npc)
				{
					this.str.Append(Links.x.gameFeed.GetPartyColorText(this.character));
				}
				this.str.Append(this.character.stats.GetName());
				if (!this.character.npc)
				{
					this.str.Append("</color>");
				}
				this.str.Append("'s attack was absorbed by ");
				this.str.Append(text4);
				if (Records.x.showRulesetInfo)
				{
					this.str.Append(" <color #857C6C>... ");
					this.str.Append(hitTexts);
					this.str.Append("</color>");
				}
				Links.x.gameFeed.AddFeed(this.str.ToString());
				this.str.Clear();
				if (!this.character.npc)
				{
					this.str.Append(Links.x.gameFeed.GetPartyColorText(this.character));
				}
				this.str.Append(this.character.stats.GetName());
				if (!this.character.npc)
				{
					this.str.Append("</color>");
				}
				this.str.Append(" hit ");
				this.str.Append(text4);
				if (Records.x.showRulesetInfo)
				{
					this.str.Append(" <color #857C6C>... ");
					this.str.Append(attackTotals);
					this.str.Append("</color>");
				}
				Links.x.gameFeed.AddFeed(this.str.ToString());
				this.str.Clear();
				this.str.Append(text4);
				this.str.Append(" absorbed attack ");
				if (Records.x.showRulesetInfo)
				{
					this.str.Append(" <color #857C6C>... ");
					this.str.Append(hitTexts);
					this.str.Append("</color>");
				}
				Links.x.gameFeed.AddFeed(this.str.ToString());
			}
			else
			{
				MasterAudio.PlaySound3DAtVector3AndForget(this.character.stats.characterRow._UnarmedAttackSound, this.character.tr.position, 1f, new float?(1f), 0f, "", null);
				MasterAudio.PlaySound3DAtVector3AndForget("Block Armor", this.character.tr.position, 1f, new float?(1f), 0.3f, "", null);
				Animator animatedText3 = Links.x.cellar.GetAnimatedText("NPCDmg", "No effect!", false);
				animatedText3.gameObject.transform.position = vector3 + new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), 0f) + new Vector3(0f, 2f, 0f);
				animatedText3.gameObject.SetActive(true);
				this.str.Clear();
				if (!this.character.npc)
				{
					this.str.Append(Links.x.gameFeed.GetPartyColorText(this.character));
				}
				this.str.Append(this.character.stats.GetName());
				if (!this.character.npc)
				{
					this.str.Append("</color>");
				}
				this.str.Append("'s attack had no effect on ");
				this.str.Append(text4);
				Links.x.gameFeed.AddFeed(this.str.ToString());
			}
			this.SetSelectedTarget(false, null, null, null);
		}
		if (!flag && target && hit != 4f && hitTexts != "")
		{
			this.UpdateGameFeed(target, hit, damage, attackTotals, defenseTotals, hitTexts, flag5);
		}
		this.UpdateSoundAlerts(target);
		this.castCompleteCoroutine = null;
		if (this.selectedTarget && (this.selectedTarget.dead || (this.selectedTarget.stunned && Records.x.kill)))
		{
			this.SetSelectedTarget(false, null, null, null);
		}
		if (this.selectedTargetInteractive || this.selectedAITargetInteractive)
		{
			GameObject gameObject = this.selectedTargetInteractive;
			if (!gameObject)
			{
				gameObject = this.selectedAITargetInteractive;
			}
			BreakableActions component9 = gameObject.GetComponent<BreakableActions>();
			ChestActions component10 = gameObject.GetComponent<ChestActions>();
			DoorActions component11 = gameObject.GetComponent<DoorActions>();
			PuzzleActions component12 = gameObject.GetComponent<PuzzleActions>();
			if (component9 && component9.destroyed)
			{
				this.SetSelectedTarget(false, null, null, null);
			}
			if (component10 && component10.destroyed)
			{
				this.SetSelectedTarget(false, null, null, null);
			}
			if (component11 && component11.destroyed)
			{
				this.SetSelectedTarget(false, null, null, null);
			}
			if (component12 && component12.destroyed)
			{
				this.SetSelectedTarget(false, null, null, null);
			}
		}
		bool flag9 = false;
		if (fromProjectile && itemRow._Name.Contains("Vial"))
		{
			flag9 = true;
		}
		if (hit == 0f && this.firstAttack && !checkingMultiTarget && damage > 0f)
		{
			this.AddSpecialAttack(target);
		}
		bool flag10 = this.firstAttack;
		bool flag11 = this.secondAttack;
		if ((target || targetInteractive) && !checkingMultiTarget && !fromProjectile && (this.firstAttack || (this.character.stats.HandCount() > 1f && this.secondAttack)) && !this.heavyAttack && !this.lightAttack && !flag)
		{
			this.firstAttack = false;
			if (!Links.x.rallyStage.playing)
			{
				this.MultiHit(target, targetInteractive, false, false, false, false, itemRow);
			}
		}
		if (this.firstAttack && (target || targetInteractive) && !checkingMultiTarget && fromProjectile && !flag && this.specialAttack2 && Links.x.combat.inPocketAttack && (itemRow._Name.Contains("Vial") || itemRow._Name.Contains("Dart")))
		{
			Vector3 vector4 = Vector3.zero;
			if (target)
			{
				vector4 = target.currentPosition;
			}
			if (targetInteractive)
			{
				vector4 = targetInteractive.transform.position;
			}
			this.MultiHitObjects(vector4, target, targetInteractive, false, true, false, fromProjectile, itemRow, 0);
		}
		if (hit == 0f && (target || targetInteractive) && !checkingMultiTarget && flag9 && this.firstAttack && !flag && itemRow._Name.Contains("Bomb"))
		{
			Vector3 vector5 = Vector3.zero;
			if (target)
			{
				vector5 = target.currentPosition;
			}
			if (targetInteractive)
			{
				vector5 = targetInteractive.transform.position;
			}
			this.MultiHitObjects(vector5, target, targetInteractive, false, false, true, fromProjectile, itemRow, 0);
		}
		if ((target || targetInteractive) && this.character.stats.HandCount() > 1f && !checkingMultiTarget && flag10 && !Links.x.combat.inPocketAttack && !flag11)
		{
			this.firstAttack = false;
			Character character2 = target;
			GameObject gameObject2 = null;
			if (targetInteractive)
			{
				gameObject2 = targetInteractive;
			}
			if (target && target.dead)
			{
				character2 = null;
				if (this.combatCharacters == null)
				{
					this.combatCharacters = Links.x.diorama.characters;
				}
				float num23 = this.character.AttackRange();
				int count = this.combatCharacters.Count;
				for (int i = 0; i < count; i++)
				{
					if (i < this.combatCharacters.Count && !character2)
					{
						Character character3 = this.combatCharacters[i];
						if (character3 && character3 != target && (character3.tr.position - target.tr.position).sqrMagnitude < num23 * num23 && this.ai.CanAttack(character3) && this.InAttackDirection(character3))
						{
							character2 = character3;
						}
					}
				}
			}
			if (character2 || gameObject2)
			{
				this.ClearDamageLists();
				this.ClearTargetCharacters();
				if (target)
				{
					this.actionTargets.Add(character2);
				}
				else
				{
					this.actionInteractives.Add(gameObject2);
				}
				if (target)
				{
					this.character.SetRotation(Quaternion.LookRotation(target.currentPosition - this.character.currentPosition), false, true);
				}
				this.ActionRolls(false, false, character2, gameObject2);
			}
		}
		if (!Records.x.combat && this.targets.Count == 0 && !checkingMultiTarget && this.firstAttack && !this.cannotInterrupt)
		{
			this.EndTurnAfterAction();
		}
		if (!checkingMultiTarget)
		{
			this.character.stats.attackCount++;
		}
	}

	// Token: 0x06000155 RID: 341 RVA: 0x0001B780 File Offset: 0x00019980
	public void MultiHit(Character target, GameObject targetInteractive, bool isRange, bool isDart, bool elixirBomb, bool fromProjectile, Library.Inventory itemRow)
	{
		Vector3 vector = Vector3.zero;
		if (target)
		{
			vector = target.currentPosition;
		}
		if (targetInteractive)
		{
			vector = targetInteractive.transform.position;
		}
		this.MultiHitObjects(vector, target, targetInteractive, false, false, false, fromProjectile, itemRow, 0);
	}

	// Token: 0x06000156 RID: 342 RVA: 0x0001B7C8 File Offset: 0x000199C8
	private void FoundMultiHit(bool isRange, bool isDart, bool elixirBomb, Vector3 position, Character target, GameObject targetInteractive, Character checking, GameObject checkingInteractive, bool fromProjectile, Library.Inventory itemRow, int ammoIndex)
	{
		if (((targetInteractive && targetInteractive != checkingInteractive) || !targetInteractive) && ((target && target != checking) || !target))
		{
			if (elixirBomb)
			{
				float num = 3f;
				Vector3 vector = Vector3.zero;
				if (checking)
				{
					vector = checking.currentPosition;
				}
				else
				{
					vector = checkingInteractive.transform.position;
				}
				if ((vector - position).sqrMagnitude < num * num)
				{
					if (checking)
					{
						this.actionTargets.Add(checking);
					}
					else
					{
						this.actionInteractives.Add(checkingInteractive);
					}
					this.ActionRolls(true, true, checking, checkingInteractive);
					int num2 = this.damages.Count - 1;
					if (num2 < this.hits.Count && num2 > -1)
					{
						if (checking)
						{
							for (int i = 0; i < this.targets.Count; i++)
							{
								if (this.targets[i] == checking)
								{
									num2 = i;
								}
							}
						}
						if (checkingInteractive)
						{
							for (int j = 0; j < this.targetsInteractive.Count; j++)
							{
								if (this.targetsInteractive[j] == checkingInteractive)
								{
									num2 = j;
								}
							}
						}
						if (num2 > -1)
						{
							this.OnAttackComplete(checking, checkingInteractive, (float)this.hits[num2], this.damages[num2], this.attackTotal[num2], this.defenseTotal[num2], this.hitText[num2], fromProjectile, itemRow, num2, true);
							return;
						}
					}
				}
			}
			else
			{
				bool flag = false;
				Vector3 vector2 = this.character.currentPosition;
				if (Links.x.rallyStage.playing)
				{
					vector2 = Links.x.combat.rallyCharacterStartPosition;
				}
				if (checking)
				{
					if (checking.InAttackShape(target, position, this.character, vector2, checking.currentPosition, this.character.invRow1))
					{
						flag = true;
					}
				}
				else if (this.character.InAttackShape(null, position, this.character, vector2, checkingInteractive.transform.position, this.character.invRow1))
				{
					flag = true;
				}
				if (flag)
				{
					if (!isDart)
					{
						if (isRange)
						{
							if (checking)
							{
								this.actionTargets.Add(checking);
							}
							else
							{
								this.actionInteractives.Add(checkingInteractive);
							}
							this.ActionRolls(true, true, checking, checkingInteractive);
							if (checking)
							{
								this.CreateAmmo(this.ammoRow, this.targets.IndexOf(checking), checking, null);
							}
							else
							{
								this.CreateAmmo(this.ammoRow, this.targetsInteractive.IndexOf(checkingInteractive), null, checkingInteractive);
							}
							this.character.UseAmmo(ammoIndex);
							return;
						}
						if (checking)
						{
							this.actionTargets.Add(checking);
						}
						else
						{
							this.actionInteractives.Add(checkingInteractive);
						}
						this.ActionRolls(true, true, checking, checkingInteractive);
						int num3 = this.damages.Count - 1;
						if (num3 < this.hits.Count && num3 > -1)
						{
							if (checking)
							{
								for (int k = 0; k < this.targets.Count; k++)
								{
									if (this.targets[k] == checking)
									{
										num3 = k;
									}
								}
							}
							if (checkingInteractive)
							{
								for (int l = 0; l < this.targetsInteractive.Count; l++)
								{
									if (this.targetsInteractive[l] == checkingInteractive)
									{
										num3 = l;
									}
								}
							}
							if (num3 > -1)
							{
								this.OnAttackComplete(checking, checkingInteractive, (float)this.hits[num3], this.damages[num3], this.attackTotal[num3], this.defenseTotal[num3], this.hitText[num3], fromProjectile, itemRow, num3, true);
								return;
							}
						}
					}
					else
					{
						if (checking)
						{
							checking.PlayAnimation("Hit", 0f);
						}
						Effects effects;
						if (checking)
						{
							effects = checking.gameObject.AddComponent<Effects>();
						}
						else
						{
							effects = checkingInteractive.AddComponent<Effects>();
						}
						Links.x.cellar.AddEffects(effects);
						effects.gameObject.SetActive(true);
						effects.source = this.character;
						effects.target = checking;
						effects.targetInteractive = checkingInteractive;
						effects.fromLoad = false;
						effects.effectName = itemRow._Effect;
						effects.sourceLevel = Mathf.Round((float)itemRow._DmgMax / 2f);
						effects.Inflicted(false);
						if (Links.x.combat.inPocketAttack && !Links.x.rallyStage.playing && checking)
						{
							checking.SetMeshState(true);
							checking.OverridePocketPause();
						}
					}
				}
			}
		}
	}

	// Token: 0x06000157 RID: 343 RVA: 0x0001BCD0 File Offset: 0x00019ED0
	public void MultiHitObjects(Vector3 hoverPosition, Character target, GameObject targetInteractive, bool isRange, bool isDart, bool elixirBomb, bool fromProjectile, Library.Inventory itemRow, int ammoIndex)
	{
		if (this.diaDoors == null)
		{
			this.currentTileEffects = Links.x.cellar.currentTileEffects;
			this.timedBreakables = Links.x.cellar.combatBreakables;
			this.diaBreakables = Links.x.diorama.breakableActions;
			this.diaDoors = Links.x.diorama.doorActions;
			this.diaChests = Links.x.diorama.chestActions;
		}
		if (hoverPosition != Vector3.zero)
		{
			if (this.combatCharacters == null)
			{
				this.combatCharacters = Links.x.diorama.characters;
			}
			this.multiHitCharacters.Clear();
			for (int i = 0; i < this.combatCharacters.Count; i++)
			{
				this.multiHitCharacters.Add(this.combatCharacters[i]);
			}
			for (int j = 0; j < this.multiHitCharacters.Count; j++)
			{
				Character character = this.multiHitCharacters[j];
				if (character && character != target && this.ai.CanAttack(character))
				{
					bool flag = true;
					if (fromProjectile && !isDart && itemRow._Name.Contains("Arrow"))
					{
						flag = Links.x.combat.InRangeSight(this.character, character);
					}
					if (flag)
					{
						this.FoundMultiHit(isRange, isDart, elixirBomb, hoverPosition, target, targetInteractive, character, null, fromProjectile, itemRow, ammoIndex);
					}
				}
			}
			for (int k = 0; k < this.timedBreakables.Count; k++)
			{
				TimedBreakable timedBreakable = this.timedBreakables[k];
				if (timedBreakable && !timedBreakable.breakable.destroyed && (this.CheckInteractiveLineOfSight(timedBreakable.breakable.transform.position, timedBreakable.breakable, null, null, null) || isDart))
				{
					this.FoundMultiHit(isRange, isDart, elixirBomb, hoverPosition, target, targetInteractive, null, timedBreakable.breakable.gameObject, fromProjectile, itemRow, ammoIndex);
				}
			}
			for (int l = 0; l < this.currentTileEffects.Count; l++)
			{
				TileEffects tileEffects = this.currentTileEffects[l];
				if (tileEffects && tileEffects.isWall)
				{
					foreach (BreakableActions breakableActions in tileEffects.breakables)
					{
						if (breakableActions && !breakableActions.destroyed && (this.CheckInteractiveLineOfSight(breakableActions.transform.position, breakableActions, null, null, null) || isDart))
						{
							this.FoundMultiHit(isRange, isDart, elixirBomb, hoverPosition, target, targetInteractive, null, breakableActions.gameObject, fromProjectile, itemRow, ammoIndex);
						}
					}
				}
			}
			for (int m = 0; m < this.diaBreakables.Count; m++)
			{
				BreakableActions breakableActions2 = this.diaBreakables[m];
				if (breakableActions2 && !breakableActions2.destroyed && (this.CheckInteractiveLineOfSight(breakableActions2.transform.position, breakableActions2, null, null, null) || isDart))
				{
					this.FoundMultiHit(isRange, isDart, elixirBomb, hoverPosition, target, targetInteractive, null, breakableActions2.gameObject, fromProjectile, itemRow, ammoIndex);
				}
			}
			for (int n = 0; n < this.diaChests.Count; n++)
			{
				ChestActions chestActions = this.diaChests[n];
				if (chestActions && !chestActions.destroyed && (this.CheckInteractiveLineOfSight(chestActions.transform.position, null, null, chestActions, null) || isDart))
				{
					this.FoundMultiHit(isRange, isDart, elixirBomb, hoverPosition, target, targetInteractive, null, chestActions.gameObject, fromProjectile, itemRow, ammoIndex);
				}
			}
			for (int num = 0; num < this.diaDoors.Count; num++)
			{
				DoorActions doorActions = this.diaDoors[num];
				if (doorActions && !doorActions.destroyed && doorActions.lockCollider && (this.CheckInteractiveLineOfSight(doorActions.lockColliderPosition, null, doorActions, null, null) || isDart))
				{
					this.FoundMultiHit(isRange, isDart, elixirBomb, hoverPosition, target, targetInteractive, null, doorActions.gameObject, fromProjectile, itemRow, ammoIndex);
				}
			}
		}
	}

	// Token: 0x06000158 RID: 344 RVA: 0x0001C10C File Offset: 0x0001A30C
	private bool CheckInteractiveLineOfSight(Vector3 mainPoint, BreakableActions breakable, DoorActions door, ChestActions chest, PuzzleActions puzzle)
	{
		Vector3 vector = mainPoint;
		GameObject gameObject = null;
		if (Records.x.pocketPause && (Links.x.gameplay.spellTargetingGround || Links.x.gameplay.spellTargetingEnemy || Links.x.gameplay.spellTargetingParty))
		{
			return false;
		}
		if (breakable)
		{
			vector = breakable.mainCollider.bounds.center;
			gameObject = breakable.gameObject;
		}
		if (door)
		{
			vector = door.lockColliderPosition;
			gameObject = door.gameObject;
		}
		if (puzzle)
		{
			vector = puzzle.gameObject.transform.position;
			gameObject = puzzle.gameObject;
		}
		if (chest)
		{
			vector = chest.tr.position + new Vector3(0f, 1f, 0f);
			gameObject = chest.mainCollider.gameObject;
		}
		vector.y += 0.5f;
		RaycastHit raycastHit;
		bool flag = Physics.SphereCast(Links.x.main.raycastPosition, 0.1f, vector - Links.x.main.raycastPosition, out raycastHit, this.character.AttackRange(), 2163200);
		if (flag)
		{
			if (raycastHit.collider.gameObject == gameObject)
			{
				flag = false;
			}
			else if (raycastHit.collider.gameObject.transform.parent && raycastHit.collider.gameObject.transform.parent.gameObject == gameObject)
			{
				flag = false;
			}
		}
		return !flag;
	}

	// Token: 0x06000159 RID: 345 RVA: 0x0001C2AC File Offset: 0x0001A4AC
	private float DodgeCalculation(Character target)
	{
		float num = Mathf.Clamp((Links.x.gameplay.seconds - target.blockDodgeStartTime) / 20f, 0f, 1f);
		if (num < 0.25f && target.mainSelected)
		{
			num = 0f;
		}
		return num;
	}

	// Token: 0x0600015A RID: 346 RVA: 0x0001C2FC File Offset: 0x0001A4FC
	public void AddPlayerToCombat(Character target)
	{
		if (target)
		{
			if (!Records.x.combat && target.hostility < 2 && !this.character.npc && !target.attackingUntilBribe)
			{
				Links.x.combat.StartCombat(null, this.character, true, true);
			}
			if (!this.doBubbleAttack)
			{
				Links.x.sensory.AddPlayerFromDamage(target, this.character);
			}
		}
	}

	// Token: 0x0600015B RID: 347 RVA: 0x0001C374 File Offset: 0x0001A574
	public void RemoveTarget(Character character, GameObject obj)
	{
		Debug.Log("Remove target");
		if (!obj)
		{
			int num = this.targets.IndexOf(character);
			if (num > -1)
			{
				this.targets.RemoveAt(num);
				this.targetsInteractive.RemoveAt(num);
				this.hits.RemoveAt(num);
				this.damages.RemoveAt(num);
				this.attackTotal.RemoveAt(num);
				this.defenseTotal.RemoveAt(num);
				this.hitText.RemoveAt(num);
				return;
			}
		}
		else
		{
			int num2 = this.targetsInteractive.IndexOf(obj);
			if (num2 > -1)
			{
				this.targetsInteractive.RemoveAt(num2);
				this.targets.RemoveAt(num2);
				this.hits.RemoveAt(num2);
				this.damages.RemoveAt(num2);
				this.attackTotal.RemoveAt(num2);
				this.defenseTotal.RemoveAt(num2);
				this.hitText.RemoveAt(num2);
			}
		}
	}

	// Token: 0x0600015C RID: 348 RVA: 0x0001C464 File Offset: 0x0001A664
	public void EndChanneling(bool endTurn)
	{
		this.channeling = false;
		if (this.currentTileEffect)
		{
			this.currentTileEffect.Remove();
		}
		this.EndVine();
		this.currentTileEffect = null;
		this.character.inRecovery = false;
		this.spellScroll = null;
		if (endTurn)
		{
			this.EndTurn(true);
		}
	}

	// Token: 0x0600015D RID: 349 RVA: 0x0001C4BA File Offset: 0x0001A6BA
	public void EndVine()
	{
		if (this.vine)
		{
			this.vine = null;
			if (this.castCompleteCoroutine != null)
			{
				base.StopCoroutine(this.castCompleteCoroutine);
			}
			this.castCompleteCoroutine = null;
			this.character.inRecovery = false;
		}
	}

	// Token: 0x0600015E RID: 350 RVA: 0x0001C4F8 File Offset: 0x0001A6F8
	public void EndTurnAfterAction()
	{
		this.character.inRecovery = false;
		this.character.inAction = false;
		if (this.character.timelineIcon && !Records.x.pocketPause)
		{
			this.character.timelineIcon.overridePause = false;
		}
		if (this.character.doingAction && !Records.x.combat)
		{
			return;
		}
		if (this.targets.Count > 0 && this.targetsInteractive.Count > 0 && !Records.x.combat)
		{
			return;
		}
		if (!this.endActionsAfterTurn || this.selectedTarget || this.selectedTargetInteractive)
		{
			this.EndTurn(true);
			return;
		}
		if (this.songsWordsQueued.Count == 0)
		{
			this.EndActions();
			return;
		}
		this.StartAbilityQueue();
	}

	// Token: 0x0600015F RID: 351 RVA: 0x0001C5D4 File Offset: 0x0001A7D4
	public float AddEffect(string abilityName, Character target)
	{
		Effects effects = target.gameObject.AddComponent<Effects>();
		Links.x.cellar.AddEffects(effects);
		effects.gameObject.SetActive(true);
		effects.source = this.character;
		effects.target = target;
		effects.fromLoad = false;
		effects.effectName = abilityName;
		effects.sourceLevel = 0f;
		effects.Inflicted(false);
		return 0f;
	}

	// Token: 0x06000160 RID: 352 RVA: 0x0001C644 File Offset: 0x0001A844
	public void DamageFX(Character actionTarget, float damage, float hit)
	{
		if (this.character.party && Links.x.rallyStage.playing)
		{
			return;
		}
		string text = Mathf.Round(damage).ToString();
		if (actionTarget.stats && actionTarget.dodging && hit == 0f)
		{
			text += "<line-height=1.2em>\n<cspace=.5em>.<size=2em> ^</size>";
		}
		Animator animator;
		if (actionTarget.npc)
		{
			if ((this.specialAttack1 || this.specialAttack2) && this.firstAttack)
			{
				animator = Links.x.cellar.GetAnimatedText("RallyDmgTotal", text, Records.x.IsTextLeft(this.character, actionTarget));
			}
			else if (this.character.mainSelected)
			{
				animator = Links.x.cellar.GetAnimatedText("PocketDmg", text, Records.x.IsTextLeft(this.character, actionTarget));
			}
			else
			{
				animator = Links.x.cellar.GetAnimatedText("NPCDmg", text, Records.x.IsTextLeft(this.character, actionTarget));
			}
		}
		else if (Links.x.combat.bubbleEvent)
		{
			animator = Links.x.cellar.GetAnimatedText("RallyDmgTotal", text, Records.x.IsTextLeft(this.character, actionTarget));
		}
		else
		{
			animator = Links.x.cellar.GetAnimatedText("PartyDmg", text, Records.x.IsTextLeft(this.character, actionTarget));
		}
		animator.gameObject.transform.position = actionTarget.body.HeadPosition(0f) + new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), 0f);
		animator.gameObject.SetActive(true);
		if (!actionTarget.npc)
		{
			if (actionTarget.portrait)
			{
				actionTarget.portrait.SetHealthColor();
				actionTarget.characterSheetPortrait.SetHealthColor();
				actionTarget.portrait.AnimatorShake();
			}
			if (actionTarget.dockFriend)
			{
				actionTarget.dockFriend.UpdateHealth();
			}
		}
	}

	// Token: 0x06000161 RID: 353 RVA: 0x0001C864 File Offset: 0x0001AA64
	public void UpdateGameFeed(Character actionTarget, float outcome, float damageAmount, string attackRollTotal, string defenseRollTotal, string dmgText, bool usingDart)
	{
		this.str.Clear();
		if (!this.character.npc)
		{
			this.str.Append(Links.x.gameFeed.GetPartyColorText(this.character));
		}
		this.str.Append(this.character.stats.displayName);
		if (!this.character.npc)
		{
			this.str.Append("</color>");
		}
		if (outcome == 0f)
		{
			this.str.Append(" hit ");
			if (!actionTarget.npc)
			{
				this.str.Append(Links.x.gameFeed.GetPartyColorText(actionTarget));
			}
			this.str.Append(actionTarget.stats.GetName());
			if (!actionTarget.npc)
			{
				this.str.Append("</color>");
			}
		}
		else if (outcome == 2f)
		{
			this.str.Append("'s attack was absorbed by ");
			if (!actionTarget.npc)
			{
				this.str.Append(Links.x.gameFeed.GetPartyColorText(actionTarget));
			}
			this.str.Append(actionTarget.stats.GetName());
			if (!actionTarget.npc)
			{
				this.str.Append("</color>");
			}
		}
		else if (outcome == 1f)
		{
			this.str.Append("'s attack was evaded by ");
			if (!actionTarget.npc)
			{
				this.str.Append(Links.x.gameFeed.GetPartyColorText(actionTarget));
			}
			this.str.Append(actionTarget.stats.GetName());
			if (!actionTarget.npc)
			{
				this.str.Append("</color>");
			}
		}
		if (Records.x.showRulesetInfo)
		{
			this.str.Append(" <color #857C6C>... ");
			this.str.Append(attackRollTotal);
			this.str.Append(" vs. ");
			this.str.Append(defenseRollTotal);
			this.str.Append("</color>");
		}
		Links.x.gameFeed.AddFeed(this.str.ToString());
		if ((outcome == 0f || outcome == 2f) && !usingDart)
		{
			this.str.Clear();
			if (!actionTarget.npc)
			{
				this.str.Append(Links.x.gameFeed.GetPartyColorText(actionTarget));
			}
			this.str.Append(actionTarget.stats.GetName());
			if (!actionTarget.npc)
			{
				this.str.Append("</color>");
			}
			this.str.Append(" lost ");
			this.str.Append(Mathf.Round(damageAmount));
			this.str.Append(" health");
			if (Records.x.showRulesetInfo)
			{
				this.str.Append(" <color #857C6C>... ");
				this.str.Append(dmgText);
				this.str.Append("</color>");
			}
			Links.x.gameFeed.AddFeed(this.str.ToString());
		}
		if ((outcome == 0f || outcome == 2f) && usingDart)
		{
			this.str.Clear();
			if (!actionTarget.npc)
			{
				this.str.Append(Links.x.gameFeed.GetPartyColorText(actionTarget));
			}
			this.str.Append(actionTarget.stats.GetName());
			if (!actionTarget.npc)
			{
				this.str.Append("</color>");
			}
			this.str.Append(" pierced with stone, will do ");
			this.str.Append(Mathf.Round(damageAmount));
			this.str.Append(" poison damage");
			if (Records.x.showRulesetInfo)
			{
				this.str.Append(" <color #857C6C>... ");
				this.str.Append(dmgText);
				this.str.Append("</color>");
			}
			Links.x.gameFeed.AddFeed(this.str.ToString());
		}
	}

	// Token: 0x06000162 RID: 354 RVA: 0x0001CCB8 File Offset: 0x0001AEB8
	public void GiveItem()
	{
		this.QueueIcon(true);
		if (Records.x.editor && this.givingItemID > -1)
		{
			Debug.Log("Giving item " + ((this != null) ? this.ToString() : null) + " " + this.givingItemID.ToString());
		}
		this.character.PlayAnimation("Use", 0f);
		GameObject gameObject = null;
		if (this.giveCharacter)
		{
			if (this.givingItemID == -1)
			{
				if (this.character.party && this.giveCharacter.dead && !Links.x.fellowship.AnyoneResurrecting(this.giveCharacter))
				{
					this.ai.busy = true;
					this.ai.PartyResurrection(this.giveCharacter);
				}
			}
			else
			{
				if (Records.x.editor)
				{
					Character character = this.giveCharacter;
					Debug.Log(((character != null) ? character.ToString() : null) + " has item now");
				}
				int invNum = this.character.GetInvNum(this.givingItemID);
				int invNum2 = this.character.GetInvNum(this.givingItemID + 1);
				Vector3 socketNum = this.character.GetSocketNum(this.givingItemID);
				Vector3 socketNum2 = this.character.GetSocketNum(this.givingItemID + 1);
				Vector4 durabilityNum = this.character.GetDurabilityNum(this.givingItemID / 2);
				this.giveCharacter.GiveItem(invNum, invNum2, socketNum, socketNum2, durabilityNum, true);
				this.character.RemoveItem(invNum, 1);
				this.giveCharacter.PlayAnimation("Use", 0f);
				gameObject = Links.x.cellar.GetPooledGameObject(16);
				gameObject.transform.position = this.giveCharacter.transform.position + new Vector3(0f, 1f, 0f);
				gameObject.SetActive(true);
				Library.Inventory inventory = Links.x.library.GetInvRow(invNum);
				MasterAudio.PlaySoundAndForget("Inventory", 1f, new float?(1f), 0f, inventory._Sound, null);
				this.str.Clear();
				if (!this.character.npc)
				{
					this.str.Append(Links.x.gameFeed.GetPartyColorText(this.character));
				}
				this.str.Append(this.character.stats.GetName());
				if (!this.character.npc)
				{
					this.str.Append("</color>");
				}
				this.str.Append(" gives item to  ");
				if (!this.giveCharacter.npc)
				{
					this.str.Append(Links.x.gameFeed.GetPartyColorText(this.giveCharacter));
				}
				this.str.Append(this.giveCharacter.stats.GetName());
				if (!this.giveCharacter.npc)
				{
					this.str.Append("</color>");
				}
				Links.x.gameFeed.AddFeed(this.str.ToString());
				int num = this.giveCharacter.HasItem(invNum);
				if (this.giveCharacter.actions)
				{
					this.giveCharacter.actions.ConsumeItem(num);
					this.str.Clear();
					if (!this.giveCharacter.npc)
					{
						this.str.Append(Links.x.gameFeed.GetPartyColorText(this.giveCharacter));
					}
					this.str.Append(this.giveCharacter.stats.GetName());
					if (!this.giveCharacter.npc)
					{
						this.str.Append("</color>");
					}
					this.str.Append(" consumed ");
					this.str.Append(inventory._DisplayName);
					Links.x.gameFeed.AddFeed(this.str.ToString());
				}
			}
		}
		this.giveCharacter = null;
		this.givingItem = false;
		if (gameObject != null)
		{
			gameObject.SetActive(false);
		}
		this.ClearTargetCharacters();
		if (!this.cannotInterrupt && !this.ai.busy)
		{
			this.EndTurn(true);
			this.canEndAttackTime = true;
			this.EndAttackTime(0f);
		}
	}

	// Token: 0x06000163 RID: 355 RVA: 0x0001D130 File Offset: 0x0001B330
	public void UsingItem()
	{
		this.QueueIcon(true);
		GameObject gameObject = null;
		this.usingItem = false;
		int invNum = this.character.GetInvNum(this.usingItemID);
		this.AddEffectFromItem(invNum);
		if (this.character.npc)
		{
			this.character.RemoveItem(invNum, 1);
		}
		else if (this.usingItemID / 2 < 19)
		{
			Links.x.inventory.RemoveBeltItem(this.usingItemID / 2, this.character);
		}
		else
		{
			this.character.RemoveItem(invNum, 1);
		}
		MasterAudio.PlaySound3DAtVector3AndForget("Amphora", this.character.tr.position, 1f, new float?(1f), 0f, "", null);
		Library.Inventory inventory = Links.x.library.GetInvRow(invNum);
		this.str.Clear();
		if (!this.character.npc)
		{
			this.str.Append(Links.x.gameFeed.GetPartyColorText(this.character));
		}
		this.str.Append(this.character.stats.GetName());
		if (!this.character.npc)
		{
			this.str.Append("</color>");
		}
		this.str.Append(" consumed ");
		this.str.Append(inventory._DisplayName);
		Links.x.gameFeed.AddFeed(this.str.ToString());
		if (gameObject != null)
		{
			gameObject.SetActive(false);
		}
		this.QueueIcon(false);
		if (!this.cannotInterrupt)
		{
			this.EndTurn(true);
		}
	}

	// Token: 0x06000164 RID: 356 RVA: 0x0001D2E4 File Offset: 0x0001B4E4
	public void PickUpItem()
	{
		this.QueueIcon(true);
		int id = this.pickupItem.ID;
		GameObject gameObject = null;
		if (this.pickupItem != null)
		{
			if (this.character.npc)
			{
				this.character.GiveItem(this.pickupItem.ID, this.pickupItem.stackSize, this.pickupItem.socketA, this.pickupItem.socketB, this.pickupItem.durability, false);
				gameObject = Links.x.cellar.GetPooledGameObject(16);
				gameObject.transform.position = this.pickupItem.transform.position + new Vector3(0f, 0.5f, 0f);
				gameObject.SetActive(true);
				MasterAudio.PlaySoundAndForget("Inventory", 1f, new float?(1f), 0f, this.pickupItem.invRow._Sound, null);
				this.pickupItem.DestroyItem(false, false);
			}
			else
			{
				this.pickupItem.Clicked(this.character);
			}
		}
		this.pickupItem = null;
		this.pickingUpItem = false;
		if (gameObject != null)
		{
			gameObject.SetActive(false);
		}
		Library.Inventory inventory = Links.x.library.GetInvRow(id);
		this.str.Clear();
		if (!this.character.npc)
		{
			this.str.Append(Links.x.gameFeed.GetPartyColorText(this.character));
		}
		this.str.Append(this.character.stats.GetName());
		if (!this.character.npc)
		{
			this.str.Append("</color>");
		}
		this.str.Append(" found ");
		this.str.Append(inventory._DisplayName);
		Links.x.gameFeed.AddFeed(this.str.ToString());
		this.character.StartQuip("Found Item");
		if ((float)this.character.stats.HealthCurrent() / (float)this.character.stats.HealthMax() < 0.3f)
		{
			int num = this.character.HasItem(id);
			this.character.actions.ConsumeItem(num);
		}
		if (!this.cannotInterrupt)
		{
			this.EndTurn(true);
		}
	}

	// Token: 0x06000165 RID: 357 RVA: 0x0001D55C File Offset: 0x0001B75C
	public void ConsumeItem(int item)
	{
		if (item > 0)
		{
			int invNum = this.character.GetInvNum(item);
			this.AddEffectFromItem(invNum);
			this.character.RemoveItem(invNum, 1);
			MasterAudio.PlaySound3DAtVector3AndForget("Amphora", this.character.tr.position, 1f, new float?(1f), 0f, "", null);
			if (!this.cannotInterrupt)
			{
				this.EndTurn(true);
			}
		}
	}

	// Token: 0x06000166 RID: 358 RVA: 0x0001D5DC File Offset: 0x0001B7DC
	public void AddEffectFromItem(int itemID)
	{
		Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(itemID);
		this.AddEffect(invRowByIndex._Effect, (float)((int)invRowByIndex._Level));
	}

	// Token: 0x06000167 RID: 359 RVA: 0x0001D610 File Offset: 0x0001B810
	public void AddEffect(string abilityName, float lvl)
	{
		Effects effects = this.character.gameObject.AddComponent<Effects>();
		Links.x.cellar.AddEffects(effects);
		effects.gameObject.SetActive(true);
		effects.source = null;
		effects.target = this.character;
		effects.fromLoad = false;
		effects.effectName = abilityName;
		effects.removeAtSceneSwitch = false;
		effects.tileEffect = null;
		effects.sourceLevel = lvl;
		effects.Inflicted(false);
	}

	// Token: 0x06000168 RID: 360 RVA: 0x0001D688 File Offset: 0x0001B888
	public void CheckForPowerWord(string evt, Character target, GameObject interactiveTarget, GraphNode startNode, string abilityName)
	{
		if (this.character.stats.GetWordsOfPower() && abilityName == "")
		{
			this.words = this.character.stats.words;
			for (int i = 0; i < this.words.Count; i++)
			{
				string text = this.words[i];
				text = text.Substring(0, text.Length - 4);
				Library.Abilities abilityRow = Links.x.library.GetAbilityRow(text);
				if (abilityRow != null && abilityRow._AINotes == evt)
				{
					Effects effects = this.character.gameObject.AddComponent<Effects>();
					Links.x.cellar.AddEffects(effects);
					effects.gameObject.SetActive(true);
					effects.source = this.character;
					effects.target = target;
					effects.fromLoad = false;
					effects.effectName = text;
					effects.removeAtSceneSwitch = false;
					effects.tileEffect = null;
					effects.sourceLevel = 0f;
					effects.Inflicted(false);
				}
			}
		}
		if (abilityName != "")
		{
			Effects effects2 = this.character.gameObject.AddComponent<Effects>();
			Links.x.cellar.AddEffects(effects2);
			effects2.gameObject.SetActive(true);
			effects2.source = this.character;
			effects2.target = target;
			effects2.fromLoad = false;
			effects2.effectName = abilityName;
			effects2.removeAtSceneSwitch = false;
			effects2.tileEffect = null;
			effects2.sourceLevel = 0f;
			effects2.Inflicted(false);
		}
	}

	// Token: 0x06000169 RID: 361 RVA: 0x0001D824 File Offset: 0x0001BA24
	public void AddSpecialAttack(Character target)
	{
		if (this.character.stats.hasEveryAttackAI && !this.character.stats.pinned)
		{
			string everyAttackAI = this.character.stats.everyAttackAI;
			if (everyAttackAI == "Evade")
			{
				Vector3 vector = this.character.currentPosition + Quaternion.LookRotation(this.character.currentPosition - target.currentPosition) * Vector3.forward * 2.5f * 1f;
				this.nodeConstraint.walkable = true;
				this.nodeConstraint.constrainWalkability = true;
				this.nodeConstraint.constrainTags = true;
				this.nodeConstraint.passID = this.character.nodeStationaryID;
				this.nodeConstraint.passID2 = this.character.nodeMovingID;
				this.nodeConstraint.checkCircleID = 0;
				this.nodeConstraint.checkConnections = this.character.ConnectionNumber();
				this.nodeConstraint.constrainToArea = (int)this.character.node.Area;
				GraphNode slideNode = this.character.GetSlideNode(vector, this.character.node, true, 0, 2);
				if (slideNode != null && this.character.stats.Stuck() == 0 && !this.character.jumping && ((Vector3)slideNode.position - this.character.currentPosition).sqrMagnitude < 25f && PathUtilities.IsPathPossible(slideNode, this.character.node))
				{
					this.character.Jump(slideNode, (Vector3)slideNode.position, true, false);
					this.character.evading = true;
					this.character.blockDodgeStartTime = Links.x.gameplay.seconds;
				}
			}
			if (everyAttackAI == "Knockback")
			{
				GraphNode graphNode = target.node;
				if (graphNode == null)
				{
					graphNode = target.NearNode(target.currentPosition, false, 0, -1, 0);
				}
				if (graphNode != null && this.ai)
				{
					string text = "Cannonball";
					if (Random.Range(0, 2) == 0)
					{
						text += "1";
					}
					else
					{
						text += "2";
					}
					MasterAudio.PlaySound3DAtVector3AndForget("SpecialAttacks", this.character.currentPosition, 0.5f, new float?(1f), 0f, text, null);
					GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(112);
					pooledGameObject.transform.position = target.currentPosition;
					pooledGameObject.SetActive(true);
					for (int i = 0; i < 9; i++)
					{
						Vector3 vector2 = (Vector3)graphNode.position;
						GraphNode graphNode2;
						if (i < 8)
						{
							graphNode2 = graphNode.ConnectionFromIndex(i);
						}
						else
						{
							vector2 = this.character.currentPosition;
							graphNode2 = graphNode;
						}
						if (graphNode2 != null && graphNode2.ID != 0 && graphNode2.ID != this.character.nodeStationaryID && graphNode2.ID != this.character.nodeMovingID)
						{
							Character nodeCharacter = this.character.GetNodeCharacter(graphNode2.ID);
							if (nodeCharacter)
							{
								nodeCharacter.Knockback(vector2, 1, false, true, false);
								if (nodeCharacter != target)
								{
									nodeCharacter.PlayAnimation("HitInterrupt", 0f);
								}
								if (this.ai.CanAttack(nodeCharacter) && nodeCharacter != target)
								{
									nodeCharacter.SetRotation(Quaternion.LookRotation(this.character.currentPosition - nodeCharacter.currentPosition), false, true);
									Effects effects = nodeCharacter.gameObject.AddComponent<Effects>();
									Links.x.cellar.AddEffects(effects);
									effects.gameObject.SetActive(true);
									effects.source = this.character;
									effects.target = nodeCharacter;
									effects.effectName = "Impact";
									effects.sourceLevel = Records.x.ChargeAmount((float)this.character.stats.level);
									effects.Inflicted(true);
									MasterAudio.PlaySound3DAtVector3AndForget("Swing", this.character.tr.position, 1f, new float?(1f), 0f, "", null);
									MasterAudio.PlaySound3DAtVector3AndForget(nodeCharacter.stats.characterRow._UnarmedAttackSound, nodeCharacter.currentPosition, Random.Range(0.2f, 0.3f), new float?(1f), 0f, "", null);
								}
							}
						}
					}
				}
			}
		}
	}

	// Token: 0x0600016A RID: 362 RVA: 0x0001DCF8 File Offset: 0x0001BEF8
	public void CheckForEnchantedWeapon(string evt, Character target, GameObject interactiveTarget, GraphNode startNode, out int multiTargetCount)
	{
		bool flag = false;
		bool flag2 = false;
		Vector3 vector = Vector3.zero;
		Vector3 vector2 = Vector3.zero;
		multiTargetCount = 0;
		for (int i = 0; i < 2; i++)
		{
			if (this.currentHand == i)
			{
				Library.Inventory inventory = null;
				if (i == 0)
				{
					inventory = this.character.invRow1;
				}
				if (i == 1)
				{
					inventory = this.character.invRow2;
				}
				if (inventory._ID > 1 && inventory._Tag == "Weapon")
				{
					vector = this.character.GetSocketNum(i * 2);
					vector2 = this.character.GetSocketNum(i * 2 + 1);
					if (vector.x > 0f && this.character.stats.CanWearEnchantedItem(vector2.z))
					{
						flag = true;
					}
				}
			}
		}
		if (flag || flag2)
		{
			Library.Pagan paganRowByID = Links.x.library.GetPaganRowByID((float)((int)vector.x));
			Library.Abilities abilityRow = Links.x.library.GetAbilityRow(paganRowByID._ID);
			if (paganRowByID != null && abilityRow != null)
			{
				float num = 0f;
				float num2 = 0f;
				float num3 = 0f;
				float num4 = 0f;
				int number = paganRowByID._Number;
				if (evt == abilityRow._Trigger)
				{
					for (int j = 0; j < 3; j++)
					{
						string text = paganRowByID._Slider1;
						float num5 = vector.y;
						if (j == 1)
						{
							text = paganRowByID._Slider2;
							num5 = vector.z;
						}
						if (j == 2)
						{
							text = paganRowByID._Slider3;
							num5 = vector2.x;
						}
						if (text != "")
						{
							if (text == "Radius")
							{
								num3 = num5;
							}
							if (text.Contains("Duration") || text.Contains("Time"))
							{
								num2 = num5;
							}
							if (text.Contains("Potency"))
							{
								num = num5;
							}
							if (text.Contains("Time") && number == 17)
							{
								num = num5;
							}
							if (text.Contains("Debuff"))
							{
								num = num5;
							}
							if (text.Contains("Reduction"))
							{
								num = num5;
							}
							if (text == "Targets")
							{
								num4 = Mathf.Round(num5);
							}
							if (text == "Distance")
							{
								num = Mathf.Round(num5);
							}
							if (text == "Tile")
							{
								num = Mathf.Round(num5);
							}
						}
					}
					if (evt == "PreAttack")
					{
						multiTargetCount = abilityRow._MultiTarget;
						if (multiTargetCount > 0)
						{
							multiTargetCount = (int)num4;
						}
					}
					bool flag3 = true;
					if ((number == 56 || number == 57) && !this.character.hasCircleBuff)
					{
						flag3 = false;
					}
					if (number == 58 && !target.stats.HasInstrumentEffect("Horn"))
					{
						flag3 = false;
					}
					if (Records.x.editor)
					{
						string[] array = new string[17];
						int num6 = 0;
						Character character = this.character;
						array[num6] = ((character != null) ? character.ToString() : null);
						array[1] = " using enchanted weapon ";
						array[2] = multiTargetCount.ToString();
						array[3] = " ";
						array[4] = abilityRow._MultiTarget.ToString();
						array[5] = " ";
						array[6] = ((int)num4).ToString();
						array[7] = " ";
						int num7 = 8;
						Vector3 vector3 = vector;
						array[num7] = vector3.ToString();
						array[9] = " ";
						int num8 = 10;
						vector3 = vector2;
						array[num8] = vector3.ToString();
						array[11] = " ";
						array[12] = num.ToString();
						array[13] = " ";
						int num9 = 14;
						Character character2 = target;
						array[num9] = ((character2 != null) ? character2.ToString() : null);
						array[15] = " ";
						array[16] = flag3.ToString();
						Debug.Log(string.Concat(array));
					}
					if (num3 == 0f && flag3)
					{
						if (abilityRow._MultiTarget == -1)
						{
							target = this.character;
						}
						if (target)
						{
							if (Links.x.library.GetEffectRow(paganRowByID._ID)._IsBuff)
							{
								target = this.character;
							}
							Effects effects = target.gameObject.AddComponent<Effects>();
							Links.x.cellar.AddEffects(effects);
							effects.gameObject.SetActive(true);
							effects.source = this.character;
							effects.target = target;
							effects.fromLoad = false;
							effects.effectName = paganRowByID._ID;
							effects.sourceLevel = num;
							if (num2 > 0f)
							{
								effects.overrideDuration = Records.x.RealSecondsToGameSeconds(num2);
							}
							effects.Inflicted(false);
							return;
						}
					}
					else if (flag3)
					{
						if (startNode == null && target && num3 > 0f)
						{
							target.FindCurrentNode(false);
							startNode = target.node;
						}
						if (startNode != null)
						{
							TileEffects tileEffects = Links.x.tileEffects.AddComponent<TileEffects>();
							tileEffects.gameObject.SetActive(true);
							tileEffects.severity = 0f;
							tileEffects.spellIndex = this.spellIndex;
							tileEffects.paganRow = paganRowByID;
							tileEffects.mainSkill = abilityRow._MainSkill;
							tileEffects.tether = 0f;
							tileEffects.spellScroll = null;
							tileEffects.fromEnchantedItem = true;
							tileEffects.timeToWait = num2;
							tileEffects.spellDuration = num2;
							tileEffects.radius = num3;
							tileEffects.sourceLevel = (float)((int)num);
							tileEffects.targetCount = (int)Mathf.Abs(num4);
							tileEffects.startNode = startNode;
							if (evt == "Attack" && (paganRowByID._Slider1.Contains("Target") || paganRowByID._Slider2.Contains("Target") || paganRowByID._Slider3.Contains("Target")))
							{
								tileEffects.singleTarget = target;
								tileEffects.singleTargetInteractive = interactiveTarget;
							}
							tileEffects.Setup(abilityRow, null, null, null, null, this.character);
							return;
						}
					}
				}
			}
			else
			{
				string[] array2 = new string[9];
				int num10 = 0;
				Character character3 = this.character;
				array2[num10] = ((character3 != null) ? character3.ToString() : null);
				array2[1] = " missing something from enchant ";
				int num11 = 2;
				Library.Pagan pagan = paganRowByID;
				array2[num11] = ((pagan != null) ? pagan.ToString() : null);
				array2[3] = " ";
				int num12 = 4;
				Library.Abilities abilities = abilityRow;
				array2[num12] = ((abilities != null) ? abilities.ToString() : null);
				array2[5] = " ";
				int num13 = 6;
				GraphNode graphNode = startNode;
				array2[num13] = ((graphNode != null) ? graphNode.ToString() : null);
				array2[7] = " ";
				int num14 = 8;
				Character character4 = target;
				array2[num14] = ((character4 != null) ? character4.ToString() : null);
				Debug.Log(string.Concat(array2));
			}
		}
	}

	// Token: 0x0600016B RID: 363 RVA: 0x0001E360 File Offset: 0x0001C560
	public void SpellFromTrigger(string spellToCast, string unique, Character t)
	{
		this.StopAction();
		this.RemoveAbility();
		this.ClearTargetCharacters();
		this.AddTarget(t);
		this.spellNode = t.node;
		this.spellIndex = this.character.stats.SpellIndex(spellToCast);
		this.paganRow = Links.x.library.GetPaganRow(spellToCast);
		this.Ability(spellToCast, unique, false, true);
		this.CastSpell(t, true, t.node, Vector3.zero, true, true);
	}

	// Token: 0x0600016C RID: 364 RVA: 0x0001E3E0 File Offset: 0x0001C5E0
	private void OnDisable()
	{
		if (this.chargeUpFX)
		{
			Links.x.cellar.ReturnPooledGameObject(this.chargeUpNum, this.chargeUpFX);
			this.chargeUpFX = null;
			MasterAudio.StopSoundGroupOfTransform(this.character.tr, "SpecialAttacks");
		}
	}

	// Token: 0x0600016D RID: 365 RVA: 0x0001E434 File Offset: 0x0001C634
	private void OnDestroy()
	{
		if (this.chargeUpFX)
		{
			Links.x.cellar.ReturnPooledGameObject(this.chargeUpNum, this.chargeUpFX);
			this.chargeUpFX = null;
			MasterAudio.StopSoundGroupOfTransform(this.character.tr, "SpecialAttacks");
		}
	}

	// Token: 0x0600016E RID: 366 RVA: 0x0001E488 File Offset: 0x0001C688
	public void EndActions()
	{
		if (this.channeling)
		{
			this.EndChanneling(false);
		}
		if (this.character.mainSelected && Records.x.pocketPause)
		{
			this.canEndAttackTime = true;
		}
		if (this.ai.busy || this.character.stats.pinning || (Links.x.combat.inPocketAttack && (this.character == Links.x.main || this.character == Links.x.pocketWheel.selectedRallyCharacter)))
		{
			this.endActionsAfterTurn = true;
			return;
		}
		this.EndAttackTime(0f);
		if (this.chargeUpFX)
		{
			Links.x.cellar.ReturnPooledGameObject(this.chargeUpNum, this.chargeUpFX);
			this.chargeUpFX = null;
			MasterAudio.StopSoundGroupOfTransform(this.character.tr, "SpecialAttacks");
		}
		if (!Records.x.combat && this.character.mainSelected)
		{
			Links.x.hudControl.timelineAnimator.Play("Timeline End");
		}
		if (this.spellCoroutine != null)
		{
			base.StopCoroutine(this.spellCoroutine);
			this.spellCoroutine = null;
		}
		if (this.instrumentCoroutine != null)
		{
			this.EndPlayingInstrument();
			if (this.instrumentCoroutine != null)
			{
				base.StopCoroutine(this.instrumentCoroutine);
			}
			this.instrumentCoroutine = null;
		}
		if (this.startAttackCoroutine != null)
		{
			this.endActionsAfterTurn = true;
			return;
		}
		if (this.actionCoroutine != null)
		{
			this.endActionsAfterTurn = true;
			return;
		}
		if (this.castCompleteCoroutine != null || this.instrumentCoroutine != null || this.wordCoroutine != null)
		{
			this.endActionsAfterTurn = true;
			return;
		}
		if (this.projectiles.Count > 0)
		{
			this.endActionsAfterTurn = true;
			return;
		}
		if (this.pinTarget)
		{
			return;
		}
		if (this.spellCasterFX)
		{
			Links.x.cellar.ReturnPooledGameObject(69, this.spellCasterFX);
		}
		if (this.spellWaveFX)
		{
			Links.x.cellar.ReturnPooledGameObject(88, this.spellWaveFX);
			this.spellWaveFX = null;
		}
		if (this.spellCasterTargetFX)
		{
			Links.x.cellar.ReturnPooledGameObject(70, this.spellCasterTargetFX);
		}
		if (Links.x.gameplay.actionCharacter == this.character)
		{
			Links.x.gameplay.actionCharacter = null;
			Links.x.gameplay.currentAbility = "";
		}
		this.readyToAttack = false;
		this.EndVine();
		this.character.MoveBackEmpty();
		this.character.body.EndBlink();
		this.spellScroll = null;
		this.character.hasActions = false;
		this.character.inAction = false;
		this.character.inRecovery = false;
		if (this.character.stats.pinning)
		{
			this.character.stats.HealEffect("Pinning");
			this.character.stats.pinning = false;
		}
		if (this.character.sailing)
		{
			this.character.NeedToUpdateSailingAnimator(false);
		}
		if (this.character.timelineIcon)
		{
			this.character.timelineIcon.overridePause = false;
		}
		this.character.inQueuedAbility = false;
		this.character.stats.lastActionModifier = 1f;
		if (Records.x.combatConsoleDebugging)
		{
			string[] array = new string[10];
			array[0] = "Leaving combat ";
			int num = 1;
			Character character = this.character;
			array[num] = ((character != null) ? character.ToString() : null);
			array[2] = " ";
			int num2 = 3;
			IEnumerator enumerator = this.castCompleteCoroutine;
			array[num2] = ((enumerator != null) ? enumerator.ToString() : null);
			array[4] = " ";
			int num3 = 5;
			IEnumerator enumerator2 = this.startAttackCoroutine;
			array[num3] = ((enumerator2 != null) ? enumerator2.ToString() : null);
			array[6] = " ";
			int num4 = 7;
			IEnumerator enumerator3 = this.actionCoroutine;
			array[num4] = ((enumerator3 != null) ? enumerator3.ToString() : null);
			array[8] = " ";
			int num5 = 9;
			IEnumerator enumerator4 = this.instrumentCoroutine;
			array[num5] = ((enumerator4 != null) ? enumerator4.ToString() : null);
			Debug.Log(string.Concat(array));
		}
		this.ai.ClearCoroutines();
		if (this.ai)
		{
			Object.Destroy(this.ai);
		}
		if (this.character.timelineIcon)
		{
			this.character.timelineIcon.End();
			this.character.timelineIcon = null;
		}
		if (this.character.heard)
		{
			this.character.heard.SetActive(false);
			Links.x.cellar.ReturnPooledGameObject(22, this.character.heard);
			this.character.heard = null;
		}
		this.QueueIcon(false);
		Links.x.combat.RemoveFromNeedsTurn(this.character);
		if (this.character)
		{
			this.character.body.animationHold = false;
			this.character.body.SetSeeThroughAmount();
			if (this.character.mainSelected || this.character == Links.x.combat.rallyCharacter)
			{
				this.character.body.CombatSheen(0);
				Links.x.cameraEffects.RemoveCombatCharacters();
			}
			if (this.character.npc && this.character.creatures.creatures.temperament == Creatures.temperamentState.FightsIfAttacked && (this.character.stats.characterRow._Quest == "" || (this.character.hostility < 2 && !Links.x.sensory.CheckProof(this.character))) && Records.x.BribeBadgeCount() == 0)
			{
				Links.x.combat.AddHostilityReduceCharacter(this.character);
			}
			Links.x.combat.RemoveTimelineIcon(this.character);
			this.character.searching = false;
			this.character.inCombat = false;
			this.character.actions = null;
			this.character.EndCombat();
			this.character.hasLKP = false;
			this.character.ClearLKP();
			if (this.character.boatNavigator && this.character.sailing)
			{
				this.character.boat.EndCombat();
			}
		}
		Object.Destroy(this);
	}

	// Token: 0x0600016F RID: 367 RVA: 0x0001EAF0 File Offset: 0x0001CCF0
	public Character AttackInBound(out bool dodgeSideways)
	{
		dodgeSideways = false;
		Character character = this.ai.NearbyAttackingEnemy();
		Character character2 = null;
		if (!character)
		{
			character2 = this.ai.NearbyAttackingProjectileCharacter();
			dodgeSideways = true;
		}
		if (character)
		{
			return character;
		}
		if (character2)
		{
			return character2;
		}
		return null;
	}

	// Token: 0x06000170 RID: 368 RVA: 0x0001EB3C File Offset: 0x0001CD3C
	public bool InAttackDirection(Character target)
	{
		if (!target)
		{
			return false;
		}
		if (!this.character)
		{
			return false;
		}
		if (target.dead)
		{
			return true;
		}
		Vector3 forward = this.character.body.tr.forward;
		Vector3 currentPosition = target.currentPosition;
		Vector3 currentPosition2 = this.character.currentPosition;
		currentPosition.y = currentPosition2.y;
		Vector3 vector = Vector3.Normalize(currentPosition - currentPosition2);
		return Vector3.Dot(forward, vector) >= 0.5f;
	}

	// Token: 0x06000171 RID: 369 RVA: 0x0001EBC0 File Offset: 0x0001CDC0
	public bool AboveMinDistance(Character target)
	{
		if (!target)
		{
			return false;
		}
		if (!this.character)
		{
			return false;
		}
		if (target.dead)
		{
			return true;
		}
		this.invRow = this.character.invRow1;
		if (this.invRow == null)
		{
			return false;
		}
		float num = 0.1f;
		float num2 = (this.invRow._MeleeRangeStart * Records.x.nodeSize + this.character.attackRadius + target.attackRadius + num) * (this.invRow._MeleeRangeStart * Records.x.nodeSize + this.character.attackRadius + target.attackRadius + num);
		return this.character.SubtractVectors(this.GetPosition(this.character), this.GetPosition(target)).sqrMagnitude >= num2;
	}

	// Token: 0x06000172 RID: 370 RVA: 0x0001EC98 File Offset: 0x0001CE98
	public bool InAttackRange(Character target)
	{
		if (!target)
		{
			return false;
		}
		if (!this.character)
		{
			return false;
		}
		if (target.dead)
		{
			return true;
		}
		this.invRow = this.character.invRow1;
		if (this.invRow == null)
		{
			return false;
		}
		float num = 0.1f;
		float num2 = this.invRow._MeleeRangeEnd;
		if (this.hasPowerDraw)
		{
			num2 += 30f;
		}
		float num3 = (num2 * Records.x.nodeSize + this.character.attackRadius + target.attackRadius + num) * (num2 * Records.x.nodeSize + this.character.attackRadius + target.attackRadius + num);
		float num4 = (this.invRow._MeleeRangeStart * Records.x.nodeSize + this.character.attackRadius + target.attackRadius + num) * (this.invRow._MeleeRangeStart * Records.x.nodeSize + this.character.attackRadius + target.attackRadius + num);
		if (num4 == num3 || this.invRow._MeleeRangeStart == 0f)
		{
			num4 = 0f;
		}
		float sqrMagnitude = this.character.SubtractVectors(this.GetPosition(this.character), this.GetPosition(target)).sqrMagnitude;
		return !this.TargetOutOfSight(target) && (sqrMagnitude <= num3 && sqrMagnitude >= num4);
	}

	// Token: 0x06000173 RID: 371 RVA: 0x0001EE00 File Offset: 0x0001D000
	public bool InAttackRangeObject(GameObject target)
	{
		if (!target)
		{
			return false;
		}
		this.invRow = this.character.invRow1;
		if (this.invRow == null)
		{
			return false;
		}
		float num = 0.1f;
		float num2 = this.invRow._MeleeRangeEnd;
		if (this.hasPowerDraw)
		{
			num2 += 30f;
		}
		Vector3 vector = target.transform.position;
		DoorActions component = target.GetComponent<DoorActions>();
		if (component)
		{
			vector = component.lockColliderPosition;
		}
		float num3 = (num2 * Records.x.nodeSize + this.character.attackRadius + 1f + num) * (num2 * Records.x.nodeSize + this.character.attackRadius + 1f + num);
		float num4 = (this.invRow._MeleeRangeStart * Records.x.nodeSize + this.character.attackRadius + 1f + num) * (this.invRow._MeleeRangeStart * Records.x.nodeSize + this.character.attackRadius + 1f + num);
		if (num4 == num3 || this.invRow._MeleeRangeStart == 0f)
		{
			num4 = 0f;
		}
		float sqrMagnitude = this.character.SubtractVectors(this.GetPosition(this.character), vector).sqrMagnitude;
		return !this.TargetOutOfSight(target) && (sqrMagnitude <= num3 && sqrMagnitude >= num4);
	}

	// Token: 0x06000174 RID: 372 RVA: 0x0001EF6C File Offset: 0x0001D16C
	public bool TargetOutOfSight(GameObject target)
	{
		this.invRow = this.character.invRow1;
		if (this.invRow._MainSkill != "Pole" && this.invRow._MainSkill != "Elixir" && !this.hasPowerDraw)
		{
			Vector3 vector = target.transform.position;
			DoorActions component = target.GetComponent<DoorActions>();
			if (component)
			{
				vector = component.lockColliderPosition;
			}
			RaycastHit raycastHit;
			if (Physics.Linecast(this.character.raycastPosition, vector + new Vector3(0f, 4f, 0f), out raycastHit, Links.x.sightBlockers))
			{
				return !(raycastHit.collider.gameObject == target) && !(raycastHit.collider.gameObject == target.transform.parent.gameObject);
			}
		}
		return false;
	}

	// Token: 0x06000175 RID: 373 RVA: 0x0001F064 File Offset: 0x0001D264
	public bool TargetOutOfSight(Character target)
	{
		return this.invRow != null && (this.invRow._MainSkill != "Pole" && this.invRow._MainSkill != "Elixir" && !this.hasPowerDraw && Physics.Linecast(this.character.raycastPosition, target.AddVectorY(this.GetPosition(target), 2f), Links.x.sightBlockers));
	}

	// Token: 0x06000176 RID: 374 RVA: 0x0001F0E8 File Offset: 0x0001D2E8
	public float AttackRange(Character target)
	{
		if (!target)
		{
			return 10000f;
		}
		float num = 0.1f;
		float num2 = this.invRow._MeleeRangeEnd;
		if (this.hasPowerDraw)
		{
			num2 += 30f;
		}
		return (num2 * Records.x.nodeSize + this.character.attackRadius + target.attackRadius + num) * (num2 * Records.x.nodeSize + this.character.attackRadius + target.attackRadius + num);
	}

	// Token: 0x06000177 RID: 375 RVA: 0x0001F168 File Offset: 0x0001D368
	public float AttackRangeObject(GameObject target)
	{
		if (!target)
		{
			return 10000f;
		}
		float num = 0.1f;
		float num2 = this.invRow._MeleeRangeEnd;
		if (this.hasPowerDraw)
		{
			num2 += 30f;
		}
		return (num2 * Records.x.nodeSize + this.character.attackRadius + 1f + num) * (num2 * Records.x.nodeSize + this.character.attackRadius + 1f + num);
	}

	// Token: 0x06000178 RID: 376 RVA: 0x0001F1E8 File Offset: 0x0001D3E8
	public bool InItemRange(Character t, Character a)
	{
		float num = (1f * Records.x.nodeSize + a.attackRadius + t.attackRadius) * (1f * Records.x.nodeSize + a.attackRadius + a.attackRadius + t.attackRadius);
		Vector3 position = this.GetPosition(a);
		position.y = this.GetPosition(t).y;
		return a.SubtractVectors(this.GetPosition(t), position).sqrMagnitude <= num;
	}

	// Token: 0x06000179 RID: 377 RVA: 0x0001F274 File Offset: 0x0001D474
	public bool InSongRange(Character t, Character a)
	{
		float num = (this.songRange * Records.x.nodeSize + a.attackRadius + t.attackRadius) * (this.songRange * Records.x.nodeSize + a.attackRadius + a.attackRadius + t.attackRadius);
		return a.SubtractVectors(this.GetPosition(t), this.GetPosition(a)).sqrMagnitude <= num;
	}

	// Token: 0x0600017A RID: 378 RVA: 0x0001F2EC File Offset: 0x0001D4EC
	public bool InItemRange(Character a, Vector3 position)
	{
		float num = 1f;
		float num2 = (num * Records.x.nodeSize + a.attackRadius) * (num * Records.x.nodeSize + a.attackRadius);
		Vector3 position2 = this.GetPosition(a);
		position2.y = position.y;
		return a.SubtractVectors(position, position2).sqrMagnitude <= num2;
	}

	// Token: 0x0600017B RID: 379 RVA: 0x0001F352 File Offset: 0x0001D552
	public Library.Abilities GetCurrentSpell()
	{
		return this.spell;
	}

	// Token: 0x0600017C RID: 380 RVA: 0x0001F35A File Offset: 0x0001D55A
	public string GetCurrentSpellName()
	{
		return this.currentSpellName;
	}

	// Token: 0x0600017D RID: 381 RVA: 0x0001F362 File Offset: 0x0001D562
	public Projectile GetFirstProjectile()
	{
		if (this.ProjectileCount() > 0)
		{
			return this.projectiles[0];
		}
		return null;
	}

	// Token: 0x0600017E RID: 382 RVA: 0x0001F37B File Offset: 0x0001D57B
	public int ProjectileCount()
	{
		return this.projectiles.Count;
	}

	// Token: 0x0600017F RID: 383 RVA: 0x0001F388 File Offset: 0x0001D588
	public Character GetTarget()
	{
		if (this.actionTargets.Count > 0)
		{
			return this.actionTargets[0];
		}
		return null;
	}

	// Token: 0x06000180 RID: 384 RVA: 0x0001F3A6 File Offset: 0x0001D5A6
	public Vector3 GetPosition(Character target)
	{
		return target.tr.position;
	}

	// Token: 0x06000181 RID: 385 RVA: 0x0001F3B4 File Offset: 0x0001D5B4
	public void QueueIcon(bool state)
	{
		if (this.character.party && this.character.portrait)
		{
			this.character.portrait.QueueIcon(state);
			if (this.selectedTarget != null && this.character.selected && !Records.x.paused)
			{
				this.selectedTarget.isTarget = true;
				this.selectedTarget.CircleAnimation("");
			}
			if (this.selectedTargetInteractive != null)
			{
				bool selected = this.character.selected;
			}
			if (this.actionTargets.Count > 0 && this.character.selected)
			{
				for (int i = 0; i < this.actionTargets.Count; i++)
				{
					if (this.actionTargets[i] && this.actionTargets[i].npc && !Records.x.paused)
					{
						this.actionTargets[i].isTarget = true;
						this.actionTargets[i].CircleAnimation("");
					}
				}
			}
		}
	}

	// Token: 0x06000182 RID: 386 RVA: 0x0001F4DF File Offset: 0x0001D6DF
	public int TargetCount()
	{
		return this.actionTargets.Count;
	}

	// Token: 0x06000183 RID: 387 RVA: 0x0001F4EC File Offset: 0x0001D6EC
	public bool HasTarget(Character t)
	{
		return this.character.selected && (this.selectedTarget == t || (this.selectedTarget == null && this.actionTargets.Contains(t)));
	}

	// Token: 0x06000184 RID: 388 RVA: 0x0001F52C File Offset: 0x0001D72C
	public bool ActionTargetsContains(Character t)
	{
		return this.actionTargets.Contains(t);
	}

	// Token: 0x06000185 RID: 389 RVA: 0x0001F53F File Offset: 0x0001D73F
	public bool DamageTargets(Character t)
	{
		return this.targets.Contains(t);
	}

	// Token: 0x06000186 RID: 390 RVA: 0x0001F554 File Offset: 0x0001D754
	public bool HasMove()
	{
		bool flag = false;
		for (int i = 0; i < this.current.Count; i++)
		{
			if (this.current[i].Contains("Move"))
			{
				flag = true;
			}
		}
		return flag;
	}

	// Token: 0x06000187 RID: 391 RVA: 0x0001F594 File Offset: 0x0001D794
	public float GetActionSpeed(string type)
	{
		float num;
		if (type != "Spell")
		{
			num = 0.1f;
		}
		else if (Records.x.banquetIsle || this.character.stats.semizenMagic)
		{
			num = 2f;
		}
		else
		{
			num = 0.001f;
		}
		return num;
	}

	// Token: 0x06000188 RID: 392 RVA: 0x0001F5EC File Offset: 0x0001D7EC
	public void ClearMoves()
	{
		bool flag = false;
		for (int i = 0; i < this.current.Count; i++)
		{
			if (this.current[i].Contains("Move"))
			{
				this.current[i] = "empty";
				flag = true;
			}
		}
		if (flag)
		{
			this.current.RemoveAll((string item) => item == "empty");
		}
	}

	// Token: 0x06000189 RID: 393 RVA: 0x0001F66A File Offset: 0x0001D86A
	private bool IsInstrument(string type)
	{
		return type == "Flute" || type == "Pipe" || type == "Drum" || type == "Horn";
	}

	// Token: 0x0600018A RID: 394 RVA: 0x0001F6A9 File Offset: 0x0001D8A9
	private bool IsWord(string type)
	{
		return type == "Melee" || type == "Range" || type == "Defense";
	}

	// Token: 0x0600018B RID: 395 RVA: 0x0001F6DC File Offset: 0x0001D8DC
	public GraphNode GetInteractiveObjectNode(GameObject obj)
	{
		this.nodeConstraint.constrainWalkability = true;
		this.nodeConstraint.walkable = true;
		this.nodeConstraint.constrainTags = false;
		this.nodeConstraint.checkCircleID = 0;
		this.nodeConstraint.passID = 0;
		this.nodeConstraint.passID2 = 0;
		this.nodeConstraint.checkConnections = 0;
		this.nodeConstraint.constrainPenalty = 0;
		this.nodeConstraint.constrainToArea = -1;
		return AstarPath.active.GetNearest(obj.transform.position, this.nodeConstraint).node;
	}

	// Token: 0x0400028B RID: 651
	[Header("ACTIONS")]
	public List<string> current = new List<string>();

	// Token: 0x0400028C RID: 652
	public Character character;

	// Token: 0x0400028D RID: 653
	private StringFast str = new StringFast(64);

	// Token: 0x0400028E RID: 654
	public AttackAI ai;

	// Token: 0x0400028F RID: 655
	public GraphNode targetMovePosition;

	// Token: 0x04000290 RID: 656
	public Character currentTarget;

	// Token: 0x04000291 RID: 657
	public List<int> hits = new List<int>();

	// Token: 0x04000292 RID: 658
	public List<Character> targets = new List<Character>();

	// Token: 0x04000293 RID: 659
	public List<GameObject> targetsInteractive = new List<GameObject>();

	// Token: 0x04000294 RID: 660
	public List<string> hitText = new List<string>();

	// Token: 0x04000295 RID: 661
	public List<string> attackTotal = new List<string>();

	// Token: 0x04000296 RID: 662
	public List<string> defenseTotal = new List<string>();

	// Token: 0x04000297 RID: 663
	public List<float> damages = new List<float>();

	// Token: 0x04000298 RID: 664
	public List<string> songsWordsQueued = new List<string>();

	// Token: 0x04000299 RID: 665
	public List<bool> songsWordsQueuedTrigger = new List<bool>();

	// Token: 0x0400029A RID: 666
	public List<GameObject[]> queuedSongWordsTargets = new List<GameObject[]>();

	// Token: 0x0400029B RID: 667
	private GameObject[] saveTargets;

	// Token: 0x0400029C RID: 668
	private GameObject[] doSaveTargets;

	// Token: 0x0400029D RID: 669
	public List<Projectile> projectiles = new List<Projectile>();

	// Token: 0x0400029E RID: 670
	public string currentAction;

	// Token: 0x0400029F RID: 671
	public bool pocketQueued;

	// Token: 0x040002A0 RID: 672
	public bool pocketAttack;

	// Token: 0x040002A1 RID: 673
	public bool heavyAttack;

	// Token: 0x040002A2 RID: 674
	public bool lightAttack;

	// Token: 0x040002A3 RID: 675
	public bool specialAttack1;

	// Token: 0x040002A4 RID: 676
	public bool specialAttack2;

	// Token: 0x040002A5 RID: 677
	public bool specialAttack3;

	// Token: 0x040002A6 RID: 678
	public bool charming;

	// Token: 0x040002A7 RID: 679
	public bool checkingMultiTarget;

	// Token: 0x040002A8 RID: 680
	private List<TimedBreakable> timedBreakables;

	// Token: 0x040002A9 RID: 681
	private List<BreakableActions> diaBreakables;

	// Token: 0x040002AA RID: 682
	private List<DoorActions> diaDoors;

	// Token: 0x040002AB RID: 683
	private List<ChestActions> diaChests;

	// Token: 0x040002AC RID: 684
	private List<TileEffects> currentTileEffects;

	// Token: 0x040002AD RID: 685
	public bool endActionsAfterTurn;

	// Token: 0x040002AE RID: 686
	public bool choosingTurn;

	// Token: 0x040002AF RID: 687
	public float useSpeed = 0.5f;

	// Token: 0x040002B0 RID: 688
	public bool queueInterrupt;

	// Token: 0x040002B1 RID: 689
	public bool readyToAttack;

	// Token: 0x040002B2 RID: 690
	public bool combatStartPassives;

	// Token: 0x040002B3 RID: 691
	public bool repathing;

	// Token: 0x040002B4 RID: 692
	public bool hasTarget;

	// Token: 0x040002B5 RID: 693
	public bool hasWaypoint;

	// Token: 0x040002B6 RID: 694
	public Character selectedTarget;

	// Token: 0x040002B7 RID: 695
	public Character currentlyTargeting;

	// Token: 0x040002B8 RID: 696
	public GameObject selectedTargetInteractive;

	// Token: 0x040002B9 RID: 697
	public GameObject selectedAITargetInteractive;

	// Token: 0x040002BA RID: 698
	public GameObject prevSelectedTargetInteractive;

	// Token: 0x040002BB RID: 699
	public GameObject rallyInteractiveTarget;

	// Token: 0x040002BC RID: 700
	public bool hasPowerDraw;

	// Token: 0x040002BD RID: 701
	private List<GraphNode> noUse;

	// Token: 0x040002BE RID: 702
	private List<Character> characters;

	// Token: 0x040002BF RID: 703
	public Library.Inventory invRow;

	// Token: 0x040002C0 RID: 704
	public string currentSpellName;

	// Token: 0x040002C1 RID: 705
	public string spellSkill;

	// Token: 0x040002C2 RID: 706
	public int currentHand;

	// Token: 0x040002C3 RID: 707
	public bool firstAttack;

	// Token: 0x040002C4 RID: 708
	public bool secondAttack;

	// Token: 0x040002C5 RID: 709
	public int secondAttackIndex;

	// Token: 0x040002C6 RID: 710
	public float effectSeverity;

	// Token: 0x040002C7 RID: 711
	public float songRange;

	// Token: 0x040002C8 RID: 712
	public bool selectedWeapon;

	// Token: 0x040002C9 RID: 713
	public bool selectedAmmo;

	// Token: 0x040002CA RID: 714
	public bool movingToPlaySong;

	// Token: 0x040002CB RID: 715
	public bool playingMusic;

	// Token: 0x040002CC RID: 716
	public Library.Abilities moveToPlaySongAbility;

	// Token: 0x040002CD RID: 717
	public bool cannotInterrupt;

	// Token: 0x040002CE RID: 718
	private List<string> words;

	// Token: 0x040002CF RID: 719
	private Library.Inventory ammoRow;

	// Token: 0x040002D0 RID: 720
	private Library.Inventory instrumentRow;

	// Token: 0x040002D1 RID: 721
	public bool canEndAttackTime;

	// Token: 0x040002D2 RID: 722
	private bool charging;

	// Token: 0x040002D3 RID: 723
	private bool pinning;

	// Token: 0x040002D4 RID: 724
	private bool doSlowTime;

	// Token: 0x040002D5 RID: 725
	private bool addDamageBonus;

	// Token: 0x040002D6 RID: 726
	private bool reroll;

	// Token: 0x040002D7 RID: 727
	private float damageBonus;

	// Token: 0x040002D8 RID: 728
	private float effectBonus;

	// Token: 0x040002D9 RID: 729
	private float evasionBonus;

	// Token: 0x040002DA RID: 730
	public bool doBubbleAttack;

	// Token: 0x040002DB RID: 731
	public bool bubbleAttackStopsGameplay;

	// Token: 0x040002DC RID: 732
	public Character bubbleTarget;

	// Token: 0x040002DD RID: 733
	[Header("ITEM ACTIONS")]
	public bool givingItem;

	// Token: 0x040002DE RID: 734
	public int givingItemID;

	// Token: 0x040002DF RID: 735
	public Character giveCharacter;

	// Token: 0x040002E0 RID: 736
	public bool movingToPin;

	// Token: 0x040002E1 RID: 737
	public Character pinTarget;

	// Token: 0x040002E2 RID: 738
	public bool usingItem;

	// Token: 0x040002E3 RID: 739
	public int usingItemID;

	// Token: 0x040002E4 RID: 740
	public bool pickingUpItem;

	// Token: 0x040002E5 RID: 741
	public Item pickupItem;

	// Token: 0x040002E6 RID: 742
	public int spellScrollID;

	// Token: 0x040002E7 RID: 743
	public Library.Inventory spellScroll;

	// Token: 0x040002E8 RID: 744
	[Header("SPELLS")]
	public bool channeling;

	// Token: 0x040002E9 RID: 745
	public TileEffects currentTileEffect;

	// Token: 0x040002EA RID: 746
	public bool vineComplete;

	// Token: 0x040002EB RID: 747
	public Library.Abilities spell;

	// Token: 0x040002EC RID: 748
	public Library.Abilities utility;

	// Token: 0x040002ED RID: 749
	public SpellVine vine;

	// Token: 0x040002EE RID: 750
	public float channelingSpeed = 4f;

	// Token: 0x040002EF RID: 751
	public int spellIndex;

	// Token: 0x040002F0 RID: 752
	public Library.Pagan paganRow;

	// Token: 0x040002F1 RID: 753
	public GameObject spellCasterFX;

	// Token: 0x040002F2 RID: 754
	public GameObject spellCasterTargetFX;

	// Token: 0x040002F3 RID: 755
	public GameObject spellCasterTargetFailFX;

	// Token: 0x040002F4 RID: 756
	public GameObject spellWaveFX;

	// Token: 0x040002F5 RID: 757
	public GameObject chargeUpFX;

	// Token: 0x040002F6 RID: 758
	public int chargeUpNum;

	// Token: 0x040002F7 RID: 759
	public bool castingSpell;

	// Token: 0x040002F8 RID: 760
	public GraphNode spellNode;

	// Token: 0x040002F9 RID: 761
	[Header("TARGETING")]
	public List<Character> actionTargets = new List<Character>();

	// Token: 0x040002FA RID: 762
	public List<GameObject> actionInteractives = new List<GameObject>();

	// Token: 0x040002FB RID: 763
	public int rangeIndex;

	// Token: 0x040002FC RID: 764
	public Character savedEnemy;

	// Token: 0x040002FD RID: 765
	[Header("TACTICS")]
	public float startSearchTime;

	// Token: 0x040002FE RID: 766
	private List<Character> allCharacters;

	// Token: 0x040002FF RID: 767
	private List<Character> combatCharacters;

	// Token: 0x04000300 RID: 768
	private List<Character> multiHitCharacters = new List<Character>();

	// Token: 0x04000301 RID: 769
	public int moveAttempts;

	// Token: 0x04000302 RID: 770
	public List<Library.Abilities> abilities = new List<Library.Abilities>();

	// Token: 0x04000303 RID: 771
	[Header("PATHFINDING")]
	public bool closingGap;

	// Token: 0x04000304 RID: 772
	[Header("PATHFINDING")]
	public bool closingGapInteract;

	// Token: 0x04000305 RID: 773
	public IEnumerator pathToCharacterCoroutine;

	// Token: 0x04000306 RID: 774
	public IEnumerator instrumentCoroutine;

	// Token: 0x04000307 RID: 775
	public IEnumerator wordCoroutine;

	// Token: 0x04000308 RID: 776
	public IEnumerator startAttackCoroutine;

	// Token: 0x04000309 RID: 777
	public IEnumerator actionCoroutine;

	// Token: 0x0400030A RID: 778
	public IEnumerator spellCoroutine;

	// Token: 0x0400030B RID: 779
	public IEnumerator checkAbilityQueues;

	// Token: 0x0400030C RID: 780
	public IEnumerator miniCoroutine;

	// Token: 0x0400030D RID: 781
	private NNConstraint nodeConstraint = new NNConstraint();

	// Token: 0x0400030E RID: 782
	private List<GraphNode> tempPath;

	// Token: 0x0400030F RID: 783
	[Header("MISC")]
	public Animator blood;

	// Token: 0x04000310 RID: 784
	private IEnumerator castCompleteCoroutine;

	// Token: 0x04000311 RID: 785
	private IEnumerator pocketAttackRoutine;

	// Token: 0x04000312 RID: 786
	private List<Character> party;

	// Token: 0x04000313 RID: 787
	private WaitForSeconds delayShort = new WaitForSeconds(0.001f);

	// Token: 0x04000314 RID: 788
	private WaitForSeconds delayHalfSecond = new WaitForSeconds(0.5f);

	// Token: 0x04000315 RID: 789
	private WaitForSeconds delaySecond = new WaitForSeconds(1f);

	// Token: 0x04000316 RID: 790
	public bool rolling;

	// Token: 0x04000317 RID: 791
	public bool quickAttack;

	// Token: 0x04000318 RID: 792
	private float lastMainActionTime;

	// Token: 0x04000319 RID: 793
	private AnimatorClipInfo[] m_CurrentClipInfo;

	// Token: 0x0400031A RID: 794
	private AnimationEvent[] events;

	// Token: 0x0400031B RID: 795
	private bool blocked;
}
