2025-05-13 19:22:01 +08:00

2358 lines
59 KiB
C#

using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using Godot;
using Godot.Bridge;
using Godot.NativeInterop;
[ScriptPath("res://Scripts/Events/ChujinDWEvents.cs")]
public partial class ChujinDWEvents : Node2D
{
[Export(PropertyHint.None, "")]
private Entity[] entities;
[Export(PropertyHint.None, "")]
public Node2D[] nodes;
[Export(PropertyHint.None, "")]
private Node[] objects;
public static ChujinDWEvents instance;
public static readonly StringName tram = "Tram";
public static readonly StringName tramIn = "TramAmt";
private const float tramTime = 200f;
public override void _EnterTree()
{
instance = this;
}
public void AxisEvent()
{
Main.inEvent = Coroutine.Start(Axis());
}
private IEnumerator Axis()
{
nodes[0].QueueFree();
Audio.music.Stop();
Party.Emoticon(Entity.Emoticons.Exclaim, noise: true);
TextSystem.GetText("AxisEvent1");
while (GodotObject.IsInstanceValid(Player.instance.emoticonObj))
{
yield return null;
}
while (TextSystem.instance.Visible)
{
yield return null;
}
Party.MoveTo(new Vector2[2]
{
GetChild<Node2D>(0).GlobalPosition,
GetChild<Node2D>(1).GlobalPosition
}, 1f, align: true, Entity.Direction.West);
while (!Party.IsStopped())
{
yield return null;
}
Room.current.DoMusic(1);
Coroutine.Start(CameraController.Pan(new Vector2(0f, -20f), 0.25f));
entities[0].DoAutoMove(GetChild<Node2D>(2).GlobalPosition, 0.9f);
while (entities[0].moving != null)
{
yield return null;
}
TextSystem.GetText("AxisEvent2");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.followers[0].anim.Play("Surprise");
Audio.PlaySound("snd_axis_geno_laser_drill.wav");
Node2D[] scan = new Node2D[2];
Party.UpdateFollowerEntities();
Vector2 p = Vector2.Down * 48f;
for (int i = 0; i < 2; i++)
{
Room.current.AddChild(scan[i] = GD.Load<PackedScene>("res://Objects/Particles/Scan.tscn").Instantiate<Node2D>(PackedScene.GenEditState.Disabled), forceReadableName: false, InternalMode.Disabled);
scan[i].GlobalPosition = Party.party[i].oEntity.GlobalPosition - p;
scan[i].ZIndex = 1;
}
for (float a = 0f; a <= 60f; a += Main.deltaTime)
{
for (int j = 0; j < 2; j++)
{
scan[j].Modulate = Main.colorClear.Lerp(Main.colorWhite, a / 60f);
}
yield return null;
}
for (float a = 0f; a <= 60f; a += Main.deltaTime)
{
for (int k = 0; k < 2; k++)
{
scan[k].GlobalPosition = (Party.party[k].oEntity.GlobalPosition - p).Lerp(Party.party[k].oEntity.GlobalPosition, a / 60f);
}
yield return null;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
for (int l = 0; l < 2; l++)
{
scan[l].Modulate = Main.colorClear.Lerp(Main.colorWhite, 1f - a / 60f);
}
yield return null;
}
for (int m = 0; m < 2; m++)
{
scan[m].QueueFree();
}
TextSystem.GetText("AxisEvent3");
while (TextSystem.instance.Visible)
{
yield return null;
}
Coroutine.Start(BattleDR.StartBattle(null, useOWBG: true, new Entity.IDs[1] { Entity.IDs.Axis }, new List<Entity> { entities[0] }, "Axis", new Audio.AudioBlock
{
stream = Room.current.music[2]
}));
yield return null;
while (BattleDR.current != null || GameOver.instance != null)
{
yield return null;
}
Player.instance.followers[0].UpdateAnim(force: true);
Coroutine c;
if (BattleDR.lastResult == BattleDR.EndState.Defeated)
{
entities[0].anim.Play("KO");
entities[0].sprite.FlipH = true;
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("AxisPostBattleFight1");
while (TextSystem.instance.Visible)
{
yield return null;
}
c = Coroutine.Start(CameraController.Pan(entities[0].GlobalPosition + new Vector2(0f, -20f), 0.5f));
Party.MoveTo(new Vector2[2]
{
entities[0].GlobalPosition + new Vector2(-30f, 0f),
entities[0].GlobalPosition + new Vector2(-5f, -20f)
}, 1.25f);
while (!c.done || !Party.IsStopped())
{
yield return null;
}
Party.LookAt(entities[0].GlobalPosition);
TextSystem.GetText("AxisPostBattleFight2");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.anim.Play("SideWalkDW");
Coroutine.Start(Player.instance.Slide(Vector2.Left, 30f));
c = Coroutine.Start(Player.instance.followers[0].Slide(Vector2.Left, 30f));
Player.instance.followers[0].anim.Play("Surprise");
Player.instance.followers[0].sprite.FlipH = true;
entities[0].Shake(30f, 1f);
while (!c.done)
{
yield return null;
}
entities[0].sprite.FlipH = false;
entities[0].anim.PlayBackwards("Shutdown");
Audio.PlaySound("snd_electric_talk.wav");
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
entities[0].anim.Play("EastIdleDW");
Player.instance.anim.Play("SideIdleDW");
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
Player.instance.followers[0].LookAt(Vector2.Right);
TextSystem.GetText("AxisPostBattleFight3");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
else
{
entities[0].anim.Play("EastIdleDW");
TextSystem.GetText("AxisPostBattleSpare1");
while (TextSystem.instance.Visible)
{
yield return null;
}
Audio.PlaySound("snd_power_down.wav");
entities[0].anim.Play("Shutdown");
for (float a = 0f; a < 120f; a += Main.deltaTime)
{
yield return null;
}
entities[0].anim.Play("Shutdown", -1.0, -1f, fromEnd: true);
Audio.PlaySound("snd_electric_talk.wav");
entities[0].anim.Play("EastIdleDW");
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("AxisPostBattleSpare2");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
Party.AddFollower(entities[0]);
Room.current.DoMusic();
c = Coroutine.Start(CameraController.PanToObj(Player.instance, 0.5f));
while (!c.done)
{
yield return null;
}
Player.instance.ResetFollowStep();
Player.instance.LookAt(Vector2.Down);
}
public void Overview()
{
Main.inEvent = Coroutine.Start(OverviewEvent());
}
private IEnumerator OverviewEvent()
{
Room.current.DoMusic(1);
Party.MoveTo(new Vector2[3]
{
nodes[0].GlobalPosition,
nodes[1].GlobalPosition,
nodes[2].GlobalPosition
}, 0.5f, align: true, Entity.Direction.North);
while (!Party.IsStopped())
{
yield return null;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("DW2OverviewEvent");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.ResetFollowStep();
if (!SaveFile.HasFlag(SaveFile.Flags.WeirdStart))
{
SaveFile.AddFlag(SaveFile.Flags.MagicDoorActive);
((MagicDoor)nodes[3])._EnterTree();
}
else
{
SaveFile.AddFlag(SaveFile.Flags.DW2MagicDoor);
}
SaveFile.AddFlag(SaveFile.Flags.LockLightWorldPortal);
}
public void LowerBridgeFirstPuzzle()
{
Main.inEvent = Coroutine.Start(LBFP());
}
private IEnumerator LBFP()
{
Party.StopMoving();
Audio.PlaySound("snd_coin_ch1.wav");
float a;
for (a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
Vector2 pos = Vector2.Zero;
if (Room.current.id != Room.IDs.ChujinDWFactoryPath)
{
if (nodes.Length > 1)
{
pos = nodes[1].GlobalPosition;
}
}
else
{
pos = nodes[2].GlobalPosition;
}
Coroutine c = Coroutine.Start(CameraController.Pan(pos, 120f, fixedRate: false));
AudioStreamPlayer sound = Audio.PlaySound(GD.Load<AudioStream>("res://Audio/Music/elevator.ogg"));
while (!c.done)
{
yield return null;
}
Vector2 p = nodes[0].GlobalPosition;
a = 0f;
for (float b = 200f; a <= b; a += Main.deltaTime)
{
nodes[0].GlobalPosition = p.Lerp(Vector2.Zero, Mathf.SmoothStep(0f, 1f, a / b));
yield return null;
}
sound.QueueFree();
Audio.PlaySound("snd_screenshake.wav");
CameraController.Shake(20f);
for (float b = 0f; b < 60f; b += Main.deltaTime)
{
yield return null;
}
if (Sukoban.instance != null)
{
Sukoban.instance.Stop();
}
else
{
c = Coroutine.Start(CameraController.PanToObj(Player.instance.controlling, 120f, fixedRate: false));
while (!c.done)
{
yield return null;
}
}
if (Room.current.id == Room.IDs.ChujinDWBeforeTown)
{
SaveFile.AddFlag(SaveFile.Flags.Puzzle2_DW2);
}
else
{
SaveFile.AddFlag(SaveFile.Flags.FirstPuzzleDW2);
}
}
public void TVEvent()
{
Main.inEvent = Coroutine.Start(TVCutscene());
}
private IEnumerator TVCutscene()
{
Audio.ChangeMusic((Audio.AudioBlock)null, 3f);
Player.instance.DoAutoMove(Player.instance.GlobalPosition + Vector2.Right * 60f);
while (Player.instance.moving != null)
{
Player.instance.AddFollowerStep(update: true);
yield return null;
}
Party.StopMoving();
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("Ch2TVEvent_1");
while (TextSystem.instance.Visible)
{
yield return null;
}
Party.Emoticon(Entity.Emoticons.Question);
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
Party.LookAt(Vector2.Up);
Coroutine c = Coroutine.Start(CameraController.Pan(nodes[0].GlobalPosition + Vector2.Down * 20f, 0.5f));
while (!c.done)
{
yield return null;
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
Room.current.DoMusic(1);
for (int i = 0; i < 3; i++)
{
nodes[0].GetChild<Node2D>(1 + i).Visible = true;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("Ch2TVEvent_2");
Dictionary<StringName, StringName>[] dicAnims = new Dictionary<StringName, StringName>[2]
{
new Dictionary<StringName, StringName>
{
{ "ChujinNervous2", "Nervous" },
{ "ChujinNormal", "Normal" },
{ "ChujinShock", "Down" },
{ "ChujinNervous", "NervousSide" }
},
new Dictionary<StringName, StringName>
{
{ "ToastNormal", "Idle" },
{ "ToastLaugh", "Laugh" },
{ "ToastSide", "Side" }
}
};
AnimationPlayer[] anims = new AnimationPlayer[2]
{
nodes[0].GetChild(2).GetChild<AnimationPlayer>(0),
nodes[0].GetChild(3).GetChild<AnimationPlayer>(0)
};
while (TextSystem.instance.Visible)
{
for (int j = 0; j < 2; j++)
{
if (dicAnims[j].ContainsKey(TextSystem.instance.portrait.Animation))
{
anims[j].Play(dicAnims[j][TextSystem.instance.portrait.Animation]);
}
}
yield return null;
}
for (int k = 0; k < 3; k++)
{
nodes[0].GetChild<Node2D>(1 + k).Visible = false;
}
Audio.ChangeMusic((Audio.AudioBlock)null, 3f);
SaveFile.AddFlag(SaveFile.Flags.DW2PlanTalk);
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
c = Coroutine.Start(CameraController.PanToObj(Player.instance, 0.5f));
while (!c.done)
{
yield return null;
}
TextSystem.GetText("Ch2TVEvent_3");
while (TextSystem.instance.Visible)
{
yield return null;
}
Party.LookAt(Vector2.Right);
Room.current.DoMusic();
}
public void FactoryRightPuzzle()
{
if (Room.current.tempFlags.Contains("LeftS") && Room.current.tempFlags.Contains("RightS"))
{
Main.inEvent = Coroutine.Start(FRP());
}
else
{
Player.instance.canInput = true;
}
}
private IEnumerator FRP()
{
Party.StopMoving();
Audio.PlaySound("snd_coin_ch1.wav");
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
Vector2 pos = Vector2.Zero;
Node2D p = null;
if (Room.current.id == Room.IDs.ChujinDWFactoryRight)
{
pos = nodes[2].GlobalPosition;
p = nodes[2];
SaveFile.AddFlag(SaveFile.Flags.FactoryRightPuzzle1);
SaveFile.AddFlag(SaveFile.Flags.TalkFactoryRight);
}
Coroutine c = Coroutine.Start(CameraController.Pan(pos, 120f, fixedRate: false));
while (!c.done)
{
yield return null;
}
Audio.PlaySound("snd_shadowpendant_ch1.wav");
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
p.Modulate = Main.colorWhite.Lerp(Main.colorClear, a / 30f);
yield return null;
}
p.QueueFree();
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
c = Coroutine.Start(CameraController.PanToObj(Player.instance.controlling, 120f, fixedRate: false));
while (!c.done)
{
yield return null;
}
}
public void FactoryLockEvents()
{
Main.inEvent = Coroutine.Start(LockEvents());
}
private IEnumerator FactoryButton()
{
Audio.PlaySound("snd_screenshake.wav");
CameraController.Shake(60f, 1.5f);
while (CameraController.instance.shakeTime > 0f)
{
yield return null;
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
Party.LookAt(Vector2.Up);
TextSystem.GetText("FactoryLock");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
private IEnumerator LockEvents()
{
Party.StopMoving();
if ((Room.current.id != Room.IDs.ChujinDWFactoryLeft || SaveFile.HasFlag(SaveFile.Flags.FactoryPuzzle2)) && (Room.current.id != Room.IDs.ChujinDWFactoryRight || SaveFile.HasFlag(SaveFile.Flags.FactoryPuzzle1)))
{
yield break;
}
Coroutine c = Coroutine.Start(FactoryButton());
while (!c.done)
{
yield return null;
}
if (!SaveFile.HasFlag(SaveFile.Flags.FactoryFirstSwitch))
{
TextSystem.GetText("FactoryLockTalk1");
while (TextSystem.instance.Visible)
{
yield return null;
}
SaveFile.AddFlag(SaveFile.Flags.FactoryFirstSwitch);
if (Room.current.id == Room.IDs.ChujinDWFactoryLeft)
{
SaveFile.AddFlag(SaveFile.Flags.TalkFactoryLeft);
}
}
else
{
AnimationPlayer canim = nodes[1].GetChild<AnimationPlayer>(0);
TextSystem.GetText("FactoryLockTalk2");
while (TextSystem.instance.Visible)
{
yield return null;
}
Party.MoveTo(new Vector2[3]
{
nodes[0].GlobalPosition,
nodes[0].GetChild<Node2D>(0).GlobalPosition,
nodes[0].GetChild<Node2D>(1).GlobalPosition
}, 0.75f, align: true, Entity.Direction.South);
while (!Party.IsStopped())
{
yield return null;
}
Party.Emoticon(Entity.Emoticons.Exclaim);
TextSystem.GetText("FactoryLockTalk2_2");
while (TextSystem.instance.Visible)
{
yield return null;
}
Party.LookAt(Entity.Direction.North);
Vector2 start = nodes[1].GlobalPosition;
Vector2 end = Player.instance.GlobalPosition + Vector2.Up * 100f;
float a = 0f;
float b;
for (b = 60f; a <= b; a += Main.deltaTime)
{
nodes[1].GlobalPosition = start.Lerp(end, a / b);
yield return null;
}
for (b = 0f; b < 60f; b += Main.deltaTime)
{
yield return null;
}
start = nodes[1].GlobalPosition;
end = Player.instance.followers[1].GlobalPosition + Vector2.Up * 100f;
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
nodes[1].GlobalPosition = start.Lerp(end, b / a);
yield return null;
}
for (a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
canim.Play("Ready");
Audio.PlaySound("snd_grab.wav");
for (a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
start = nodes[1].GlobalPosition;
end = Player.instance.followers[1].GlobalPosition + Vector2.Up * 35f;
Audio.PlaySound("snd_spearrise_ch1.wav");
a = 0f;
for (b = 20f; a <= b; a += Main.deltaTime)
{
nodes[1].GlobalPosition = start.Lerp(end, a / b);
yield return null;
}
Audio.PlaySound("snd_switchpull_n.wav").Bus = "Reverb";
Player.instance.followers[1].LookAt(Vector2.Down);
Player.instance.LookAt(Player.instance.followers[1].GlobalPosition);
Player.instance.followers[0].anim.Play("Surprise");
Player.instance.followers[1].Reparent(nodes[1]);
CameraController.Shake(15f);
for (b = 0f; b < 30f; b += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("FactoryLockTalk2_4");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.LookAt(Vector2.Up);
Player.instance.followers[0].LookAt(Vector2.Up);
start = nodes[1].GlobalPosition;
end = nodes[1].GlobalPosition + Vector2.Up * 200f;
b = 0f;
for (a = 150f; b <= a; b += Main.deltaTime)
{
nodes[1].GlobalPosition = start.Lerp(end, b / a);
yield return null;
}
nodes[1].Visible = false;
TextSystem.GetText("FactoryLockTalk2_5");
while (TextSystem.instance.Visible)
{
yield return null;
}
Party.Remove(2);
Party.LookAt(Entity.Direction.South);
SaveFile.current.values[5] = 20;
Player.instance.ResetFollowStep();
}
SaveFile.AddFlag((Room.current.id == Room.IDs.ChujinDWFactoryRight) ? SaveFile.Flags.FactoryPuzzle1 : SaveFile.Flags.FactoryPuzzle2);
}
public void TramGuy()
{
Main.inEvent = Coroutine.Start(TramGuyEvent());
}
private IEnumerator TramGuyEvent()
{
if (!Room.current.tempValue.ContainsKey(tram))
{
Room.current.tempValue.Add(tram, 0);
}
if (!Room.current.tempFlags.Contains(tramIn))
{
TextSystem.GetText("TramGuy" + Room.current.tempValue[tram]);
while (TextSystem.instance.Visible)
{
yield return null;
}
Audio.PlaySound("snd_rocket_long.wav");
float a = 0f;
for (float b = 200f; a <= b; a += Main.deltaTime)
{
nodes[0].GlobalPosition = new Vector2(Mathf.Lerp(600f, 0f, Mathf.SmoothStep(0f, 1f, a / b)), -120f);
yield return null;
}
Audio.PlaySound("snd_sliding_door_open.wav");
nodes[1].Visible = false;
Room.current.tempFlags.Add(tramIn);
}
else
{
TextSystem.GetText("TramGuyB" + Room.current.tempValue[tram]);
while (TextSystem.instance.Visible)
{
yield return null;
}
}
}
public void TramPrompt()
{
Main.inEvent = Coroutine.Start(TramPromptEvent());
}
private IEnumerator TramPromptEvent()
{
Party.LookAt(Vector2.Up);
TextSystem.GetText("TramPrompt");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt == 0)
{
Vector2 pos = nodes[1].GlobalPosition + new Vector2(0f, 30f);
Entity[] en = new Entity[2]
{
Player.instance,
Player.instance.followers[0]
};
for (int i = 0; i < 2; i++)
{
en[i].DoAutoAlign(pos, 0.5f);
en[i].moving.dirAtEnd = Entity.Direction.North;
while (en[i].moving != null)
{
yield return null;
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
en[i].Visible = false;
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
CameraController.instance.follow = null;
Coroutine c = Coroutine.Start(TramLeave());
while (!c.done)
{
yield return null;
}
CameraController.Transition(Main.colorBlack, 60f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
yield return null;
Room.LoadRoom(Room.IDs.ChujinDWInsideTrain, reparent: true);
Room.current.DoMusic();
Vector2[] pos2 = new Vector2[2]
{
new Vector2(-30f, 8f),
new Vector2(-60f, 0f)
};
Party.SetPosition(in pos2);
for (int j = 0; j < 2; j++)
{
en[j].Visible = true;
en[j].LookAt(Vector2.Down);
}
CameraController.instance.GlobalPosition = Vector2.Zero;
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
CameraController.Transition(Main.colorClearB, 60f);
}
else
{
Room.current.tempFlags.Remove(tramIn);
if (Room.current.tempValue[tram] < 3)
{
Room.current.tempValue[tram]++;
}
Coroutine c = Coroutine.Start(TramLeave());
while (!c.done)
{
yield return null;
}
}
}
private IEnumerator TramLeave()
{
nodes[1].Visible = true;
Audio.PlaySound("snd_sliding_door_open.wav");
float a;
for (a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
Audio.PlaySound("snd_rocket_long.wav");
a = 0f;
for (float b = 200f; a <= b; a += Main.deltaTime)
{
nodes[0].GlobalPosition = new Vector2(Mathf.Lerp(0f, -600f, Mathf.SmoothStep(0f, 1f, a / b)), -120f);
yield return null;
}
}
public void InsideTram()
{
Main.inEvent = Coroutine.Start(InsideTramEvent());
}
private IEnumerator InsideTramEvent()
{
nodes[2].Visible = false;
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("TramEvent1");
while (TextSystem.instance.Visible)
{
yield return null;
}
Party.ChangeCollider(state: false);
Party.MoveTo(new Vector2[2]
{
nodes[0].GlobalPosition,
nodes[1].GlobalPosition
}, 0.5f, align: true, Entity.Direction.South);
while (!Party.IsStopped())
{
yield return null;
}
Party.ChangeCollider(state: true);
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
Entity[] array = new Entity[2]
{
Player.instance,
Player.instance.followers[0]
};
Audio.PlaySound("snd_wing_ch1.wav");
for (int i = 0; i < 2; i++)
{
array[i].anim.Play("TramSit");
array[i].Shake(10f, 1f);
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("TramEvent2");
while (TextSystem.instance.Visible)
{
yield return null;
}
for (float a = 0f; a < 120f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("TramEvent3");
while (TextSystem.instance.Visible)
{
yield return null;
}
for (float a = 0f; a < 120f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("TramEvent4");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.ResetFollowStep();
nodes[2].Visible = true;
}
public void ToastTramEncounter()
{
if (SaveFile.HasFlag(SaveFile.Flags.WeirdStart))
{
Main.inEvent = Coroutine.Start(ToastFirst());
}
else
{
Main.inEvent = Coroutine.Start(ToastFirst());
}
}
private IEnumerator ToastFirst()
{
nodes[2].Visible = false;
Party.LookAt(Vector2.Up);
float a;
for (a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
Party.Emoticon(Entity.Emoticons.Exclaim, noise: true);
Audio.ChangeMusic((Audio.AudioBlock)null, 2f);
TextSystem.GetText("TramEvent5");
while (TextSystem.instance.Visible)
{
yield return null;
}
while (GodotObject.IsInstanceValid(Player.instance.emoticonObj))
{
yield return null;
}
Audio.PlaySound("snd_explosion.wav");
CameraController.Shake(30f);
Party.UpdateFollowerEntities();
entities[0].anim.Play("Fall");
Vector2 start = nodes[1].GlobalPosition + Vector2.Up * 140f;
Vector2 end = nodes[1].GlobalPosition + Vector2.Down * 20f;
Vector2[] pstart = new Vector2[2]
{
Party.party[0].oEntity.GlobalPosition,
Party.party[1].oEntity.GlobalPosition
};
Vector2[] pmid = null;
Party.party[1].oEntity.anim.Play("Surprise");
Party.party[1].oEntity.sprite.FlipH = true;
Party.party[0].oEntity.anim.Play("Hurt");
a = 0f;
float b;
for (b = 30f; a <= b; a += Main.deltaTime)
{
float num = Mathf.Min(a / b, 1f);
if (pmid == null)
{
pmid = new Vector2[2]
{
nodes[3].GetChild<Node2D>(0).GlobalPosition,
nodes[4].GetChild<Node2D>(0).GlobalPosition
};
}
for (int i = 0; i < 2; i++)
{
Party.party[i].oEntity.GlobalPosition = Common.Beizier(pstart[i], pmid[i], nodes[3 + i].GlobalPosition, num);
}
entities[0].GlobalPosition = start.Lerp(end, num);
yield return null;
}
entities[0].anim.Play("Land");
entities[0].Shake(10f, 1f);
CameraController.Shake(30f, 2f);
for (b = 0f; b < 120f; b += Main.deltaTime)
{
yield return null;
}
entities[0].LookAt(Vector2.Left);
for (int j = 0; j < 2; j++)
{
Party.party[j].oEntity.LookAt(Vector2.Right);
}
for (b = 0f; b < 60f; b += Main.deltaTime)
{
yield return null;
}
Room.current.DoMusic(1);
TextSystem.GetText("TramEvent6");
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[0].DoAutoMove(new Vector2(nodes[5].GlobalPosition.X, entities[0].GlobalPosition.Y), 0.7f);
entities[0].moving.doFacing = false;
for (int k = 0; k < 2; k++)
{
Party.party[k].oEntity.DoAutoMove(Party.party[k].oEntity.GlobalPosition + Vector2.Left * 30f, 0.2f);
Party.party[k].oEntity.moving.doFacing = false;
}
AudioStreamPlayer sound = null;
while (entities[0].moving != null && !Party.IsStopped())
{
if (entities[0].moving != null && !GodotObject.IsInstanceValid(sound))
{
sound = Audio.PlaySound("snd_footstep2.wav");
}
yield return null;
}
for (b = 0f; b < 30f; b += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("TramEvent7");
while (TextSystem.instance.Visible)
{
yield return null;
}
for (b = 0f; b < 80f; b += Main.deltaTime)
{
yield return null;
}
entities[0].Emoticon(Entity.Emoticons.Exclaim);
Party.Emoticon(Entity.Emoticons.Exclaim, noise: true);
Audio.ChangeMusic((Audio.AudioBlock)null, 2f);
TextSystem.GetText("TramEvent8");
while (TextSystem.instance.Visible || GodotObject.IsInstanceValid(entities[0].emoticonObj))
{
yield return null;
}
Audio.PlaySound("snd_explosion.wav");
CameraController.Shake(30f);
Party.party[1].oEntity.anim.Play("Surprise");
Party.party[1].oEntity.sprite.FlipH = true;
Party.party[0].oEntity.anim.Play("Hurt");
Party.party[0].oEntity.sprite.FlipH = false;
start = nodes[5].GlobalPosition + Vector2.Up * 100f;
end = entities[0].GlobalPosition;
entities[1].anim.Play("Fall");
entities[0].anim.Play("Hurt");
Vector2 end2 = new Vector2(nodes[0].GlobalPosition.X + 20f, 20f);
b = 0f;
for (a = 30f; b <= a; b += Main.deltaTime)
{
float num2 = Mathf.Min(b / a, 1f);
entities[0].GlobalPosition = Common.Beizier(end, nodes[6].GlobalPosition, end2, num2);
entities[1].GlobalPosition = start.Lerp(nodes[5].GlobalPosition, num2);
yield return null;
}
entities[1].anim.Play("Land");
for (a = 0f; a < 120f; a += Main.deltaTime)
{
yield return null;
}
for (int l = 0; l < 2; l++)
{
Party.party[l].oEntity.UpdateAnim(force: true);
}
entities[0].UpdateAnim(force: true);
entities[1].LookAt(Vector2.Right);
Room.current.DoMusic(2);
TextSystem.GetText("TramEvent9");
while (TextSystem.instance.Visible)
{
yield return null;
}
Audio.ChangeMusic((Audio.AudioBlock)null, 1f);
for (int m = 0; m < 2; m++)
{
Party.party[m].oEntity.anim.Play("Spin");
}
Party.ChangeCollider(state: false);
Party.MoveTo(new Vector2[2]
{
nodes[7].GlobalPosition,
nodes[7].GetChild<Node2D>(0).GlobalPosition
}, 1.5f, align: true, Entity.Direction.North);
while (!Party.IsStopped())
{
yield return null;
}
Party.ChangeCollider(state: true);
Audio.PlaySound("snd_noise.wav");
Room.current.Modulate = Main.colorDark;
for (a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
start = Player.instance.GlobalPosition + Vector2.Up * 16f;
end = entities[1].GlobalPosition + new Vector2(7f, -10f);
nodes[8].GlobalPosition = start;
Main.Particle("SoulSplit", nodes[8].GlobalPosition);
Audio.PlaySound("snd_break2.wav");
for (a = 0f; a < 70f; a += Main.deltaTime)
{
yield return null;
}
Audio.PlaySound("snd_spearappear_ch1.wav");
for (a = 0f; a <= 100f; a += Main.deltaTime)
{
nodes[8].GlobalPosition = start.Lerp(end, a / 60f);
yield return null;
}
Audio.PlaySound("snd_break2.wav");
Main.Particle("SoulSplit", nodes[8].GlobalPosition);
nodes[8].Visible = false;
nodes[8].TopLevel = false;
nodes[8].Reparent(entities[1]);
for (a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
Audio.PlaySound("snd_noise.wav");
Room.current.Modulate = Main.colorWhite;
for (a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
((FightingGame)nodes[9]).Start();
yield return null;
}
public void ToastTramPart2()
{
Main.inEvent = Coroutine.Start(ToastTram2());
}
private IEnumerator ToastTram2()
{
Vector2[] pos = new Vector2[2]
{
nodes[4].GlobalPosition + Vector2.Left * 20f,
nodes[3].GlobalPosition + Vector2.Left * 20f
};
Party.SetPosition(in pos);
Party.LookAt(Entity.Direction.West);
entities[0].Shake(-200f, 1f);
entities[1].GlobalPosition += Vector2.Right * 20f;
float a;
for (a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
CameraController.Transition(Main.colorClear, 100f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
TextSystem.GetText("TramEventPB1");
while (TextSystem.instance.Visible)
{
yield return null;
}
for (a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
CameraController.Shake(30f, 2f);
Vector2 p = entities[0].GlobalPosition;
Main.SetActive(entities[0], state: false);
Main.Particle("BadExplosion", entities[0].GlobalPosition + Vector2.Up * 20f, 1, null, localSpace: false);
entities[1].anim.Play("Block");
entities[2].anim.Play("Blown1");
entities[2].collider.Disabled = true;
Party.party[1].oEntity.anim.Play("Surprise");
Party.party[1].oEntity.sprite.FlipH = true;
Party.party[0].oEntity.anim.Play("Hurt");
Party.party[0].oEntity.sprite.FlipH = false;
a = 0f;
float b;
for (b = 60f; a <= b; a += Main.deltaTime)
{
entities[2].GlobalPosition = p.Lerp(p + Vector2.Up * 200f, a / b);
yield return null;
}
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
yield return null;
}
Party.UpdateAnim();
entities[1].LookAt(Vector2.Right);
entities[2].anim.Play("Blown2");
Audio.PlaySound("snd_fall2.wav");
Vector2 op = p;
p += new Vector2(-15f, 0f);
a = 0f;
for (b = 60f; a <= b; a += Main.deltaTime)
{
entities[2].GlobalPosition = p.Lerp(p + Vector2.Up * 200f, 1f - a / b);
yield return null;
}
Audio.PlaySound("snd_screenshake.wav");
CameraController.Shake(30f);
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
yield return null;
}
a = 0f;
for (b = 60f; a <= b; a += Main.deltaTime)
{
entities[2].RotationDegrees = Mathf.Lerp(0f, 90f, a / b);
yield return null;
}
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
yield return null;
}
entities[2].GlobalPosition = op + Vector2.Right * 20f;
entities[2].anim.Play("Angry");
entities[2].Shake(15f, 1f);
entities[2].RotationDegrees = 0f;
Audio.PlaySound("snd_grab.wav");
a = 0f;
for (b = 60f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("TramEventPB2");
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[2].anim.Play("Bomb1");
entities[1].anim.Play("Hurt");
Party.party[1].oEntity.anim.Play("Surprise");
Party.party[1].oEntity.sprite.FlipH = true;
Audio.PlaySound("snd_grab.wav");
nodes[10].GlobalPosition = entities[2].GlobalPosition + new Vector2(-12f, -40f);
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
yield return null;
}
Audio.PlaySound("snd_heavyswing.wav");
TextSystem.GetText("TramEventPB3");
bool anim = false;
op = nodes[10].GlobalPosition;
p = entities[1].GlobalPosition + new Vector2(10f, -50f);
Vector2 m = new Vector2(Mathf.Lerp(op.X, p.X, 0.5f), -80f);
entities[2].anim.Play("Bomb2");
entities[1].anim.Play("Protecc");
a = 0f;
for (b = 200f; a <= b; a += Main.deltaTime)
{
nodes[10].GlobalPosition = Common.Beizier(op, m, p, a / b);
if (!anim && a / b > 0.65f)
{
nodes[10].GetChild<AnimationPlayer>(0).Play("Explode");
anim = true;
}
yield return null;
entities[1].GlobalPosition = entities[1].GlobalPosition.Lerp(entities[1].startPos + new Vector2(-20f, 0f), Main.deltaTime * 0.025f);
}
CameraController.Transition(Main.colorBlack, 300f);
if (TextSystem.instance.Visible)
{
TextSystem.End();
}
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
yield return null;
}
Party.Remove(1);
Room.LoadRoom(Room.IDs.ChujinDWPostTram1, reparent: true);
yield return null;
Player.instance.GlobalPosition = Vector2.Zero;
Player.instance.anim.Play("FallenDW");
CameraController.instance.follow = Player.instance;
yield return null;
CameraController.Transition(Main.colorClearB, 300f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
Player.instance.Shake(30f, 1f);
while (Player.instance.shake > 0f)
{
yield return null;
}
Audio.PlaySound("snd_wing_ch1.wav");
Player.instance.anim.Play("LandDW");
a = 0f;
for (b = 60f; a <= b; a += Main.deltaTime)
{
yield return null;
}
Player.instance.LookAt(Vector2.Down);
}
public void AxisTrash()
{
Main.inEvent = Coroutine.Start(AxisInTrash());
}
private IEnumerator AxisInTrash()
{
Player.instance.LookAt(Vector2.Right);
Coroutine c = Coroutine.Start(CommonEvents.ShakeObj(nodes[0], -1f, Vector2.Right));
TextSystem.GetText("AxisTrash1");
while (TextSystem.instance.Visible)
{
yield return null;
}
Coroutine cam = Coroutine.Start(CameraController.Pan(nodes[1].GlobalPosition + Vector2.Down * 50f, 0.5f));
while (!cam.done)
{
yield return null;
}
float a = 0f;
float b;
for (b = 60f; a <= b; a += Main.deltaTime)
{
yield return null;
}
Coroutine.Stop(c);
Audio.PlaySound("snd_shakerbreaker.wav").Bus = "Reverb";
Main.SetActive(nodes[0], state: false);
Main.SetActive(nodes[1], state: true);
CameraController.Shake(20f);
entities[0].collider.Disabled = true;
entities[0].anim.Play("Slide");
entities[0].GlobalPosition = nodes[0].GlobalPosition;
bool anim = false;
Vector2 target = new Vector2(20f, 30f);
for (b = 0f; b < 60f; b += Main.deltaTime)
{
if (!anim && b >= 30f)
{
entities[0].sprite.RegionRect = new Rect2(320f, 0f, 40f, 60f);
anim = true;
}
entities[0].GlobalPosition = entities[0].GlobalPosition.Lerp(target, Main.deltaTime * 0.025f);
yield return null;
}
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
yield return null;
}
entities[0].LookAt(Vector2.Down);
entities[0].Shake(10f, 1f);
Audio.PlaySound("snd_wing_ch1.wav");
a = 0f;
for (b = 60f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("AxisTrash2");
while (TextSystem.instance.Visible)
{
yield return null;
}
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
yield return null;
}
entities[0].LookAt(Vector2.Left);
entities[0].Emoticon(Entity.Emoticons.Exclaim, sound: true);
a = 0f;
for (b = 60f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("AxisTrash3");
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[0].LookAt(Vector2.Down);
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
yield return null;
}
entities[0].LookAt(Vector2.Left);
a = 0f;
for (b = 60f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("AxisTrash4");
while (TextSystem.instance.Visible)
{
yield return null;
}
Party.AddFollower(entities[0]);
yield return null;
cam = Coroutine.Start(CameraController.PanToObj(Player.instance, 0.5f));
while (!cam.done)
{
yield return null;
}
Party.LookAt(Vector2.Down);
SaveFile.current.values[5] = 21;
}
public void KanakoReunitePostTram()
{
Main.inEvent = Coroutine.Start(KanakoReunite());
}
private IEnumerator KanakoReunite()
{
Party.LookAt(Vector2.Right);
Party.Emoticon(Entity.Emoticons.Exclaim, noise: true);
while (GodotObject.IsInstanceValid(Player.instance.emoticonObj))
{
yield return null;
}
TextSystem.GetText("DW2KanakoReunite1");
while (TextSystem.instance.Visible)
{
yield return null;
}
Party.MoveTo(new Vector2[2]
{
nodes[1].GlobalPosition,
nodes[1].GetChild<Node2D>(0).GlobalPosition
}, 1.1f, align: false, Entity.Direction.West);
while (!Party.IsStopped())
{
yield return null;
}
float a = 0f;
float b;
for (b = 30f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("DW2KanakoReunite2");
while (TextSystem.instance.Visible)
{
yield return null;
}
CameraController.instance.follow = null;
Player.instance.DoAutoMove(Player.instance.GlobalPosition + Vector2.Right * 30f, 0.3f);
while (Player.instance.moving != null)
{
yield return null;
}
b = 0f;
for (a = 30f; b <= a; b += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("DW2KanakoReunite3");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt != 2)
{
Player.instance.sprite.FlipH = false;
Player.instance.ShakeAnimChange("KCheck");
a = 0f;
for (b = 60f; a <= b; a += Main.deltaTime)
{
yield return null;
}
}
switch (TextSystem.lastPrompt)
{
case 0:
{
Coroutine p = Coroutine.Start(KanakoPoke());
b = 0f;
for (a = 100f; b <= a; b += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("DW2KanakoReunite3Poke");
while (TextSystem.instance.Visible)
{
yield return null;
}
Coroutine.Stop(p);
Player.instance.DoAutoMove(Player.instance.GlobalPosition + Vector2.Left * 30f, 0.5f);
Player.instance.moving.doFacing = false;
entities[0].ShakeAnimChange("Fainted_4");
a = 0f;
for (b = 80f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("DW2KanakoReunite3Poke2");
while (TextSystem.instance.Visible)
{
yield return null;
}
break;
}
case 1:
SaveFile.current.values[0]++;
b = 0f;
for (a = 30f; b <= a; b += Main.deltaTime)
{
yield return null;
}
Player.instance.ShakeAnimChange("KCheck_2");
Player.instance.GlobalPosition += Vector2.Right * 5f;
a = 0f;
for (b = 60f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("DW2KanakoReunite3M2M");
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[0].ShakeAnimChange("Fainted_3");
Player.instance.DoAutoMove(Player.instance.GlobalPosition + Vector2.Left * 30f, 0.5f);
Player.instance.moving.doFacing = false;
b = 0f;
for (a = 80f; b <= a; b += Main.deltaTime)
{
yield return null;
}
entities[0].ShakeAnimChange("Fainted_5");
a = 0f;
for (b = 30f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("DW2KanakoReunite3M2M2");
while (TextSystem.instance.Visible)
{
yield return null;
}
break;
case 2:
{
Player.instance.followers[0].DoAutoMove(Player.instance.followers[0].GlobalPosition + Vector2.Right * 30f);
Player.instance.DoAutoMove(Player.instance.GlobalPosition + Vector2.Left * 30f, 0.65f);
Player.instance.moving.dirAtEnd = Entity.Direction.West;
while (Player.instance.followers[0].moving != null || Player.instance.moving != null)
{
yield return null;
}
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("DW2KanakoReunite3Nothing2");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.followers[0].Shake(50f, 2f);
while (Player.instance.followers[0].shake > 0f)
{
yield return null;
}
Main.Particle("BadExplosion", Player.instance.followers[0].GlobalPosition + Vector2.Up * 20f, 1, null, localSpace: false);
Player.instance.followers[0].anim.Play("Hurt");
CameraController.Shake(60f, 2f);
Vector2 ap = Player.instance.followers[0].GlobalPosition + Vector2.Left * 30f;
a = 0f;
for (b = 90f; a <= b; a += Main.deltaTime)
{
Player.instance.followers[0].GlobalPosition = Player.instance.followers[0].GlobalPosition.Lerp(ap, Main.deltaTime * 0.05f);
yield return null;
}
Player.instance.followers[0].UpdateAnim(force: true);
TextSystem.GetText("DW2KanakoReunite3Nothing3");
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[0].ShakeAnimChange("Fainted_4");
b = 0f;
for (a = 80f; b <= a; b += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("DW2KanakoReunite3Nothing4");
while (TextSystem.instance.Visible)
{
yield return null;
}
break;
}
case 3:
SaveFile.current.values[0] += 2;
Player.instance.Visible = false;
entities[0].ShakeAnimChange("Fainted_2");
a = 0f;
for (b = 80f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("DW2KanakoReunite3Pulse");
while (TextSystem.instance.Visible)
{
yield return null;
}
b = 0f;
for (a = 90f; b <= a; b += Main.deltaTime)
{
yield return null;
}
Player.instance.Visible = true;
entities[0].ShakeAnimChange("Fainted_3");
Player.instance.DoAutoMove(Player.instance.GlobalPosition + Vector2.Left * 30f, 0.5f);
Player.instance.moving.doFacing = false;
a = 0f;
for (b = 80f; a <= b; a += Main.deltaTime)
{
yield return null;
}
entities[0].ShakeAnimChange("Fainted_5");
b = 0f;
for (a = 30f; b <= a; b += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("DW2KanakoReunite3Pulse2");
while (TextSystem.instance.Visible)
{
yield return null;
}
break;
}
a = 0f;
for (b = 60f; a <= b; a += Main.deltaTime)
{
yield return null;
}
entities[0].anim.Play("Fainted_4");
TextSystem.GetText("DW2KanakoReunite4");
while (TextSystem.instance.Visible)
{
yield return null;
}
b = 0f;
for (a = 120f; b <= a; b += Main.deltaTime)
{
yield return null;
}
entities[0].anim.Play("Fainted_3");
Party.Emoticon(Entity.Emoticons.Exclaim, noise: true);
entities[0].Emoticon(Entity.Emoticons.Exclaim);
TextSystem.GetText("DW2KanakoReunite5");
while (TextSystem.instance.Visible)
{
yield return null;
}
Coroutine c = Coroutine.Start(CameraController.PanToObj(Player.instance, 0.5f));
while (!c.done)
{
yield return null;
}
Follower entity = Player.instance.followers[0];
Party.Remove(2, updateFollowers: false);
Party.AddFollower(entities[0]);
Party.AddFollower(entity);
yield return null;
Player.instance.followers = new List<Follower>
{
Player.instance.followers[1],
Player.instance.followers[0]
};
Player.instance.ResetFollowStep();
SaveFile.current.values[5] = 22;
Party.LookAt(Vector2.Down);
}
public void AxisGlove()
{
Main.inEvent = Coroutine.Start(AxisGloveEvent());
}
private IEnumerator AxisGloveEvent()
{
TextSystem.GetText("AxisHandItem");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt != 0)
{
yield break;
}
if (Items.CheckFull(Items.Type.Weapon))
{
TextSystem.GetText("AxisHandItem");
while (TextSystem.instance.Visible)
{
yield return null;
}
yield break;
}
SaveFile.AddFlag(SaveFile.Flags.AxisHandGet);
objects[0].QueueFree();
Audio.PlaySound("snd_item_ch1.wav");
TextSystem.GetText("AxisHandItem2");
while (TextSystem.instance.Visible)
{
yield return null;
}
SaveFile.current.dwWeapon.Add(Items.IDs.GuardianMitt);
}
private IEnumerator KanakoPoke()
{
while (true)
{
Audio.PlaySound("snd_noise.wav");
entities[0].Shake(15f, 1f);
float a = 0f;
for (float b = 40f; a <= b; a += Main.deltaTime)
{
yield return null;
}
yield return null;
}
}
public void BunBunBalloon()
{
Main.inEvent = Coroutine.Start(BunBunFirst());
}
private IEnumerator BunBunFirst()
{
Party.LookAt(Vector2.Up);
Party.Emoticon(Entity.Emoticons.Exclaim, noise: true);
while (GodotObject.IsInstanceValid(Player.instance.emoticonObj))
{
yield return null;
}
TextSystem.GetText("BunBun1Encounter1");
while (TextSystem.instance.Visible)
{
yield return null;
}
Coroutine c = Coroutine.Start(CameraController.Pan(nodes[2].GlobalPosition, 0.5f));
while (!c.done)
{
yield return null;
}
Party.SetPosition(nodes[3]);
Vector2 p = nodes[0].GlobalPosition;
bool pan = false;
Room.current.DoMusic(1);
float a = 0f;
float b;
for (b = 600f; a <= b; a += Main.deltaTime)
{
if (!pan && a / b > 0.5f)
{
pan = true;
Coroutine.Start(CameraController.Pan(nodes[4].GlobalPosition, 0.25f));
}
nodes[0].GlobalPosition = p.Lerp(nodes[4].GlobalPosition, a / b);
yield return null;
}
b = 0f;
for (a = 40f; b <= a; b += Main.deltaTime)
{
yield return null;
}
c = Coroutine.Start(CameraController.Pan(nodes[5].GlobalPosition, 0.25f, fixedRate: true, 800f));
p = nodes[0].GlobalPosition;
a = 0f;
for (b = 500f; a <= b; a += Main.deltaTime)
{
nodes[0].GlobalPosition = p.Lerp(nodes[5].GlobalPosition, a / b);
yield return null;
}
Coroutine.Start(CommonEvents.ShakeObj(nodes[0], 10f, Vector2.Right));
Audio.PlaySound("snd_wing_ch1.wav");
while (!c.done)
{
yield return null;
}
b = 0f;
for (a = 40f; b <= a; b += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("BunBun1Encounter2");
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[1].collider.Disabled = true;
c = Coroutine.Start(CameraController.Pan(CameraController.instance.GlobalPosition + Vector2.Down * 40f, 0.5f));
entities[1].DoAutoAlign(nodes[0].GlobalPosition + Vector2.Down * 60f, 0.5f);
while (entities[1].moving != null || !c.done)
{
yield return null;
}
entities[1].Emoticon(Entity.Emoticons.Exclaim, sound: true);
while (GodotObject.IsInstanceValid(entities[1].emoticonObj))
{
yield return null;
}
TextSystem.GetText("BunBun1Encounter3");
while (TextSystem.instance.Visible)
{
yield return null;
}
Coroutine.Start(CameraController.Pan(nodes[0].GlobalPosition, 0.5f, fixedRate: true, 800f));
Party.UpdateFollowerEntities();
Party.ChangeCollider(state: false);
Vector2[] bp = new Vector2[4]
{
nodes[0].GetChild<Node2D>(0).GlobalPosition,
nodes[0].GetChild(0).GetChild<Node2D>(0).GlobalPosition,
nodes[0].GetChild(0).GetChild<Node2D>(1).GlobalPosition,
nodes[0].GetChild(0).GetChild<Node2D>(2).GlobalPosition
};
entities[1].DoAutoMove(new Vector2[2]
{
nodes[0].GlobalPosition + Vector2.Down * 20f,
bp[3]
}, 0.75f);
entities[1].moving.dirAtEnd = Entity.Direction.East;
for (int i = 0; i < 3; i++)
{
a = 0f;
for (b = 100f; a <= b; a += Main.deltaTime)
{
yield return null;
}
Party.party[SaveFile.current.activeParty[i]].oEntity.DoAutoMove(new Vector2[3]
{
new Vector2(nodes[0].GlobalPosition.X, Party.party[SaveFile.current.activeParty[i]].oEntity.GlobalPosition.Y),
nodes[0].GlobalPosition + Vector2.Down * 20f,
bp[i]
}, 0.5f);
Party.party[SaveFile.current.activeParty[i]].oEntity.moving.doFailsafe = false;
}
while (!Party.IsStopped())
{
yield return null;
}
entities[1].ShakeAnimChange("SitSide");
for (int i = 0; i < 3; i++)
{
b = 0f;
for (a = 40f; b <= a; b += Main.deltaTime)
{
yield return null;
}
Party.party[SaveFile.current.activeParty[i]].oEntity.ShakeAnimChange("TramSit");
}
Audio.ChangeMusic((Audio.AudioBlock)null, 5f);
Party.Reparent(nodes[0]);
p = nodes[0].GlobalPosition;
a = 0f;
for (b = 40f; a <= b; a += Main.deltaTime)
{
yield return null;
}
Audio.PlaySound("snd_steamworks_13_vent.wav", 1f, 0.8f).Bus = "Reverb";
b = 0f;
for (a = 300f; b <= a; b += Main.deltaTime)
{
nodes[0].GlobalPosition = p.Lerp(p + Vector2.Up * 200f, Mathf.SmoothStep(0f, 1f, b / a));
yield return null;
}
CameraController.Transition(Main.colorBlack, 100f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
a = 0f;
for (b = 40f; a <= b; a += Main.deltaTime)
{
yield return null;
}
Room.current.DoMusic(2);
Player.instance.followers[0].sprite.FlipH = true;
nodes[0].GlobalPosition = nodes[6].GlobalPosition + Vector2.Down * 60f;
CameraController.instance.GlobalPosition = nodes[6].GlobalPosition;
CameraController.Transition(Main.colorClearB, 100f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
b = 0f;
for (a = 40f; b <= a; b += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("BunBun1Encounter4");
while (TextSystem.instance.Visible)
{
yield return null;
}
a = 0f;
for (b = 100f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("BunBun1Encounter5");
while (TextSystem.instance.Visible)
{
yield return null;
}
p = nodes[0].GlobalPosition;
b = 0f;
for (a = 500f; b <= a; b += Main.deltaTime)
{
nodes[0].GlobalPosition = p.Lerp(p + new Vector2(250f, -150f), b / a);
yield return null;
}
CameraController.Transition(Main.colorBlack, 100f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
Entity bunbun = entities[1];
Node2D balloon = nodes[0];
balloon.Reparent(Main.instance);
yield return null;
Room.LoadRoom(Room.IDs.ChujinDWUpstairsPort);
yield return null;
CameraController.instance.GlobalPosition = instance.nodes[1].GlobalPosition + Vector2.Up * 80f;
Coroutine pp = Coroutine.Start(CameraController.Pan(instance.nodes[2].GlobalPosition, 0.35f, fixedRate: true, 1200f));
p = instance.nodes[0].GlobalPosition;
instance.nodes[0].QueueFree();
balloon.Reparent(Room.current);
Vector2 m = instance.nodes[1].GetChild<Node2D>(0).GlobalPosition;
CameraController.Transition(Main.colorClearB, 100f);
a = 0f;
for (b = 300f; a <= b; a += Main.deltaTime)
{
balloon.GlobalPosition = Common.Beizier(instance.nodes[1].GlobalPosition, m, p, a / b);
yield return null;
}
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
Audio.PlaySound("snd_wing_ch1.wav");
Coroutine.Start(CommonEvents.ShakeObj(balloon, 10f, Vector2.Right));
b = 0f;
for (a = 40f; b <= a; b += Main.deltaTime)
{
yield return null;
}
bunbun.DoAutoMove(new Vector2[3]
{
balloon.GlobalPosition + Vector2.Down * 20f,
new Vector2(balloon.GlobalPosition.X, instance.nodes[2].GlobalPosition.Y),
instance.nodes[2].GlobalPosition
}, 0.5f);
Party.Reparent(Room.current);
bunbun.Reparent(Room.current);
bunbun.moving.dirAtEnd = Entity.Direction.East;
for (int i = 0; i < 3; i++)
{
a = 0f;
for (b = 100f; a <= b; a += Main.deltaTime)
{
yield return null;
}
Party.party[SaveFile.current.activeParty[i]].oEntity.DoAutoMove(new Vector2[3]
{
balloon.GlobalPosition + Vector2.Down * 20f,
new Vector2(balloon.GlobalPosition.X, instance.nodes[2].GlobalPosition.Y),
instance.nodes[2].GetChild<Node2D>(i).GlobalPosition
}, 0.5f);
}
while (!Party.IsStopped())
{
yield return null;
}
TextSystem.GetText("BunBun1Encounter6");
while (TextSystem.instance.Visible || !pp.done)
{
yield return null;
}
c = Coroutine.Start(CameraController.PanToObj(Player.instance, 0.5f));
while (!c.done)
{
yield return null;
}
SaveFile.current.followers.Add(Entity.IDs.BunBun);
Party.AddFollower(bunbun);
Player.instance.ResetFollowStep();
Player.instance.LookAt(Vector2.Down);
Party.ChangeCollider(state: true);
SaveFile.AddFlag(SaveFile.Flags.BunBunEvent1);
}
public void UpstairsOverview()
{
Main.inEvent = Coroutine.Start(UPOverview());
}
private IEnumerator UPOverview()
{
Party.MoveTo(Party.GetPosFromNode(nodes[0]), 0.75f, align: true, Entity.Direction.North);
while (!Party.IsStopped())
{
yield return null;
}
float a = 0f;
for (float b = 40f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("UpstairsOverview");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.ResetFollowStep();
}
public void BunBunLeaves()
{
Main.inEvent = Coroutine.Start(BunBunLeaveEvent());
}
private IEnumerator BunBunLeaveEvent()
{
Party.MoveTo(Party.GetPosFromNode(nodes[0]), 0.5f, align: true, Entity.Direction.North);
while (!Party.IsStopped())
{
yield return null;
}
Player.instance.followers[2].LookAt(Vector2.Down);
float a = 0f;
for (float b = 40f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("BunBunEvent2");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.followers[2].DoAutoMove(Party.GetPosFromNode(nodes[1]), 0.85f);
while (Player.instance.followers[2].moving != null)
{
yield return null;
}
TextSystem.GetText("BunBunEvent2-2");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.followers[2].QueueFree();
Player.instance.followers.RemoveAt(2);
Player.instance.ResetFollowStep();
SaveFile.current.followers.Remove(Entity.IDs.BunBun);
SaveFile.AddFlag(SaveFile.Flags.BunBunEvent2);
SaveFile.current.values[5] = 23;
}
public void RangerEvent()
{
Main.inEvent = Coroutine.Start(RangerEventRoutine());
}
private IEnumerator RangerEventRoutine()
{
Party.LookAt(Vector2.Left);
Player.instance.followers[0].Emoticon(Entity.Emoticons.Exclaim, sound: true);
while (GodotObject.IsInstanceValid(Player.instance.followers[0].emoticonObj))
{
yield return null;
}
TextSystem.GetText("RangerEvent1");
while (TextSystem.instance.Visible)
{
yield return null;
}
Audio.ChangeMusic((Audio.AudioBlock)null, 3f);
Coroutine c = Coroutine.Start(CameraController.Pan(entities[0].GlobalPosition, 0.35f));
while (!c.done || !Audio.routine.done)
{
yield return null;
}
Room.current.DoMusic(1);
TextSystem.GetText("RangerEvent2");
while (TextSystem.instance.Visible)
{
yield return null;
}
float a = 0f;
for (float b = 40f; a <= b; a += Main.deltaTime)
{
yield return null;
}
for (int i = 0; i < 3; i++)
{
entities[i].LookAt(Vector2.Right);
entities[i].Emoticon(Entity.Emoticons.Exclaim, i == 0);
entities[i].collider.Disabled = true;
}
while (GodotObject.IsInstanceValid(entities[0].emoticonObj))
{
yield return null;
}
Vector2[] p = new Vector2[3]
{
Player.instance.GlobalPosition + new Vector2(-50f, 0f),
Player.instance.GlobalPosition + new Vector2(-70f, -30f),
Player.instance.GlobalPosition + new Vector2(-80f, 30f)
};
c = Coroutine.Start(CameraController.PanToObj(Player.instance, 0.35f));
for (int j = 0; j < 3; j++)
{
entities[j].DoAutoAlign(p[j]);
entities[j].moving.dirAtEnd = Entity.Direction.West;
float b = 0f;
for (a = 40f; b <= a; b += Main.deltaTime)
{
yield return null;
}
}
while (entities[2].moving != null || !c.done)
{
yield return null;
}
TextSystem.GetText("RangerEvent3");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt == 1)
{
Audio.music.StreamPaused = true;
a = 0f;
float b;
for (b = 60f; a <= b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("RangerEvent3C");
while (TextSystem.instance.Visible)
{
yield return null;
}
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
yield return null;
}
Audio.music.StreamPaused = false;
TextSystem.GetText("RangerEvent3C2");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
Audio.PlaySound("snd_magicsprinkle.wav");
CameraController.Transition(Main.colorWhite, 90f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
a = 0f;
for (float b = 40f; a <= b; a += Main.deltaTime)
{
yield return null;
}
CameraController.Transition(Main.colorClearB);
CameraController.Shake(10f, 2f);
Audio.PlaySound("snd_cd_bagel_susie.wav");
TextSystem.GetText("RangerEvent5");
while (TextSystem.instance.Visible)
{
yield return null;
}
Color[] colors = new Color[3]
{
Main.colorRed,
Main.colorBlue,
Main.colorGreen
};
for (int j = 0; j < 3; j++)
{
CameraController.Shake(10f);
((Node2D)Main.Particle("BadExplosion", entities[j].GlobalPosition + Vector2.Up * 10f, 0, Room.current, localSpace: false)).Modulate = colors[j];
float b = 0f;
for (a = 40f; b <= a; b += Main.deltaTime)
{
yield return null;
}
}
a = 0f;
for (float b = 40f; a <= b; a += Main.deltaTime)
{
yield return null;
}
for (int k = 0; k < 3; k++)
{
entities[k].UpdateAnim(force: true);
}
TextSystem.GetText("RangerEvent6");
while (TextSystem.instance.Visible)
{
yield return null;
}
for (int j = 0; j < 3; j++)
{
entities[j].doTrail = true;
Audio.PlaySound("snd_spearrise_ch1.wav");
float b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
entities[j].GlobalPosition += Vector2.Up * Main.deltaTime * 4f;
yield return null;
}
entities[j].QueueFree();
}
Audio.ChangeMusic((Audio.AudioBlock)null, 3f);
TextSystem.GetText("RangerEvent7");
while (TextSystem.instance.Visible || !Audio.routine.done)
{
yield return null;
}
Room.current.DoMusic();
Player.instance.LookAt(Vector2.Down);
}
public void BlueRangerBalloon()
{
Main.inEvent = Coroutine.Start(BRBalloon());
}
private IEnumerator BRBalloon()
{
if (Room.current.id == Room.IDs.ChujinDWUpstairsBalloons)
{
TextSystem.GetText("RangerBlueBalloon");
}
else
{
TextSystem.GetText("RangerBlueBalloonReturn");
}
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt != 0)
{
yield break;
}
CameraController.Transition(Main.colorBlack, 60f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
yield return null;
Audio.ChangeMusic((Audio.AudioBlock)null, 2f);
AudioStreamPlayer v = Audio.PlaySound("snd_steamworks_13_vent.wav", 1.1f, 0.9f);
v.Bus = "Reverb";
if (Room.current.id == Room.IDs.ChujinDWUpstairsBalloons)
{
Room.LoadRoom(Room.IDs.ChujinDWArchiveOutside, reparent: true);
yield return null;
Vector2[] pos = new Vector2[3]
{
new Vector2(0f, 100f),
new Vector2(0f, 120f),
new Vector2(0f, 140f)
};
Party.SetPosition(in pos);
Party.LookAt(Vector2.Up);
}
else
{
Room.LoadRoom(Room.IDs.ChujinDWUpstairsBalloons, reparent: true);
yield return null;
Vector2[] pos = new Vector2[3]
{
new Vector2(-360f, -380f),
new Vector2(-360f, -400f),
new Vector2(-360f, -420f)
};
Party.SetPosition(in pos);
Party.LookAt(Vector2.Down);
}
while (!Audio.routine.done || GodotObject.IsInstanceValid(v))
{
yield return null;
}
Room.current.DoMusic();
CameraController.Transition(Main.colorClearB, 60f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
if (!SaveFile.HasFlag(SaveFile.Flags.RangerBlueBalloon))
{
SaveFile.AddFlag(SaveFile.Flags.RangerBlueBalloon);
TextSystem.GetText("RangerBlueArchive");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
Player.instance.ResetFollowStep();
}
public void KanakoPC()
{
Main.inEvent = Coroutine.Start(KanakoPCLogic());
}
private IEnumerator KanakoPCLogic()
{
if (entities[0].currentAnim == Entity.Animations.Sleep)
{
if (!SaveFile.HasFlag(SaveFile.Flags.ArchivesPC))
{
Party.MoveTo(Party.GetPosFromNode(nodes[1]), 0.65f, align: true, Entity.Direction.North);
while (!Party.IsStopped())
{
yield return null;
}
TextSystem.caller = entities[0];
TextSystem.GetText("ArchivePC1");
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[0].Emoticon(Entity.Emoticons.Exclaim, sound: true);
while (GodotObject.IsInstanceValid(entities[0].emoticonObj))
{
yield return null;
}
}
entities[0].anim.Play("Wake");
float a = 0f;
for (float b = 60f; a <= b; a += Main.deltaTime)
{
yield return null;
}
entities[0].currentAnim = Entity.Animations.Idle;
yield return null;
}
if (!SaveFile.HasFlag(SaveFile.Flags.ArchivesPC))
{
TextSystem.caller = entities[0];
TextSystem.GetText("ArchivePC2");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.followers[0].DoAutoMove(Player.instance.followers[0].GlobalPosition + Vector2.Up * 20f, 0.45f);
while (Player.instance.followers[0].moving != null)
{
yield return null;
}
TextSystem.caller = entities[0];
TextSystem.GetText("ArchivePC3");
while (TextSystem.instance.Visible)
{
yield return null;
}
Audio.PlaySound("snd_shadowpendant_ch1.wav");
float b = 0f;
for (float a = 30f; b <= a; b += Main.deltaTime)
{
nodes[0].Modulate = Main.colorWhite.Lerp(Main.colorClear, b / a);
yield return null;
}
nodes[0].QueueFree();
Player.instance.ResetFollowStep();
}
else
{
TextSystem.caller = entities[0];
TextSystem.GetText("ArchivePC4");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
SaveFile.AddFlag(SaveFile.Flags.RangerTalk);
SaveFile.AddFlag(SaveFile.Flags.ArchivesPC);
}
}