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

1734 lines
44 KiB
C#

using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using Godot;
using Godot.Bridge;
using Godot.NativeInterop;
[ScriptPath("res://Scripts/Events/SchoolDWEvents.cs")]
public partial class SchoolDWEvents : Node, IEvent
{
[Export(PropertyHint.None, "")]
private Entity[] entities;
[Export(PropertyHint.None, "")]
private Node2D[] objects;
[Export(PropertyHint.None, "")]
private Node[] others;
public static IEnumerator FirstEvent()
{
CameraController.instance.follow = Player.instance;
Player.instance.ZIndex = 0;
Player.instance.collider.Disabled = false;
Player.instance.GlobalPosition = default(Vector2);
Player.instance.animMod = Entity.AnimMods.DW;
SaveFile.AddFlag(SaveFile.Flags.IsInDW);
Player.instance.anim.Play("FallenDW");
Player.instance.direction = Entity.Direction.South;
yield return null;
for (float a = 0f; a < 420f; a += Main.deltaTime)
{
yield return null;
}
CameraController.instance.cover.Visible = false;
Audio.ChangeMusic((Audio.AudioBlock)null, 0.01f);
for (float a = 0f; a < 120f; a += Main.deltaTime)
{
yield return null;
}
Player.instance.Shake(100f, 3f);
while (Player.instance.shake > 0f)
{
yield return null;
}
Player.instance.anim.Play("LandDW");
Audio.PlaySound("snd_wing_ch1.wav");
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
Player.instance.currentAnim = Entity.Animations.Idle;
}
public void KanakoSaveEvent()
{
Main.inEvent = Coroutine.Start(KanakoSaveEventRoutine());
}
private IEnumerator KanakoSaveEventRoutine()
{
Party.AddFollower(Party.IDs.Kanako, updateEntities: true, spawnInvisible: true);
Audio.ChangeMusic((Audio.AudioBlock)null, 2f);
yield return null;
entities[0] = Player.instance.followers[0];
entities[0].Position = new Vector2(-357f, -251f);
entities[0].Visible = true;
entities[0].animMod = Entity.AnimMods.DW;
yield return null;
entities[0].currentAnim = Entity.Animations.KO;
TextSystem.GetText("KanakoDWSave1");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.ChangeDirection(Entity.Direction.North);
Audio.PlaySound("snd_b.wav");
Node c = Player.instance.Emoticon(Entity.Emoticons.Exclaim);
while (GodotObject.IsInstanceValid(c))
{
yield return null;
}
Coroutine p = Coroutine.Start(CameraController.Pan(new Vector2(-355f, CameraController.instance.Position.Y), 1f));
while (!p.done)
{
yield return null;
}
p = Coroutine.Start(CameraController.Pan(new Vector2(-355f, entities[0].Position.Y - 32f), 1f));
while (!p.done)
{
yield return null;
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("KanakoDWSave2");
while (TextSystem.instance.Visible)
{
yield return null;
}
Player.instance.Position = new Vector2(-355f, -118f);
Player.instance.DoAutoMove(new Vector2(-355f, -206f), 1.5f);
Coroutine.Start(CameraController.Pan(CameraController.instance.Position + Vector2.Down * 32f, 1f));
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
for (int i = 0; i < 2; i++)
{
entities[1 + i].Emoticon(Entity.Emoticons.Exclaim);
}
Audio.PlaySound("snd_b.wav");
while (Player.instance.moving != null)
{
yield return null;
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("KanakoDWSave3");
while (TextSystem.instance.Visible)
{
yield return null;
}
Coroutine n = Coroutine.Start(BattleDR.IntroNoise());
while (!n.done)
{
yield return null;
}
p = Coroutine.Start(BattleDR.StartBattle(null, useOWBG: false, new Entity.IDs[2]
{
Entity.IDs.Penceller,
Entity.IDs.Eraserhead
}, new List<Entity>
{
entities[1],
entities[2]
}, "PencilEraser"));
yield return null;
while (!BattleDR.current.started)
{
yield return null;
}
BattleDR.current.busy = Coroutine.Start(Acts.instance.FirstBattleEvent());
while (!p.done)
{
yield return null;
}
for (int j = 0; j < 2; j++)
{
entities[j + 1].QueueFree();
}
entities[0].Position = new Vector2(-374f, -244f);
entities[0].currentAnim = Entity.Animations.Idle;
yield return null;
while (BattleDR.current != null || GameOver.instance != null)
{
yield return null;
}
yield return null;
yield return null;
entities[0].anim.Play("Kneel1");
entities[0].sprite.FlipH = true;
Player.instance.Position = new Vector2(-329f, -244f);
CameraController.instance.Position = new Vector2(CameraController.instance.Position.X, -244f) + CameraController.instance.offset;
Player.instance.LookAt(entities[0].Position);
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("KanakoDWSave4");
while (TextSystem.instance.Visible)
{
yield return null;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("KanakoDWSave5");
while (TextSystem.instance.Visible)
{
yield return null;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
entities[0].anim.Play("Kneel2");
CameraController.Shake(10f, 3f);
TextSystem.GetText("KanakoDWSave6");
while (TextSystem.instance.Visible)
{
yield return null;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
entities[0].anim.Play("Kneel1");
TextSystem.GetText("KanakoDWSave7");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt == 0)
{
SaveFile.current.values[0]++;
}
while (TextSystem.instance.Visible)
{
yield return null;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
entities[0].Shake(5f, 2f);
entities[0].anim.Play("Kneel3");
Audio.PlaySound("snd_wing_ch1.wav");
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
entities[0].Shake(5f, 2f);
entities[0].LookAt(Player.instance.Position);
Audio.PlaySound("snd_wing_ch1.wav");
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("KanakoDWSave8");
while (TextSystem.instance.Visible)
{
yield return null;
}
p = Coroutine.Start(CameraController.Pan(Player.instance.Position + CameraController.instance.offset, 1f));
while (!p.done)
{
yield return null;
}
CameraController.instance.follow = Player.instance;
Player.instance.ResetFollowStep();
Player.instance.LookAt(Player.instance.Position + Vector2.Down);
Room.current.DoMusic();
Party.Heal(playSound: false);
}
public void ChaseCorridorEvent()
{
Main.inEvent = Coroutine.Start(ChaseCorridor());
}
private IEnumerator ChaseCorridor()
{
entities[0] = Party.GetOWEntityByIndex(0);
entities[1] = Party.GetOWEntityByIndex(1);
objects[1].ProcessMode = ProcessModeEnum.Disabled;
objects[0].Position = new Vector2(entities[0].Position.X, objects[0].Position.Y);
Vector2[] p = new Vector2[5]
{
entities[0].Position,
entities[1].Position,
objects[0].Position,
new Vector2(objects[0].Position.X, 15f),
Vector2.Left * 50f
};
Audio.ChangeMusic(null);
Audio.PlaySound("snd_rudebuster_swing.wav");
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
if (a >= 30f)
{
for (int i = 0; i < 2; i++)
{
entities[1].anim.Play("Surprise");
entities[1].sprite.FlipH = true;
entities[0].currentAnim = Entity.Animations.Hurt;
entities[i].Position = p[i].Lerp(p[i] + p[4], Mathf.SmoothStep(0f, 1f, (a - 30f) / 30f));
}
}
objects[0].Position = p[2].Lerp(p[3], a / 60f);
yield return null;
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
entities[0].LookAt(entities[0].Position + Vector2.Right);
TextSystem.GetText("ChaseEvent1");
while (TextSystem.instance.Visible)
{
yield return null;
}
Coroutine c = Coroutine.Start(CameraController.Pan(CameraController.instance.Position + Vector2.Right * 32f, 1f));
while (!c.done)
{
yield return null;
}
CameraController.instance.target = CameraController.instance.Position;
entities[1].LookAt(entities[0].Position);
for (int j = 0; j < 4; j++)
{
Audio.PlaySound("snd_arrow.wav");
c = Coroutine.Start(FallingAnim(2 + j));
while (!c.done)
{
yield return null;
}
Audio.PlaySound("snd_impact_ch1.wav");
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("ChaseEvent2");
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[6].anim.Play("Fall");
Audio.PlaySound("snd_spearrise_ch1.wav", 1f, 0.9f);
c = Coroutine.Start(FallingAnim(6, 2f, 50f));
while (!c.done)
{
yield return null;
}
Audio.PlaySound("snd_screenshake.wav");
entities[6].anim.Play("Land");
entities[0].currentAnim = Entity.Animations.Hurt;
entities[1].anim.Play("Surprise");
entities[1].sprite.FlipH = true;
entities[6].Shake(20f);
for (float a = 0f; a < 80f; a += Main.deltaTime)
{
yield return null;
}
entities[6].anim.Play("Idle");
Room.current.DoMusic(3);
for (float a = 0f; a < 80f; a += Main.deltaTime)
{
yield return null;
}
entities[1].UpdateAnim(force: true);
TextSystem.GetText("ChaseEvent3");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (SaveFile.current.values[1] >= SaveFile.current.values[2])
{
TextSystem.GetText("ChaseEvent3a");
}
else
{
TextSystem.GetText("ChaseEvent3b");
}
while (TextSystem.instance.Visible)
{
yield return null;
}
TextSystem.GetText("ChaseEvent4");
while (TextSystem.instance.Visible)
{
yield return null;
}
SchoolDWChase chase = (SchoolDWChase)objects[7];
Vector2[] pos = new Vector2[5];
for (int k = 2; k < entities.Length; k++)
{
entities[k].anim.Play("Walk");
pos[k - 2] = entities[k].GlobalPosition;
entities[k].Reparent(chase);
}
CameraController.instance.target = null;
Vector2 cp = CameraController.instance.GlobalPosition;
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
for (int l = 2; l < entities.Length; l++)
{
entities[l].GlobalPosition = pos[l - 2].Lerp(chase.pos[l - 2].GlobalPosition, a / 30f);
}
CameraController.instance.GlobalPosition = cp.Lerp(Player.instance.GlobalPosition + CameraController.instance.offset, a / 30f);
yield return null;
}
chase.ProcessMode = ProcessModeEnum.Inherit;
Player.instance.ResetFollowStep();
objects[1].ProcessMode = ProcessModeEnum.Inherit;
CameraController.instance.follow = Player.instance;
Room.current.DoMusic(1);
}
private IEnumerator FallingAnim(int id, float shakeAmt = 1f, float shakeTime = 5f)
{
entities[id].collider.Disabled = true;
entities[id].doTrail = true;
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
entities[id].Position = (objects[id].Position + Vector2.Up * 200f).Lerp(objects[id].Position, a / 30f);
yield return null;
}
CameraController.Shake(shakeTime, shakeAmt);
entities[id].doTrail = false;
}
public void ChaseCorridorEventPart2()
{
Main.inEvent = Coroutine.Start(ChaseCorridor2());
}
private IEnumerator ChaseCorridor2()
{
objects[7].ProcessMode = ProcessModeEnum.Disabled;
Audio.ChangeMusic((Audio.AudioBlock)null, 3f);
Player.instance.dangerZoneCD = 0f;
SchoolDWChase chase = (SchoolDWChase)objects[7];
for (int i = 2; i < entities.Length; i++)
{
entities[i].ProcessMode = ProcessModeEnum.Always;
}
for (int j = 0; j < chase.bullets.Length; j++)
{
Main.SetActive(chase.bullets[j], state: false);
}
for (int k = 0; k < 2; k++)
{
entities[k].DoAutoMove(objects[8 + k].GlobalPosition, 2f);
}
Vector2 p = chase.GlobalPosition;
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
chase.GlobalPosition = p.Lerp(objects[10].GlobalPosition, a / 30f);
yield return null;
}
for (int l = 2; l < entities.Length; l++)
{
entities[l].anim.Play("Idle");
}
while (entities[0].moving != null || entities[1].moving != null)
{
yield return null;
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("PostChase1");
while (TextSystem.instance.Visible)
{
yield return null;
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
for (int m = 0; m < 2; m++)
{
entities[m].LookAt(p);
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("PostChase2");
while (TextSystem.instance.Visible)
{
yield return null;
}
Room.current.DoMusic(2);
p = entities[6].GlobalPosition;
int[] we = new int[3] { 0, 1, 6 };
for (int n = 0; n < 3; n++)
{
entities[we[n]].currentAnim = Entity.Animations.Walk;
}
entities[6].anim.SpeedScale = 0.5f;
Vector2 offset = Vector2.Left * 20f;
CameraController.instance.target = null;
for (float a = 0f; a < 100f; a += Main.deltaTime)
{
entities[4].Position = entities[4].Position.Lerp(new Vector2(-24f, 36f), 0.05f * Main.deltaTime);
entities[2].Position = entities[2].Position.Lerp(new Vector2(-25f, -33f), 0.05f * Main.deltaTime);
entities[6].GlobalPosition = p.Lerp(p + Vector2.Left * 40f, a / 100f);
entities[0].Position = objects[8].GlobalPosition.Lerp(objects[8].GlobalPosition + offset, a / 100f);
entities[1].Position = objects[9].GlobalPosition.Lerp(objects[9].GlobalPosition + offset, a / 100f);
yield return null;
}
for (int num = 0; num < 3; num++)
{
entities[we[num]].currentAnim = Entity.Animations.Idle;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("PostChase3");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt == 0)
{
TextSystem.GetText("PostChase3A");
while (TextSystem.instance.Visible)
{
yield return null;
}
TextSystem.GetText("PostChase3A2");
for (int num2 = 0; num2 < 3; num2++)
{
entities[we[num2]].currentAnim = Entity.Animations.Walk;
}
Vector2[] ppp = new Vector2[2]
{
entities[0].GlobalPosition,
entities[1].GlobalPosition
};
p = entities[6].GlobalPosition;
offset /= 2f;
for (float a = 0f; a < 100f; a += Main.deltaTime)
{
entities[6].GlobalPosition = p.Lerp(p + Vector2.Left * 40f, a / 100f);
entities[0].GlobalPosition = ppp[0].Lerp(ppp[0] + offset, a / 100f);
entities[1].GlobalPosition = ppp[1].Lerp(ppp[1] + offset, a / 100f);
yield return null;
}
for (int num3 = 0; num3 < 3; num3++)
{
entities[we[num3]].currentAnim = Entity.Animations.Idle;
}
while (TextSystem.instance.Visible)
{
yield return null;
}
}
else
{
Audio.PlaySound("snd_weaponpull.wav");
entities[0].currentAnim = Entity.Animations.BattleStart;
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
entities[0].currentAnim = Entity.Animations.BattleIdle;
for (float a = 0f; a < 70f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.overridePlayer = false;
TextSystem.GetText("PostChase3B");
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[6].anim.SpeedScale = 1f;
entities[6].anim.Play("Punch0");
Audio.PlaySound("snd_boost.wav", 1f, 0.85f);
entities[6].Shake(-200f, 2f);
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.overridePlayer = false;
TextSystem.GetText("PostChase3B2");
entities[1].DoAutoMove(entities[6].GlobalPosition + Vector2.Left * 40f, 2f);
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
while (entities[1].moving != null)
{
yield return null;
}
entities[1].currentAnim = Entity.Animations.AttackReady;
for (float a = 0f; a < 10f; a += Main.deltaTime)
{
yield return null;
}
entities[6].anim.Play("Punch1");
Audio.PlaySound("snd_rudebuster_hit.wav", 1f, 0.95f);
for (float a = 0f; a < 5f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.End();
CameraController.Shake(15f, 5f);
entities[6].shake = 0f;
entities[1].currentAnim = Entity.Animations.Idle;
entities[1].UpdateAnim(force: true);
yield return null;
entities[1].anim.Play("Surprise");
entities[1].sprite.FlipH = true;
entities[0].currentAnim = Entity.Animations.Hurt;
}
Vector2[] pp = new Vector2[4]
{
entities[0].GlobalPosition,
entities[1].GlobalPosition,
objects[11].GlobalPosition,
Vector2.Left * 200f
};
entities[0].collider.Disabled = true;
Coroutine c = Coroutine.Start(CameraController.Pan(CameraController.instance.GlobalPosition + pp[3] / 2f, 0.5f));
if (TextSystem.lastPrompt == 0)
{
entities[0].LookAt(entities[0].GlobalPosition + Vector2.Left);
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
Coroutine.Start(Common.Arc(entities[0], pp[0], pp[2], objects[12].GlobalPosition, 100f));
entities[0].anim.Play("Slide");
Audio.PlaySound("snd_wing_ch1.wav");
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
entities[1].LookAt(entities[1].GlobalPosition + Vector2.Left);
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
Audio.PlaySound("snd_wing_ch1.wav");
entities[1].anim.Play("Slide");
Coroutine temp = Coroutine.Start(Common.Arc(entities[1], pp[1], pp[2], objects[12].GlobalPosition, 100f));
while (!temp.done)
{
yield return null;
}
}
else
{
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
for (int num4 = 0; num4 < 2; num4++)
{
entities[num4].Position = Common.Beizier(pp[num4], pp[2], objects[12].GlobalPosition, a / 60f);
}
yield return null;
}
}
while (!c.done)
{
yield return null;
}
entities[6].anim.Play("Idle");
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
entities[6].DoAutoMove(new Vector2(-5048f, entities[6].GlobalPosition.Y), 0.5f);
while (entities[6].moving != null)
{
yield return null;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("PostChase4");
while (TextSystem.instance.Visible)
{
yield return null;
}
CameraController.Transition(Main.colorBlack, 80f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
yield return null;
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
AudioStreamPlayer splash = Audio.PlaySound("watersplash.mp3");
yield return null;
while (splash.Playing)
{
yield return null;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
Room.LoadRoom(Room.IDs.SchoolDWLake, reparent: true);
yield return null;
Main.inEvent = Coroutine.Start(LakeFallEvent());
}
private IEnumerator LakeFallEvent()
{
entities = new Entity[3]
{
Player.instance,
Player.instance.followers[0],
null
};
Room.current.AddChild(entities[2] = GD.Load<PackedScene>("res://Objects/Characters/Warden.tscn").Instantiate<Entity>(PackedScene.GenEditState.Disabled), forceReadableName: false, InternalMode.Disabled);
entities[2].collider.Disabled = true;
CameraController.instance.GlobalPosition = new Vector2(110f, 418f);
entities[2].Position = Room.current.eventPointers[0].GlobalPosition + Vector2.Down * 100f;
entities[0].Position = new Vector2(300f, 300f);
entities[1].Position = new Vector2(350f, 270f);
for (int i = 0; i < 2; i++)
{
entities[i].collider.Disabled = true;
entities[i].sprite.FlipH = false;
}
yield return null;
CameraController.Transition(Main.colorClearB, 100f);
entities[2].DoAutoMove(Room.current.eventPointers[0].GlobalPosition, 0.35f);
entities[2].moving.doFailsafe = false;
while (entities[2].moving != null)
{
yield return null;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
for (int j = 0; j < 2; j++)
{
entities[j].DoAutoMove(new Vector2(-100f, entities[j].Position.Y), 0.1f, Entity.Animations.None);
entities[j].moving.doFailsafe = false;
}
Coroutine.Start(CameraController.Pan(new Vector2(110f, 368f), 0.5f));
for (float a = 0f; a < 250f; a += Main.deltaTime)
{
for (int k = 0; k < 2; k++)
{
entities[k].anim.Play("OnWater");
}
yield return null;
}
TextSystem.overridePlayer = false;
TextSystem.SingleText("* ...", "WardenNormal");
while (TextSystem.instance.Visible)
{
yield return null;
}
CameraController.Transition(Main.colorBlack, 100f);
Audio.ChangeMusic((Audio.AudioBlock)null, 2f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
Player.instance.StopMoving();
yield return null;
Party.Remove(1);
Party.DeleteFollowers();
yield return null;
Player.instance.anim.Play("FallenDW");
Room.LoadRoom(Room.IDs.DarkPrisonLeft, reparent: true);
CameraController.instance.follow = Player.instance;
yield return null;
Player.instance.Position = new Vector2(120f, -160f);
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
CameraController.Transition(Main.colorClearB, 100f);
while (!CameraController.transitionRoutine.done)
{
yield return null;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
Player.instance.Shake(60f, 1f);
while (Player.instance.shake > 0f)
{
yield return null;
}
Player.instance.anim.Play("LandDW");
Audio.PlaySound("snd_wing_ch1.wav");
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
Player.instance.currentAnim = Entity.Animations.Idle;
Player.instance.LookAt(Player.instance.GlobalPosition + Vector2.Down);
Party.Heal(playSound: false);
Player.instance.collider.Disabled = false;
}
public void KanakoPrisonTalk()
{
Main.inEvent = Coroutine.Start(KanakoPrison());
}
public void TheMossEvent()
{
Main.inEvent = Coroutine.Start(MossEvent());
}
private IEnumerator MossEvent()
{
if (!SaveFile.current.flags.Contains(SaveFile.Flags.MossChecked))
{
SaveFile.AddFlag(SaveFile.Flags.MossChecked);
TextSystem.GetText("MossEvent1");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt == 0)
{
SaveFile.AddFlag(SaveFile.Flags.AteMoss);
TextSystem.GetText("MossEventEat");
Party.party[0].title = 4;
}
else
{
TextSystem.GetText("MossEventNo");
}
}
else if (SaveFile.current.flags.Contains(SaveFile.Flags.KanakoFollowing))
{
if (SaveFile.current.flags.Contains(SaveFile.Flags.KanakoCommentsOnMoss))
{
TextSystem.GetText("MossEventKanakoPost");
}
else if (!SaveFile.current.flags.Contains(SaveFile.Flags.AteMoss))
{
TextSystem.GetText("MossEventKanakoNo");
}
else
{
TextSystem.GetText("MossEventKanakoEat");
}
SaveFile.AddFlag(SaveFile.Flags.KanakoCommentsOnMoss);
}
else
{
TextSystem.GetText("MossEnd");
}
while (TextSystem.instance.Visible)
{
yield return null;
}
}
private IEnumerator KanakoPrison()
{
entities[0] = Player.instance;
entities[0].LookAt(entities[1].Position);
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
entities[1].Emoticon(Entity.Emoticons.Exclaim);
Audio.PlaySound("snd_b.wav");
while (GodotObject.IsInstanceValid(entities[1].emoticonObj))
{
yield return null;
}
entities[1].LookAt(entities[0].Position);
TextSystem.GetText("PrisonFirstEvent1");
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[1].DoAutoMove(new Vector2(-31f, entities[1].Position.Y), 0.3f);
while (entities[1].moving != null)
{
yield return null;
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
entities[1].sprite.FlipH = false;
entities[1].anim.Play("Kneel4");
Audio.PlaySound("snd_wing_ch1.wav");
entities[1].Shake(5f, 1f);
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
Room.current.DoMusic(1);
TextSystem.GetText("PrisonFirstEvent2");
while (TextSystem.instance.Visible)
{
yield return null;
}
for (float a = 0f; a < 120f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("PrisonFirstEvent3");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt == 0)
{
TextSystem.GetText("PrisonFirstEvent3P1");
}
else
{
TextSystem.GetText("PrisonFirstEvent3P2");
}
while (TextSystem.instance.Visible)
{
yield return null;
}
for (float a = 0f; a < 120f; a += Main.deltaTime)
{
yield return null;
}
Audio.ChangeMusic((Audio.AudioBlock)null, 3f);
TextSystem.GetText("PrisonFirstEvent4");
while (TextSystem.instance.Visible)
{
yield return null;
}
Audio.PlaySound("snd_b.wav");
for (int i = 0; i < 2; i++)
{
entities[i].LookAt(Vector2.Down);
entities[i].Emoticon(Entity.Emoticons.Exclaim);
}
for (float a = 0f; a < 80f; a += Main.deltaTime)
{
yield return null;
}
CameraController.instance.follow = null;
Coroutine.Start(CameraController.Pan(CameraController.instance.GlobalPosition + Vector2.Down * 64f, 0.5f));
entities[2].Position = new Vector2(245f, 0f);
entities[2].DoAutoMove(new Vector2[2]
{
new Vector2(objects[0].Position.X, 0f),
objects[0].Position
}, 0.5f);
entities[2].moving.doFailsafe = false;
while (entities[2].moving != null)
{
yield return null;
}
TextSystem.GetText("PrisonFirstEvent5");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt == 0)
{
TextSystem.GetText("PrisonFirstEvent5P1");
}
else
{
SaveFile.AddFlag(SaveFile.Flags.DisagreedWardenFirstTalk);
TextSystem.GetText("PrisonFirstEvent5P2");
}
while (TextSystem.instance.Visible)
{
yield return null;
}
Audio.PlaySound("snd_shadowpendant_ch1.wav");
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
objects[1].Modulate = Main.colorWhite.Lerp(Main.colorClear, a / 60f);
yield return null;
}
Main.SetActive(objects[1], state: false);
TextSystem.GetText("PrisonFirstEvent6");
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[2].DoAutoMove(new Vector2[2]
{
new Vector2(entities[2].Position.X, 0f),
new Vector2(427f, 0f)
}, 0.75f);
entities[0].DoAutoMove(new Vector2[2]
{
new Vector2(objects[1].GetChild<Node2D>(1).Position.X, entities[0].Position.Y),
new Vector2(objects[1].GetChild<Node2D>(1).Position.X, objects[0].Position.Y)
}, 0.75f);
entities[1].DoAutoMove(new Vector2[3]
{
new Vector2(objects[1].GetChild<Node2D>(0).Position.X, entities[1].Position.Y),
new Vector2(objects[1].GetChild<Node2D>(0).Position.X, objects[0].Position.Y),
objects[0].Position
}, 0.75f);
for (int j = 0; j < 3; j++)
{
entities[j].moving.doFailsafe = false;
}
while (entities[0].moving != null || entities[1].moving != null)
{
yield return null;
}
entities[0].LookAt(Vector2.Left);
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("PrisonFirstEvent7");
while (TextSystem.instance.Visible)
{
yield return null;
}
Coroutine c = Coroutine.Start(CameraController.Pan(entities[0].Position + CameraController.instance.offset, 0.5f));
while (!c.done)
{
yield return null;
}
Party.AddFollower(entities[1]);
entities[0].LookAt(Vector2.Down);
CameraController.instance.follow = entities[0];
SaveFile.AddFlag(SaveFile.Flags.FreedFromJail);
SaveFile.AddFlag(SaveFile.Flags.MossChecked);
SaveFile.current.values[5]++;
}
public void KanakoWeirdTalkBreakRoom()
{
Main.inEvent = Coroutine.Start(KWTBR());
}
private IEnumerator KWTBR()
{
Audio.ChangeMusic((Audio.AudioBlock)null, 2f);
TextSystem.GetText("KanakoBreakRoomWeird1");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt == 0)
{
Audio.PlaySound("snd_ominous_cancel.wav");
Party.party[0].title = 0;
Party.party[1].title = 1;
SaveFile.current.flags.Remove(SaveFile.Flags.WeirdStart);
}
else
{
if (TextSystem.lastPrompt == 1)
{
SaveFile.current.values[7]++;
TextSystem.GetText("KanakoBreakRoomWeird1P2");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
Audio.PlaySound("snd_ominous.wav");
}
SaveFile.AddFlag(SaveFile.Flags.KanakoTalkBreakRoom);
SaveFile.AddFlag(SaveFile.Flags.KanakoWeirdTalkBreakRoom);
Room.current.DoMusic();
}
public void PrisonButton()
{
if (!SaveFile.HasFlag(SaveFile.Flags.BearingFortMainGate))
{
Main.inEvent = Coroutine.Start(PrisonButtonEvent());
}
}
private IEnumerator PrisonButtonEvent()
{
Audio.PlaySound("snd_screenshake.wav");
Party.StopMoving();
CameraController.Shake(60f, 2f);
for (float a = 0f; a < 90f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText(SaveFile.HasFlag(SaveFile.Flags.WeirdStart) ? "BearPrisonPressedButtonWeird" : "BearPrisonPressedButton");
while (TextSystem.instance.Visible)
{
yield return null;
}
SaveFile.current.values[5] = 2;
SaveFile.AddFlag(SaveFile.Flags.BearingFortMainGate);
SaveFile.AddFlag(SaveFile.Flags.BearingFortUpRoomLock);
}
public void BearingFight()
{
Main.inEvent = Coroutine.Start(BearingEvent());
}
public void FountainEvent()
{
if (Main.inEvent == null)
{
Main.inEvent = Coroutine.Start(Fountain.SchoolDW());
}
}
public void FoxEvent()
{
if (!SaveFile.HasFlag(SaveFile.Flags.FoxFirstTalk))
{
Main.inEvent = Coroutine.Start(FoxFirstTalk());
}
else if (!Items.HasItem(Items.IDs.GoldenBell))
{
Main.inEvent = Coroutine.Start(FoxSecondTalk());
}
else
{
Main.inEvent = Coroutine.Start(FoxBattle());
}
}
private IEnumerator FoxSecondTalk()
{
TextSystem.GetText("FoxTalkNoItem");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
private IEnumerator FoxFirstTalk()
{
Party.ChangeCollider(state: false);
Party.MoveTo(new Vector2[2]
{
objects[0].GlobalPosition,
objects[1].GlobalPosition
}, 0.8f, align: true);
while (!Party.IsStopped())
{
yield return null;
}
Party.ChangeCollider(state: true);
Party.LookAt(Vector2.Up);
for (float a = 0f; a < 90f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("FoxFirstTalk");
while (TextSystem.instance.Visible)
{
yield return null;
}
SaveFile.AddFlag(SaveFile.Flags.FoxFirstTalk);
}
private IEnumerator FoxBattle()
{
Party.ChangeCollider(state: false);
Party.MoveTo(new Vector2[2]
{
objects[0].GlobalPosition,
objects[1].GlobalPosition
}, 0.8f, align: true);
while (!Party.IsStopped())
{
yield return null;
}
Party.ChangeCollider(state: true);
Party.LookAt(Vector2.Up);
float a;
for (a = 0f; a < 40f; a += Main.deltaTime)
{
yield return null;
}
Coroutine c = Coroutine.Start(CameraController.Pan(entities[0].GlobalPosition, 0.75f));
while (!c.done)
{
yield return null;
}
TextSystem.GetText("FoxTalkPreFight");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt == 0)
{
TextSystem.GetText("FoxTalkPreFight1.5");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
Vector2 p = entities[0].GlobalPosition;
Vector2 tp = p + Vector2.Up * 15f;
entities[0].anim.Play("Unrobe");
entities[0].anim.Stop();
a = 0f;
float b;
for (b = 30f; a < b; a += Main.deltaTime)
{
entities[0].GlobalPosition = p.Lerp(tp, a / b);
yield return null;
}
for (b = 0f; b < 15f; b += Main.deltaTime)
{
yield return null;
}
p += Vector2.Down * 20f;
Vector2[] pPos = new Vector2[2]
{
Player.instance.GlobalPosition,
Player.instance.followers[0].GlobalPosition
};
Vector2[] tPos = new Vector2[2]
{
pPos[0] + new Vector2(-25f, 100f),
pPos[1] + new Vector2(25f, 100f)
};
bool pushed = false;
b = 0f;
for (a = 20f; b < a; b += Main.deltaTime)
{
entities[0].GlobalPosition = tp.Lerp(p, b / a);
if (b / a > 0.5f)
{
if (!pushed)
{
Audio.PlaySound("snd_heavydamage.wav");
Audio.PlaySound("snd_ceroba_attack_bell_ring.wav");
Player.instance.anim.Play("KO");
Player.instance.followers[0].anim.Play("KO");
Player.instance.followers[0].sprite.FlipH = true;
pushed = true;
objects[3].Visible = true;
CameraController.Shake(20f, 3f);
}
float weight = Mathf.SmoothStep(0f, 1f, b / a / 2f);
Player.instance.GlobalPosition = pPos[0].Lerp(tPos[0], weight);
Player.instance.followers[0].GlobalPosition = pPos[1].Lerp(tPos[1], weight);
}
yield return null;
}
Items.RemoveItem(Items.IDs.GoldenBell, Items.Type.Equip, checkEquipped: true);
for (a = 0f; a < 40f; a += Main.deltaTime)
{
yield return null;
}
Audio.ChangeMusic(Room.current.music[2]);
TextSystem.GetText("FoxTalkPreFight2");
while (TextSystem.instance.Visible)
{
yield return null;
}
for (a = 0f; a < 40f; a += Main.deltaTime)
{
yield return null;
}
Audio.PlaySound("snd_wing_ch1.wav");
entities[0].anim.Play();
p = objects[3].GlobalPosition;
tp = entities[0].GlobalPosition + Vector2.Up * 25f;
a = 0f;
for (b = 40f; a < b; a += Main.deltaTime)
{
objects[3].GlobalPosition = p.Lerp(tp, a / b);
yield return null;
}
objects[3].Visible = false;
Audio.PlaySound("snd_ceroba_attack_bell_ring.wav");
b = 0f;
for (a = 60f; b < a; b += Main.deltaTime)
{
yield return null;
}
Audio.PlaySound("snd_ceroba_scream.wav");
CameraController.Shake(100f, 2f);
while (CameraController.instance.shakeTime > 0f)
{
yield return null;
}
CameraController.Shake(20f, 5f);
entities[0].anim.Play("Unrobe2");
entities[0].anim.SpeedScale = 0.75f;
Audio.PlaySound("snd_ceroba_phase_1_transform.wav");
a = 0f;
for (b = 120f; a < b; a += Main.deltaTime)
{
yield return null;
}
for (int i = 0; i < objects[4].GetChildCount(); i++)
{
Room.current.tileMap.Modulate -= new Color(0.1f, 0.1f, 0.1f, 0f);
objects[4].GetChild<Node2D>(i).Visible = true;
Audio.PlaySound("snd_wing_ch1.wav", 1f, 0.9f);
b = 0f;
for (a = 35f; b < a; b += Main.deltaTime)
{
yield return null;
}
}
a = 0f;
for (b = 80f; a < b; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("FoxTalkPreFight3");
while (TextSystem.instance.Visible)
{
yield return null;
}
objects[4].Visible = false;
Coroutine.Start(BattleDR.StartBattle(null, useOWBG: true, new Entity.IDs[1] { Entity.IDs.FoxBoss }, null, "FoxBoss", new Audio.AudioBlock
{
stream = Room.current.music[1],
pitch = 0.975f
}, quickIntro: true));
yield return null;
BattleDR.lastResult = BattleDR.EndState.Special;
Color color = objects[2].Modulate;
objects[2].Visible = true;
objects[2].GlobalPosition = CameraController.instance.GlobalPosition + Vector2.Down * 150f;
b = 0f;
for (a = 60f; b <= a; b += Main.deltaTime)
{
objects[2].Modulate = Main.colorClear.Lerp(color, b / a);
yield return null;
}
AnimationPlayer anim = objects[2].GetChild<AnimationPlayer>(0);
anim.Play("Anim");
while (!BattleDR.current.started)
{
yield return null;
}
while ((BattleDR.current?.started ?? false) || GameOver.instance != null)
{
objects[2].GlobalPosition = CameraController.instance.GlobalPosition + Vector2.Down * 150f;
yield return null;
}
Room.current.tileMap.Modulate = Main.colorWhite;
for (a = 0f; a < 90f; a += Main.deltaTime)
{
yield return null;
}
BattleDR.EndState e = BattleDR.current.GetLastResult();
TextSystem.GetText("FoxTalkPost" + e);
while (TextSystem.instance.Visible)
{
yield return null;
}
entities[0].GlobalPosition = entities[0].startPos + Vector2.Up * 15f;
entities[0].anim.Play("Defeat");
Party.SetPosition(new Vector2[2]
{
objects[0].GlobalPosition,
objects[1].GlobalPosition
});
Party.LookAt(Vector2.Up);
CameraController.instance.follow = Player.instance;
yield return null;
c = Coroutine.Start(BattleDR.current.FinalizeBattle());
color = objects[2].Modulate;
anim.Pause();
a = 0f;
for (b = 30f; a <= b; a += Main.deltaTime)
{
objects[2].Modulate = color.Lerp(Main.colorClear, a / b);
entities[0].anim.Play("Defeat");
Party.UpdateAnim();
yield return null;
}
objects[2].Visible = false;
while (!c.done)
{
yield return null;
}
while (BattleDR.current != null)
{
yield return null;
}
for (b = 0f; b < 30f; b += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("FoxPostFinal" + e);
while (TextSystem.instance.Visible)
{
yield return null;
}
Audio.PlaySound("snd_magicsprinkle.wav");
Node2D obj = objects[(e == BattleDR.EndState.Defeated) ? 6 : 5];
b = 0f;
for (a = 100f; b <= a; b += Main.deltaTime)
{
entities[0].Modulate = Main.colorWhite.Lerp(Main.colorClear, b / a);
obj.Modulate = Main.colorClear.Lerp(Main.colorWhite, b / a);
yield return null;
}
entities[0].QueueFree();
for (a = 0f; a < 50f; a += Main.deltaTime)
{
yield return null;
}
p = obj.GlobalPosition;
tp = new Vector2(p.X, Player.instance.GlobalPosition.Y - 16f);
a = 0f;
for (b = 100f; a <= b; a += Main.deltaTime)
{
obj.GlobalPosition = p.Lerp(tp, a / b);
yield return null;
}
obj.Visible = false;
Audio.PlaySound("snd_item_ch1.wav");
TextSystem.GetText("FoxGetItem" + e);
while (TextSystem.instance.Visible)
{
yield return null;
}
bool flag;
if (e == BattleDR.EndState.Spared)
{
flag = Items.CheckFull(Items.Type.Equip);
if (flag)
{
SaveFile.AddFlag(SaveFile.Flags.FoxFullInvSpare);
}
else
{
SaveFile.current.dwArmor.Add(Items.IDs.FoxNecklace);
}
}
else
{
flag = Items.CheckFull(Items.Type.Weapon);
if (flag)
{
SaveFile.AddFlag(SaveFile.Flags.FoxFullInvDefeat);
}
else
{
SaveFile.current.dwWeapon.Add(Items.IDs.FoxStaff);
}
}
if (flag)
{
TextSystem.GetText("FoxFullInv");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
else
{
SaveFile.AddFlag(SaveFile.Flags.FoxGotItem);
}
SaveFile.AddFlag(SaveFile.Flags.FoxDefeated);
Player.instance.ResetFollowStep();
}
public void BellInteraction()
{
Main.inEvent = Coroutine.Start(BellBattle());
}
private IEnumerator BellBattle()
{
if (SaveFile.HasFlag(SaveFile.Flags.WeirdStart))
{
TextSystem.GetText("BellBossIntroWeird");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
else
{
TextSystem.GetText("BellBossIntro");
while (TextSystem.instance.Visible)
{
yield return null;
}
if (TextSystem.lastPrompt == 1)
{
yield break;
}
}
objects[0].QueueFree();
Coroutine.Start(BattleDR.StartBattle(null, useOWBG: false, new Entity.IDs[1] { Entity.IDs.BellBoss }, new List<Entity> { entities[0] }, "BellBoss", new Audio.AudioBlock
{
stream = GD.Load<AudioStream>("res://Audio/Music/heatwave_approaching.ogg")
}));
yield return null;
while (BattleDR.current != null || GameOver.instance != null)
{
yield return null;
}
switch (BattleDR.lastResult)
{
case BattleDR.EndState.Apprehended:
{
entities[0].QueueFree();
SaveFile.AddFlag(SaveFile.Flags.LuncherCaught);
SaveFile.AddFlag(SaveFile.Flags.LuncherDisappear);
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("BellCaught");
break;
}
case BattleDR.EndState.Defeated:
{
entities[0].QueueFree();
TextSystem.GetText("BellFled");
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
SaveFile.AddFlag(SaveFile.Flags.LuncherDisappear);
break;
}
case BattleDR.EndState.Spared:
{
entities[0].currentAnim = Entity.Animations.Idle;
entities[0].LookAt(Vector2.Right);
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("BellSpare");
break;
}
case BattleDR.EndState.Executed:
{
SaveFile.AddFlag(SaveFile.Flags.LuncherDisappear);
entities[0].QueueFree();
SaveFile.current.values[10]--;
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("BellKill");
SaveFile.AddFlag(SaveFile.Flags.LuncherDEAD);
break;
}
}
while (TextSystem.instance.Visible)
{
yield return null;
}
if (BattleDR.lastResult != BattleDR.EndState.Executed && SaveFile.HasFlag(SaveFile.Flags.WeirdStart))
{
SaveFile.current.flags.Remove(SaveFile.Flags.WeirdStart);
Audio.PlaySound("snd_ominous_cancel.wav");
}
if (SaveFile.HasFlag(SaveFile.Flags.WeirdStart))
{
Audio.PlaySound("snd_ominous.wav");
}
Room.current.DoMusic();
SaveFile.AddFlag(SaveFile.Flags.LuncherFought);
}
private IEnumerator BearingEvent()
{
TextSystem.GetText("BearingEvent1");
while (TextSystem.instance.Visible)
{
yield return null;
}
Party.Emoticon(Entity.Emoticons.Exclaim, noise: true);
Party.LookAt(Vector2.Up);
for (float a = 0f; a < 50f; a += Main.deltaTime)
{
yield return null;
}
Party.MoveTo(new Vector2[2]
{
objects[0].GlobalPosition,
objects[1].GlobalPosition
}, 1f, align: true, Entity.Direction.North);
Coroutine c = Coroutine.Start(CameraController.Pan(entities[0].GlobalPosition + Vector2.Down * 20f, 0.5f));
while (!Party.IsStopped())
{
yield return null;
}
while (!c.done)
{
yield return null;
}
Room.current.DoMusic(1);
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
if (SaveFile.HasFlag(SaveFile.Flags.WeirdedOnce))
{
TextSystem.GetText("BearingEventWeird");
}
else if (SaveFile.current.values[2] > SaveFile.current.values[1])
{
TextSystem.GetText("BearingEventFight");
}
else
{
TextSystem.GetText("BearingEventSpare");
}
while (TextSystem.instance.Visible)
{
yield return null;
}
TextSystem.GetText("BearingEvent2");
while (TextSystem.instance.Visible)
{
yield return null;
}
Coroutine.Start(BattleDR.StartBattle(null, useOWBG: true, new Entity.IDs[1] { Entity.IDs.Bearing }, new List<Entity> { entities[0] }, "Bearing", new Audio.AudioBlock
{
stream = Room.current.music[2]
}, quickIntro: true));
yield return null;
BattleDR.lastResult = BattleDR.EndState.Special;
while (!BattleDR.current.started)
{
yield return null;
}
while (BattleDR.current.started || GameOver.instance != null)
{
yield return null;
}
BattleDR.current.forceEnd = true;
BattleDR.EndState r = BattleDR.current.GetLastResult();
for (float a = 0f; a < 90f; a += Main.deltaTime)
{
yield return null;
}
Entity b = BattleDR.current.GetNode<Entity>("Bearing");
TextSystem.GetText("Bearing" + r);
if (r == BattleDR.EndState.Executed)
{
b.anim.Play("KO");
}
while (TextSystem.instance.Visible)
{
yield return null;
}
if (r == BattleDR.EndState.Executed)
{
b.anim.Play("KO2");
b.Shake(10f, 1f);
Audio.PlaySound("snd_break1.wav");
for (float a = 0f; a < 50f; a += Main.deltaTime)
{
yield return null;
}
c = Coroutine.Start(BattleDR.KillAnim(b));
while (!c.done)
{
yield return null;
}
for (float a = 0f; a < 30f; a += Main.deltaTime)
{
yield return null;
}
Party.AddBonus();
TextSystem.GetText("JusticeServed");
while (TextSystem.instance.Visible)
{
yield return null;
}
}
Coroutine.Start(BattleDR.current.FinalizeBattle());
while (BattleDR.current != null)
{
yield return null;
}
entities[0].currentAnim = Entity.Animations.ActDo;
switch (r)
{
case BattleDR.EndState.Apprehended:
entities[0].QueueFree();
SaveFile.AddFlag(SaveFile.Flags.BearingCaught);
SaveFile.AddFlag(SaveFile.Flags.BearingDefeated);
break;
case BattleDR.EndState.Executed:
SaveFile.current.values[10]--;
entities[0].QueueFree();
SaveFile.AddFlag(SaveFile.Flags.BearingDEAD);
SaveFile.AddFlag(SaveFile.Flags.BearingDefeated);
break;
case BattleDR.EndState.Spared:
if (!SaveFile.HasFlag(SaveFile.Flags.WeirdedOnce) && !SaveFile.HasFlag(SaveFile.Flags.FightMore))
{
SaveFile.AddFlag(SaveFile.Flags.BearingCaught);
SaveFile.AddFlag(SaveFile.Flags.BearingSpared);
SaveFile.current.flags.Remove(SaveFile.Flags.MagicDoorActive);
}
break;
}
for (float a = 0f; a < 60f; a += Main.deltaTime)
{
yield return null;
}
TextSystem.GetText("BearingPost" + r);
while (TextSystem.instance.Visible)
{
yield return null;
}
if (SaveFile.HasFlag(SaveFile.Flags.WeirdStart))
{
if (r == BattleDR.EndState.Executed)
{
Audio.PlaySound("snd_ominous.wav");
}
else
{
Audio.PlaySound("snd_ominous_cancel.wav");
SaveFile.current.flags.Remove(SaveFile.Flags.WeirdStart);
}
}
c = Coroutine.Start(CameraController.PanToObj(Player.instance, 0.5f));
while (!c.done)
{
yield return null;
}
Player.instance.ResetFollowStep();
}
private void OpenBridgePostKanako()
{
if (!SaveFile.HasFlag(SaveFile.Flags.AfterKanakoBridgeOpen))
{
SaveFile.AddFlag(SaveFile.Flags.AfterKanakoBridgeOpen);
CameraController.Shake(30f, 2f);
Audio.PlaySound("snd_impact_ch1.wav");
Room.current.eventPointers[1].QueueFree();
Main.SetActive(Room.current.eventPointers[0], state: true);
}
}
}