386 lines
9.3 KiB
C#
386 lines
9.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using Godot;
|
|
using Godot.Bridge;
|
|
using Godot.Collections;
|
|
using Godot.NativeInterop;
|
|
|
|
[ScriptPath("res://Scripts/Events/DarkJailEvents.cs")]
|
|
public partial class DarkJailEvents : Node, IEvent
|
|
{
|
|
[Export(PropertyHint.None, "")]
|
|
private Entity[] entities;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Node2D[] objects;
|
|
|
|
public void WardenExposition()
|
|
{
|
|
if (!SaveFile.HasFlag(SaveFile.Flags.WardenExposited))
|
|
{
|
|
Main.inEvent = Coroutine.Start(WardenExpositionEvent());
|
|
}
|
|
else if (!SaveFile.HasFlag(SaveFile.Flags.SchoolCheckedLock))
|
|
{
|
|
if (SaveFile.current.apprehended.Count > 0 && !SaveFile.HasFlag(SaveFile.Flags.WardenInnocentTalk))
|
|
{
|
|
TextSystem.GetText("WardenCapturedInnocents");
|
|
SaveFile.AddFlag(SaveFile.Flags.WardenInnocentTalk);
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("WardenPostEvent");
|
|
}
|
|
}
|
|
else if (!SaveFile.HasFlag(SaveFile.Flags.WardenTalkEndDay1))
|
|
{
|
|
Main.inEvent = Coroutine.Start(WardenDay1EndTalk());
|
|
}
|
|
else if (SaveFile.current.apprehended.Count > 0 && !SaveFile.HasFlag(SaveFile.Flags.WardenInnocentTalk))
|
|
{
|
|
TextSystem.GetText("WardenCapturedInnocents");
|
|
SaveFile.AddFlag(SaveFile.Flags.WardenInnocentTalk);
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("WardenEndDay1");
|
|
}
|
|
}
|
|
|
|
private IEnumerator WardenDay1EndTalk()
|
|
{
|
|
entities[2].LookAt(Vector2.Down);
|
|
Party.ChangeCollider(state: false);
|
|
Party.MoveTo(new Vector2[2]
|
|
{
|
|
objects[0].GlobalPosition,
|
|
objects[1].GlobalPosition
|
|
}, 0.5f, align: true, Entity.Direction.North);
|
|
while (!Party.IsStopped())
|
|
{
|
|
yield return null;
|
|
}
|
|
Party.ChangeCollider(state: true);
|
|
if (SaveFile.HasFlag(SaveFile.Flags.WeirdStart))
|
|
{
|
|
TextSystem.GetText("WardenDay1Weird");
|
|
}
|
|
else if (SaveFile.HasFlag(SaveFile.Flags.WeirdedOnce))
|
|
{
|
|
TextSystem.GetText("WardenDay1WeirdAbort");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("WardenDay1Talk2");
|
|
}
|
|
else
|
|
{
|
|
if (SaveFile.HasFlags(new Array<SaveFile.Flags>
|
|
{
|
|
SaveFile.Flags.PenniltonCaught,
|
|
SaveFile.Flags.BearingCaught,
|
|
SaveFile.Flags.LuncherCaught
|
|
}))
|
|
{
|
|
TextSystem.GetText("WardenDay1End");
|
|
}
|
|
else if (SaveFile.HasFlag(SaveFile.Flags.PenniltonCaught) || SaveFile.HasFlag(SaveFile.Flags.BearingCaught) || SaveFile.HasFlag(SaveFile.Flags.LuncherCaught))
|
|
{
|
|
TextSystem.GetText("WardenDay1CaptureSome");
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("WardenDay1CaptureNone");
|
|
}
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("WardenDay1Talk2");
|
|
}
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
SaveFile.AddFlag(SaveFile.Flags.WardenTalkEndDay1);
|
|
Player.instance.ResetFollowStep();
|
|
Player.instance.LookAt(Vector2.Down);
|
|
}
|
|
|
|
private IEnumerator WardenExpositionEvent()
|
|
{
|
|
TextSystem.GetText("WardenExpositionPrompt");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (TextSystem.lastPrompt == 1)
|
|
{
|
|
TextSystem.GetText("WardenExpositionPromptRefuse");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
yield break;
|
|
}
|
|
Audio.ChangeMusic((Audio.AudioBlock)null, 1f);
|
|
entities[0] = Player.instance;
|
|
entities[1] = Player.instance.followers[0];
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
entities[i].DoAutoAlign(objects[i].GlobalPosition, 0.5f);
|
|
entities[i].moving.dirAtEnd = Entity.Direction.North;
|
|
entities[i].collider.Disabled = true;
|
|
}
|
|
while (entities[0].moving != null || entities[1].moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[2].LookAt(Vector2.Down);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Coroutine c = Coroutine.Start(CameraController.Pan(entities[2].GlobalPosition + Vector2.Down * 16f, 0.5f));
|
|
while (!c.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (SaveFile.current.flags.Contains(SaveFile.Flags.DisagreedWardenFirstTalk))
|
|
{
|
|
TextSystem.GetText("WardenExpositionNoListenEarlier");
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("WardenExpositionListenEarlier");
|
|
}
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("WardenExpositionProper1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
CameraController.Transition(Main.colorBlack, 80f);
|
|
while (!CameraController.transitionRoutine.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Room.current.DoMusic(1);
|
|
CameraController instance = CameraController.instance;
|
|
LegendCS node;
|
|
LegendCS l = (node = GD.Load<PackedScene>("res://Objects/Events/LegendCS.tscn").Instantiate<LegendCS>(PackedScene.GenEditState.Disabled));
|
|
instance.AddChild(node, forceReadableName: false, InternalMode.Disabled);
|
|
yield return null;
|
|
while (!l.routine.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.ChangeMusic((Audio.AudioBlock)null, 4f);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
CameraController.Transition(Main.colorClearB, 120f);
|
|
while (!CameraController.transitionRoutine.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("WardenExpositionProper2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
SaveFile.AddFlag(SaveFile.Flags.ApprehendTutorial);
|
|
if (TextSystem.lastPrompt == 0)
|
|
{
|
|
Coroutine.Start(BattleDR.StartBattle(null, useOWBG: true, new Entity.IDs[1] { Entity.IDs.Warden }, new List<Entity> { entities[2] }, "WardenTutorial", null, quickIntro: true));
|
|
yield return null;
|
|
BattleDR.current.blockedCommands = new int[3] { 0, 2, 3 };
|
|
BattleDR.current.eventBattle = BattleDR.EventBattle.WardenTutorial;
|
|
while (!BattleDR.current.started)
|
|
{
|
|
yield return null;
|
|
}
|
|
BattleDR.current.busy = Coroutine.Start(Acts.instance.WardenTutorial());
|
|
while (BattleDR.current != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("WardenPostTutorial");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
SaveFile.AddFlag(SaveFile.Flags.DidApprehendTutorial);
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("WardenTutorialRefused");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
c = Coroutine.Start(CameraController.PanToObj(Player.instance, 0.5f));
|
|
yield return null;
|
|
while (!c.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
SaveFile.AddFlag(SaveFile.Flags.WardenExposited);
|
|
for (int j = 0; j < 2; j++)
|
|
{
|
|
entities[j].collider.Disabled = false;
|
|
}
|
|
SaveFile.AddFlag(SaveFile.Flags.MagicDoorActive);
|
|
SaveFile.current.dwKey.Add(Items.IDs.WantedPoster);
|
|
Player.instance.ResetFollowStep();
|
|
Room.current.DoMusic();
|
|
}
|
|
|
|
public void PenGuy()
|
|
{
|
|
Main.inEvent = Coroutine.Start(PenGuyLogic());
|
|
}
|
|
|
|
private IEnumerator PenGuyLogic()
|
|
{
|
|
if (SaveFile.HasFlag(SaveFile.Flags.Day1End))
|
|
{
|
|
if (!SaveFile.HasFlag(SaveFile.Flags.PenGuyTalkDay2))
|
|
{
|
|
TextSystem.GetText("PenGuyPrisonD2");
|
|
SaveFile.AddFlag(SaveFile.Flags.PenGuyTalkDay2);
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("PenGuyPrisonService");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
switch (TextSystem.lastPrompt)
|
|
{
|
|
case 0:
|
|
CameraController.instance.contents.AddChild(GD.Load<PackedScene>("res://Objects/UI/StorageMenu.tscn").Instantiate(PackedScene.GenEditState.Disabled), forceReadableName: false, InternalMode.Disabled);
|
|
break;
|
|
case 1:
|
|
((ShopCaller)Room.current.eventPointers[0]).CallShop();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("PenGuyPrisonD1");
|
|
}
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
public void DarkJailDay2()
|
|
{
|
|
Main.inEvent = Coroutine.Start(Day2Warden());
|
|
}
|
|
|
|
private IEnumerator AlignParty()
|
|
{
|
|
Party.ChangeCollider(state: false);
|
|
Party.MoveTo(new Vector2[3]
|
|
{
|
|
objects[0].GlobalPosition,
|
|
objects[1].GlobalPosition,
|
|
objects[2].GlobalPosition
|
|
}, 0.5f, align: true, Entity.Direction.North);
|
|
while (!Party.IsStopped())
|
|
{
|
|
yield return null;
|
|
}
|
|
Party.ChangeCollider(state: true);
|
|
entities[2].LookAt(Vector2.Down);
|
|
Player.instance.ResetFollowStep();
|
|
}
|
|
|
|
private IEnumerator Day2Warden()
|
|
{
|
|
if (SaveFile.HasFlag(SaveFile.Flags.AxisEvent))
|
|
{
|
|
if (!SaveFile.HasFlag(SaveFile.Flags.WardenRobotopiaTalk))
|
|
{
|
|
Coroutine c = Coroutine.Start(AlignParty());
|
|
while (!c.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("WardenRobotopia");
|
|
SaveFile.AddFlag(SaveFile.Flags.WardenRobotopiaTalk);
|
|
}
|
|
else
|
|
{
|
|
Coroutine c = Coroutine.Start(AlignParty());
|
|
while (!c.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("WardenRobotopia2");
|
|
}
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
else if (!SaveFile.HasFlag(SaveFile.Flags.WardenTalkDay2))
|
|
{
|
|
Coroutine c = Coroutine.Start(AlignParty());
|
|
while (!c.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (SaveFile.HasFlag(SaveFile.Flags.WeirdStart))
|
|
{
|
|
TextSystem.GetText("");
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("WardenDay2Start");
|
|
}
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
SaveFile.AddFlag(SaveFile.Flags.WardenTalkDay2);
|
|
}
|
|
else
|
|
{
|
|
if (SaveFile.HasFlag(SaveFile.Flags.WeirdStart))
|
|
{
|
|
TextSystem.GetText("");
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("WardenDay2Start2");
|
|
}
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|