4961 lines
138 KiB
C#
4961 lines
138 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DarkTonic.MasterAudio;
|
|
using Pathfinding;
|
|
using PixelCrushers.DialogueSystem;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
// Token: 0x02000021 RID: 33
|
|
public class Combat : MonoBehaviour
|
|
{
|
|
// Token: 0x0600049B RID: 1179 RVA: 0x00067BED File Offset: 0x00065DED
|
|
private void Start()
|
|
{
|
|
this.party = Links.x.party;
|
|
this.currentTileEffects = Links.x.cellar.currentTileEffects;
|
|
}
|
|
|
|
// Token: 0x0600049C RID: 1180 RVA: 0x00067C14 File Offset: 0x00065E14
|
|
private void Update()
|
|
{
|
|
if (this.slowingTime)
|
|
{
|
|
if (this.slowSpeed == 0f)
|
|
{
|
|
this.slowSpeed = 5f;
|
|
}
|
|
float num = this.slowSpeed * (1.5f - Time.timeScale);
|
|
if (this.timeTarget == 1f)
|
|
{
|
|
num = 200f * Time.timeScale;
|
|
}
|
|
if (num <= 0f)
|
|
{
|
|
num = 0.05f;
|
|
}
|
|
if (this.timeTarget < 1f && this.timeScale < this.timeTarget + 0.05f && !this.startTimeHold && !this.slowingTimeForLastDeath)
|
|
{
|
|
this.startTimeHold = true;
|
|
this.startTimeHoldDeltaTime = Time.timeSinceLevelLoad;
|
|
}
|
|
if (this.startTimeHold)
|
|
{
|
|
Time.timeScale = this.timeTarget;
|
|
if (Time.timeSinceLevelLoad > this.startTimeHoldDeltaTime + 0.25f)
|
|
{
|
|
this.startTimeHold = false;
|
|
if (!Records.x.pocketPause)
|
|
{
|
|
Links.x.rtsCamera.Zoom(false, "");
|
|
}
|
|
this.timeTarget = 1f;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.timeScale = Mathf.Lerp(this.timeScale, this.timeTarget, Time.deltaTime * num);
|
|
Time.timeScale = this.timeScale;
|
|
}
|
|
if (this.timeTarget == 1f && this.timeScale > 0.9f)
|
|
{
|
|
Time.timeScale = 1f;
|
|
this.slowingTime = false;
|
|
MasterAudio.PlaySoundAndForget("Slow Time End", 1f, new float?(1f), 0f, "", null);
|
|
}
|
|
}
|
|
if (!Records.x.combat)
|
|
{
|
|
this.CheckReduceHostilities(false);
|
|
}
|
|
if (this.showDebugs)
|
|
{
|
|
this.showDebugs = false;
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
if (this.characters[i] && this.characters[i].actions)
|
|
{
|
|
this.characters[i].actions.ai.ShowDebug();
|
|
}
|
|
}
|
|
}
|
|
if (Records.x.combat && !this.combatCinematics && this.combatStart == null && !this.slowTimePause && !Records.x.waitForResurrect && !Records.x.mainCharacterDead && Links.x.gaia.sceneLoaded && !this.inRally && !this.inPocketAttack && this.combatEnd == null)
|
|
{
|
|
this.npcCount = 0;
|
|
for (int j = 0; j < this.characters.Count; j++)
|
|
{
|
|
if (!this.characters[j])
|
|
{
|
|
this.characters.RemoveAt(j);
|
|
this.charactersLastActionTime.RemoveAt(j);
|
|
j--;
|
|
}
|
|
else if (this.characters[j].npc && this.characters[j].inCombat && !this.characters[j].vipFollow)
|
|
{
|
|
this.npcCount++;
|
|
}
|
|
}
|
|
this.CheckToMakeNewGroup();
|
|
this.CheckOnlyNPCs();
|
|
if (!Links.x.soundtrack.currentSoundtrack.Contains("Combat") && this.npcsInCombat && !Records.x.removeControls && !this.npcOnlyCombat)
|
|
{
|
|
Links.x.gaia.SetPlaylist("Combat", true, 0.75f);
|
|
MasterAudio.PlaySoundAndForget("Dome Open", 1f, new float?(1f), 0f, "", null);
|
|
MasterAudio.PlaySoundAndForget("Combat Starts", 1f, new float?(1f), 0f, "", null);
|
|
MasterAudio.PlaySoundAndForget("Combat Start", 1f, new float?(1f), 0f, "", null);
|
|
}
|
|
if (this.npcCount > 0 && !this.npcOnlyCombat)
|
|
{
|
|
this.preDome = false;
|
|
this.npcsInCombat = true;
|
|
this.playerStartedCombat = false;
|
|
this.attackingInteractiveOutsideOfCombat = false;
|
|
}
|
|
else if (!this.npcsInCombat)
|
|
{
|
|
this.preDome = true;
|
|
}
|
|
if (Records.x.secrets && Input.GetKeyDown(KeyCode.B))
|
|
{
|
|
Debug.Log(string.Concat(new string[]
|
|
{
|
|
"Combat info ",
|
|
this.npcsInCombat.ToString(),
|
|
" ",
|
|
this.npcCount.ToString(),
|
|
" ",
|
|
this.preDome.ToString(),
|
|
" ",
|
|
this.inRally.ToString()
|
|
}));
|
|
for (int k = 0; k < this.characters.Count; k++)
|
|
{
|
|
string text = "\nCombatant ";
|
|
Character character = this.characters[k];
|
|
Debug.Log(text + ((character != null) ? character.ToString() : null));
|
|
}
|
|
}
|
|
if (this.npcsInCombat)
|
|
{
|
|
this.preDome = false;
|
|
}
|
|
if ((this.npcCount == 0 || this.npcOnlyCombat) && !this.playerStartedCombat && !this.preDome && !this.inRally && !this.inPocketAttack)
|
|
{
|
|
this.EndCombat(false);
|
|
}
|
|
this.CheckHudButtons(this.npcCount);
|
|
int num2 = -1;
|
|
if (this.targetUpdateTime <= 0f)
|
|
{
|
|
if (!this.hoverShowTargets)
|
|
{
|
|
this.GetTargets(false, false, null);
|
|
}
|
|
this.targetUpdateTime = 4f;
|
|
}
|
|
else
|
|
{
|
|
this.GetNodeCalled();
|
|
this.targetUpdateTime -= 1f;
|
|
}
|
|
this.TargetsAnytime();
|
|
if (!Records.x.turnBased)
|
|
{
|
|
for (int l = 0; l < this.needsTurn.Count; l++)
|
|
{
|
|
if (num2 == -1 && !Records.x.paused && !Records.x.removeControls && !Records.x.holdCombat && !Records.x.dialogue && !Records.x.pocketPause)
|
|
{
|
|
Character character2 = this.needsTurn[l];
|
|
if (character2 && character2.hasActions && !character2.turning && !character2.stats.pinned && !character2.stats.pinning && !character2.body.IsHit())
|
|
{
|
|
bool flag = true;
|
|
if (!character2.IsSentient())
|
|
{
|
|
flag = false;
|
|
}
|
|
this.SendTurnEvents(character2);
|
|
if (!flag)
|
|
{
|
|
if (character2.timelineIcon)
|
|
{
|
|
character2.timelineIcon.offsetTime = 0f;
|
|
character2.timelineIcon.Beginning();
|
|
}
|
|
num2 = l;
|
|
}
|
|
else
|
|
{
|
|
num2 = l;
|
|
this.waitingForOverlap = false;
|
|
this.SetCharacterInTurn(true);
|
|
this.StartCharacterTurn(character2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (num2 > -1 && num2 < this.needsTurn.Count)
|
|
{
|
|
this.needsTurn.RemoveAt(num2);
|
|
}
|
|
}
|
|
if (Records.x.turnBased)
|
|
{
|
|
if (this.shaderFlash)
|
|
{
|
|
if (!Records.x.playerTurn)
|
|
{
|
|
this.shaderFlash = false;
|
|
Shader.SetGlobalFloat("_TurnFlash", 0f);
|
|
}
|
|
if (this.shaderFlashTarget == 0f && this.shaderTimeFlash < 0.05f)
|
|
{
|
|
this.shaderFlashTarget = 1f;
|
|
}
|
|
if (this.shaderFlashTarget == 1f && this.shaderTimeFlash > 0.95f)
|
|
{
|
|
this.shaderFlashTarget = 0f;
|
|
}
|
|
float num3 = 4f;
|
|
if (this.shaderFlashTarget == 0f)
|
|
{
|
|
num3 = 4f;
|
|
}
|
|
this.shaderTimeFlash = Mathf.Lerp(this.shaderTimeFlash, this.shaderFlashTarget, Time.deltaTime * num3);
|
|
Shader.SetGlobalFloat("_TurnFlash", this.shaderTimeFlash);
|
|
}
|
|
this.domeTr.Rotate(new Vector3(0f, 10f * Time.deltaTime, 3f * Time.deltaTime));
|
|
if (!this.characterInTurn)
|
|
{
|
|
num2 = -1;
|
|
if (this.delayedAttacks.Count > 0 && this.overlapping.Count == 0)
|
|
{
|
|
this.currentTurnCharacter = this.delayedAttacks[0];
|
|
this.SetCharacterInTurn(true);
|
|
this.currentTurnCharacter.actions.StartAttackFromDelay();
|
|
this.delayedAttacks.RemoveAt(0);
|
|
num2 = -2;
|
|
}
|
|
for (int m = 0; m < this.needsTurn.Count; m++)
|
|
{
|
|
if (num2 == -1)
|
|
{
|
|
Character character3 = this.needsTurn[m];
|
|
if (character3)
|
|
{
|
|
if (this.overlapping.Count > 0 && !character3.npc)
|
|
{
|
|
num2 = -2;
|
|
this.waitingForOverlap = true;
|
|
break;
|
|
}
|
|
if (character3.hasActions && !character3.overlapping)
|
|
{
|
|
bool flag2 = true;
|
|
if (!character3.IsSentient())
|
|
{
|
|
flag2 = false;
|
|
}
|
|
this.SendTurnEvents(character3);
|
|
if (!flag2)
|
|
{
|
|
character3.timelineIcon.offsetTime = 0f;
|
|
character3.timelineIcon.Beginning();
|
|
num2 = m;
|
|
}
|
|
else
|
|
{
|
|
num2 = m;
|
|
this.waitingForOverlap = false;
|
|
this.SetCharacterInTurn(true);
|
|
this.StartCharacterTurn(character3);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (num2 > -1)
|
|
{
|
|
this.needsTurn.RemoveAt(num2);
|
|
}
|
|
if (this.waitingForOverlap)
|
|
{
|
|
int num4 = 0;
|
|
for (int n = 0; n < this.overlapping.Count; n++)
|
|
{
|
|
if (this.overlapping[n] && this.overlapping[n].IsSentient())
|
|
{
|
|
num4++;
|
|
}
|
|
}
|
|
if (num4 == 0)
|
|
{
|
|
this.waitingForOverlap = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (Time.timeSinceLevelLoad > this.characterAddedTime + 0.5f && this.characterAddedTime > 0f && Links.x.gaia.sceneLoaded)
|
|
{
|
|
for (int num5 = 0; num5 < this.characters.Count; num5++)
|
|
{
|
|
Character character4 = this.characters[num5];
|
|
if (character4 && !character4.dead && !character4.stunned && character4.hasActions && !character4.actions.combatStartPassives && (character4.npc || this.npcCount > 0))
|
|
{
|
|
character4.actions.combatStartPassives = true;
|
|
int num6;
|
|
character4.stats.CheckForSongsAndWords("CombatStart", out num6);
|
|
}
|
|
}
|
|
this.characterAddedTime = Time.timeSinceLevelLoad;
|
|
}
|
|
float seconds = Links.x.gameplay.seconds;
|
|
for (int num7 = 0; num7 < this.characters.Count; num7++)
|
|
{
|
|
Character character5 = this.characters[num7];
|
|
if (character5 && !character5.mainSelected && character5.IsSentient() && character5.attackTime >= 1f && !character5.inAction && !character5.inQueuedAbility && !character5.inRecovery && !character5.moving && !character5.isHit && !character5.turning && !character5.dodging && character5.waitingForPath == 0 && !character5.jumping && !character5.searching && !character5.missing)
|
|
{
|
|
bool flag3 = false;
|
|
if (character5.actions)
|
|
{
|
|
if (character5.actions.ai.findingAction && seconds > 100f + character5.actions.ai.findingActionTime)
|
|
{
|
|
flag3 = true;
|
|
}
|
|
if (character5.timelineIcon && (character5.timelineIcon.Nothing() || flag3) && seconds > this.charactersLastActionTime[num7] + 150f && character5.actions && !character5.actions.chargeUpFX && !character5.actions.ai.jumping && !character5.actions.ai.busy && (!character5.actions.ai.findingAction || flag3) && !this.needsTurn.Contains(character5))
|
|
{
|
|
this.GetNextAction(character5);
|
|
this.charactersLastActionTime[num7] = seconds;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (Records.x.pocketPause)
|
|
{
|
|
if (this.targetUpdateTime <= 0f)
|
|
{
|
|
if (!this.hoverShowTargets)
|
|
{
|
|
this.GetTargets(false, false, null);
|
|
}
|
|
this.targetUpdateTime = 4f;
|
|
}
|
|
else
|
|
{
|
|
this.targetUpdateTime -= 1f;
|
|
}
|
|
}
|
|
if (!Records.x.combat && !Records.x.removeControls && (Links.x.soundtrack.currentSoundtrack.Contains("Combat") || Links.x.soundtrack.currentSong.Contains("Combat")))
|
|
{
|
|
Links.x.gaia.FadeOutPlaylist(true, 0.5f);
|
|
Links.x.gaia.SetEnvironmentPlaylist(Links.x.gameplay.sailing, Links.x.main.inTown, true);
|
|
}
|
|
if (!this.combatCinematics)
|
|
{
|
|
this.centralEnemyPosition = Vector3.zero;
|
|
int num8 = 0;
|
|
bool flag4 = false;
|
|
for (int num9 = 0; num9 < this.characters.Count; num9++)
|
|
{
|
|
if (this.characters[num9])
|
|
{
|
|
if (this.characters[num9].actions && !this.characters[num9].dead && !this.characters[num9].stunned)
|
|
{
|
|
if (this.characters[num9].actions.startSearchTime > 0f)
|
|
{
|
|
this.characters[num9].actions.CheckSearchTime();
|
|
}
|
|
if (this.characters[num9].npc)
|
|
{
|
|
num8++;
|
|
this.centralEnemyPosition += this.characters[num9].currentPosition;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.characters[num9] = null;
|
|
if (num9 < this.charactersLastActionTime.Count && num9 > -1)
|
|
{
|
|
this.charactersLastActionTime[num9] = -1f;
|
|
}
|
|
flag4 = true;
|
|
}
|
|
}
|
|
}
|
|
if (num8 > 0)
|
|
{
|
|
this.centralEnemyPosition /= (float)num8;
|
|
}
|
|
if (flag4)
|
|
{
|
|
this.characters.RemoveAll((Character item) => item == null);
|
|
this.charactersLastActionTime.RemoveAll((float item) => item == -1f);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600049D RID: 1181 RVA: 0x00068B48 File Offset: 0x00066D48
|
|
public void Enraged()
|
|
{
|
|
int num = 0;
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
Character character = this.characters[i];
|
|
if (character && character.enraged)
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
for (int j = 0; j < this.characters.Count; j++)
|
|
{
|
|
Character character = this.characters[j];
|
|
if (character && character.npc && !character.summoned && character.IsSentient() && character.visible == 1 && !character.ghost && character.stats.magicPointsBase == 0 && !character.stats.defendMainInCombat && !character.stats.isLeader && character.hostility >= 2 && num < 1)
|
|
{
|
|
bool flag = false;
|
|
int num2 = 35;
|
|
if (!character.stats.animal)
|
|
{
|
|
num2 = 50;
|
|
}
|
|
if (Random.Range(0, num2) == 0 || flag)
|
|
{
|
|
num++;
|
|
character.enraged = true;
|
|
if (character.inCircle && character.group)
|
|
{
|
|
character.group.LeaveCircle(character);
|
|
}
|
|
Effects effects = character.gameObject.AddComponent<Effects>();
|
|
Links.x.cellar.AddEffects(effects);
|
|
effects.gameObject.SetActive(true);
|
|
effects.source = character;
|
|
effects.target = character;
|
|
effects.fromLoad = false;
|
|
effects.effectName = "Enraged";
|
|
effects.sourceLevel = (float)character.combatLevel;
|
|
effects.Inflicted(false);
|
|
Links.x.rtsCamera.StartShake("");
|
|
MasterAudio.PlaySoundAndForget("Enraged", 1f, new float?(1f), 0f, "", null);
|
|
character.PlaySoundFX(0, 2);
|
|
Animator animatedText = Links.x.cellar.GetAnimatedText("SmallDmg", "Enraged!", false);
|
|
animatedText.gameObject.transform.position = character.body.HeadPosition(0f) + new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), 0f);
|
|
animatedText.gameObject.SetActive(true);
|
|
this.str.Clear();
|
|
this.str.Append(character.stats.GetName());
|
|
this.str.Append(" enraged! ");
|
|
Links.x.gameFeed.AddFeed(this.str.ToString());
|
|
if (character.creatures && character.creatures.creatures.pickOneLeader)
|
|
{
|
|
Character defendingCharacter = character.stats.defendingCharacter;
|
|
string text = "Current leader ";
|
|
Character character2 = defendingCharacter;
|
|
Debug.Log(text + ((character2 != null) ? character2.ToString() : null));
|
|
if (!defendingCharacter)
|
|
{
|
|
character.creatures.SetNewFirstLeader(character);
|
|
effects.timeToWait = 50;
|
|
}
|
|
if (defendingCharacter)
|
|
{
|
|
Debug.Log("Current leader " + defendingCharacter.dead.ToString());
|
|
if (defendingCharacter.dead || defendingCharacter.stunned || defendingCharacter.stats.HealthCurrent() <= 0)
|
|
{
|
|
character.creatures.SetNewFirstLeader(character);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600049E RID: 1182 RVA: 0x00068EC4 File Offset: 0x000670C4
|
|
public void StartCharacterTurn(Character character)
|
|
{
|
|
if (character.npc)
|
|
{
|
|
character.actions.ChooseAction();
|
|
if (Records.x.turnBased)
|
|
{
|
|
Records.x.playerTurn = false;
|
|
Records.x.RemoveControls(true);
|
|
this.SwitchUI("NPC");
|
|
this.ClearTargets();
|
|
this.currentTurnCharacter = character;
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
character.actions.ChooseAction();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600049F RID: 1183 RVA: 0x00068F2C File Offset: 0x0006712C
|
|
public void StartSlowTime(string type)
|
|
{
|
|
if (Time.timeScale == 1f && !this.slowingTime)
|
|
{
|
|
this.slowingTime = true;
|
|
MasterAudio.PlaySoundAndForget("Slow Time Start", 1f, new float?(1f), 0f, "", null);
|
|
this.timeTarget = 0.25f;
|
|
this.startTime = Time.deltaTime;
|
|
this.slowSpeed = 10f;
|
|
if (type == "")
|
|
{
|
|
this.slowSpeed = 10f;
|
|
this.slowTimeHold = false;
|
|
this.slowTimePause = true;
|
|
}
|
|
if (type == "Critical")
|
|
{
|
|
this.slowSpeed = 8f;
|
|
this.slowTimeHold = false;
|
|
this.slowTimePause = true;
|
|
}
|
|
if (type == "Rally")
|
|
{
|
|
this.slowSpeed = 20f;
|
|
}
|
|
type == "Synergy";
|
|
if (this.slowingTimeForLastDeath)
|
|
{
|
|
this.slowSpeed = 5f;
|
|
this.timeTarget = 0.5f;
|
|
Links.x.hudControl.ChangeHudVisibility(false, true);
|
|
Links.x.gameCard.End();
|
|
Links.x.itemCard.End();
|
|
Links.x.hudControl.timelineAnimator.Play("Timeline End");
|
|
Records.x.mainCharacterDead = true;
|
|
if (Records.x.turnBased)
|
|
{
|
|
Records.x.RemoveControls(true);
|
|
}
|
|
for (int i = 0; i < this.timelineIcons.Count; i++)
|
|
{
|
|
if (this.timelineIcons[i])
|
|
{
|
|
this.timelineIcons[i].SetAsActive(false);
|
|
}
|
|
}
|
|
Links.x.gaia.FadeOutPlaylist(true, 0.5f);
|
|
Links.x.gaia.FadeOutPlaylist(false, 0.5f);
|
|
}
|
|
if (!Records.x.pocketPause)
|
|
{
|
|
Links.x.rtsCamera.Zoom(true, "");
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004A0 RID: 1184 RVA: 0x00069129 File Offset: 0x00067329
|
|
public void EndSlowTime()
|
|
{
|
|
this.slowTimeHold = false;
|
|
}
|
|
|
|
// Token: 0x060004A1 RID: 1185 RVA: 0x00069134 File Offset: 0x00067334
|
|
public void AddPartyToTurnList()
|
|
{
|
|
for (int i = 0; i < this.party.Count; i++)
|
|
{
|
|
if (this.party[i] && this.party[i].IsSentient() && !this.party[i].isBoro && !this.party[i].inAction && !this.party[i].inRecovery && !this.party[i].actions.hasTarget && !this.needsTurn.Contains(this.party[i]) && this.party[i].actions.GetTarget() == null)
|
|
{
|
|
this.GetNextAction(this.party[i]);
|
|
}
|
|
}
|
|
if (Links.x.gaia.boroControls)
|
|
{
|
|
Links.x.gaia.boroControls.LeavingForCombat();
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004A2 RID: 1186 RVA: 0x00069250 File Offset: 0x00067450
|
|
public void SetCharacterInTurn(bool state)
|
|
{
|
|
if (Records.x.turnBased)
|
|
{
|
|
this.characterInTurn = state;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004A3 RID: 1187 RVA: 0x00069268 File Offset: 0x00067468
|
|
public void SendTurnEvents(Character source)
|
|
{
|
|
int count = this.currentTileEffects.Count;
|
|
this.currentTileEffectsTemp.Clear();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
this.currentTileEffectsTemp.Add(this.currentTileEffects[i]);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004A4 RID: 1188 RVA: 0x000692B0 File Offset: 0x000674B0
|
|
public void Projectile(Projectile projectile, bool adding)
|
|
{
|
|
int num = this.projectiles.IndexOf(projectile);
|
|
if (adding)
|
|
{
|
|
if (num == -1)
|
|
{
|
|
this.projectiles.Add(projectile);
|
|
return;
|
|
}
|
|
}
|
|
else if (num > -1)
|
|
{
|
|
this.projectiles.RemoveAt(num);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004A5 RID: 1189 RVA: 0x000692F0 File Offset: 0x000674F0
|
|
public void RemoveFromNeedsTurn(Character character)
|
|
{
|
|
int num = this.needsTurn.IndexOf(character);
|
|
if (num > -1)
|
|
{
|
|
this.needsTurn.RemoveAt(num);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004A6 RID: 1190 RVA: 0x0006931C File Offset: 0x0006751C
|
|
public void GetNextAction(Character character)
|
|
{
|
|
if (character.mainSelected && !Records.x.cyclingAttacks && !Records.x.freeAttack)
|
|
{
|
|
return;
|
|
}
|
|
if (this.needsTurn.IndexOf(character) == -1)
|
|
{
|
|
this.needsTurn.Add(character);
|
|
}
|
|
int num = this.characters.IndexOf(character);
|
|
if (num > -1 && this.charactersLastActionTime.Count < num)
|
|
{
|
|
this.charactersLastActionTime[num] = Links.x.gameplay.seconds;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004A7 RID: 1191 RVA: 0x000693A0 File Offset: 0x000675A0
|
|
public void RemoveFromPartyLists(Character character)
|
|
{
|
|
for (int i = 0; i < this.party.Count; i++)
|
|
{
|
|
if (this.party[i])
|
|
{
|
|
this.party[i].RemoveLKPlayer(character);
|
|
if (this.party[i].GetLKPCount() == 0 && this.party[i].actions)
|
|
{
|
|
this.party[i].actions.EndActions();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004A8 RID: 1192 RVA: 0x0006942C File Offset: 0x0006762C
|
|
public void EndEnemyTurn(Character character, bool setIconAtBeginning)
|
|
{
|
|
Records.x.playerTurn = false;
|
|
character.ToggleArrow(false);
|
|
character.centerOfAttention = false;
|
|
character.CircleAnimation("");
|
|
character.EndTurn();
|
|
if (setIconAtBeginning && character.timelineIcon)
|
|
{
|
|
character.timelineIcon.offsetTime = 0f;
|
|
character.timelineIcon.Beginning();
|
|
}
|
|
this.SetCharacterInTurn(false);
|
|
this.currentTurnCharacter = null;
|
|
}
|
|
|
|
// Token: 0x060004A9 RID: 1193 RVA: 0x0006949C File Offset: 0x0006769C
|
|
public void EndEnemyTurnFromOverlap(Character character)
|
|
{
|
|
if (Records.x.turnBased)
|
|
{
|
|
character.ToggleArrow(false);
|
|
character.centerOfAttention = false;
|
|
character.CircleAnimation("");
|
|
character.timelineIcon.Beginning();
|
|
character.EndTurn();
|
|
int num = this.overlapping.IndexOf(character);
|
|
if (num > -1)
|
|
{
|
|
this.overlapping.RemoveAt(num);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004AA RID: 1194 RVA: 0x000694FC File Offset: 0x000676FC
|
|
public void TriggerNextEnemy(Character character)
|
|
{
|
|
this.SetCharacterInTurn(false);
|
|
character.timelineIcon.SetAtBeginningPosition();
|
|
this.currentTurnCharacter = null;
|
|
if (Records.x.turnBased)
|
|
{
|
|
if (this.overlapping.Count == 0)
|
|
{
|
|
for (int i = 0; i < this.timelineIcons.Count; i++)
|
|
{
|
|
this.timelineIcons[i].RecordOffset();
|
|
}
|
|
}
|
|
if (this.overlapping.IndexOf(character) == -1 && character.stats.Stuck() == 0)
|
|
{
|
|
this.overlapping.Add(character);
|
|
return;
|
|
}
|
|
this.EndEnemyTurnFromOverlap(character);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004AB RID: 1195 RVA: 0x00069594 File Offset: 0x00067794
|
|
public void RemoveTimelineIcon(Character character)
|
|
{
|
|
int num = this.overlapping.IndexOf(character);
|
|
if (num > -1)
|
|
{
|
|
this.overlapping.RemoveAt(num);
|
|
}
|
|
num = this.needsTurn.IndexOf(character);
|
|
if (num > -1)
|
|
{
|
|
this.needsTurn.RemoveAt(num);
|
|
}
|
|
num = this.delayedAttacks.IndexOf(character);
|
|
if (num > -1)
|
|
{
|
|
this.delayedAttacks.RemoveAt(num);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004AC RID: 1196 RVA: 0x000695F8 File Offset: 0x000677F8
|
|
public void AddDelayedAttack(Character character)
|
|
{
|
|
if (this.delayedAttacks.IndexOf(character) == -1)
|
|
{
|
|
this.delayedAttacks.Add(character);
|
|
}
|
|
this.SetCharacterInTurn(false);
|
|
}
|
|
|
|
// Token: 0x060004AD RID: 1197 RVA: 0x0006961C File Offset: 0x0006781C
|
|
public void EndTurn(bool immediate, Character endTurnCharacter, bool setIconAtBeginning)
|
|
{
|
|
endTurnCharacter.EndTurn();
|
|
if (Records.x.turnBased)
|
|
{
|
|
setIconAtBeginning = true;
|
|
}
|
|
if (endTurnCharacter.timelineIcon && setIconAtBeginning)
|
|
{
|
|
endTurnCharacter.timelineIcon.offsetTime = 0f;
|
|
if (endTurnCharacter.hasActions && !endTurnCharacter.actions.choosingTurn)
|
|
{
|
|
endTurnCharacter.timelineIcon.Beginning();
|
|
}
|
|
}
|
|
if (Records.x.turnBased)
|
|
{
|
|
if (!this.currentTurnCharacter)
|
|
{
|
|
return;
|
|
}
|
|
if (this.currentTurnCharacter.npc)
|
|
{
|
|
return;
|
|
}
|
|
Records.x.playerTurn = false;
|
|
Records.x.RemoveControls(true);
|
|
this.currentTurnCharacter.ToggleArrow(false);
|
|
this.currentTurnCharacter.EndTurn();
|
|
this.ClearTargets();
|
|
bool flag = false;
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
if (this.characters[i] && this.characters[i].npc && this.characters[i].inCombat)
|
|
{
|
|
flag = true;
|
|
break;
|
|
}
|
|
}
|
|
this.ClearTargets();
|
|
if (!flag && !this.combatCinematics && this.preDome)
|
|
{
|
|
Character character = Links.x.protagonist;
|
|
if (!Links.x.hasMain)
|
|
{
|
|
character = Links.x.GetNearestParty(Links.x.follow.position);
|
|
}
|
|
this.StartCombat(null, character, true, false);
|
|
}
|
|
this.currentTurnCharacter.centerOfAttention = false;
|
|
this.currentTurnCharacter.CircleAnimation("");
|
|
this.currentTurnCharacter = null;
|
|
this.SetCharacterInTurn(false);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004AE RID: 1198 RVA: 0x000697B0 File Offset: 0x000679B0
|
|
public void SwitchUI(string current)
|
|
{
|
|
if (!Records.x.turnBased)
|
|
{
|
|
return;
|
|
}
|
|
if (current == "Party")
|
|
{
|
|
Links.x.domeAnimator.SetBool("None", false);
|
|
Links.x.domeAnimator.SetBool("NPC", false);
|
|
int count = this.domeMeshes.Count;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
this.domeMeshes[i].sharedMaterial = this.radiusGemPlayerTurn;
|
|
}
|
|
return;
|
|
}
|
|
if (current == "NPC")
|
|
{
|
|
Links.x.domeAnimator.SetBool("None", false);
|
|
Links.x.domeAnimator.SetBool("NPC", true);
|
|
int count2 = this.domeMeshes.Count;
|
|
for (int j = 0; j < count2; j++)
|
|
{
|
|
this.domeMeshes[j].sharedMaterial = this.radiusGemEnemyTurn;
|
|
}
|
|
return;
|
|
}
|
|
if (current == "None")
|
|
{
|
|
Links.x.domeAnimator.SetBool("NPC", false);
|
|
Links.x.domeAnimator.SetBool("None", true);
|
|
int count3 = this.domeMeshes.Count;
|
|
for (int k = 0; k < count3; k++)
|
|
{
|
|
this.domeMeshes[k].sharedMaterial = this.radiusGemNoTurn;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004AF RID: 1199 RVA: 0x00069908 File Offset: 0x00067B08
|
|
public bool PartyNearTimelineEnd()
|
|
{
|
|
for (int i = 0; i < this.party.Count; i++)
|
|
{
|
|
if (this.party[i] && this.party[i].timelineIcon && this.party[i].timelineIcon.t > 0.7f)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x060004B0 RID: 1200 RVA: 0x00069978 File Offset: 0x00067B78
|
|
public void CheckHudButtons(int x)
|
|
{
|
|
if (Records.x.turnBased)
|
|
{
|
|
if (Records.x.canLeaveCombat || x == 0)
|
|
{
|
|
if (!this.doveObject.activeSelf)
|
|
{
|
|
this.doveObject.SetActive(true);
|
|
}
|
|
}
|
|
else if (this.doveObject.activeSelf)
|
|
{
|
|
this.doveObject.SetActive(false);
|
|
}
|
|
if (Records.x.playerTurn && x > 0)
|
|
{
|
|
if (!this.endTurnObject.activeSelf)
|
|
{
|
|
this.endTurnObject.SetActive(true);
|
|
return;
|
|
}
|
|
}
|
|
else if (this.endTurnObject.activeSelf)
|
|
{
|
|
this.endTurnObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004B1 RID: 1201 RVA: 0x00069A1C File Offset: 0x00067C1C
|
|
public int PartyTurnsLeft()
|
|
{
|
|
int num = 0;
|
|
for (int i = 0; i < this.party.Count; i++)
|
|
{
|
|
if (this.party[i] && !this.party[i].outsideDome && !this.party[i].waitingToJoinDome && this.party[i].CanMakePath() && this.party[i].CanChooseActions())
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x060004B2 RID: 1202 RVA: 0x00069AA8 File Offset: 0x00067CA8
|
|
private void CheckOnlyNPCs()
|
|
{
|
|
bool flag = false;
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
if (this.characters[i] && this.characters[i].npc)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
if (flag)
|
|
{
|
|
for (int j = 0; j < this.characters.Count; j++)
|
|
{
|
|
if (this.characters[j] && this.characters[j].npc && this.characters[j].HasPartyLKP())
|
|
{
|
|
flag = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
this.npcOnlyCombat = flag;
|
|
}
|
|
|
|
// Token: 0x060004B3 RID: 1203 RVA: 0x00069B54 File Offset: 0x00067D54
|
|
public void AddParty(Character character, bool searching, Character firstTarget, bool setIconAtBeginning)
|
|
{
|
|
if (Records.x.combatConsoleDebugging)
|
|
{
|
|
Debug.Log(string.Concat(new string[]
|
|
{
|
|
"Add to combat: ",
|
|
(character != null) ? character.ToString() : null,
|
|
", is searching? ",
|
|
searching.ToString(),
|
|
", first target is: ",
|
|
(firstTarget != null) ? firstTarget.ToString() : null,
|
|
" ",
|
|
character.visible.ToString()
|
|
}));
|
|
}
|
|
if (character.missing)
|
|
{
|
|
return;
|
|
}
|
|
if (character.isBoro)
|
|
{
|
|
return;
|
|
}
|
|
if (character.party && Records.x.holdCombat)
|
|
{
|
|
return;
|
|
}
|
|
if (!character.IsSentient())
|
|
{
|
|
return;
|
|
}
|
|
if (character.ghost && character.ghostVanishing)
|
|
{
|
|
return;
|
|
}
|
|
if (character.ambushing && !character.jumping)
|
|
{
|
|
return;
|
|
}
|
|
if (character.inactive)
|
|
{
|
|
return;
|
|
}
|
|
if (Links.x.gaia.waitingToRemoveScene)
|
|
{
|
|
return;
|
|
}
|
|
if (Records.x.miniGame && !this.miniGameCharacters.Contains(character))
|
|
{
|
|
return;
|
|
}
|
|
if (character.npc && (character.attackingUntilBribe || character.hostility == 2))
|
|
{
|
|
foreach (Character character2 in this.party)
|
|
{
|
|
bool hasActions = character2.hasActions;
|
|
}
|
|
}
|
|
this.CheckOnlyNPCs();
|
|
if (!searching)
|
|
{
|
|
this.characterAddedTime = Time.timeSinceLevelLoad;
|
|
}
|
|
int num = this.characters.IndexOf(character);
|
|
if (num == -1)
|
|
{
|
|
this.characters.Add(character);
|
|
this.charactersLastActionTime.Add(Links.x.gameplay.seconds);
|
|
if (!character.actions && !character.isBoro)
|
|
{
|
|
Links.x.sensory.LookAtObject(base.transform, 30f, false, character, 4f, 0.5f, null, 3);
|
|
Actions actions = character.gameObject.AddComponent<Actions>();
|
|
AttackAI attackAI = character.gameObject.AddComponent<AttackAI>();
|
|
actions.ai = attackAI;
|
|
attackAI.character = character;
|
|
actions.character = character;
|
|
actions.invRow = character.invRow1;
|
|
attackAI.actions = actions;
|
|
character.actions = actions;
|
|
attackAI.StartCombat();
|
|
character.hasActions = true;
|
|
character.ToggleCombatAnimator(true);
|
|
if (!character.IsWalking() && !character.inAction && !character.inRecovery && !character.inQueuedAbility)
|
|
{
|
|
character.PlayIdle();
|
|
}
|
|
character.GetStaminaBar();
|
|
}
|
|
if (character.npc)
|
|
{
|
|
this.playerStartedCombat = false;
|
|
}
|
|
character.actions.character = character;
|
|
if (character.dayNightVanishing && !character.inCircle)
|
|
{
|
|
character.EndPath();
|
|
}
|
|
if (this.HasTimelineIcon(character) && !character.mainSelected)
|
|
{
|
|
character.timelineIcon.Beginning();
|
|
}
|
|
}
|
|
if (character.actions)
|
|
{
|
|
character.hasActions = true;
|
|
character.actions.endActionsAfterTurn = false;
|
|
}
|
|
if (Records.x.combatConsoleDebugging)
|
|
{
|
|
Debug.Log(string.Concat(new string[]
|
|
{
|
|
"Adding character to combat ",
|
|
(character != null) ? character.ToString() : null,
|
|
" targeting ",
|
|
(firstTarget != null) ? firstTarget.ToString() : null,
|
|
" ",
|
|
searching.ToString(),
|
|
" ",
|
|
num.ToString(),
|
|
" ",
|
|
character.GetLKPCount().ToString()
|
|
}));
|
|
}
|
|
num = this.characters.IndexOf(character);
|
|
if (character.mainSelected && firstTarget && !firstTarget.party)
|
|
{
|
|
Links.x.hudControl.ToggleAttackTimer(true);
|
|
}
|
|
character.body.SetSeeThroughAmount();
|
|
if (character.npc && !searching && !character.inCombat)
|
|
{
|
|
if (!this.HasTimelineIcon(character))
|
|
{
|
|
TimelineIcon timelineIconEnemy = Links.x.cellar.GetTimelineIconEnemy();
|
|
timelineIconEnemy.Setup(character, num, setIconAtBeginning);
|
|
this.timelineIcons.Add(timelineIconEnemy);
|
|
}
|
|
if (character.hostility == 1)
|
|
{
|
|
Records.x.UpdateBribeState(character);
|
|
}
|
|
if (character.searching && !character.inCircle)
|
|
{
|
|
character.EndPath();
|
|
}
|
|
if (character.npc && character.sailing && character.boatNavigator)
|
|
{
|
|
character.boat.StopBoat();
|
|
}
|
|
if (character.heard)
|
|
{
|
|
Links.x.cellar.ReturnPooledGameObject(22, character.heard);
|
|
character.heard.SetActive(false);
|
|
character.heard = null;
|
|
}
|
|
character.StartQuip("NPC Seen");
|
|
character.inCombat = true;
|
|
character.searching = false;
|
|
if ((character.npc || (!character.npc && Records.x.ai == 1)) && !this.npcOnlyCombat && !character.jumping && !character.resting && !character.animator.GetBool("Combat"))
|
|
{
|
|
character.PlayAnimation("CombatStart", 0f);
|
|
}
|
|
character.ClearMoveTargets();
|
|
character.ToggleCombatAnimator(true);
|
|
character.centerOfAttention = false;
|
|
character.CircleAnimation("");
|
|
}
|
|
if (character.npc && !searching && firstTarget)
|
|
{
|
|
Links.x.sensory.AddNoise(character.gameObject, character.node, "Combat Aggro", firstTarget);
|
|
}
|
|
if (character.npc && searching && !character.searching && !character.inCombat)
|
|
{
|
|
character.StartQuip("NPC Heard");
|
|
character.searching = true;
|
|
if (!character.inCircle)
|
|
{
|
|
character.PlayAnimation("Heard", 0f);
|
|
}
|
|
character.ToggleCombatAnimator(true);
|
|
if (character.hasActions)
|
|
{
|
|
character.actions.StartSearch(firstTarget);
|
|
}
|
|
}
|
|
if (!character.npc && !character.isBoro)
|
|
{
|
|
if (!this.HasTimelineIcon(character))
|
|
{
|
|
TimelineIcon timelineIcon = Links.x.cellar.GetTimelineIcon();
|
|
timelineIcon.Setup(character, num, setIconAtBeginning);
|
|
this.timelineIcons.Add(timelineIcon);
|
|
}
|
|
character.inCombat = true;
|
|
character.HasBuffItem();
|
|
}
|
|
bool flag = false;
|
|
if (this.characterStartingAttack == character)
|
|
{
|
|
flag = true;
|
|
}
|
|
character.StartCombat(firstTarget, flag);
|
|
if (character.actions)
|
|
{
|
|
character.actions.ai.actionCount = 0;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004B4 RID: 1204 RVA: 0x0006A190 File Offset: 0x00068390
|
|
public void GivePartyActions(Character character, bool needsAction)
|
|
{
|
|
if (Records.x.turnBased)
|
|
{
|
|
if (this.characters.IndexOf(character) == -1)
|
|
{
|
|
this.characters.Add(character);
|
|
this.charactersLastActionTime.Add(Links.x.gameplay.seconds);
|
|
if (!character.actions)
|
|
{
|
|
Actions actions = character.gameObject.AddComponent<Actions>();
|
|
AttackAI attackAI = character.gameObject.AddComponent<AttackAI>();
|
|
actions.ai = attackAI;
|
|
attackAI.character = character;
|
|
actions.character = character;
|
|
actions.ResetAction();
|
|
attackAI.StartCombat();
|
|
attackAI.actions = actions;
|
|
character.actions = actions;
|
|
character.hasActions = true;
|
|
}
|
|
if (character.npc)
|
|
{
|
|
this.playerStartedCombat = false;
|
|
}
|
|
character.actions.character = character;
|
|
}
|
|
Debug.Log("Adding actions to " + ((character != null) ? character.ToString() : null));
|
|
return;
|
|
}
|
|
this.AddParty(character, false, null, false);
|
|
Links.x.hudControl.timelineAnimator.Play("Timeline Start");
|
|
if (needsAction)
|
|
{
|
|
character.timelineIcon.Beginning();
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004B5 RID: 1205 RVA: 0x0006A2A8 File Offset: 0x000684A8
|
|
public int NPCCount(bool canBeSearching)
|
|
{
|
|
int num = 0;
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
if (this.characters[i] && this.characters[i].npc && (this.characters[i].inCombat || canBeSearching))
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x060004B6 RID: 1206 RVA: 0x0006A310 File Offset: 0x00068510
|
|
public bool HasTimelineIcon(Character character)
|
|
{
|
|
for (int i = 0; i < this.timelineIcons.Count; i++)
|
|
{
|
|
if (this.timelineIcons[i].character == character)
|
|
{
|
|
character.timelineIcon = this.timelineIcons[i];
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x060004B7 RID: 1207 RVA: 0x0006A364 File Offset: 0x00068564
|
|
public void RemoveTimelineIcon(TimelineIcon icon)
|
|
{
|
|
int num = this.timelineIcons.IndexOf(icon);
|
|
if (num > -1)
|
|
{
|
|
this.timelineIcons.RemoveAt(num);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004B8 RID: 1208 RVA: 0x0006A390 File Offset: 0x00068590
|
|
public void StartCombat(Character firstTarget, Character initiator, bool partyInitiative, bool firstStart)
|
|
{
|
|
if (this.combatEnd != null)
|
|
{
|
|
base.StopCoroutine(this.combatEnd);
|
|
this.endingCombat = false;
|
|
this.combatEnd = null;
|
|
}
|
|
if (this.combatStart == null)
|
|
{
|
|
this.combatStart = this.SetDomeNodes(firstTarget, initiator, partyInitiative, firstStart);
|
|
base.StartCoroutine(this.combatStart);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004B9 RID: 1209 RVA: 0x0006A3E5 File Offset: 0x000685E5
|
|
private IEnumerator SetDomeNodes(Character firstTarget, Character initiator, bool partyInitiative, bool firstStart)
|
|
{
|
|
bool waitedToEnd = false;
|
|
while (this.endingCombat)
|
|
{
|
|
Debug.Log("Ending combat");
|
|
waitedToEnd = true;
|
|
yield return null;
|
|
}
|
|
if (this.characters.Count > 0 || !waitedToEnd)
|
|
{
|
|
Links.x.combat.SetCharacterInTurn(false);
|
|
Shader.SetGlobalFloat("_NoCharacterFX", 0f);
|
|
this.combatCinematics = true;
|
|
Records.x.combat = true;
|
|
bool flag = false;
|
|
bool flag2 = true;
|
|
if (firstTarget && initiator && firstTarget.npc && initiator.npc)
|
|
{
|
|
flag2 = false;
|
|
}
|
|
if (firstStart)
|
|
{
|
|
this.partyXP.Clear();
|
|
this.partyCharacterXP.Clear();
|
|
for (int j = 0; j < this.party.Count; j++)
|
|
{
|
|
if (this.party[j])
|
|
{
|
|
this.partyCharacterXP.Add(this.party[j]);
|
|
this.partyXP.Add(this.party[j].stats.XP);
|
|
}
|
|
}
|
|
}
|
|
if (Links.x.gaia.boroControls && flag2)
|
|
{
|
|
Links.x.gaia.boroControls.LeavingForCombat();
|
|
}
|
|
if (initiator && !initiator.npc)
|
|
{
|
|
initiator = Links.x.main;
|
|
}
|
|
Links.x.SetFormationOrder();
|
|
this.currentTurn = "Party";
|
|
this.domeOn = true;
|
|
bool flag3 = firstStart && flag2;
|
|
if (flag)
|
|
{
|
|
if (this.combatEnd != null)
|
|
{
|
|
base.StopCoroutine(this.combatEnd);
|
|
this.endingCombat = false;
|
|
this.combatEnd = null;
|
|
}
|
|
if (!Links.x.domeAnimator.gameObject.activeSelf)
|
|
{
|
|
Links.x.domeAnimator.gameObject.SetActive(true);
|
|
}
|
|
Links.x.domeColliders.SetActive(true);
|
|
}
|
|
this.combatStartTime = Links.x.gameplay.seconds;
|
|
if (firstStart && flag2 && Records.x.turnBased)
|
|
{
|
|
if (initiator.npc && !partyInitiative)
|
|
{
|
|
this.currentTurn = "Party";
|
|
this.playerStartedCombat = false;
|
|
}
|
|
else
|
|
{
|
|
this.currentTurn = "NPC";
|
|
this.playerStartedCombat = true;
|
|
if (partyInitiative)
|
|
{
|
|
if (Links.x.domeAnimator.gameObject.activeSelf)
|
|
{
|
|
Links.x.domeAnimator.SetBool("NPC", false);
|
|
}
|
|
}
|
|
else if (Links.x.domeAnimator.gameObject.activeSelf)
|
|
{
|
|
Links.x.domeAnimator.SetBool("NPC", false);
|
|
}
|
|
}
|
|
}
|
|
this.domeDistance = 25f;
|
|
float num = this.domeDistance;
|
|
float num2 = this.domeDistance;
|
|
if (initiator)
|
|
{
|
|
this.domeCenter = initiator.tr.position;
|
|
}
|
|
if (!firstStart || partyInitiative)
|
|
{
|
|
this.domeCenter = initiator.tr.position;
|
|
}
|
|
this.allCharacters = Links.x.diorama.characters;
|
|
if (this.characterStartingAttack && Records.x.turnBased)
|
|
{
|
|
this.currentTurnCharacter = this.characterStartingAttack;
|
|
if (Records.x.turnBased)
|
|
{
|
|
this.characterInTurn = true;
|
|
}
|
|
}
|
|
this.domeDistance = 25f;
|
|
if (flag)
|
|
{
|
|
Links.x.domeAnimator.gameObject.SetActive(true);
|
|
Links.x.domeAnimator.gameObject.transform.position = this.domeCenter;
|
|
Links.x.cameraEffects.ChangeDomeState(true);
|
|
Links.x.domeColliders.transform.position = this.domeCenter;
|
|
Shader.SetGlobalVector("_DomeCenter", this.domeCenter);
|
|
if (Links.x.worldCamera.orthographic)
|
|
{
|
|
Links.x.domeAnimator.speed = 0.8f;
|
|
}
|
|
else
|
|
{
|
|
Links.x.domeAnimator.speed = 0.3f;
|
|
}
|
|
}
|
|
Links.x.hudControl.timelineAnimator.Play("Timeline Start");
|
|
int count = this.allCharacters.Count;
|
|
if (firstStart && flag2)
|
|
{
|
|
int num3;
|
|
for (int i = 0; i < this.party.Count; i = num3 + 1)
|
|
{
|
|
if (this.party[i] && !this.party[i].isBoro)
|
|
{
|
|
this.AddParty(this.party[i], false, initiator, true);
|
|
this.party[i].inCombat = true;
|
|
if (Records.x.useBigTiles)
|
|
{
|
|
yield return this.delayQuarterSecond;
|
|
}
|
|
}
|
|
num3 = i;
|
|
}
|
|
}
|
|
if (firstStart)
|
|
{
|
|
if (Records.x.turnBased && !this.characterStartingAttack)
|
|
{
|
|
yield return this.delaySecond;
|
|
}
|
|
this.npcCount = 0;
|
|
for (int k = 0; k < this.characters.Count; k++)
|
|
{
|
|
if (this.characters[k].npc)
|
|
{
|
|
this.npcCount++;
|
|
}
|
|
}
|
|
this.preDome = true;
|
|
if (this.npcCount > 0)
|
|
{
|
|
this.preDome = false;
|
|
this.npcsInCombat = true;
|
|
}
|
|
}
|
|
Links.x.hudControl.StartCombat();
|
|
}
|
|
this.combatStart = null;
|
|
this.characterStartingAttack = null;
|
|
this.combatCinematics = false;
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x060004BA RID: 1210 RVA: 0x0006A411 File Offset: 0x00068611
|
|
public void CheckForFreeAttack(Character attacker, Character target)
|
|
{
|
|
}
|
|
|
|
// Token: 0x060004BB RID: 1211 RVA: 0x0006A414 File Offset: 0x00068614
|
|
public bool CanSeeSomeoneInCombat(Vector3 pt, float sight)
|
|
{
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
Character character = this.characters[i];
|
|
if (character && (pt - character.tr.position).sqrMagnitude < sight * sight && character.hasActions && character.actions.ai.HasEnemies())
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x060004BC RID: 1212 RVA: 0x0006A488 File Offset: 0x00068688
|
|
public bool AnyoneCharging()
|
|
{
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
if (this.characters[i] && this.characters[i].actions && this.characters[i].actions.chargeUpFX)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x060004BD RID: 1213 RVA: 0x0006A4F8 File Offset: 0x000686F8
|
|
public bool InDomeRange(Character character)
|
|
{
|
|
if (Records.x.turnBased)
|
|
{
|
|
float num = this.domeDistance + 2f;
|
|
return Vector3.Distance(character.tr.position, this.domeCenter) < num;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x060004BE RID: 1214 RVA: 0x0006A53C File Offset: 0x0006873C
|
|
public void SaveCombatants(Vector3 exitPoint, bool newMap)
|
|
{
|
|
if (newMap)
|
|
{
|
|
this.changingMap = Links.x.gaia.changingMaps;
|
|
this.changingMapDistance = Links.x.gaia.changingMapsDistance;
|
|
if (Links.x.gaia.changingMapsComplete)
|
|
{
|
|
this.changingMap.Clear();
|
|
this.changingMapDistance.Clear();
|
|
}
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
Character character = this.characters[i];
|
|
if (character && character.IsSentient() && character.npc && character.creatures && !character.creatures.temporary && !character.ghost && !character.stats.characterRow._NeverLeaveMap && character.stats.characterRow._Quest == "")
|
|
{
|
|
this.changingMap.Add(character);
|
|
this.changingMapDistance.Add(Vector3.Distance(character.tr.position, exitPoint) * 10f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004BF RID: 1215 RVA: 0x0006A668 File Offset: 0x00068868
|
|
public void SetCombatantsHostility(int hostility)
|
|
{
|
|
Debug.Log("Checking combatants " + this.characters.Count.ToString());
|
|
int num = 0;
|
|
foreach (Character character in this.characters)
|
|
{
|
|
if (character && character.npc && character.creatures.creatures.temperament != Creatures.temperamentState.AttacksOnSight)
|
|
{
|
|
character.hostility = (int)character.creatures.creatures.temperament;
|
|
character.CircleAnimation("");
|
|
if (character.actions)
|
|
{
|
|
character.actions.EndActions();
|
|
}
|
|
if (num == 0 || Random.Range(0, 3) == 0)
|
|
{
|
|
int num2 = Random.Range(0, 3);
|
|
if (!character.stats.animal)
|
|
{
|
|
if (num2 == 0)
|
|
{
|
|
character.StartQuip("That'll be a lesson for you");
|
|
}
|
|
if (num2 == 1)
|
|
{
|
|
character.StartQuip("Do that again and you'll be on exile island");
|
|
}
|
|
if (num2 == 2)
|
|
{
|
|
character.StartQuip("I was merciful...this time");
|
|
}
|
|
}
|
|
}
|
|
num++;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004C0 RID: 1216 RVA: 0x0006A798 File Offset: 0x00068998
|
|
private IEnumerator StartXPCoroutine()
|
|
{
|
|
yield return new WaitForSeconds(1.5f);
|
|
if (!Records.x.dialogue)
|
|
{
|
|
for (int i = 0; i < this.partyCharacterXP.Count; i++)
|
|
{
|
|
if (this.partyCharacterXP[i] && this.partyCharacterXP[i].stats.XP - this.partyXP[i] > 0)
|
|
{
|
|
bool dead = this.partyCharacterXP[i].dead;
|
|
}
|
|
}
|
|
}
|
|
yield return new WaitForSeconds(2f);
|
|
if (this.exileCharacter)
|
|
{
|
|
if (this.exileCharacter.creatures)
|
|
{
|
|
float num = this.exileCharacter.creatures.GetTimeOfDeath(this.exileCharacter);
|
|
num -= 21f;
|
|
float num2 = Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours());
|
|
if (!Records.x.combat && !Records.x.dialogue && num2 < num && Records.x.CanTurnInExile(this.exileCharacter.stats.characterRow._Quest, this.exileCharacter.stats.xmlName) && QuestLog.GetQuestState("ShowExileIslandDialogue") == QuestState.Unassigned)
|
|
{
|
|
if (!this.exileCharacter.stats.xmlName.Contains("RenazinSpy"))
|
|
{
|
|
Character firstAvailableParty = Links.x.GetFirstAvailableParty(this.exileCharacter.tr.position);
|
|
Character secondAvailableParty = Links.x.GetSecondAvailableParty(this.exileCharacter.tr.position, firstAvailableParty);
|
|
if (!secondAvailableParty)
|
|
{
|
|
Links.x.gameplay.StartDialogue(Links.x.main, this.exileCharacter, null, null, "Party/ExileIslandSingle");
|
|
}
|
|
else if (secondAvailableParty)
|
|
{
|
|
Links.x.gameplay.StartDialogue(firstAvailableParty, this.exileCharacter, secondAvailableParty, null, "Party/ExileIsland");
|
|
}
|
|
}
|
|
QuestLog.SetQuestState("ShowExileIslandDialogue", QuestState.Active);
|
|
}
|
|
}
|
|
this.exileCharacter = null;
|
|
}
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x060004C1 RID: 1217 RVA: 0x0006A7A8 File Offset: 0x000689A8
|
|
public void ClickAwayFromCombat()
|
|
{
|
|
int num = 0;
|
|
if (Records.x.combat)
|
|
{
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
if (this.characters[i] && this.characters[i].npc)
|
|
{
|
|
num++;
|
|
break;
|
|
}
|
|
}
|
|
if (num == 0)
|
|
{
|
|
this.EndCombat(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004C2 RID: 1218 RVA: 0x0006A810 File Offset: 0x00068A10
|
|
public void BribeToReduceHostilities()
|
|
{
|
|
List<Character> list = new List<Character>();
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
list.Add(this.characters[i]);
|
|
}
|
|
int num = 0;
|
|
for (int j = 0; j < list.Count; j++)
|
|
{
|
|
if (list[j] && list[j].npc && list[j].hasActions)
|
|
{
|
|
if (list[j].stats.isGuard || list[j].stats.allegiance == 6U)
|
|
{
|
|
list[j].hostility = 1;
|
|
list[j].attackingUntilBribe = false;
|
|
list[j].actions.EndActions();
|
|
}
|
|
else
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
}
|
|
if (num == 0)
|
|
{
|
|
this.EndCombat(false);
|
|
}
|
|
Links.x.sensory.RemoveBribeHostility();
|
|
}
|
|
|
|
// Token: 0x060004C3 RID: 1219 RVA: 0x0006A900 File Offset: 0x00068B00
|
|
public void JusticeCombat(Character guilty)
|
|
{
|
|
Debug.Log("Setting non-hostile everyone but " + ((guilty != null) ? guilty.ToString() : null));
|
|
List<Character> list = new List<Character>();
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
list.Add(this.characters[i]);
|
|
}
|
|
int num = 0;
|
|
for (int j = 0; j < list.Count; j++)
|
|
{
|
|
if (list[j] && list[j].npc)
|
|
{
|
|
if ((list[j].stats.isGuard || list[j].stats.allegiance == 6U) && list[j] != guilty && !Links.x.sensory.CheckProof(list[j]))
|
|
{
|
|
if (list[j].hasActions)
|
|
{
|
|
list[j].hostility = 1;
|
|
list[j].actions.EndActions();
|
|
list[j].ClearLKP();
|
|
}
|
|
else
|
|
{
|
|
list[j].ClearLKP();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004C4 RID: 1220 RVA: 0x0006AA2C File Offset: 0x00068C2C
|
|
public void AddHostilityReduceCharacter(Character character)
|
|
{
|
|
int num = this.reduceHostilities.IndexOf(character);
|
|
Debug.Log("reduce hostilities for " + ((character != null) ? character.ToString() : null));
|
|
if (num == -1)
|
|
{
|
|
this.reduceHostilities.Add(character);
|
|
this.reduceHostilitiesTimes.Add(Time.timeSinceLevelLoad);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004C5 RID: 1221 RVA: 0x0006AA80 File Offset: 0x00068C80
|
|
public void CheckReduceHostilities(bool ignoreTimes)
|
|
{
|
|
if (Records.x.BribeBadgeCount() > 0)
|
|
{
|
|
return;
|
|
}
|
|
bool flag = false;
|
|
for (int i = 0; i < this.reduceHostilities.Count; i++)
|
|
{
|
|
if (Time.timeSinceLevelLoad > this.reduceHostilitiesTimes[i] + 3f && ((!Records.x.InCombat(false) && this.reduceHostilities[i]) || ignoreTimes))
|
|
{
|
|
string text = "removed hostility for ";
|
|
Character character = this.reduceHostilities[i];
|
|
Debug.Log(text + ((character != null) ? character.ToString() : null));
|
|
this.reduceHostilities[i].hostility = 1;
|
|
this.reduceHostilitiesTimes[i] = -1f;
|
|
this.reduceHostilities[i] = null;
|
|
flag = true;
|
|
}
|
|
}
|
|
if (flag)
|
|
{
|
|
this.reduceHostilitiesTimes.RemoveAll((float item) => item == -1f);
|
|
this.reduceHostilities.RemoveAll((Character item) => item == null);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004C6 RID: 1222 RVA: 0x0006ABA9 File Offset: 0x00068DA9
|
|
public void EndCombat(bool immediate)
|
|
{
|
|
if (this.combatEnd != null)
|
|
{
|
|
base.StopCoroutine(this.combatEnd);
|
|
this.endingCombat = false;
|
|
this.combatEnd = null;
|
|
}
|
|
this.combatEnd = this.EndingCombat(immediate);
|
|
base.StartCoroutine(this.combatEnd);
|
|
}
|
|
|
|
// Token: 0x060004C7 RID: 1223 RVA: 0x0006ABE8 File Offset: 0x00068DE8
|
|
private bool EveryoneDone()
|
|
{
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
Character character = this.characters[i];
|
|
if (character && character.actions)
|
|
{
|
|
if (character.actions.playingMusic)
|
|
{
|
|
return false;
|
|
}
|
|
if (character.inAction && Time.timeSinceLevelLoad < this.startCombatEnd + 1f)
|
|
{
|
|
return false;
|
|
}
|
|
if (character.inQueuedAbility)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return !this.inRally && !this.inPocketAttack;
|
|
}
|
|
|
|
// Token: 0x060004C8 RID: 1224 RVA: 0x0006AC78 File Offset: 0x00068E78
|
|
private IEnumerator EndingCombat(bool immediate)
|
|
{
|
|
this.startCombatEnd = Time.timeSinceLevelLoad;
|
|
while (!this.EveryoneDone() && !immediate)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (Records.x.combatConsoleDebugging)
|
|
{
|
|
Debug.Log("End combat");
|
|
}
|
|
if (this.pickingRally)
|
|
{
|
|
Links.x.main.portrait.AnimatorSynergyDone();
|
|
this.rallyCharacter.portrait.AnimatorSynergyDone();
|
|
}
|
|
Links.x.gameCard.badgesCanvasGroup.alpha = 1f;
|
|
this.centralEnemyPosition = Vector3.zero;
|
|
this.endingCombat = true;
|
|
this.pickingRally = false;
|
|
this.inRally = false;
|
|
this.preDome = false;
|
|
this.inPocketAttack = false;
|
|
this.isJustice = false;
|
|
if (this.combatStart != null)
|
|
{
|
|
base.StopCoroutine(this.combatStart);
|
|
this.combatStart = null;
|
|
}
|
|
Links.x.combat.SetCharacterInTurn(false);
|
|
if (this.groupCorout != null)
|
|
{
|
|
base.StopCoroutine(this.groupCorout);
|
|
this.groupCorout = null;
|
|
}
|
|
Links.x.hudControl.EndOfCombat();
|
|
if (false)
|
|
{
|
|
Links.x.domeColliders.SetActive(false);
|
|
}
|
|
bool flag = false;
|
|
for (int i = 0; i < this.party.Count; i++)
|
|
{
|
|
if (this.party[i] && !this.party[i].isBoro && this.party[i].hasActions)
|
|
{
|
|
flag = true;
|
|
break;
|
|
}
|
|
}
|
|
for (int j = 0; j < this.reduceHostilities.Count; j++)
|
|
{
|
|
this.reduceHostilitiesTimes[j] = Time.timeSinceLevelLoad;
|
|
}
|
|
Links.x.fellowship.formation = 0;
|
|
Links.x.fellowship.GetFormation();
|
|
Links.x.hudControl.EndCombat();
|
|
this.npcOnlyCombat = false;
|
|
base.StartCoroutine(this.StartXPCoroutine());
|
|
this.combatCinematics = true;
|
|
Records.x.combat = false;
|
|
Links.x.hudControl.timelineAnimator.Play("Timeline End");
|
|
this.playerStartedCombat = false;
|
|
for (int k = 0; k < this.characters.Count; k++)
|
|
{
|
|
Character character = this.characters[k];
|
|
if (character)
|
|
{
|
|
if (character.actions)
|
|
{
|
|
character.inCombat = false;
|
|
character.EndCombat();
|
|
if (character.actions)
|
|
{
|
|
character.actions.EndActions();
|
|
}
|
|
character.isTarget = false;
|
|
if (character.stats.isLazureGuard)
|
|
{
|
|
this.AddHostilityReduceCharacter(character);
|
|
}
|
|
this.characters[k] = null;
|
|
this.charactersLastActionTime[k] = -1f;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.charactersLastActionTime[k] = -1f;
|
|
}
|
|
}
|
|
this.TargetsAnytime();
|
|
this.pocketTarget = null;
|
|
if (Links.x.gaia.boroControls && flag)
|
|
{
|
|
Links.x.gaia.boroControls.ComingBackFromCombat();
|
|
}
|
|
Records.x.CombatDoneBribeStates();
|
|
for (int l = 0; l < this.enemyGroups.Count; l++)
|
|
{
|
|
this.enemyGroups[l].BreakCircle(false, false);
|
|
}
|
|
this.enemyGroups.Clear();
|
|
this.groupCount = 3;
|
|
this.characters.RemoveAll((Character item) => item == null);
|
|
this.charactersLastActionTime.RemoveAll((float item) => item == -1f);
|
|
Links.x.cellar.ReturnCombatPools();
|
|
int count = this.currentTileEffects.Count;
|
|
this.currentTileEffectsTemp.Clear();
|
|
for (int m = 0; m < count; m++)
|
|
{
|
|
this.currentTileEffectsTemp.Add(this.currentTileEffects[m]);
|
|
}
|
|
if (Links.x.soundtrack.currentSoundtrack.Contains("Combat") || Links.x.soundtrack.currentSong.Contains("Combat"))
|
|
{
|
|
Links.x.gaia.FadeOutPlaylist(true, 0.5f);
|
|
Links.x.gaia.SetEnvironmentPlaylist(Links.x.gameplay.sailing, Links.x.main.inTown, true);
|
|
}
|
|
if (Records.x.turnBased)
|
|
{
|
|
this.SwitchUI("Off");
|
|
Records.x.playerTurn = true;
|
|
for (int n = 0; n < this.party.Count; n++)
|
|
{
|
|
this.party[n].ToggleArrow(true);
|
|
}
|
|
this.domeOn = true;
|
|
}
|
|
this.undeadCount = 0;
|
|
Records.x.playerTurn = false;
|
|
this.combatCinematics = false;
|
|
this.combatEnd = null;
|
|
int num = 0;
|
|
int num2 = 0;
|
|
for (int num3 = 0; num3 < this.party.Count; num3++)
|
|
{
|
|
if (this.party[num3])
|
|
{
|
|
if ((this.party[num3].stunned || this.party[num3].dead) && this.party[num3].party)
|
|
{
|
|
num++;
|
|
}
|
|
if (this.party[num3].party)
|
|
{
|
|
this.party[num3].portrait.skillBag.SetSelectedState();
|
|
num2++;
|
|
}
|
|
}
|
|
}
|
|
if (num < num2)
|
|
{
|
|
for (int num4 = 0; num4 < this.party.Count; num4++)
|
|
{
|
|
if (this.party[num4] && (this.party[num4].stunned || this.party[num4].dead) && this.party[num4].party)
|
|
{
|
|
this.party[num4].PartyResurrect(-1);
|
|
}
|
|
}
|
|
}
|
|
if (!Links.x.AllDead())
|
|
{
|
|
Links.x.diorama.CombatEndPrompts();
|
|
}
|
|
if (!this.attackingInteractiveOutsideOfCombat)
|
|
{
|
|
Links.x.hudControl.ToggleAttackTimer(false);
|
|
}
|
|
this.npcsInCombat = false;
|
|
this.ClearPossibleTargets();
|
|
this.endingCombat = false;
|
|
Links.x.gameplay.SetDomeSize();
|
|
this.timedBreakables = null;
|
|
this.diaBreakables = null;
|
|
this.diaDoors = null;
|
|
this.diaChests = null;
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x060004C9 RID: 1225 RVA: 0x0006AC8E File Offset: 0x00068E8E
|
|
private IEnumerator DomeEnd()
|
|
{
|
|
yield return this.delayHalfSecond;
|
|
if (!Records.x.combat)
|
|
{
|
|
Links.x.cameraEffects.ChangeDomeState(false);
|
|
this.domeOn = false;
|
|
}
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x060004CA RID: 1226 RVA: 0x0006ACA0 File Offset: 0x00068EA0
|
|
public void EndCombatFromTestScreen()
|
|
{
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
if (this.characters[i] && (this.characters[i].hostility == 2 || this.characters[i].attackingUntilBribe))
|
|
{
|
|
if (this.characters[i].hasActions)
|
|
{
|
|
this.characters[i].actions.EndActions();
|
|
}
|
|
this.characters[i].TargetReached();
|
|
if (Records.x.kill)
|
|
{
|
|
this.characters[i].stats.SetHealth(0, false);
|
|
if (!this.characters[i].dead)
|
|
{
|
|
this.characters[i].Dead(false, true, false);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.characters[i].stats.SetHealth(0, false);
|
|
this.characters[i].Stunned(false);
|
|
}
|
|
}
|
|
}
|
|
this.EndCombat(false);
|
|
}
|
|
|
|
// Token: 0x060004CB RID: 1227 RVA: 0x0006ADC4 File Offset: 0x00068FC4
|
|
public void CheckToMakeNewGroup()
|
|
{
|
|
float seconds = Links.x.gameplay.seconds;
|
|
bool flag = true;
|
|
if (Records.x.banquetIsle)
|
|
{
|
|
flag = Links.x.GetPartyCount() > 1;
|
|
}
|
|
if (Records.x.InCombat(false) && Links.x.gaia.pathfindingReady && Links.x.gaia.sceneLoaded && !Records.x.pocketPause && !Records.x.paused && flag && !Records.x.removeControls && this.npcCount >= 0)
|
|
{
|
|
Character character = null;
|
|
if (this.groupCorout == null && !Records.x.partySailing)
|
|
{
|
|
bool flag2 = false;
|
|
bool flag3 = false;
|
|
bool flag4 = false;
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
if (!flag2 && !flag4)
|
|
{
|
|
Character character2 = this.characters[i];
|
|
if (character2 && character2.npc && character2.IsSentient() && !character2.inCircle && (seconds > character2.timeSinceCircle + 30f || character2.timeSinceCircle == 0f) && !character2.sailing)
|
|
{
|
|
if ((character2.protectMe || character2.stats.needsDefending) && (Links.x.gameplay.seconds > character2.timeSinceCircle + 100f || character2.timeSinceCircle == 0f) && character2.node != null)
|
|
{
|
|
flag2 = true;
|
|
character = character2;
|
|
}
|
|
if (character2.postHitTime > 0f && character2.stats.isFishMonster)
|
|
{
|
|
flag4 = true;
|
|
character = character2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this.npcCount == 1 && !flag2 && this.enemyGroups.Count == 0 && Random.Range(0, 10) != 0)
|
|
{
|
|
int j = 0;
|
|
while (j < this.characters.Count)
|
|
{
|
|
if (this.characters[j] && this.characters[j].npc && !this.characters[j].inCircle && !this.characters[j].ambushing)
|
|
{
|
|
if (this.characters[j].actions)
|
|
{
|
|
this.characters[j].actions.ai.runBackToFriends = true;
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
j++;
|
|
}
|
|
}
|
|
}
|
|
bool flag5 = false;
|
|
if ((Links.x.gameplay.seconds > this.lastGroupTime + 50f && ((Random.Range(0, 10) == 0 && this.enemyGroups.Count == 0) || (Random.Range(0, 20) == 0 && this.enemyGroups.Count == 1) || (Random.Range(0, 20) == 0 && this.enemyGroups.Count == 2))) || flag2 || flag4 || flag5)
|
|
{
|
|
bool flag6 = false;
|
|
if (!character && Random.Range(0, 4) == 0)
|
|
{
|
|
flag6 = true;
|
|
}
|
|
if (this.npcCount == 1)
|
|
{
|
|
flag6 = true;
|
|
}
|
|
if (flag4)
|
|
{
|
|
flag6 = true;
|
|
flag3 = false;
|
|
flag2 = false;
|
|
}
|
|
this.groupCorout = this.MakeGroup(flag2, flag6, character, flag3, flag4);
|
|
base.StartCoroutine(this.groupCorout);
|
|
return;
|
|
}
|
|
if (this.groupCorout == null)
|
|
{
|
|
this.CheckIfSomeoneShouldAddToGroup();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004CC RID: 1228 RVA: 0x0006B149 File Offset: 0x00069349
|
|
private IEnumerator MakeGroup(bool defensive, bool swarm, Character defendCharacter, bool noUICircle, bool aggressionFromHit)
|
|
{
|
|
float t = Links.x.gameplay.seconds;
|
|
Character centerCharacter = null;
|
|
this.triedCharacters.Clear();
|
|
bool swarming = swarm;
|
|
bool staminaFilling = false;
|
|
bool movingTogether = noUICircle;
|
|
if (!defendCharacter && Random.Range(0, 3) == 0 && this.npcCount > 5 && !swarm)
|
|
{
|
|
movingTogether = true;
|
|
}
|
|
if (movingTogether)
|
|
{
|
|
swarm = false;
|
|
swarming = false;
|
|
defensive = false;
|
|
staminaFilling = false;
|
|
}
|
|
if (!swarming && !movingTogether && !defensive)
|
|
{
|
|
staminaFilling = true;
|
|
}
|
|
if (Records.x.banquetIsle && Records.x.needsCircleTooltip)
|
|
{
|
|
movingTogether = true;
|
|
swarming = false;
|
|
defensive = false;
|
|
staminaFilling = false;
|
|
defendCharacter = null;
|
|
}
|
|
Vector3 groupPosition = Vector3.zero;
|
|
GraphNode groupNode = null;
|
|
Vector3 mainPosition = Links.x.main.currentPosition;
|
|
if (this.groupCount == 0)
|
|
{
|
|
this.groupCount = 3;
|
|
}
|
|
if (defensive && defendCharacter)
|
|
{
|
|
groupNode = defendCharacter.node;
|
|
ConstantPath constPath = ConstantPath.ConstructFast(groupNode, Records.x.GetConstantPathRadius(9), null);
|
|
this.groupConstraint.constrainWalkability = false;
|
|
this.groupConstraint.walkable = true;
|
|
this.groupConstraint.constrainTags = false;
|
|
this.groupConstraint.passID = 0;
|
|
this.groupConstraint.passID2 = 0;
|
|
this.groupConstraint.checkCircleID = this.groupCount;
|
|
this.groupConstraint.checkConnections = 0;
|
|
this.groupConstraint.constrainToEnvironment = 1;
|
|
this.groupConstraint.constrainToArea = -1;
|
|
if (defendCharacter.movesOnWater)
|
|
{
|
|
this.groupConstraint.constrainToEnvironment = 2;
|
|
}
|
|
constPath.nnConstraint = this.groupConstraint;
|
|
AstarPath.StartPath(constPath, false);
|
|
yield return base.StartCoroutine(constPath.WaitForPath());
|
|
constPath.Claim(this);
|
|
this.allNodes = constPath.allNodes;
|
|
int count = this.allNodes.Count;
|
|
this.possibleCenters.Clear();
|
|
Vector3 vector = Vector3.zero;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
GraphNode graphNode = this.allNodes[i];
|
|
if (graphNode.Walkable)
|
|
{
|
|
vector = (Vector3)graphNode.position;
|
|
if (this.AwayFromOtherGroups(vector, mainPosition, 625f) && graphNode.ConnectionCount(16) <= 8 && this.AwayFromOtherParty(vector, 144f) && !Physics.Linecast(Links.x.main.torsoPosition, vector + new Vector3(0f, 3f, 0f), 66304))
|
|
{
|
|
this.possibleCenters.Add(graphNode);
|
|
}
|
|
}
|
|
}
|
|
centerCharacter = defendCharacter;
|
|
constPath.Release(this, false);
|
|
constPath = null;
|
|
}
|
|
else if (!defensive && Links.x.main.node != null)
|
|
{
|
|
groupNode = Links.x.main.node;
|
|
ConstantPath constPath = ConstantPath.ConstructFast(groupNode, Records.x.GetConstantPathRadius(9), null);
|
|
this.groupConstraint.constrainWalkability = false;
|
|
this.groupConstraint.walkable = true;
|
|
this.groupConstraint.constrainTags = false;
|
|
this.groupConstraint.passID = 0;
|
|
this.groupConstraint.passID2 = 0;
|
|
this.groupConstraint.checkCircleID = this.groupCount;
|
|
this.groupConstraint.checkConnections = 0;
|
|
this.groupConstraint.constrainToEnvironment = -1;
|
|
this.groupConstraint.constrainToArea = -1;
|
|
constPath.nnConstraint = this.groupConstraint;
|
|
AstarPath.StartPath(constPath, false);
|
|
yield return base.StartCoroutine(constPath.WaitForPath());
|
|
constPath.Claim(this);
|
|
this.allNodes = constPath.allNodes;
|
|
int count2 = this.allNodes.Count;
|
|
this.possibleCenters.Clear();
|
|
Vector3 vector2 = Vector3.zero;
|
|
float num = 256f;
|
|
float num2 = 625f;
|
|
if (movingTogether && this.npcCount > 1)
|
|
{
|
|
num = 100f;
|
|
num2 = 400f;
|
|
}
|
|
for (int j = 0; j < count2; j++)
|
|
{
|
|
GraphNode graphNode2 = this.allNodes[j];
|
|
if (graphNode2.Walkable)
|
|
{
|
|
vector2 = (Vector3)graphNode2.position;
|
|
if ((this.AwayFromOtherGroups(vector2, mainPosition, 1225f) || aggressionFromHit) && (graphNode2.ConnectionCount(16) >= 12 || aggressionFromHit) && (this.AwayFromOtherParty(vector2, num) || aggressionFromHit) && (this.NearParty(vector2, num2) || aggressionFromHit) && !Physics.Linecast(Links.x.main.torsoPosition, vector2 + new Vector3(0f, 3f, 0f), 66304))
|
|
{
|
|
this.possibleCenters.Add(graphNode2);
|
|
}
|
|
}
|
|
}
|
|
centerCharacter = defendCharacter;
|
|
constPath.Release(this, false);
|
|
constPath = null;
|
|
}
|
|
bool overrideTime = false;
|
|
if (aggressionFromHit)
|
|
{
|
|
overrideTime = true;
|
|
}
|
|
yield return new WaitForSeconds(0.001f);
|
|
if (this.possibleCenters.Count > 0)
|
|
{
|
|
this.npcsThatCanGroup.Clear();
|
|
Character character = centerCharacter;
|
|
for (int k = 0; k < this.characters.Count; k++)
|
|
{
|
|
Character character2 = this.characters[k];
|
|
if (character2 && character2.npc && character2.IsSentient() && !character2.inCircle && !character2.enraged)
|
|
{
|
|
if (!defensive && !centerCharacter && !swarming && character2.stats.xmlName.Contains("Bakka") && !character2.ambushing && !character && character2.stats.StaminaPercent() > 0.5f)
|
|
{
|
|
swarming = true;
|
|
}
|
|
if (this.CanJoin(character2, character, t, false, swarming, movingTogether, staminaFilling, defensive, overrideTime))
|
|
{
|
|
this.npcsThatCanGroup.Add(character2);
|
|
}
|
|
}
|
|
}
|
|
Character character3 = defendCharacter;
|
|
if (!character3)
|
|
{
|
|
for (int l = 0; l < this.characters.Count; l++)
|
|
{
|
|
if (this.characters[l] && this.characters[l].inCombat && this.characters[l].IsSentient() && this.characters[l].npc)
|
|
{
|
|
character3 = this.characters[l];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (character3)
|
|
{
|
|
for (int m = 0; m < this.allCharacters.Count; m++)
|
|
{
|
|
Character character4 = this.allCharacters[m];
|
|
if (character4 && !character4.inactive && character4.npc && character4.IsSentient() && !character4.inCircle && !character4.enraged && !character4.hasActions && (character4.hostility == 2 || character4.attackingUntilBribe) && character4.stats.race == character3.stats.race && this.CanJoin(character4, character, t, false, swarming, movingTogether, staminaFilling, defensive, overrideTime) && character4 != character)
|
|
{
|
|
this.npcsThatCanGroup.Add(character4);
|
|
}
|
|
}
|
|
}
|
|
int z = this.possibleCenters.Count;
|
|
Vector3 vector3 = Vector3.zero;
|
|
int characterCount = this.npcsThatCanGroup.Count;
|
|
int charactersAllowed = 6;
|
|
if (swarming)
|
|
{
|
|
charactersAllowed = Random.Range(2, 6);
|
|
}
|
|
if (movingTogether)
|
|
{
|
|
charactersAllowed = Random.Range(2, 4);
|
|
}
|
|
if (aggressionFromHit)
|
|
{
|
|
charactersAllowed = Random.Range(2, 4);
|
|
}
|
|
this.possibleGroupNodes.Clear();
|
|
this.possibleGroupNodeCharacters.Clear();
|
|
bool failedFirstPass = false;
|
|
int num5;
|
|
for (int y = 0; y < 2; y = num5 + 1)
|
|
{
|
|
if (y == 0 || (y == 1 && staminaFilling && failedFirstPass))
|
|
{
|
|
for (int x = 0; x < z; x = num5 + 1)
|
|
{
|
|
bool flag = true;
|
|
vector3 = (Vector3)this.possibleCenters[x].position;
|
|
int num3 = 0;
|
|
if (centerCharacter)
|
|
{
|
|
float num4 = (vector3 - centerCharacter.currentPosition).sqrMagnitude;
|
|
if (num4 < 400f || aggressionFromHit)
|
|
{
|
|
Vector3 vector4 = Quaternion.LookRotation(vector3 - new Vector3(centerCharacter.currentPosition.x, vector3.y, centerCharacter.currentPosition.z)) * Vector3.forward;
|
|
Vector3 vector5 = Vector3.Normalize(mainPosition - new Vector3(centerCharacter.currentPosition.x, mainPosition.y, centerCharacter.currentPosition.z));
|
|
if (Vector3.Dot(vector4, vector5) > 0.5f || aggressionFromHit)
|
|
{
|
|
num3++;
|
|
}
|
|
else
|
|
{
|
|
flag = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
flag = false;
|
|
}
|
|
}
|
|
if (flag)
|
|
{
|
|
this.groupCharacters.Clear();
|
|
Character character5;
|
|
if (this.GetGroupCharacters(vector3, centerCharacter, defensive, staminaFilling, characterCount, num3, charactersAllowed, out character5, false, swarming, movingTogether, staminaFilling, overrideTime) >= 2 && character5)
|
|
{
|
|
this.possibleGroupNodes.Add(this.possibleCenters[x]);
|
|
this.possibleGroupNodeCharacters.Add(character5);
|
|
}
|
|
}
|
|
if (x == 100 || x == 200 || x == 300 || x == 400)
|
|
{
|
|
yield return new WaitForSeconds(0.001f);
|
|
}
|
|
num5 = x;
|
|
}
|
|
}
|
|
if (y == 0 && staminaFilling && this.possibleGroupNodes.Count == 0)
|
|
{
|
|
failedFirstPass = true;
|
|
staminaFilling = false;
|
|
swarming = true;
|
|
swarm = true;
|
|
}
|
|
num5 = y;
|
|
}
|
|
float num6 = float.PositiveInfinity;
|
|
int num7 = -1;
|
|
for (int n = 0; n < this.possibleGroupNodes.Count; n++)
|
|
{
|
|
float num4 = this.SubtractVectors((Vector3)this.possibleGroupNodes[n].position, this.possibleGroupNodeCharacters[n].currentPosition).sqrMagnitude;
|
|
if (num4 < num6)
|
|
{
|
|
num6 = num4;
|
|
num7 = n;
|
|
}
|
|
}
|
|
if (num7 > -1)
|
|
{
|
|
this.groupCharacters.Clear();
|
|
groupNode = this.possibleGroupNodes[num7];
|
|
groupPosition = (Vector3)this.possibleGroupNodes[num7].position;
|
|
int num8 = 0;
|
|
if (centerCharacter)
|
|
{
|
|
this.groupCharacters.Add(centerCharacter);
|
|
num8++;
|
|
}
|
|
Character character6;
|
|
this.GetGroupCharacters(groupPosition, centerCharacter, defensive, staminaFilling, characterCount, num8, charactersAllowed, out character6, true, swarming, movingTogether, staminaFilling, overrideTime);
|
|
this.groupNodes.Clear();
|
|
if (this.groupCharacters.Count < 8)
|
|
{
|
|
for (int num9 = this.groupCharacters.Count; num9 < 9; num9++)
|
|
{
|
|
this.groupCharacters.Add(null);
|
|
}
|
|
}
|
|
bool flag2 = true;
|
|
if (swarming && aggressionFromHit)
|
|
{
|
|
if (defendCharacter.dead || defendCharacter.stunned)
|
|
{
|
|
flag2 = false;
|
|
}
|
|
groupNode = this.groupCharacters[0].node;
|
|
}
|
|
if (flag2)
|
|
{
|
|
ConstantPath constPath = ConstantPath.ConstructFast(groupNode, Records.x.GetConstantPathRadius(4), null);
|
|
this.groupConstraint.constrainWalkability = false;
|
|
this.groupConstraint.walkable = true;
|
|
this.groupConstraint.constrainTags = false;
|
|
this.groupConstraint.checkCircleID = this.groupCount;
|
|
this.groupConstraint.passID = 0;
|
|
this.groupConstraint.passID2 = 0;
|
|
this.groupConstraint.checkConnections = 0;
|
|
this.groupConstraint.constrainToEnvironment = 1;
|
|
if (this.groupCharacters.Count > 0 && this.groupCharacters[0] && this.groupCharacters[0].movesOnWater)
|
|
{
|
|
this.groupConstraint.constrainToEnvironment = 2;
|
|
}
|
|
this.groupConstraint.constrainToArea = -1;
|
|
constPath.nnConstraint = this.groupConstraint;
|
|
if (Links.x.gaia.pathfindingReady && Links.x.gaia.sceneLoaded)
|
|
{
|
|
AstarPath.StartPath(constPath, false);
|
|
yield return base.StartCoroutine(constPath.WaitForPath());
|
|
constPath.Claim(this);
|
|
this.allNodes = constPath.allNodes;
|
|
int count3 = this.allNodes.Count;
|
|
this.groupNodes.Clear();
|
|
int num10 = 0;
|
|
this.allNodesTaken.Clear();
|
|
for (int num11 = 0; num11 < count3; num11++)
|
|
{
|
|
this.allNodesTaken.Add(0);
|
|
}
|
|
for (int num12 = 0; num12 < 10; num12++)
|
|
{
|
|
float num13 = 3f;
|
|
if (num12 == 1)
|
|
{
|
|
num13 = 3.6f;
|
|
}
|
|
if (num12 == 2)
|
|
{
|
|
num13 = 5.1f;
|
|
}
|
|
if (num12 == 3)
|
|
{
|
|
num13 = 7.1f;
|
|
}
|
|
if (num12 == 4)
|
|
{
|
|
num13 = 7.6f;
|
|
}
|
|
if (num12 == 5)
|
|
{
|
|
num13 = 10.6f;
|
|
}
|
|
if (num12 == 6)
|
|
{
|
|
num13 = 10.1f;
|
|
}
|
|
if (num12 == 7)
|
|
{
|
|
num13 = 14.1f;
|
|
}
|
|
if (num12 == 8)
|
|
{
|
|
num13 = 12.6f;
|
|
}
|
|
if (num12 == 9)
|
|
{
|
|
num13 = 17.6f;
|
|
}
|
|
float num14 = num13 * num13;
|
|
for (int num15 = 0; num15 < count3; num15++)
|
|
{
|
|
if (this.allNodesTaken[num15] == 0 && (num12 <= 1 || num10 < 9) && ((Vector3)this.allNodes[num15].position - groupPosition).sqrMagnitude < num14 && this.allNodes[num15].Walkable)
|
|
{
|
|
num10++;
|
|
this.groupNodes.Add(this.allNodes[num15]);
|
|
this.allNodesTaken[num15] = 1;
|
|
}
|
|
}
|
|
}
|
|
this.allNodesTaken.Clear();
|
|
int count4 = this.groupNodes.Count;
|
|
for (int num16 = 0; num16 < count4; num16++)
|
|
{
|
|
this.allNodesTaken.Add(0);
|
|
}
|
|
for (int num17 = 0; num17 < count4; num17++)
|
|
{
|
|
vector3 = (Vector3)this.groupNodes[num17].position;
|
|
bool flag3 = false;
|
|
for (int num18 = 0; num18 < count4; num18++)
|
|
{
|
|
if (!flag3)
|
|
{
|
|
Vector3 vector6 = (Vector3)this.groupNodes[num18].position;
|
|
vector6.y = vector3.y;
|
|
float num4 = (vector6 - vector3).sqrMagnitude;
|
|
if (num4 < 16f)
|
|
{
|
|
flag3 = true;
|
|
}
|
|
}
|
|
}
|
|
if (!flag3)
|
|
{
|
|
this.allNodesTaken[num17] = 1;
|
|
}
|
|
}
|
|
bool flag4 = false;
|
|
for (int num19 = 0; num19 < count4; num19++)
|
|
{
|
|
if (this.allNodesTaken[num19] == 1)
|
|
{
|
|
this.groupNodes[num19] = null;
|
|
flag4 = true;
|
|
}
|
|
}
|
|
if (flag4)
|
|
{
|
|
this.groupNodes.RemoveAll((GraphNode item) => item == null);
|
|
}
|
|
if (this.groupNodes.Count < 13)
|
|
{
|
|
for (int num20 = this.groupNodes.Count; num20 < 13; num20++)
|
|
{
|
|
this.groupNodes.Add(null);
|
|
}
|
|
}
|
|
constPath.Release(this, false);
|
|
this.lastGroupTime = Links.x.gameplay.seconds;
|
|
EnemyGroup enemyGroup = base.gameObject.AddComponent<EnemyGroup>();
|
|
this.enemyGroups.Add(enemyGroup);
|
|
enemyGroup.groupID = this.groupCount;
|
|
enemyGroup.maxCharacters = charactersAllowed;
|
|
this.groupCount++;
|
|
if (swarming)
|
|
{
|
|
enemyGroup.aggressive = true;
|
|
}
|
|
if (!defensive && !swarming && !movingTogether)
|
|
{
|
|
enemyGroup.staminaFilling = true;
|
|
}
|
|
enemyGroup.movingTogether = movingTogether;
|
|
enemyGroup.Setup(this.groupCharacters[0], this.groupCharacters[1], this.groupCharacters[2], this.groupCharacters[3], this.groupCharacters[4], this.groupCharacters[5], this.groupCharacters[6], this.groupCharacters[7], groupNode, this.groupNodes[0], this.groupNodes[1], this.groupNodes[2], this.groupNodes[3], this.groupNodes[4], this.groupNodes[5], this.groupNodes[6], this.groupNodes[7], this.groupNodes[8], this.groupNodes[9], this.groupNodes[10], this.groupNodes[11]);
|
|
}
|
|
constPath = null;
|
|
}
|
|
}
|
|
}
|
|
this.groupCorout = null;
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x060004CD RID: 1229 RVA: 0x0006B180 File Offset: 0x00069380
|
|
private int GetGroupCharacters(Vector3 pt, Character centerCharacter, bool defensive, bool needsStamina, int characterCount, int count, int charactersAllowed, out Character firstCharacter, bool addToGroup, bool swarming, bool movingTogether, bool staminaFilling, bool overrideTime)
|
|
{
|
|
int num = count;
|
|
firstCharacter = centerCharacter;
|
|
Vector3 currentPosition = Links.x.main.currentPosition;
|
|
float seconds = Links.x.gameplay.seconds;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
if (addToGroup || i == 1)
|
|
{
|
|
float num2 = 900f;
|
|
if (!defensive)
|
|
{
|
|
if (firstCharacter)
|
|
{
|
|
num2 = 256f;
|
|
}
|
|
else
|
|
{
|
|
num2 = 529f;
|
|
}
|
|
}
|
|
if (this.npcCount < 2)
|
|
{
|
|
num2 = 1600f;
|
|
}
|
|
if (i == 0)
|
|
{
|
|
num2 = 64f;
|
|
}
|
|
for (int j = 0; j < characterCount; j++)
|
|
{
|
|
if (num <= charactersAllowed)
|
|
{
|
|
Character character = this.npcsThatCanGroup[j];
|
|
if (character != firstCharacter && character.npc && character.IsSentient() && !character.inCircle && !character.enraged && (defensive || needsStamina || character.stats.formationGroup <= 3) && this.CanJoin(character, firstCharacter, seconds, needsStamina, swarming, movingTogether, staminaFilling, defensive, overrideTime))
|
|
{
|
|
float num3;
|
|
if (firstCharacter)
|
|
{
|
|
num3 = (character.currentPosition - firstCharacter.currentPosition).sqrMagnitude;
|
|
}
|
|
else
|
|
{
|
|
num3 = (character.currentPosition - pt).sqrMagnitude;
|
|
}
|
|
if (num3 < num2)
|
|
{
|
|
bool flag = false;
|
|
if (i > 0)
|
|
{
|
|
flag = this.groupCharacters.Contains(character);
|
|
}
|
|
if (!flag)
|
|
{
|
|
if (!firstCharacter)
|
|
{
|
|
Vector3 vector = Quaternion.LookRotation(pt - new Vector3(character.currentPosition.x, pt.y, character.currentPosition.z)) * Vector3.forward;
|
|
Vector3 vector2 = Vector3.Normalize(currentPosition - new Vector3(character.currentPosition.x, currentPosition.y, character.currentPosition.z));
|
|
if (Vector3.Dot(vector, vector2) < 0.5f && !overrideTime)
|
|
{
|
|
flag = true;
|
|
}
|
|
else
|
|
{
|
|
firstCharacter = character;
|
|
}
|
|
}
|
|
if (!flag)
|
|
{
|
|
num++;
|
|
this.groupCharacters.Add(character);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x060004CE RID: 1230 RVA: 0x0006B3D0 File Offset: 0x000695D0
|
|
public void CheckIfSomeoneShouldAddToGroup()
|
|
{
|
|
for (int i = 0; i < this.enemyGroups.Count; i++)
|
|
{
|
|
EnemyGroup enemyGroup = this.enemyGroups[i];
|
|
if (enemyGroup.inCircleCount < enemyGroup.maxCharacters && enemyGroup.formationCoroutine == null)
|
|
{
|
|
int num = enemyGroup.FreeSpots();
|
|
bool aggressive = enemyGroup.aggressive;
|
|
Character centerCharacter = enemyGroup.centerCharacter;
|
|
if (centerCharacter)
|
|
{
|
|
int num2 = 0;
|
|
for (int j = 0; j < 2; j++)
|
|
{
|
|
float num3 = 400f;
|
|
if (enemyGroup.aggressive || enemyGroup.staminaFilling)
|
|
{
|
|
num3 = 100f;
|
|
}
|
|
if (j == 0)
|
|
{
|
|
num3 = 56.25f;
|
|
}
|
|
for (int k = 0; k < this.characters.Count; k++)
|
|
{
|
|
if (num2 <= num)
|
|
{
|
|
Character character = this.characters[k];
|
|
if (character && character.npc && character.IsSentient() && !character.inCircle && !character.enraged && !character.inAction && !character.jumping && (!enemyGroup.aggressive || character.stats.formationGroup <= 3) && this.CanJoin(character, centerCharacter, Links.x.gameplay.seconds, enemyGroup.staminaFilling, enemyGroup.aggressive, enemyGroup.movingTogether, enemyGroup.staminaFilling, enemyGroup.defensive, false) && (enemyGroup.centroid - character.currentPosition).sqrMagnitude < num3 && character.hasActions && !character.actions.ai.busy)
|
|
{
|
|
num2++;
|
|
enemyGroup.AddToCircle(character);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004CF RID: 1231 RVA: 0x0006B5AC File Offset: 0x000697AC
|
|
private bool CanJoin(Character c1, Character c2, float t, bool needsStamina, bool isAggressiveGroup, bool isFakeGroup, bool isRecoverGroup, bool isDefendGroup, bool overrideTime)
|
|
{
|
|
if (c1.sailing)
|
|
{
|
|
return false;
|
|
}
|
|
if (overrideTime && !c1.inCircle && !c1.enraged)
|
|
{
|
|
if (!c2)
|
|
{
|
|
return true;
|
|
}
|
|
if (c1.stats.race == c2.stats.race && !c1.movesOnWater && !c2.movesOnWater)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
if (c1.ambushing || c1.resting)
|
|
{
|
|
return false;
|
|
}
|
|
if (c1.inCircle)
|
|
{
|
|
return false;
|
|
}
|
|
if (c1.stats.flying)
|
|
{
|
|
return false;
|
|
}
|
|
if (c1.stats.pinned || c1.stats.pinning)
|
|
{
|
|
return false;
|
|
}
|
|
if (isAggressiveGroup && !c1.stats.canAggressionGroup && (float)c1.stats.formationGroup <= 3f)
|
|
{
|
|
return false;
|
|
}
|
|
if (isFakeGroup && !c1.stats.canSecretGroup && (float)c1.stats.formationGroup <= 3f)
|
|
{
|
|
return false;
|
|
}
|
|
if (isRecoverGroup && !c1.stats.canRecoverGroup)
|
|
{
|
|
return false;
|
|
}
|
|
if (isDefendGroup && !c1.stats.canSecretGroup)
|
|
{
|
|
if (!c2)
|
|
{
|
|
return true;
|
|
}
|
|
if (c1.movesOnWater != c2.movesOnWater)
|
|
{
|
|
return false;
|
|
}
|
|
if (c2.stats.race == c1.stats.race)
|
|
{
|
|
return true;
|
|
}
|
|
if (c1.hostility >= 2 && c1.stats.allegiance == c2.stats.allegiance)
|
|
{
|
|
if (Links.x.diorama.sceneName == "D5_WestRuins")
|
|
{
|
|
if (c2.stats.xmlName.Contains("Pagan"))
|
|
{
|
|
return c1.stats.xmlName.Contains("Acorn");
|
|
}
|
|
if (c2.stats.xmlName.Contains("Baron"))
|
|
{
|
|
return c1.stats.xmlName.Contains("Skilpi");
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
if (t < c1.timeSinceCircle + 100f && c1.timeSinceCircle != 0f)
|
|
{
|
|
return false;
|
|
}
|
|
if (c1.stats.hasCustomAI && c1.stats.customAI == "MushroomWallTiles")
|
|
{
|
|
return false;
|
|
}
|
|
if (c1.stats.hasEveryAttackAI && c1.stats.everyAttackAI == "BubbleEvade")
|
|
{
|
|
return false;
|
|
}
|
|
if (needsStamina && c1.stats.StaminaPercent() > 0.7f)
|
|
{
|
|
return false;
|
|
}
|
|
if (c1.stats.defendMainInCombat && !c1.ghost)
|
|
{
|
|
return false;
|
|
}
|
|
if (c1.stats.stayNearPatrol)
|
|
{
|
|
return false;
|
|
}
|
|
if (isAggressiveGroup && !c2 && !c1.stats.canSecretGroup && c1.stats.isFishMonster)
|
|
{
|
|
return c1.postHitTime > 0f;
|
|
}
|
|
return !c2 || (!(c1.stats.race != c2.stats.race) && c1.movesOnWater == c2.movesOnWater && (c1.stats.MoveSpeedMS() == c2.stats.MoveSpeedMS() || isDefendGroup));
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004D0 RID: 1232 RVA: 0x0006B8EC File Offset: 0x00069AEC
|
|
private bool AwayFromOtherGroups(Vector3 groupPosition, Vector3 mainPosition, float maxFromMain)
|
|
{
|
|
if (this.SubtractVectors(groupPosition, mainPosition).sqrMagnitude < maxFromMain && Mathf.Abs(groupPosition.y - mainPosition.y) < 8f)
|
|
{
|
|
for (int i = 0; i < this.enemyGroups.Count; i++)
|
|
{
|
|
if ((groupPosition - this.enemyGroups[i].center).sqrMagnitude < 400f)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x060004D1 RID: 1233 RVA: 0x0006B968 File Offset: 0x00069B68
|
|
private bool AwayFromOtherParty(Vector3 groupPosition, float max)
|
|
{
|
|
for (int i = 0; i < this.party.Count; i++)
|
|
{
|
|
if (this.party[i] && this.party[i].party && this.party[i].IsSentient() && (groupPosition - this.party[i].currentPosition).sqrMagnitude < max)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x060004D2 RID: 1234 RVA: 0x0006B9EC File Offset: 0x00069BEC
|
|
public bool NearParty(Vector3 groupPosition, float dist)
|
|
{
|
|
for (int i = 0; i < this.party.Count; i++)
|
|
{
|
|
if (this.party[i] && this.party[i].party && this.party[i].IsSentient() && (this.party[i].mainSelected || this.SubtractVectors(Links.x.main.currentPosition, this.party[i].currentPosition).sqrMagnitude < dist) && (groupPosition - this.party[i].currentPosition).sqrMagnitude < dist)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x060004D3 RID: 1235 RVA: 0x0006BABC File Offset: 0x00069CBC
|
|
public bool NearAnyParty(Vector3 pt, float dist)
|
|
{
|
|
for (int i = 0; i < this.party.Count; i++)
|
|
{
|
|
Character character = this.party[i];
|
|
if (character && character.party && character.IsSentient() && (pt - character.currentPosition).sqrMagnitude < dist)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x060004D4 RID: 1236 RVA: 0x0006BB20 File Offset: 0x00069D20
|
|
public void AddCharacterToGroup(Character c, EnemyGroup g)
|
|
{
|
|
}
|
|
|
|
// Token: 0x060004D5 RID: 1237 RVA: 0x0006BB24 File Offset: 0x00069D24
|
|
public void RemoveGroup(EnemyGroup g)
|
|
{
|
|
int num = this.enemyGroups.IndexOf(g);
|
|
if (num > -1)
|
|
{
|
|
this.enemyGroups.RemoveAt(num);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004D6 RID: 1238 RVA: 0x0006BB50 File Offset: 0x00069D50
|
|
public void ClearTargets()
|
|
{
|
|
int count = this.characters.Count;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
Character character = this.characters[i];
|
|
if (character && character.npc)
|
|
{
|
|
character.body.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004D7 RID: 1239 RVA: 0x0006BBA0 File Offset: 0x00069DA0
|
|
public int ChallengeLevel(bool useParty)
|
|
{
|
|
int num = 0;
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
Character character = this.characters[i];
|
|
if (character && ((useParty && character.party) || (!useParty && character.npc)))
|
|
{
|
|
num += character.stats.level;
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x060004D8 RID: 1240 RVA: 0x0006BC04 File Offset: 0x00069E04
|
|
public void ClearPossibleTargets()
|
|
{
|
|
for (int i = 0; i < this.possibleTargets.Count; i++)
|
|
{
|
|
if (this.possibleTargets[i])
|
|
{
|
|
this.possibleTargets[i].body.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int j = 0; j < this.synergies.Count; j++)
|
|
{
|
|
if (this.synergies[j])
|
|
{
|
|
if (this.synergyFX[j])
|
|
{
|
|
Links.x.cellar.ReturnPooledGameObject(87, this.synergyFX[j]);
|
|
}
|
|
this.synergies[j].body.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int k = 0; k < this.synergyFX.Count; k++)
|
|
{
|
|
if (this.synergyFX[k])
|
|
{
|
|
Links.x.cellar.ReturnPooledGameObject(87, this.synergyFX[k]);
|
|
}
|
|
}
|
|
this.synergies.Clear();
|
|
this.synergyFX.Clear();
|
|
for (int l = 0; l < this.nearBreakables.Count; l++)
|
|
{
|
|
BreakableActions breakableActions = this.nearBreakables[l];
|
|
if (breakableActions && !breakableActions.destroyed)
|
|
{
|
|
breakableActions.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int m = 0; m < this.nearDoors.Count; m++)
|
|
{
|
|
DoorActions doorActions = this.nearDoors[m];
|
|
if (doorActions && !doorActions.destroyed)
|
|
{
|
|
doorActions.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int n = 0; n < this.nearChests.Count; n++)
|
|
{
|
|
ChestActions chestActions = this.nearChests[n];
|
|
if (chestActions && !chestActions.destroyed)
|
|
{
|
|
chestActions.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int num = 0; num < this.nearPuzzles.Count; num++)
|
|
{
|
|
PuzzleActions puzzleActions = this.nearPuzzles[num];
|
|
if (puzzleActions)
|
|
{
|
|
puzzleActions.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004D9 RID: 1241 RVA: 0x0006BE1B File Offset: 0x0006A01B
|
|
public int PossibleTargetCount()
|
|
{
|
|
return this.possibleTargets.Count;
|
|
}
|
|
|
|
// Token: 0x060004DA RID: 1242 RVA: 0x0006BE28 File Offset: 0x0006A028
|
|
public bool CanAttackTarget(Character target)
|
|
{
|
|
return this.possibleTargets.Contains(target);
|
|
}
|
|
|
|
// Token: 0x060004DB RID: 1243 RVA: 0x0006BE3B File Offset: 0x0006A03B
|
|
public bool InRangeTarget(Character c)
|
|
{
|
|
return this.inRange.Contains(c);
|
|
}
|
|
|
|
// Token: 0x060004DC RID: 1244 RVA: 0x0006BE4C File Offset: 0x0006A04C
|
|
public void TargetsAnytime()
|
|
{
|
|
bool flag = true;
|
|
Character main = Links.x.main;
|
|
if (Links.x.pocketWheel.open && (!Links.x.pocketWheel.selected.Contains("Attack") || Links.x.pocketWheel.selected.Contains("Special")))
|
|
{
|
|
flag = false;
|
|
}
|
|
if ((main.inAction || main.inRecovery || main.IsAttacking(main.body.currentHash)) && main.timelineIcon && main.timelineIcon.overridePause)
|
|
{
|
|
flag = false;
|
|
}
|
|
bool flag2 = false;
|
|
bool flag3 = false;
|
|
if (Links.x.pocketWheel.selected.Contains("Medium Attack"))
|
|
{
|
|
flag2 = true;
|
|
}
|
|
if (Links.x.pocketWheel.selected.Contains("Heavy Attack"))
|
|
{
|
|
flag3 = true;
|
|
}
|
|
if (flag2 && Records.x.pocketPause && !Links.x.pocketWheel.mediumAtkBtn.interactable)
|
|
{
|
|
flag = false;
|
|
}
|
|
if (flag3 && Records.x.pocketPause && !Links.x.pocketWheel.heavyAtkBtn.interactable)
|
|
{
|
|
flag = false;
|
|
}
|
|
if (!Records.x.removeControls && Links.x.gaia.sceneLoaded && !this.miniEvent && !this.bubbleEvent && !Records.x.miniGame && Records.x.InCombat(false) && !this.npcOnlyCombat && flag && !Links.x.pocketWheel.rally1)
|
|
{
|
|
Vector3 position = main.tr.position;
|
|
this.inRange.Clear();
|
|
float meleeRangeStart = main.invRow1._MeleeRangeStart;
|
|
for (int i = 0; i < this.allCharacters.Count; i++)
|
|
{
|
|
Character character = this.allCharacters[i];
|
|
if (character)
|
|
{
|
|
bool flag4 = false;
|
|
if (!character.inactive && character.npc && !character.dead && !character.inactive && (!character.stunned || (character.stunned && Records.x.kill)) && (character.hostility >= 2 || character.attackingUntilBribe) && character.visible == 1 && !character.meshAlwaysOff)
|
|
{
|
|
float num;
|
|
float num2;
|
|
float num3;
|
|
this.GetDistances(main, character, out num, out num2, out num3);
|
|
float sqrMagnitude = (position - character.tr.position).sqrMagnitude;
|
|
if (flag2)
|
|
{
|
|
num3 = 0f;
|
|
num2 = 12.25f;
|
|
}
|
|
else if (flag3)
|
|
{
|
|
num3 = 0f;
|
|
num2 = 49f;
|
|
}
|
|
if (sqrMagnitude <= num2 && (meleeRangeStart == 0f || sqrMagnitude >= num3 || this.inPocketAttack) && (!Physics.Linecast(main.raycastPosition, main.AddVectorY(character.tr.position, 2f), 66048) || this.inPocketAttack))
|
|
{
|
|
bool flag5 = true;
|
|
if (main.invRow1._MainSkill != "Elixir" && main.invRow1._MainSkill != "Pole")
|
|
{
|
|
flag5 = Links.x.combat.InRangeSight(main, character);
|
|
}
|
|
if (flag5)
|
|
{
|
|
if (!character.body.targetOutline)
|
|
{
|
|
character.body.TargetingOutline(true);
|
|
}
|
|
this.inRange.Add(character);
|
|
flag4 = true;
|
|
}
|
|
}
|
|
}
|
|
if (!flag4 && character.body.targetOutline && !character.body.multiHit)
|
|
{
|
|
character.body.TargetingOutline(false);
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
for (int j = 0; j < this.inRange.Count; j++)
|
|
{
|
|
if (this.inRange[j] && !this.inRange[j].body.multiHit)
|
|
{
|
|
this.inRange[j].body.TargetingOutline(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004DD RID: 1245 RVA: 0x0006C278 File Offset: 0x0006A478
|
|
public int GetTargets(bool first, bool test, Character main)
|
|
{
|
|
if (!Links.x.gaia.sceneLoaded)
|
|
{
|
|
return 0;
|
|
}
|
|
this.planes = GeometryUtility.CalculateFrustumPlanes(Links.x.worldCamera);
|
|
this.targetUpdateTime = 4f;
|
|
if (first)
|
|
{
|
|
this.allCharacters = Links.x.diorama.characters;
|
|
}
|
|
if (this.allCharacters == null)
|
|
{
|
|
this.allCharacters = Links.x.diorama.characters;
|
|
}
|
|
if (!main)
|
|
{
|
|
main = Links.x.main;
|
|
if (Links.x.pocketWheel.rallyWheelOpen && Links.x.pocketWheel.selectedRallyCharacter)
|
|
{
|
|
main = Links.x.pocketWheel.selectedRallyCharacter;
|
|
}
|
|
}
|
|
if (main.inAction && !Links.x.pocketWheel.rallyWheelOpen)
|
|
{
|
|
return 0;
|
|
}
|
|
bool flag = true;
|
|
if (test)
|
|
{
|
|
if (!Links.x.pocketWheel.rally1)
|
|
{
|
|
Links.x.follow.position = main.tr.position + main.HeadHeight();
|
|
}
|
|
flag = this.hoverShowTargets;
|
|
}
|
|
if (this.debugTargets)
|
|
{
|
|
string[] array = new string[6];
|
|
array[0] = "Get targets ";
|
|
array[1] = test.ToString();
|
|
array[2] = " ";
|
|
int num = 3;
|
|
Character character = main;
|
|
array[num] = ((character != null) ? character.ToString() : null);
|
|
array[4] = " ";
|
|
array[5] = Links.x.pocketWheel.canTarget.ToString();
|
|
Debug.Log(string.Concat(array));
|
|
}
|
|
if (!test)
|
|
{
|
|
this.ClearPossibleTargets();
|
|
this.possibleTargets.Clear();
|
|
}
|
|
string selected = Links.x.pocketWheel.selected;
|
|
int num2 = 0;
|
|
if (main)
|
|
{
|
|
bool flag2 = false;
|
|
if ((main.CanAttack() || Links.x.pocketWheel.rallyWheelOpen) && (!Links.x.combat.inPocketAttack || (Links.x.combat.inPocketAttack && Links.x.pocketWheel.rallyWheelOpen)) && (Links.x.pocketWheel.rallyWheelOpen || Links.x.pocketWheel.open) && (Links.x.pocketWheel.canTarget || test || !Links.x.pocketWheel.rallyWheelOpen) && (Links.x.pocketWheel.CanSelectRallyTarget() || !Links.x.pocketWheel.rallyWheelOpen || test))
|
|
{
|
|
flag2 = true;
|
|
}
|
|
if (this.debugTargets)
|
|
{
|
|
Debug.Log(flag2.ToString() + " " + selected);
|
|
}
|
|
bool flag3 = false;
|
|
if (selected.Contains("Light Attack"))
|
|
{
|
|
flag3 = true;
|
|
}
|
|
if (selected.Contains("Medium Attack") && Links.x.pocketWheel.mediumAtkBtn.interactable)
|
|
{
|
|
flag3 = true;
|
|
}
|
|
if (selected.Contains("Heavy Attack") && Links.x.pocketWheel.heavyAtkBtn.interactable)
|
|
{
|
|
flag3 = true;
|
|
}
|
|
if (Records.x.pocketPause && !this.miniEvent && flag2 && (Links.x.gameplay.spellTargetingParty || Links.x.gameplay.spellTargetingEnemy || flag3 || Links.x.pocketWheel.Charming() || selected.Contains("Special Attack")))
|
|
{
|
|
Vector3 right = Links.x.worldCamera.gameObject.transform.right;
|
|
Vector3 position = main.tr.position;
|
|
float meleeRangeStart = main.invRow1._MeleeRangeStart;
|
|
bool flag4 = false;
|
|
float num3 = 0f;
|
|
float num4 = 0f;
|
|
float num5 = 0f;
|
|
float num6 = 0f;
|
|
int num7 = -1;
|
|
bool flag5 = false;
|
|
bool flag6 = false;
|
|
if (Links.x.pocketWheel.open && Links.x.pocketWheel.selected.Contains("Medium Attack"))
|
|
{
|
|
flag5 = true;
|
|
}
|
|
if (Links.x.pocketWheel.open && Links.x.pocketWheel.selected.Contains("Heavy Attack"))
|
|
{
|
|
flag6 = true;
|
|
}
|
|
if (Links.x.pocketWheel.open && Links.x.pocketWheel.Charming() && main.attackTime >= 1f)
|
|
{
|
|
flag4 = true;
|
|
num6 = main.stats.SummonModCharm();
|
|
num3 = main.stats.Charming("Shroom", false);
|
|
num4 = main.stats.Charming("Forest", false);
|
|
num5 = main.stats.Charming("Fish", false);
|
|
this.charmFail = "No targets";
|
|
num7 = main.HasRosary();
|
|
if (num7 == -1)
|
|
{
|
|
this.charmFail = "No Bells";
|
|
}
|
|
if (Records.x.partySailing)
|
|
{
|
|
this.charmFail = "On water";
|
|
}
|
|
}
|
|
if (Records.x.pocketPause)
|
|
{
|
|
int num8 = 0;
|
|
if (main.invRow1._MeleeRangeEnd >= 5f && (selected.Contains("Light Attack") || selected.Contains("Special Attack")))
|
|
{
|
|
num8 = main.GetAmmoIndex(main.invRow1);
|
|
if (num8 == -1 && first)
|
|
{
|
|
if (main.invRow1._WeaponType == "Sling")
|
|
{
|
|
main.StartQuip("I'm out of stones!");
|
|
}
|
|
else if (main.invRow1._WeaponType == "Bow")
|
|
{
|
|
main.StartQuip("I'm out of arrows!");
|
|
}
|
|
else
|
|
{
|
|
main.StartQuip("I'm out of elyxirs!");
|
|
}
|
|
}
|
|
}
|
|
if (num8 == -1 && selected.Contains("Special Attack") && (Links.x.pocketWheel.selectedRally.Contains("Crippl") || test) && Links.x.pocketWheel.HasAmmo(main, false))
|
|
{
|
|
num8 = 0;
|
|
}
|
|
bool flag7 = false;
|
|
if (Links.x.gameplay.spellTargetingParty && main == Links.x.gameplay.actionCharacter)
|
|
{
|
|
flag7 = true;
|
|
}
|
|
if (this.debugTargets)
|
|
{
|
|
Debug.Log(this.allCharacters.Count.ToString() + " " + num8.ToString());
|
|
}
|
|
for (int i = 0; i < this.allCharacters.Count; i++)
|
|
{
|
|
Character character2 = this.allCharacters[i];
|
|
if (character2 && num8 > -1 && !character2.inactive && ((character2.npc && !flag7) || (!character2.npc && flag7 && !character2.isBoro)) && !character2.dead && !character2.inactive && (!character2.stunned || (character2.stunned && Records.x.kill)) && !Links.x.gameplay.spellTargetingGround && !character2.meshAlwaysOff)
|
|
{
|
|
bool flag8 = false;
|
|
float num9;
|
|
float num10;
|
|
float num11;
|
|
this.GetDistances(main, character2, out num9, out num10, out num11);
|
|
if (Links.x.gameplay.spellTargetingEnemy || Links.x.gameplay.spellTargetingParty || Links.x.pocketWheel.Charming())
|
|
{
|
|
if (main == Links.x.gameplay.actionCharacter)
|
|
{
|
|
num11 = 0f;
|
|
num10 = main.stats.SpellRadius(Links.x.gameplay.spellPaganRow) * main.stats.SpellRadius(Links.x.gameplay.spellPaganRow);
|
|
}
|
|
if (Links.x.pocketWheel.Charming())
|
|
{
|
|
num10 = main.stats.SpellRadius(Links.x.gameplay.spellPaganRow) * main.stats.SpellRadius(Links.x.gameplay.spellPaganRow);
|
|
}
|
|
}
|
|
else if (flag5)
|
|
{
|
|
num11 = 0f;
|
|
num10 = 12.25f;
|
|
}
|
|
else if (flag6)
|
|
{
|
|
num11 = 0f;
|
|
num10 = 49f;
|
|
}
|
|
if (this.inPocketAttack)
|
|
{
|
|
num10 = 100f;
|
|
}
|
|
float num12 = (position - character2.tr.position).sqrMagnitude;
|
|
if (this.inPocketAttack)
|
|
{
|
|
num12 = (this.rallyStartPosition - character2.tr.position).sqrMagnitude;
|
|
}
|
|
if (this.debugTargets)
|
|
{
|
|
string text = num12.ToString();
|
|
string text2 = " ";
|
|
Character character3 = character2;
|
|
Debug.Log(text + text2 + ((character3 != null) ? character3.ToString() : null));
|
|
}
|
|
if (num12 <= num10 && (meleeRangeStart == 0f || num12 >= num11 || this.inPocketAttack) && (!Physics.Linecast(main.raycastPosition, main.AddVectorY(character2.tr.position, 2f), 66048) || this.inPocketAttack))
|
|
{
|
|
if (this.debugTargets)
|
|
{
|
|
string text3 = "in sight ";
|
|
Character character4 = character2;
|
|
Debug.Log(text3 + ((character4 != null) ? character4.ToString() : null));
|
|
}
|
|
if (this.OnScreen(character2, right) || this.inPocketAttack)
|
|
{
|
|
bool flag9 = true;
|
|
if (main.invRow1._MainSkill != "Elixir" && main.invRow1._MainSkill != "Pole" && !flag4 && !flag6)
|
|
{
|
|
flag9 = Links.x.combat.InRangeSight(main, character2);
|
|
}
|
|
if (this.debugTargets)
|
|
{
|
|
string text4 = "on screen ";
|
|
Character character5 = character2;
|
|
Debug.Log(text4 + ((character5 != null) ? character5.ToString() : null));
|
|
}
|
|
if (flag5 && (character2.radius > 2f || character2.stats.characterRow._Height > 4f || character2.stats.pinned || character2.stats.flying))
|
|
{
|
|
flag9 = false;
|
|
}
|
|
if (!flag4)
|
|
{
|
|
if (flag9 || this.inPocketAttack)
|
|
{
|
|
if (test)
|
|
{
|
|
num2++;
|
|
if (flag)
|
|
{
|
|
character2.body.CombatSheen(3);
|
|
}
|
|
flag8 = true;
|
|
}
|
|
else
|
|
{
|
|
this.possibleTargets.Add(character2);
|
|
if (this.inPocketAttack && character2.visible == 0)
|
|
{
|
|
character2.SetMeshState(true);
|
|
}
|
|
flag8 = true;
|
|
character2.body.CombatSheen(3);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string race = character2.stats.race;
|
|
if (num7 > -1 && !Records.x.partySailing && (race.Contains("Shroom") || race.Contains("Fish") || race.Contains("Forest")))
|
|
{
|
|
bool flag10 = false;
|
|
float num13 = character2.stats.CharmResistance(false, (float)character2.stats.HealthCurrent());
|
|
if (race.Contains("Shroom") && num3 + 2f >= num13 + num6)
|
|
{
|
|
flag10 = true;
|
|
}
|
|
if (race.Contains("Forest") && num4 + 2f >= num13 + num6)
|
|
{
|
|
flag10 = true;
|
|
}
|
|
if (race.Contains("Fish") && num5 + 2f >= num13 + num6)
|
|
{
|
|
flag10 = true;
|
|
}
|
|
if (flag10)
|
|
{
|
|
if (!character2.stats.xmlName.Contains("Cat"))
|
|
{
|
|
this.possibleTargets.Add(character2);
|
|
flag8 = true;
|
|
character2.body.CombatSheen(3);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.charmFail = "Low Skill";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!flag8 && (!test || (test && flag)))
|
|
{
|
|
character2.body.CombatSheen(0);
|
|
}
|
|
character2.CircleAnimation("");
|
|
}
|
|
}
|
|
bool flag11 = false;
|
|
if (Links.x.pocketWheel.rallyWheelOpen)
|
|
{
|
|
if (Links.x.pocketWheel.selectedRally.Contains("Both") || Links.x.pocketWheel.selectedRally.Contains("Crippl") || Links.x.pocketWheel.selectedRally.Contains("Wound"))
|
|
{
|
|
flag11 = true;
|
|
}
|
|
if (this.hoverShowTargets && (this.hoverShowTargetsType.Contains("Both") || this.hoverShowTargetsType.Contains("Crippl") || this.hoverShowTargetsType.Contains("Wound")))
|
|
{
|
|
flag11 = true;
|
|
}
|
|
}
|
|
if (!Links.x.pocketWheel.Charming() && Links.x.pocketWheel.selected != "Medium Attack" && !flag11 && num8 > -1)
|
|
{
|
|
for (int j = 0; j < this.nearBreakables.Count; j++)
|
|
{
|
|
BreakableActions breakableActions = this.nearBreakables[j];
|
|
if (breakableActions && !breakableActions.destroyed && ((this.inPocketAttack && breakableActions.gameObject == this.lastRallyTarget && (this.hoverShowTargets || Links.x.pocketWheel.canTarget)) || this.CheckInteractiveLineOfSight(breakableActions, null, null, null, main)))
|
|
{
|
|
bool flag12 = false;
|
|
if (breakableActions && (float)breakableActions.currentHealth < Records.x.ChargeAmount((float)main.stats.level))
|
|
{
|
|
flag12 = true;
|
|
}
|
|
if (!flag6 || flag12)
|
|
{
|
|
if (test)
|
|
{
|
|
num2++;
|
|
}
|
|
if (flag)
|
|
{
|
|
breakableActions.CombatSheen(3);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
breakableActions.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
for (int k = 0; k < this.nearDoors.Count; k++)
|
|
{
|
|
DoorActions doorActions = this.nearDoors[k];
|
|
if (doorActions && !doorActions.destroyed && doorActions.lockCollider.enabled && ((this.inPocketAttack && doorActions.gameObject == this.lastRallyTarget && (this.hoverShowTargets || Links.x.pocketWheel.canTarget)) || this.CheckInteractiveLineOfSight(null, doorActions, null, null, main)))
|
|
{
|
|
if (test)
|
|
{
|
|
num2++;
|
|
}
|
|
if (flag)
|
|
{
|
|
if (!flag6)
|
|
{
|
|
doorActions.CombatSheen(3);
|
|
}
|
|
else
|
|
{
|
|
doorActions.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (int l = 0; l < this.nearChests.Count; l++)
|
|
{
|
|
ChestActions chestActions = this.nearChests[l];
|
|
if (chestActions && !chestActions.destroyed && ((this.inPocketAttack && chestActions.gameObject == this.lastRallyTarget && (this.hoverShowTargets || Links.x.pocketWheel.canTarget)) || this.CheckInteractiveLineOfSight(null, null, chestActions, null, main)))
|
|
{
|
|
if (test)
|
|
{
|
|
num2++;
|
|
}
|
|
if (flag)
|
|
{
|
|
if (!flag6)
|
|
{
|
|
chestActions.CombatSheen(3);
|
|
}
|
|
else
|
|
{
|
|
chestActions.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (int m = 0; m < this.nearPuzzles.Count; m++)
|
|
{
|
|
PuzzleActions puzzleActions = this.nearPuzzles[m];
|
|
if (puzzleActions && ((this.inPocketAttack && puzzleActions.gameObject == this.lastRallyTarget && (this.hoverShowTargets || Links.x.pocketWheel.canTarget)) || this.CheckInteractiveLineOfSight(null, null, null, puzzleActions, main)))
|
|
{
|
|
if (test)
|
|
{
|
|
num2++;
|
|
}
|
|
if (flag)
|
|
{
|
|
if (!flag6)
|
|
{
|
|
puzzleActions.CombatSheen(3);
|
|
}
|
|
else
|
|
{
|
|
puzzleActions.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (!test || flag)
|
|
{
|
|
for (int n = 0; n < this.nearBreakables.Count; n++)
|
|
{
|
|
BreakableActions breakableActions2 = this.nearBreakables[n];
|
|
if (breakableActions2)
|
|
{
|
|
breakableActions2.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int num14 = 0; num14 < this.nearDoors.Count; num14++)
|
|
{
|
|
DoorActions doorActions2 = this.nearDoors[num14];
|
|
if (doorActions2)
|
|
{
|
|
doorActions2.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int num15 = 0; num15 < this.nearChests.Count; num15++)
|
|
{
|
|
ChestActions chestActions2 = this.nearChests[num15];
|
|
if (chestActions2)
|
|
{
|
|
chestActions2.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int num16 = 0; num16 < this.nearPuzzles.Count; num16++)
|
|
{
|
|
PuzzleActions puzzleActions2 = this.nearPuzzles[num16];
|
|
if (puzzleActions2)
|
|
{
|
|
puzzleActions2.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (Records.x.pocketPause && !this.hoverShowTargets)
|
|
{
|
|
this.ClearSheens();
|
|
}
|
|
}
|
|
return num2;
|
|
}
|
|
|
|
// Token: 0x060004DE RID: 1246 RVA: 0x0006D2DC File Offset: 0x0006B4DC
|
|
public void ClearSheens()
|
|
{
|
|
for (int i = 0; i < this.nearBreakables.Count; i++)
|
|
{
|
|
BreakableActions breakableActions = this.nearBreakables[i];
|
|
if (breakableActions)
|
|
{
|
|
breakableActions.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int j = 0; j < this.nearDoors.Count; j++)
|
|
{
|
|
DoorActions doorActions = this.nearDoors[j];
|
|
if (doorActions)
|
|
{
|
|
doorActions.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int k = 0; k < this.nearChests.Count; k++)
|
|
{
|
|
ChestActions chestActions = this.nearChests[k];
|
|
if (chestActions)
|
|
{
|
|
chestActions.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int l = 0; l < this.nearPuzzles.Count; l++)
|
|
{
|
|
PuzzleActions puzzleActions = this.nearPuzzles[l];
|
|
if (puzzleActions)
|
|
{
|
|
puzzleActions.CombatSheen(0);
|
|
}
|
|
}
|
|
for (int m = 0; m < this.allCharacters.Count; m++)
|
|
{
|
|
Character character = this.allCharacters[m];
|
|
if (character)
|
|
{
|
|
character.body.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004DF RID: 1247 RVA: 0x0006D400 File Offset: 0x0006B600
|
|
public void MultiHitObjects(bool state, Vector3 position, BreakableActions mainHoverBreak, ChestActions mainHoverChest, DoorActions mainHoverDoor)
|
|
{
|
|
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;
|
|
}
|
|
Character character = Links.x.main;
|
|
if (Links.x.pocketWheel.rallyWheelOpen && Links.x.pocketWheel.selectedRallyCharacter)
|
|
{
|
|
character = Links.x.pocketWheel.selectedRallyCharacter;
|
|
}
|
|
Vector3 vector = Links.x.gameplay.GetHoverPosition();
|
|
if (position != Vector3.zero)
|
|
{
|
|
vector = position;
|
|
}
|
|
if (vector != Vector3.zero)
|
|
{
|
|
for (int i = 0; i < this.timedBreakables.Count; i++)
|
|
{
|
|
TimedBreakable timedBreakable = this.timedBreakables[i];
|
|
if (timedBreakable && !timedBreakable.breakable.destroyed && mainHoverBreak != timedBreakable.breakable && character.InAttackShape(null, vector, character, character.currentPosition, timedBreakable.breakable.transform.position, character.invRow1) && this.CheckInteractiveLineOfSight(timedBreakable.breakable, null, null, null, character))
|
|
{
|
|
if (state)
|
|
{
|
|
timedBreakable.breakable.HoverIn(false);
|
|
}
|
|
else
|
|
{
|
|
timedBreakable.breakable.HoverOut();
|
|
}
|
|
}
|
|
}
|
|
for (int j = 0; j < this.currentTileEffects.Count; j++)
|
|
{
|
|
TileEffects tileEffects = this.currentTileEffects[j];
|
|
if (tileEffects && tileEffects.isWall)
|
|
{
|
|
foreach (BreakableActions breakableActions in tileEffects.breakables)
|
|
{
|
|
if (breakableActions && mainHoverBreak != breakableActions && character.InAttackShape(null, vector, character, character.currentPosition, breakableActions.transform.position, character.invRow1) && this.CheckInteractiveLineOfSight(breakableActions, null, null, null, character))
|
|
{
|
|
if (state)
|
|
{
|
|
breakableActions.HoverIn(false);
|
|
}
|
|
else
|
|
{
|
|
breakableActions.HoverOut();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (int k = 0; k < this.diaBreakables.Count; k++)
|
|
{
|
|
BreakableActions breakableActions2 = this.diaBreakables[k];
|
|
if (breakableActions2 && !breakableActions2.destroyed && mainHoverBreak != breakableActions2 && character.InAttackShape(null, vector, character, character.currentPosition, breakableActions2.transform.position, character.invRow1) && this.CheckInteractiveLineOfSight(breakableActions2, null, null, null, character))
|
|
{
|
|
if (state)
|
|
{
|
|
breakableActions2.HoverIn(false);
|
|
}
|
|
else
|
|
{
|
|
breakableActions2.HoverOut();
|
|
}
|
|
}
|
|
}
|
|
for (int l = 0; l < this.diaChests.Count; l++)
|
|
{
|
|
ChestActions chestActions = this.diaChests[l];
|
|
if (chestActions && !chestActions.destroyed && mainHoverChest != chestActions && character.InAttackShape(null, vector, character, character.currentPosition, chestActions.transform.position, character.invRow1) && this.CheckInteractiveLineOfSight(null, null, chestActions, null, character))
|
|
{
|
|
if (state)
|
|
{
|
|
chestActions.HoverIn(false);
|
|
}
|
|
else
|
|
{
|
|
chestActions.HoverOut();
|
|
}
|
|
}
|
|
}
|
|
for (int m = 0; m < this.diaDoors.Count; m++)
|
|
{
|
|
DoorActions doorActions = this.diaDoors[m];
|
|
if (doorActions && !doorActions.destroyed && doorActions.lockCollider && mainHoverDoor != doorActions && character.InAttackShape(null, vector, character, character.currentPosition, doorActions.transform.position, character.invRow1) && this.CheckInteractiveLineOfSight(null, doorActions, null, null, character))
|
|
{
|
|
if (state)
|
|
{
|
|
doorActions.HoverIn(false);
|
|
}
|
|
else
|
|
{
|
|
doorActions.HoverOut();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004E0 RID: 1248 RVA: 0x0006D834 File Offset: 0x0006BA34
|
|
public void MultiHitCharacters(bool state)
|
|
{
|
|
Character character = Links.x.main;
|
|
if (Links.x.pocketWheel.rallyWheelOpen)
|
|
{
|
|
character = Links.x.pocketWheel.selectedRallyCharacter;
|
|
}
|
|
if (state)
|
|
{
|
|
Vector3 hoverPosition = Links.x.gameplay.GetHoverPosition();
|
|
if (hoverPosition != Vector3.zero)
|
|
{
|
|
for (int i = 0; i < this.possibleTargets.Count; i++)
|
|
{
|
|
Character character2 = this.possibleTargets[i];
|
|
if (character2 && character.InAttackShape(character2, hoverPosition, Links.x.main, character.currentPosition, character2.currentPosition, Links.x.main.invRow1))
|
|
{
|
|
character2.body.Hover(state, false);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int j = 0; j < this.allCharacters.Count; j++)
|
|
{
|
|
if (this.allCharacters[j] && this.allCharacters[j].body.bracket)
|
|
{
|
|
this.allCharacters[j].body.Hover(false, false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004E1 RID: 1249 RVA: 0x0006D960 File Offset: 0x0006BB60
|
|
private float Dist(Vector3 p1)
|
|
{
|
|
p1.y = this.mainPosition.y;
|
|
return (p1 - this.mainPosition).sqrMagnitude;
|
|
}
|
|
|
|
// Token: 0x060004E2 RID: 1250 RVA: 0x0006D994 File Offset: 0x0006BB94
|
|
public void GetJoystickTarget(out Character closestEnemy, out Character closestParty, out BreakableActions closestBreakable, out ChestActions closestChest, out DoorActions closestDoor, out PuzzleActions closestPuzzle, Vector2 dir, bool first)
|
|
{
|
|
closestEnemy = null;
|
|
closestParty = null;
|
|
closestBreakable = null;
|
|
closestChest = null;
|
|
closestDoor = null;
|
|
closestPuzzle = null;
|
|
if (this.possibleTargets.Count == 0)
|
|
{
|
|
this.GetTargets(false, false, null);
|
|
}
|
|
Character character = Links.x.main;
|
|
if (Links.x.pocketWheel.rallyWheelOpen && Links.x.pocketWheel.selectedRallyCharacter)
|
|
{
|
|
character = Links.x.pocketWheel.selectedRallyCharacter;
|
|
}
|
|
bool flag = false;
|
|
if (Links.x.pocketWheel.Charming())
|
|
{
|
|
flag = true;
|
|
}
|
|
if (closestEnemy)
|
|
{
|
|
GameObject gameObject = closestEnemy.gameObject;
|
|
}
|
|
if (closestParty)
|
|
{
|
|
GameObject gameObject2 = closestParty.gameObject;
|
|
}
|
|
if (closestBreakable)
|
|
{
|
|
GameObject gameObject3 = closestBreakable.gameObject;
|
|
}
|
|
if (closestChest)
|
|
{
|
|
GameObject gameObject4 = closestChest.gameObject;
|
|
}
|
|
if (closestDoor)
|
|
{
|
|
GameObject gameObject5 = closestDoor.gameObject;
|
|
}
|
|
if (closestPuzzle)
|
|
{
|
|
GameObject gameObject6 = closestPuzzle.gameObject;
|
|
}
|
|
closestParty = null;
|
|
closestEnemy = null;
|
|
closestBreakable = null;
|
|
closestChest = null;
|
|
closestDoor = null;
|
|
closestPuzzle = null;
|
|
this.mainPosition = character.tr.position;
|
|
Vector2 move = Links.x.fellowship.move;
|
|
float num = Mathf.Atan2(move.x, move.y) / 3.1415927f * 180f;
|
|
if (num < 0f)
|
|
{
|
|
num += 360f;
|
|
}
|
|
if (character && (first || this.forw == Vector3.zero))
|
|
{
|
|
this.forw = character.tr.forward;
|
|
}
|
|
float num2 = character.AttackRange();
|
|
if (this.synergies.Count > 0)
|
|
{
|
|
for (int i = 0; i < this.synergies.Count; i++)
|
|
{
|
|
float num3 = Vector3.Distance(character.currentPosition, this.synergies[i].currentPosition);
|
|
if (num3 > num2)
|
|
{
|
|
num2 = num3;
|
|
}
|
|
}
|
|
}
|
|
Vector3 vector = this.mainPosition + this.forw * num2 / 2f;
|
|
if (Mathf.Abs(move.magnitude) > 0.1f && !Links.x.gameplay.gameFeedScrolling && !Links.x.gameplay.badgeScrolling)
|
|
{
|
|
this.forw = Quaternion.Euler(0f, num + Links.x.worldCamera.transform.rotation.eulerAngles.y, 0f) * Vector3.forward;
|
|
vector = this.mainPosition + this.forw * (num2 * Mathf.Abs(move.magnitude));
|
|
}
|
|
this.mainPosition = vector;
|
|
float num4 = 100000f;
|
|
if (!Links.x.gameplay.spellTargetingParty)
|
|
{
|
|
for (int j = 0; j < this.possibleTargets.Count; j++)
|
|
{
|
|
float num5 = this.Dist(this.possibleTargets[j].tr.position);
|
|
if (num5 < num4)
|
|
{
|
|
num4 = num5;
|
|
closestEnemy = this.possibleTargets[j];
|
|
}
|
|
}
|
|
}
|
|
num4 = 100000f;
|
|
for (int k = 0; k < this.party.Count; k++)
|
|
{
|
|
if (!flag && ((!this.pickingRally && this.synergies.Contains(this.party[k])) || Links.x.gameplay.spellTargetingParty))
|
|
{
|
|
float num6 = this.Dist(this.party[k].tr.position);
|
|
if (num6 < num4)
|
|
{
|
|
num4 = num6;
|
|
closestParty = this.party[k];
|
|
}
|
|
}
|
|
}
|
|
num4 = 100000f;
|
|
for (int l = 0; l < this.nearBreakables.Count; l++)
|
|
{
|
|
if (Links.x.combat.CheckInteractiveLineOfSight(this.nearBreakables[l], null, null, null, character) && !flag && this.nearBreakables[l])
|
|
{
|
|
float num7 = this.Dist(this.nearBreakables[l].gameObject.transform.position);
|
|
if (num7 < num4)
|
|
{
|
|
num4 = num7;
|
|
closestBreakable = this.nearBreakables[l];
|
|
}
|
|
}
|
|
}
|
|
num4 = 100000f;
|
|
for (int m = 0; m < this.nearChests.Count; m++)
|
|
{
|
|
if (Links.x.combat.CheckInteractiveLineOfSight(null, null, this.nearChests[m], null, character) && !flag)
|
|
{
|
|
float num8 = this.Dist(this.nearChests[m].gameObject.transform.position);
|
|
if (num8 < num4)
|
|
{
|
|
num4 = num8;
|
|
closestChest = this.nearChests[m];
|
|
}
|
|
}
|
|
}
|
|
num4 = 100000f;
|
|
for (int n = 0; n < this.nearDoors.Count; n++)
|
|
{
|
|
if (Links.x.combat.CheckInteractiveLineOfSight(null, this.nearDoors[n], null, null, character) && !flag)
|
|
{
|
|
float num9 = this.Dist(this.nearDoors[n].lockColliderPosition);
|
|
if (num9 < num4)
|
|
{
|
|
num4 = num9;
|
|
closestDoor = this.nearDoors[n];
|
|
}
|
|
}
|
|
}
|
|
num4 = 100000f;
|
|
int num10 = -1;
|
|
for (int num11 = 0; num11 < 8; num11++)
|
|
{
|
|
float num12 = 100000f;
|
|
if (num11 == 1 && closestEnemy)
|
|
{
|
|
num12 = this.Dist(closestEnemy.tr.position);
|
|
}
|
|
if (num11 == 5 && closestParty)
|
|
{
|
|
num12 = this.Dist(closestParty.tr.position);
|
|
}
|
|
if (!Links.x.pocketWheel.Charming())
|
|
{
|
|
if (num11 == 2 && closestBreakable)
|
|
{
|
|
num12 = this.Dist(closestBreakable.gameObject.transform.position);
|
|
}
|
|
if (num11 == 3 && closestChest)
|
|
{
|
|
num12 = this.Dist(closestChest.gameObject.transform.position);
|
|
}
|
|
if (num11 == 4 && closestDoor)
|
|
{
|
|
num12 = this.Dist(closestDoor.lockColliderPosition);
|
|
}
|
|
if (num11 == 7 && closestPuzzle)
|
|
{
|
|
num12 = this.Dist(closestPuzzle.gameObject.transform.position);
|
|
}
|
|
}
|
|
if (num12 < num4)
|
|
{
|
|
num4 = num12;
|
|
num10 = num11;
|
|
}
|
|
}
|
|
if (num10 > -1)
|
|
{
|
|
if (num10 == 1 && closestEnemy)
|
|
{
|
|
GameObject gameObject7 = closestEnemy.gameObject;
|
|
closestBreakable = null;
|
|
closestChest = null;
|
|
closestDoor = null;
|
|
closestPuzzle = null;
|
|
closestParty = null;
|
|
}
|
|
if (num10 == 5 && closestParty)
|
|
{
|
|
GameObject gameObject7 = closestParty.gameObject;
|
|
closestBreakable = null;
|
|
closestChest = null;
|
|
closestDoor = null;
|
|
closestPuzzle = null;
|
|
closestEnemy = null;
|
|
}
|
|
if (num10 == 2 && closestBreakable)
|
|
{
|
|
closestEnemy = null;
|
|
closestParty = null;
|
|
GameObject gameObject7 = closestBreakable.gameObject;
|
|
closestChest = null;
|
|
closestDoor = null;
|
|
closestPuzzle = null;
|
|
}
|
|
if (num10 == 3 && closestChest)
|
|
{
|
|
closestEnemy = null;
|
|
closestParty = null;
|
|
closestBreakable = null;
|
|
GameObject gameObject7 = closestChest.gameObject;
|
|
closestDoor = null;
|
|
closestPuzzle = null;
|
|
}
|
|
if (num10 == 4 && closestDoor)
|
|
{
|
|
closestEnemy = null;
|
|
closestParty = null;
|
|
closestBreakable = null;
|
|
closestChest = null;
|
|
GameObject gameObject7 = closestDoor.gameObject;
|
|
closestPuzzle = null;
|
|
}
|
|
if (num10 == 7 && closestPuzzle)
|
|
{
|
|
closestEnemy = null;
|
|
closestParty = null;
|
|
closestBreakable = null;
|
|
closestChest = null;
|
|
closestDoor = null;
|
|
GameObject gameObject7 = closestPuzzle.gameObject;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004E3 RID: 1251 RVA: 0x0006E104 File Offset: 0x0006C304
|
|
private float Dot(Vector3 p1)
|
|
{
|
|
Vector3 vector = Vector3.Normalize(p1 - this.mainPosition);
|
|
return Vector3.Dot(this.forw, vector);
|
|
}
|
|
|
|
// Token: 0x060004E4 RID: 1252 RVA: 0x0006E130 File Offset: 0x0006C330
|
|
private float Dot(Vector3 p1, Vector3 f)
|
|
{
|
|
Vector3 vector = Vector3.Normalize(p1 - this.mainPosition);
|
|
return Vector3.Dot(f, vector);
|
|
}
|
|
|
|
// Token: 0x060004E5 RID: 1253 RVA: 0x0006E156 File Offset: 0x0006C356
|
|
public int TargetCount()
|
|
{
|
|
return this.possibleTargets.Count;
|
|
}
|
|
|
|
// Token: 0x060004E6 RID: 1254 RVA: 0x0006E164 File Offset: 0x0006C364
|
|
public int ItemCardCount()
|
|
{
|
|
int num = 0;
|
|
num += this.possibleTargets.Count;
|
|
if (this.synergies.Count > 0)
|
|
{
|
|
num += this.synergies.Count;
|
|
}
|
|
for (int i = 0; i < this.nearBreakables.Count; i++)
|
|
{
|
|
if (this.nearBreakables[i] && this.nearBreakables[i].combatTargetID != 0)
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
for (int j = 0; j < this.nearDoors.Count; j++)
|
|
{
|
|
if (this.nearDoors[j] && this.nearDoors[j].combatTargetID != 0)
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
for (int k = 0; k < this.nearChests.Count; k++)
|
|
{
|
|
if (this.nearChests[k] && this.nearChests[k].combatTargetID != 0)
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x060004E7 RID: 1255 RVA: 0x0006E260 File Offset: 0x0006C460
|
|
public bool BreakableIsNear(BreakableActions c, Character main)
|
|
{
|
|
return (Links.x.combat.inPocketAttack && this.lastRallyTarget == c.gameObject) || (this.nearBreakables.Contains(c) && this.CheckInteractiveLineOfSight(c, null, null, null, main));
|
|
}
|
|
|
|
// Token: 0x060004E8 RID: 1256 RVA: 0x0006E2B4 File Offset: 0x0006C4B4
|
|
public bool ChestIsNear(ChestActions c, Character main)
|
|
{
|
|
return (Links.x.combat.inPocketAttack && this.lastRallyTarget == c.gameObject) || (this.nearChests.Contains(c) && this.CheckInteractiveLineOfSight(null, null, c, null, main));
|
|
}
|
|
|
|
// Token: 0x060004E9 RID: 1257 RVA: 0x0006E308 File Offset: 0x0006C508
|
|
public bool PuzzleIsNear(PuzzleActions c, Character main)
|
|
{
|
|
return (Links.x.combat.inPocketAttack && this.lastRallyTarget == c.gameObject) || (this.nearPuzzles.Contains(c) && this.CheckInteractiveLineOfSight(null, null, null, c, main));
|
|
}
|
|
|
|
// Token: 0x060004EA RID: 1258 RVA: 0x0006E35C File Offset: 0x0006C55C
|
|
public bool DoorIsNear(DoorActions c, Character main)
|
|
{
|
|
return (Links.x.combat.inPocketAttack && this.lastRallyTarget == c.gameObject) || (this.nearDoors.Contains(c) && this.CheckInteractiveLineOfSight(null, c, null, null, main));
|
|
}
|
|
|
|
// Token: 0x060004EB RID: 1259 RVA: 0x0006E3AD File Offset: 0x0006C5AD
|
|
public void ClearNearby()
|
|
{
|
|
this.nearBreakables.Clear();
|
|
this.nearChests.Clear();
|
|
this.nearPuzzles.Clear();
|
|
this.nearDoors.Clear();
|
|
this.possibleTargets.Clear();
|
|
}
|
|
|
|
// Token: 0x060004EC RID: 1260 RVA: 0x0006E3E8 File Offset: 0x0006C5E8
|
|
public void SetPositionAtWorldPoint(RectTransform rt, Vector3 worldPoint)
|
|
{
|
|
Vector3 vector = Links.x.worldCamera.WorldToScreenPoint(worldPoint);
|
|
vector.z = 0f;
|
|
vector.x = vector.x * (1920f / (float)Screen.width) - 960f;
|
|
vector.y = vector.y * (Links.x.canvasRT.sizeDelta.y / (float)Screen.height) - Links.x.canvasRT.sizeDelta.y / 2f;
|
|
rt.localPosition = vector;
|
|
}
|
|
|
|
// Token: 0x060004ED RID: 1261 RVA: 0x0006E47D File Offset: 0x0006C67D
|
|
public void ChangeScene()
|
|
{
|
|
this.miniGameCharacters.Clear();
|
|
}
|
|
|
|
// Token: 0x060004EE RID: 1262 RVA: 0x0006E48A File Offset: 0x0006C68A
|
|
public void HighlightCharacter(bool state, Character character)
|
|
{
|
|
}
|
|
|
|
// Token: 0x060004EF RID: 1263 RVA: 0x0006E48C File Offset: 0x0006C68C
|
|
public void HighlightChest(bool state, ChestActions chest)
|
|
{
|
|
}
|
|
|
|
// Token: 0x060004F0 RID: 1264 RVA: 0x0006E48E File Offset: 0x0006C68E
|
|
public void HighlightBreakable(bool state, BreakableActions breakable)
|
|
{
|
|
}
|
|
|
|
// Token: 0x060004F1 RID: 1265 RVA: 0x0006E490 File Offset: 0x0006C690
|
|
public void HighlightDoor(bool state, DoorActions door)
|
|
{
|
|
}
|
|
|
|
// Token: 0x060004F2 RID: 1266 RVA: 0x0006E492 File Offset: 0x0006C692
|
|
public void HighlightPuzzle(bool state, PuzzleActions puzzle)
|
|
{
|
|
}
|
|
|
|
// Token: 0x060004F3 RID: 1267 RVA: 0x0006E494 File Offset: 0x0006C694
|
|
public void RemoveAllHighlights()
|
|
{
|
|
this.HighlightPuzzle(false, null);
|
|
this.HighlightChest(false, null);
|
|
this.HighlightDoor(false, null);
|
|
this.HighlightBreakable(false, null);
|
|
this.HighlightCharacter(false, null);
|
|
}
|
|
|
|
// Token: 0x060004F4 RID: 1268 RVA: 0x0006E4C0 File Offset: 0x0006C6C0
|
|
public void AddRemoveInteraction(bool state, BreakableActions nearBreak, ChestActions nearChest, PuzzleActions nearPuzzle, DoorActions nearDoor)
|
|
{
|
|
if (nearBreak)
|
|
{
|
|
int num = this.nearBreakables.IndexOf(nearBreak);
|
|
if (num == -1 && state)
|
|
{
|
|
this.nearBreakables.Add(nearBreak);
|
|
}
|
|
if (num > -1 && !state)
|
|
{
|
|
this.nearBreakables.RemoveAt(num);
|
|
if (!Links.x.pocketWheel.Charming())
|
|
{
|
|
nearBreak.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
if (nearChest)
|
|
{
|
|
int num2 = this.nearChests.IndexOf(nearChest);
|
|
if (num2 == -1 && state)
|
|
{
|
|
this.nearChests.Add(nearChest);
|
|
}
|
|
if (num2 > -1 && !state)
|
|
{
|
|
this.nearChests.RemoveAt(num2);
|
|
if (!Links.x.pocketWheel.Charming())
|
|
{
|
|
nearChest.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
if (nearPuzzle)
|
|
{
|
|
int num3 = this.nearPuzzles.IndexOf(nearPuzzle);
|
|
if (num3 == -1 && state && nearPuzzle.currentHealth > 0)
|
|
{
|
|
this.nearPuzzles.Add(nearPuzzle);
|
|
}
|
|
if (num3 > -1 && !state)
|
|
{
|
|
this.nearPuzzles.RemoveAt(num3);
|
|
if (!Links.x.pocketWheel.Charming())
|
|
{
|
|
nearPuzzle.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
if (nearDoor)
|
|
{
|
|
int num4 = this.nearDoors.IndexOf(nearDoor);
|
|
if (num4 == -1 && state)
|
|
{
|
|
this.nearDoors.Add(nearDoor);
|
|
}
|
|
if (num4 > -1 && !state)
|
|
{
|
|
this.nearDoors.RemoveAt(num4);
|
|
if (!Links.x.pocketWheel.Charming())
|
|
{
|
|
nearDoor.CombatSheen(0);
|
|
}
|
|
}
|
|
}
|
|
if (Records.x.pocketPause)
|
|
{
|
|
this.GetTargets(false, false, null);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004F5 RID: 1269 RVA: 0x0006E645 File Offset: 0x0006C845
|
|
public bool InAttackDirection(Vector3 targetPosition)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x060004F6 RID: 1270 RVA: 0x0006E648 File Offset: 0x0006C848
|
|
public bool CharacterHasSynergy(Character c)
|
|
{
|
|
return this.synergies.Contains(c);
|
|
}
|
|
|
|
// Token: 0x060004F7 RID: 1271 RVA: 0x0006E65C File Offset: 0x0006C85C
|
|
public void UpdateRallyVisuals()
|
|
{
|
|
for (int i = 0; i < this.synergies.Count; i++)
|
|
{
|
|
if (this.synergies[i])
|
|
{
|
|
if (this.synergyFX[i])
|
|
{
|
|
this.synergyFX[i].SetActive(false);
|
|
Links.x.cellar.ReturnPooledGameObject(87, this.synergyFX[i]);
|
|
}
|
|
this.synergies[i].body.CombatSheen(0);
|
|
}
|
|
}
|
|
this.synergies.Clear();
|
|
this.synergyFX.Clear();
|
|
this.GetTargets(false, false, null);
|
|
}
|
|
|
|
// Token: 0x060004F8 RID: 1272 RVA: 0x0006E70C File Offset: 0x0006C90C
|
|
public bool InRangeSight(Character attacker, Character target)
|
|
{
|
|
bool flag = false;
|
|
if (!attacker.hasActions)
|
|
{
|
|
return true;
|
|
}
|
|
if (target)
|
|
{
|
|
RaycastHit raycastHit;
|
|
if (Physics.SphereCast(attacker.torsoPosition, 0.1f, target.torsoPosition - attacker.torsoPosition, out raycastHit, Vector3.Distance(target.torsoPosition, attacker.torsoPosition), -2147483584))
|
|
{
|
|
SelectionCircle selectionCircle = raycastHit.collider.gameObject.GetComponent<SelectionCircle>();
|
|
if (selectionCircle)
|
|
{
|
|
if (selectionCircle.character == attacker)
|
|
{
|
|
if (Physics.SphereCast(attacker.torsoPosition, 0.1f, target.torsoPosition - attacker.torsoPosition, out raycastHit, Vector3.Distance(target.torsoPosition, attacker.torsoPosition), -2147483584))
|
|
{
|
|
selectionCircle = raycastHit.collider.gameObject.GetComponent<SelectionCircle>();
|
|
if (selectionCircle)
|
|
{
|
|
if (selectionCircle.character == target || !attacker.actions.ai.CanAttack(selectionCircle.character))
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Character component = raycastHit.collider.gameObject.GetComponent<Character>();
|
|
if (component && (component == target || !attacker.actions.ai.CanAttack(component)))
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (selectionCircle.character == target || !attacker.actions.ai.CanAttack(selectionCircle.character))
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Character component2 = raycastHit.collider.gameObject.GetComponent<Character>();
|
|
if (component2 && (component2 == target || !attacker.actions.ai.CanAttack(component2)))
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x060004F9 RID: 1273 RVA: 0x0006E8CC File Offset: 0x0006CACC
|
|
public bool OnScreen(Character target, Vector3 cameraDirection)
|
|
{
|
|
if (false)
|
|
{
|
|
float characterHeight = target.characterHeight;
|
|
Vector3 position = target.tr.position;
|
|
float num = target.RealRadius();
|
|
Vector3 vector = position + cameraDirection * num;
|
|
Vector3 vector2 = position + cameraDirection * num * -1f;
|
|
Vector3 vector3 = vector + new Vector3(0f, target.characterHeight, 0f);
|
|
Vector3 vector4 = vector2 + new Vector3(0f, target.characterHeight, 0f);
|
|
Camera worldCamera = Links.x.worldCamera;
|
|
int width = Screen.width;
|
|
int height = Screen.height;
|
|
Vector3 vector5 = worldCamera.WorldToScreenPoint(vector);
|
|
Vector3 vector6 = worldCamera.WorldToScreenPoint(vector2);
|
|
Vector3 vector7 = worldCamera.WorldToScreenPoint(vector4);
|
|
Vector3 vector8 = worldCamera.WorldToScreenPoint(vector3);
|
|
if (vector6.x <= 0f && vector7.x <= 0f)
|
|
{
|
|
return false;
|
|
}
|
|
if (vector5.x >= (float)width && vector8.x >= (float)width)
|
|
{
|
|
return false;
|
|
}
|
|
if (vector7.y <= 0f && vector8.y <= 0f)
|
|
{
|
|
return false;
|
|
}
|
|
if (vector6.y >= (float)height && vector5.y >= (float)height)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x060004FA RID: 1274 RVA: 0x0006EA04 File Offset: 0x0006CC04
|
|
public bool CheckInteractiveLineOfSight(BreakableActions breakable, DoorActions door, ChestActions chest, PuzzleActions puzzle, Character main)
|
|
{
|
|
Vector3 vector = main.tr.position;
|
|
GameObject gameObject = null;
|
|
if (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;
|
|
}
|
|
float sqrMagnitude = (vector - main.currentPosition).sqrMagnitude;
|
|
float num = main.AttackRange();
|
|
if (sqrMagnitude < num * num)
|
|
{
|
|
vector.y += 0.5f;
|
|
RaycastHit raycastHit;
|
|
bool flag = Physics.SphereCast(main.raycastPosition, 0.25f, vector - main.raycastPosition, out raycastHit, num, 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;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x060004FB RID: 1275 RVA: 0x0006EBB1 File Offset: 0x0006CDB1
|
|
public void PerfectDodge(Character main, Character target)
|
|
{
|
|
if (this.dodgeCoroutine == null)
|
|
{
|
|
this.dodgeCoroutine = this.PerfectDodgeSlow(main, target);
|
|
base.StartCoroutine(this.dodgeCoroutine);
|
|
return;
|
|
}
|
|
main.FullAttackTime();
|
|
}
|
|
|
|
// Token: 0x060004FC RID: 1276 RVA: 0x0006EBDD File Offset: 0x0006CDDD
|
|
private IEnumerator PerfectDodgeSlow(Character main, Character target)
|
|
{
|
|
MasterAudio.PlaySoundAndForget("Synergy Pass", Random.Range(0.8f, 0.9f), new float?(1f), 0f, "", null);
|
|
this.StartSlowTime("Synergy");
|
|
Links.x.rtsCamera.Zoom(true, "MainCharacterQTERange");
|
|
Links.x.hudControl.attackTimerAnimator.gameObject.transform.localScale = Vector3.one * 1.5f;
|
|
float startValue = main.attackTime;
|
|
float endValue = 1f;
|
|
float timeToLerp = 0.125f;
|
|
float percentage = 0f;
|
|
float startTime = Time.timeSinceLevelLoad;
|
|
while (percentage < 1f)
|
|
{
|
|
Links.x.hudControl.attackTimerAnimator.gameObject.transform.localScale = Vector3.one * 1.5f;
|
|
main.inventoryTime = 0f;
|
|
percentage = (Time.time - startTime) / timeToLerp;
|
|
main.attackTime = Mathf.Lerp(startValue, endValue, percentage);
|
|
main.portrait.SetActionBar(main.attackTime);
|
|
main.portrait.skillBag.SetSelectedState();
|
|
Links.x.hudControl.UpdateAttackTime(main.attackTime, 1f, 0f);
|
|
yield return null;
|
|
}
|
|
timeToLerp = 1f;
|
|
percentage = 0f;
|
|
startTime = Time.timeSinceLevelLoad;
|
|
while (percentage < 1f)
|
|
{
|
|
percentage = (Time.time - startTime) / timeToLerp;
|
|
yield return null;
|
|
}
|
|
if (!Records.x.pocketPause)
|
|
{
|
|
Links.x.rtsCamera.Zoom(false, "");
|
|
Links.x.hudControl.attackTimerAnimator.gameObject.transform.localScale = Vector3.one;
|
|
}
|
|
main.FullAttackTime();
|
|
this.dodgeCoroutine = null;
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x060004FD RID: 1277 RVA: 0x0006EBF4 File Offset: 0x0006CDF4
|
|
public void SwitchLethality()
|
|
{
|
|
int count = this.allCharacters.Count;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
Character character = this.allCharacters[i];
|
|
if (character && character.npc && (!character.stunned || (character.stunned && Records.x.kill)) && !character.dead && !character.inactive)
|
|
{
|
|
character.CircleAnimation("");
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004FE RID: 1278 RVA: 0x0006EC70 File Offset: 0x0006CE70
|
|
public void GetDistances(Character pathfinder, Character target, out float bestDistance, out float maxDistance, out float minDistance)
|
|
{
|
|
float meleeRangeEnd = pathfinder.invRow1._MeleeRangeEnd;
|
|
bestDistance = (meleeRangeEnd * Records.x.nodeSize + pathfinder.attackRadius + target.attackRadius - 0.65f) * (meleeRangeEnd * Records.x.nodeSize + pathfinder.attackRadius + target.attackRadius - 0.65f);
|
|
maxDistance = (meleeRangeEnd * Records.x.nodeSize + pathfinder.attackRadius + target.attackRadius) * (meleeRangeEnd * Records.x.nodeSize + pathfinder.attackRadius + target.attackRadius);
|
|
minDistance = (pathfinder.invRow1._MeleeRangeStart * Records.x.nodeSize + pathfinder.attackRadius + target.attackRadius) * (pathfinder.invRow1._MeleeRangeStart * Records.x.nodeSize + pathfinder.attackRadius + target.attackRadius);
|
|
if (minDistance == maxDistance || pathfinder.invRow1._MeleeRangeStart == 0f)
|
|
{
|
|
minDistance = 0f;
|
|
}
|
|
if (bestDistance < minDistance)
|
|
{
|
|
bestDistance = minDistance;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060004FF RID: 1279 RVA: 0x0006ED80 File Offset: 0x0006CF80
|
|
public bool NodeCalled(GraphNode n)
|
|
{
|
|
for (int i = 0; i < this.targetNodes.Count; i++)
|
|
{
|
|
if (n == this.targetNodes[i])
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x06000500 RID: 1280 RVA: 0x0006EDB8 File Offset: 0x0006CFB8
|
|
public void GetNodeCalled()
|
|
{
|
|
this.targetNodes.Clear();
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
Character character = this.characters[i];
|
|
if (character && character.hasActions && character.actions.targetMovePosition != null)
|
|
{
|
|
this.targetNodes.Add(character.actions.targetMovePosition);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000501 RID: 1281 RVA: 0x0006EE28 File Offset: 0x0006D028
|
|
public int OverlapCount()
|
|
{
|
|
return this.overlapping.Count;
|
|
}
|
|
|
|
// Token: 0x06000502 RID: 1282 RVA: 0x0006EE38 File Offset: 0x0006D038
|
|
public Vector3 SubtractVectors(Vector3 a, Vector3 b)
|
|
{
|
|
Vector3 vector;
|
|
vector.x = a.x - b.x;
|
|
vector.y = a.y - b.y;
|
|
vector.z = a.z - b.z;
|
|
return vector;
|
|
}
|
|
|
|
// Token: 0x06000503 RID: 1283 RVA: 0x0006EE84 File Offset: 0x0006D084
|
|
public Vector3 AddVectors(Vector3 a, Vector3 b)
|
|
{
|
|
Vector3 vector;
|
|
vector.x = a.x + b.x;
|
|
vector.y = a.y + b.y;
|
|
vector.z = a.z + b.z;
|
|
return vector;
|
|
}
|
|
|
|
// Token: 0x06000504 RID: 1284 RVA: 0x0006EED0 File Offset: 0x0006D0D0
|
|
public Vector3 AddVectorY(Vector3 a, float b)
|
|
{
|
|
Vector3 vector;
|
|
vector.x = a.x;
|
|
vector.y = a.y + b;
|
|
vector.z = a.z;
|
|
return vector;
|
|
}
|
|
|
|
// Token: 0x06000505 RID: 1285 RVA: 0x0006EF08 File Offset: 0x0006D108
|
|
public int GetNPCCount()
|
|
{
|
|
int num = 0;
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
if (this.characters[i] && this.characters[i].npc)
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x06000506 RID: 1286 RVA: 0x0006EF58 File Offset: 0x0006D158
|
|
public int GetNPCCountHostile()
|
|
{
|
|
if (this.npcOnlyCombat)
|
|
{
|
|
return 0;
|
|
}
|
|
int num = 0;
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
if (this.characters[i] && this.characters[i].npc && (this.characters[i].attackingUntilBribe || this.characters[i].hostility >= 2))
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x06000507 RID: 1287 RVA: 0x0006EFDC File Offset: 0x0006D1DC
|
|
public Character FindTargetInRange(Character attacker)
|
|
{
|
|
for (int i = 0; i < this.characters.Count; i++)
|
|
{
|
|
Character character = this.characters[i];
|
|
if (character && ((character.npc && !attacker.npc) || (attacker.npc && !character.npc)))
|
|
{
|
|
float num = attacker.invRow1._MeleeRangeStart * Records.x.nodeSize * (attacker.invRow1._MeleeRangeStart * Records.x.nodeSize);
|
|
float num2 = attacker.invRow1._MeleeRangeEnd * Records.x.nodeSize + attacker.attackRadius + character.attackRadius;
|
|
float num3 = num2 * num2;
|
|
float sqrMagnitude = ((Vector3)character.node.position - (Vector3)attacker.node.position).sqrMagnitude;
|
|
if (sqrMagnitude <= num3 && sqrMagnitude >= num)
|
|
{
|
|
return character;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Token: 0x04000765 RID: 1893
|
|
[Header("TURNS")]
|
|
public string currentTurn;
|
|
|
|
// Token: 0x04000766 RID: 1894
|
|
private IEnumerator combatEnd;
|
|
|
|
// Token: 0x04000767 RID: 1895
|
|
private IEnumerator combatStart;
|
|
|
|
// Token: 0x04000768 RID: 1896
|
|
public bool playerStartedCombat;
|
|
|
|
// Token: 0x04000769 RID: 1897
|
|
public bool preDome;
|
|
|
|
// Token: 0x0400076A RID: 1898
|
|
public bool npcsInCombat;
|
|
|
|
// Token: 0x0400076B RID: 1899
|
|
public bool attackingInteractiveOutsideOfCombat;
|
|
|
|
// Token: 0x0400076C RID: 1900
|
|
public bool miniEvent;
|
|
|
|
// Token: 0x0400076D RID: 1901
|
|
public bool bubbleEvent;
|
|
|
|
// Token: 0x0400076E RID: 1902
|
|
public float domeDistance;
|
|
|
|
// Token: 0x0400076F RID: 1903
|
|
public Character comboTargetHover;
|
|
|
|
// Token: 0x04000770 RID: 1904
|
|
public Character currentTurnCharacter;
|
|
|
|
// Token: 0x04000771 RID: 1905
|
|
public Character characterStartingAttack;
|
|
|
|
// Token: 0x04000772 RID: 1906
|
|
public Character rallyCharacter;
|
|
|
|
// Token: 0x04000773 RID: 1907
|
|
public Character rallyTarget;
|
|
|
|
// Token: 0x04000774 RID: 1908
|
|
public Character pocketTarget;
|
|
|
|
// Token: 0x04000775 RID: 1909
|
|
public Character bubbleEventTarget;
|
|
|
|
// Token: 0x04000776 RID: 1910
|
|
public bool characterInTurn;
|
|
|
|
// Token: 0x04000777 RID: 1911
|
|
public bool waitingForOverlap;
|
|
|
|
// Token: 0x04000778 RID: 1912
|
|
public bool slowingTime;
|
|
|
|
// Token: 0x04000779 RID: 1913
|
|
public bool slowingTimeForLastDeath;
|
|
|
|
// Token: 0x0400077A RID: 1914
|
|
public bool slowTimeHold;
|
|
|
|
// Token: 0x0400077B RID: 1915
|
|
public bool slowTimePause;
|
|
|
|
// Token: 0x0400077C RID: 1916
|
|
public bool npcOnlyCombat;
|
|
|
|
// Token: 0x0400077D RID: 1917
|
|
public bool pickingRally;
|
|
|
|
// Token: 0x0400077E RID: 1918
|
|
public bool inRally;
|
|
|
|
// Token: 0x0400077F RID: 1919
|
|
public bool inPocketAttack;
|
|
|
|
// Token: 0x04000780 RID: 1920
|
|
public int undeadCount;
|
|
|
|
// Token: 0x04000781 RID: 1921
|
|
public int allDeadCount;
|
|
|
|
// Token: 0x04000782 RID: 1922
|
|
public int rallyAttacks;
|
|
|
|
// Token: 0x04000783 RID: 1923
|
|
public int rallyDamage;
|
|
|
|
// Token: 0x04000784 RID: 1924
|
|
public GameObject synergySpaceFX;
|
|
|
|
// Token: 0x04000785 RID: 1925
|
|
public GameObject synergySpaceFX2;
|
|
|
|
// Token: 0x04000786 RID: 1926
|
|
public GameObject pocketFX;
|
|
|
|
// Token: 0x04000787 RID: 1927
|
|
public GameObject lastRallyTarget;
|
|
|
|
// Token: 0x04000788 RID: 1928
|
|
public Vector3 centralEnemyPosition;
|
|
|
|
// Token: 0x04000789 RID: 1929
|
|
public Vector3 bubbleEventTargetPosition;
|
|
|
|
// Token: 0x0400078A RID: 1930
|
|
public Vector3 pocketTargetPosition;
|
|
|
|
// Token: 0x0400078B RID: 1931
|
|
public int npcCount;
|
|
|
|
// Token: 0x0400078C RID: 1932
|
|
public int groupCount;
|
|
|
|
// Token: 0x0400078D RID: 1933
|
|
[Header("LISTS")]
|
|
public List<Character> characters = new List<Character>();
|
|
|
|
// Token: 0x0400078E RID: 1934
|
|
private List<Character> groupCharacters = new List<Character>();
|
|
|
|
// Token: 0x0400078F RID: 1935
|
|
private List<Character> triedCharacters = new List<Character>();
|
|
|
|
// Token: 0x04000790 RID: 1936
|
|
public List<Character> npcsThatCanGroup = new List<Character>();
|
|
|
|
// Token: 0x04000791 RID: 1937
|
|
private List<GraphNode> groupNodes = new List<GraphNode>();
|
|
|
|
// Token: 0x04000792 RID: 1938
|
|
private List<GraphNode> targetNodes = new List<GraphNode>();
|
|
|
|
// Token: 0x04000793 RID: 1939
|
|
private List<Character> inRange = new List<Character>();
|
|
|
|
// Token: 0x04000794 RID: 1940
|
|
private List<GraphNode> possibleCenters = new List<GraphNode>();
|
|
|
|
// Token: 0x04000795 RID: 1941
|
|
private List<int> allNodesTaken = new List<int>();
|
|
|
|
// Token: 0x04000796 RID: 1942
|
|
public List<EnemyGroup> enemyGroups = new List<EnemyGroup>();
|
|
|
|
// Token: 0x04000797 RID: 1943
|
|
public List<float> charactersLastActionTime = new List<float>();
|
|
|
|
// Token: 0x04000798 RID: 1944
|
|
public List<Character> needsTurn = new List<Character>();
|
|
|
|
// Token: 0x04000799 RID: 1945
|
|
public List<Character> delayedAttacks = new List<Character>();
|
|
|
|
// Token: 0x0400079A RID: 1946
|
|
public List<Character> overlapping = new List<Character>();
|
|
|
|
// Token: 0x0400079B RID: 1947
|
|
public List<Character> synergies = new List<Character>();
|
|
|
|
// Token: 0x0400079C RID: 1948
|
|
private List<GameObject> synergyFX = new List<GameObject>();
|
|
|
|
// Token: 0x0400079D RID: 1949
|
|
private List<Character> changingMap;
|
|
|
|
// Token: 0x0400079E RID: 1950
|
|
private List<float> changingMapDistance;
|
|
|
|
// Token: 0x0400079F RID: 1951
|
|
private List<Character> allCharacters;
|
|
|
|
// Token: 0x040007A0 RID: 1952
|
|
private List<GraphNode> allNodes;
|
|
|
|
// Token: 0x040007A1 RID: 1953
|
|
private List<GraphNode> allDomeNodes;
|
|
|
|
// Token: 0x040007A2 RID: 1954
|
|
public List<GraphNode> domeNodes = new List<GraphNode>();
|
|
|
|
// Token: 0x040007A3 RID: 1955
|
|
public List<GraphNode> tempDomeNodes = new List<GraphNode>();
|
|
|
|
// Token: 0x040007A4 RID: 1956
|
|
public List<int> partyXP = new List<int>();
|
|
|
|
// Token: 0x040007A5 RID: 1957
|
|
public List<Character> partyCharacterXP = new List<Character>();
|
|
|
|
// Token: 0x040007A6 RID: 1958
|
|
public List<Character> reduceHostilities = new List<Character>();
|
|
|
|
// Token: 0x040007A7 RID: 1959
|
|
public List<float> reduceHostilitiesTimes = new List<float>();
|
|
|
|
// Token: 0x040007A8 RID: 1960
|
|
public List<BreakableActions> nearBreakables = new List<BreakableActions>();
|
|
|
|
// Token: 0x040007A9 RID: 1961
|
|
public List<ChestActions> nearChests = new List<ChestActions>();
|
|
|
|
// Token: 0x040007AA RID: 1962
|
|
public List<PuzzleActions> nearPuzzles = new List<PuzzleActions>();
|
|
|
|
// Token: 0x040007AB RID: 1963
|
|
public List<DoorActions> nearDoors = new List<DoorActions>();
|
|
|
|
// Token: 0x040007AC RID: 1964
|
|
private List<TimedBreakable> timedBreakables;
|
|
|
|
// Token: 0x040007AD RID: 1965
|
|
private List<BreakableActions> diaBreakables;
|
|
|
|
// Token: 0x040007AE RID: 1966
|
|
private List<DoorActions> diaDoors;
|
|
|
|
// Token: 0x040007AF RID: 1967
|
|
private List<ChestActions> diaChests;
|
|
|
|
// Token: 0x040007B0 RID: 1968
|
|
private List<Character> party;
|
|
|
|
// Token: 0x040007B1 RID: 1969
|
|
public List<TimelineIcon> timelineIcons = new List<TimelineIcon>();
|
|
|
|
// Token: 0x040007B2 RID: 1970
|
|
public List<Projectile> projectiles = new List<Projectile>();
|
|
|
|
// Token: 0x040007B3 RID: 1971
|
|
private List<MeshRenderer> gridMeshes1 = new List<MeshRenderer>();
|
|
|
|
// Token: 0x040007B4 RID: 1972
|
|
private List<MeshRenderer> gridMeshes2 = new List<MeshRenderer>();
|
|
|
|
// Token: 0x040007B5 RID: 1973
|
|
private List<int> gridMeshTypes = new List<int>();
|
|
|
|
// Token: 0x040007B6 RID: 1974
|
|
private List<MeshRenderer> domeMeshes = new List<MeshRenderer>();
|
|
|
|
// Token: 0x040007B7 RID: 1975
|
|
private List<GraphNode> targetingNodes = new List<GraphNode>();
|
|
|
|
// Token: 0x040007B8 RID: 1976
|
|
private List<GraphNode> tempPath;
|
|
|
|
// Token: 0x040007B9 RID: 1977
|
|
private List<GraphNode> tempNodes = new List<GraphNode>();
|
|
|
|
// Token: 0x040007BA RID: 1978
|
|
private List<GraphNode> savedNodes = new List<GraphNode>();
|
|
|
|
// Token: 0x040007BB RID: 1979
|
|
private List<bool> targetingBool = new List<bool>();
|
|
|
|
// Token: 0x040007BC RID: 1980
|
|
private List<float> targetingDist = new List<float>();
|
|
|
|
// Token: 0x040007BD RID: 1981
|
|
private List<Character> orderedTargets = new List<Character>();
|
|
|
|
// Token: 0x040007BE RID: 1982
|
|
private List<Character> orderedTargetsTemp = new List<Character>();
|
|
|
|
// Token: 0x040007BF RID: 1983
|
|
private List<TileEffects> currentTileEffects;
|
|
|
|
// Token: 0x040007C0 RID: 1984
|
|
private List<TileEffects> currentTileEffectsTemp = new List<TileEffects>();
|
|
|
|
// Token: 0x040007C1 RID: 1985
|
|
[Header("UI")]
|
|
public Vector3 domeCenter;
|
|
|
|
// Token: 0x040007C2 RID: 1986
|
|
public Animator combatHudAnim;
|
|
|
|
// Token: 0x040007C3 RID: 1987
|
|
public GameObject doveObject;
|
|
|
|
// Token: 0x040007C4 RID: 1988
|
|
public GameObject endTurnObject;
|
|
|
|
// Token: 0x040007C5 RID: 1989
|
|
private Transform domeTr;
|
|
|
|
// Token: 0x040007C6 RID: 1990
|
|
public bool domeOn;
|
|
|
|
// Token: 0x040007C7 RID: 1991
|
|
private float startCombatEnd;
|
|
|
|
// Token: 0x040007C8 RID: 1992
|
|
public TextMeshProUGUI playerTurnUI;
|
|
|
|
// Token: 0x040007C9 RID: 1993
|
|
public TextMeshProUGUI enemyTurnUI;
|
|
|
|
// Token: 0x040007CA RID: 1994
|
|
public TextMeshProTypewriterEffect typeWriterPlayerTurnUI;
|
|
|
|
// Token: 0x040007CB RID: 1995
|
|
public TextMeshProTypewriterEffect typeWriterEnemyTurnUI;
|
|
|
|
// Token: 0x040007CC RID: 1996
|
|
public List<Character> possibleTargets = new List<Character>();
|
|
|
|
// Token: 0x040007CD RID: 1997
|
|
private List<Character> characterTargets;
|
|
|
|
// Token: 0x040007CE RID: 1998
|
|
public Material radiusGemEnemyTurn;
|
|
|
|
// Token: 0x040007CF RID: 1999
|
|
public Material radiusGemPlayerTurn;
|
|
|
|
// Token: 0x040007D0 RID: 2000
|
|
public Material radiusGemNoTurn;
|
|
|
|
// Token: 0x040007D1 RID: 2001
|
|
public Image huddleFill;
|
|
|
|
// Token: 0x040007D2 RID: 2002
|
|
public float targetUpdateTime;
|
|
|
|
// Token: 0x040007D3 RID: 2003
|
|
private bool endingCombat;
|
|
|
|
// Token: 0x040007D4 RID: 2004
|
|
[Header("MISC")]
|
|
public bool showDebugs;
|
|
|
|
// Token: 0x040007D5 RID: 2005
|
|
[Header("MISC")]
|
|
public bool debugTargets;
|
|
|
|
// Token: 0x040007D6 RID: 2006
|
|
private List<GraphNode> nodes;
|
|
|
|
// Token: 0x040007D7 RID: 2007
|
|
private IEnumerator partyTargetCoroutine;
|
|
|
|
// Token: 0x040007D8 RID: 2008
|
|
private IEnumerator radiusCoroutine;
|
|
|
|
// Token: 0x040007D9 RID: 2009
|
|
private IEnumerator endCoroutine;
|
|
|
|
// Token: 0x040007DA RID: 2010
|
|
private IEnumerator groupCorout;
|
|
|
|
// Token: 0x040007DB RID: 2011
|
|
private IEnumerator dodgeCoroutine;
|
|
|
|
// Token: 0x040007DC RID: 2012
|
|
private NNConstraint nodeConstraint = new NNConstraint();
|
|
|
|
// Token: 0x040007DD RID: 2013
|
|
private NNConstraint groupConstraint = new NNConstraint();
|
|
|
|
// Token: 0x040007DE RID: 2014
|
|
public bool combatCinematics;
|
|
|
|
// Token: 0x040007DF RID: 2015
|
|
public bool updateSelected;
|
|
|
|
// Token: 0x040007E0 RID: 2016
|
|
public bool updateCircles;
|
|
|
|
// Token: 0x040007E1 RID: 2017
|
|
private WaitForSeconds delayShort = new WaitForSeconds(0.001f);
|
|
|
|
// Token: 0x040007E2 RID: 2018
|
|
private WaitForSeconds delayHalfSecond = new WaitForSeconds(0.5f);
|
|
|
|
// Token: 0x040007E3 RID: 2019
|
|
private WaitForSeconds delayQuarterSecond = new WaitForSeconds(0.25f);
|
|
|
|
// Token: 0x040007E4 RID: 2020
|
|
private Plane[] planes = new Plane[0];
|
|
|
|
// Token: 0x040007E5 RID: 2021
|
|
private StringFast str = new StringFast(32);
|
|
|
|
// Token: 0x040007E6 RID: 2022
|
|
public List<Character> miniGameCharacters = new List<Character>();
|
|
|
|
// Token: 0x040007E7 RID: 2023
|
|
public Vector3 rallyStartPosition;
|
|
|
|
// Token: 0x040007E8 RID: 2024
|
|
public Vector3 rallyCharacterStartPosition;
|
|
|
|
// Token: 0x040007E9 RID: 2025
|
|
public GameObject pocketParticle;
|
|
|
|
// Token: 0x040007EA RID: 2026
|
|
private WaitForSeconds delaySecond = new WaitForSeconds(1f);
|
|
|
|
// Token: 0x040007EB RID: 2027
|
|
private float shaderTimeFlash;
|
|
|
|
// Token: 0x040007EC RID: 2028
|
|
private float shaderFlashTarget;
|
|
|
|
// Token: 0x040007ED RID: 2029
|
|
private bool shaderFlash;
|
|
|
|
// Token: 0x040007EE RID: 2030
|
|
public float timeTarget;
|
|
|
|
// Token: 0x040007EF RID: 2031
|
|
public float timeScale;
|
|
|
|
// Token: 0x040007F0 RID: 2032
|
|
public float startTime;
|
|
|
|
// Token: 0x040007F1 RID: 2033
|
|
public float slowSpeed;
|
|
|
|
// Token: 0x040007F2 RID: 2034
|
|
public float startTimeHoldDeltaTime;
|
|
|
|
// Token: 0x040007F3 RID: 2035
|
|
public float combatStartTime;
|
|
|
|
// Token: 0x040007F4 RID: 2036
|
|
private bool startTimeHold;
|
|
|
|
// Token: 0x040007F5 RID: 2037
|
|
public Character exileCharacter;
|
|
|
|
// Token: 0x040007F6 RID: 2038
|
|
public bool isJustice;
|
|
|
|
// Token: 0x040007F7 RID: 2039
|
|
private Vector3 mainPosition;
|
|
|
|
// Token: 0x040007F8 RID: 2040
|
|
private Vector3 forw;
|
|
|
|
// Token: 0x040007F9 RID: 2041
|
|
private GameObject prevClosestItem;
|
|
|
|
// Token: 0x040007FA RID: 2042
|
|
public GameObject targetArrow;
|
|
|
|
// Token: 0x040007FB RID: 2043
|
|
public TextMeshProUGUI targetBtnText;
|
|
|
|
// Token: 0x040007FC RID: 2044
|
|
public RectTransform targetArrowRT;
|
|
|
|
// Token: 0x040007FD RID: 2045
|
|
private float characterAddedTime;
|
|
|
|
// Token: 0x040007FE RID: 2046
|
|
public float lastJusticeTime;
|
|
|
|
// Token: 0x040007FF RID: 2047
|
|
public float lastPinTime;
|
|
|
|
// Token: 0x04000800 RID: 2048
|
|
public float lastChargeTime;
|
|
|
|
// Token: 0x04000801 RID: 2049
|
|
public string charmFail;
|
|
|
|
// Token: 0x04000802 RID: 2050
|
|
private float lastGroupTime;
|
|
|
|
// Token: 0x04000803 RID: 2051
|
|
private List<GraphNode> possibleGroupNodes = new List<GraphNode>();
|
|
|
|
// Token: 0x04000804 RID: 2052
|
|
private List<Character> possibleGroupNodeCharacters = new List<Character>();
|
|
|
|
// Token: 0x04000805 RID: 2053
|
|
public bool hoverShowTargets;
|
|
|
|
// Token: 0x04000806 RID: 2054
|
|
public string hoverShowTargetsType;
|
|
|
|
// Token: 0x04000807 RID: 2055
|
|
public Character hoverShowTargetCharacter;
|
|
}
|