Skip to content

Commit d8c8ef1

Browse files
committed
a
1 parent f862926 commit d8c8ef1

File tree

7 files changed

+505
-78
lines changed

7 files changed

+505
-78
lines changed

source/archipelago/APEntryState.hx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,8 @@ class APEntryState extends MusicBeatState
418418
deathLink = slotData.deathlink == 0 ? false : true;
419419
victorySong = slotData.victoryLocation;
420420
fullSongCount = slotData.fullSongCount;
421-
try { APInfo.ticketCount = slotData.ticketCount;
422-
APInfo.ticketWinCount = slotData.ticketWinCount;}
423-
catch(e) { APInfo.ticketCount = slotData.ticketCount;
424-
APInfo.ticketWinCount = -1;}
425-
426-
APInfo.ticketCount = 0;
421+
APInfo.ticketWinCount = slotData.ticketWinCount;
422+
APInfo.ticketCount = 0;
427423
closeSubState();
428424
inArchipelagoMode = true;
429425
var FNF = new FlxSave();

source/archipelago/APGameState.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class APGameState {
288288

289289
for (songName in song)
290290
{
291-
trace(ItemIndex + " - " + songName.index);
291+
//trace(ItemIndex + " - " + songName.index);
292292

293293
var itemName = info().get_item_name(songName.item);
294294

@@ -386,7 +386,7 @@ class APGameState {
386386

387387
for (items in nonSongsNames)
388388
{
389-
if (items == 'ticket') archipelago.APItem.createItemByName(items);
389+
if (items == 'Ticket') archipelago.APItem.createItemByName(items);
390390
else {
391391
if (nonSongs.get(items) <= ItemIndex)
392392
{

source/archipelago/APItem.hx

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ class APItem {
113113
allItems.push(this);
114114
}
115115

116-
public static function popup(desc:String):Void {
116+
public static function popup(desc:String, ?title:String, ?isWhite:Bool = false):Void {
117117
if (!APGameState.haventranyet) {
118-
archipelago.ArchPopup.startPopupCustom("AP Item!", desc, "archColor", function() {
118+
archipelago.ArchPopup.startPopupCustom(title != null ? title : "AP Item!", desc, !isWhite ? "archColor" : "archWhite", function() {
119119
FlxG.sound.playMusic(Paths.sound('secret'));});
120120
}
121121
}
@@ -127,12 +127,13 @@ class APItem {
127127
// Check if shields are available
128128
if (shields > 0) {
129129
shields--;
130-
ArchPopup.startPopupCustom("Death Avoided!", 'Shields left: $shields', "archWhite");
130+
popup('Shields left: $shields', "Death Avoided!", true);
131131
return; // Do nothing else if shields are consumed
132132
}
133133

134134
// Ensure we are in APPlayState
135135
if (!Std.is(FlxG.state, archipelago.APPlayState)) {
136+
popup('Unfortunate...', "APItem: Blue Balls Curse (Trap)", true);
136137
// Switch to APPlayState if not already there
137138
FlxG.switchState(new archipelago.APPlayState());
138139
}
@@ -156,88 +157,95 @@ class APItem {
156157
case "Fake Transition":
157158
return new APItem(name, ConditionHelper.Everywhere(), function() TransitionState.fakeTransition({transitionType:"transparent close"}), true, false);
158159
case "Ticket":
159-
return new APItem(name, ConditionHelper.Everywhere(), function() {popup("You got a ticket!");
160+
return new APItem(name, ConditionHelper.Everywhere(), function() {popup("One step closer...", "You got a ticket!");
160161
archipelago.APInfo.ticketCount++;
161162
}, true, true);
162163
case "SvC Effect":
163-
return new APItem(name, ConditionHelper.PlayState(), function() APPlayState.instance.doEffect(APPlayState.instance.effectArray[APPlayState.instance.curEffect]), true, false);
164+
return new APItem(name, ConditionHelper.PlayState(), function() {
165+
APPlayState.instance.doEffect(APPlayState.instance.effectArray[APPlayState.instance.curEffect]);
166+
popup('Effect: ${APPlayState.instance.effectArray[APPlayState.instance.curEffect]}', "APItem: SvC Effect (Trap)", true);
167+
}, true, false);
164168
case "Ghost Chat":
165-
return new APItem(name, ConditionHelper.PlayState(), function() APPlayState.instance.triggerGhostChat(), true, false);
169+
return new APItem(name, ConditionHelper.PlayState(), function() {
170+
APPlayState.instance.triggerGhostChat();
171+
popup('I wish you luck...', "APItem: SvC Effect (Trap)", true);
172+
}, true, false);
166173
case "Shield":
167174
return new APItem(name, ConditionHelper.Everywhere(), function() {
168175
shields++;
169176
trace("Shield acquired! Current shields: " + shields);
170-
popup("You got a shield!");
177+
popup('Shields left: $shields', "APItem: Shield");
171178
}, true, true);
172179
case "Max HP Up":
173180
return new APItem(name, ConditionHelper.Everywhere(), function() {
174181
maxHPUp++;
175182
trace("Max HP increased! Current max HP: " + maxHPUp);
176-
popup("You got a max HP up!");
183+
popup('Current Max HP: +$maxHPUp', "APItem: Max HP Increase");
177184
}, true, true);
178185
case "Tutorial Trap":
179186
return new APItem(name, ConditionHelper.PlayState(), function() {
180187
// Wait for PlayState's startedCountdown to become active
181188
haxe.Timer.delay(function checkCountdown() {
182189
var playState:archipelago.APPlayState = cast states.PlayState.instance;
183190
if (playState != null && playState.startedCountdown) {
191+
popup('Go relearn the basics and then come back.', "APItem: Tutorial (trap)");
184192
APPlayState.instance.doEffect('songSwitch');
185193
} else {
186194
// Retry after a short delay if countdown hasn't started
187195
haxe.Timer.delay(checkCountdown, 100);
188196
}
189197
}, 100);
190-
}, true, false);
198+
}, false, false);
191199
default:
192200
throw "Unknown item name: " + name;
193201
}
194202
}
195203

196204
public function trigger():Void {
197-
trace('is Gonna Run Sync: ${APGameState.isSync}');
205+
//trace('is Gonna Run Sync: ${APGameState.isSync}');
198206
if (APInfo.ap.firstSync && this.toSync) {
199-
trace("RUNNING FIRST SYNC!");
200-
trace("Triggering item: " + this.name);
201-
trace("Is exception: " + this.isException);
202-
trace("Condition type: " + this.condition.type);
203-
trace("Condition check result: " + this.condition.checkFn(this));
207+
//trace("RUNNING FIRST SYNC!");
208+
//trace("Triggering item: " + this.name);
209+
//trace("Is exception: " + this.isException);
210+
//trace("Condition type: " + this.condition.type);
211+
//trace("Condition check result: " + this.condition.checkFn(this));
204212

205213
if (!this.isException && this.condition.type != ConditionType.Everywhere && this.condition.checkFn(this)) {
206-
trace("Setting active item to: " + this.name);
214+
//trace("Setting active item to: " + this.name);
207215
APItem.activeItem = this;
208216
} else {
209-
trace("Active item not set due to condition, exception rules, or being an Everywhere item.");
217+
//trace("Active item not set due to condition, exception rules, or being an Everywhere item.");
210218
}
211219

212220
if (this.condition.checkFn(this)) {
213-
trace("Condition passed, executing onTrigger for item: " + this.name);
221+
//trace("Condition passed, executing onTrigger for item: " + this.name);
214222
onTrigger();
215223
} else {
216-
trace("Condition failed, onTrigger not executed for item: " + this.name);
224+
//trace("Condition failed, onTrigger not executed for item: " + this.name);
217225
}
218226
} else if (!APInfo.ap.firstSync) {
219-
trace("RUNNING NORMAL SYNC!");
220-
trace("Triggering item: " + this.name);
221-
trace("Is exception: " + this.isException);
222-
trace("Condition type: " + this.condition.type);
223-
trace("Condition check result: " + this.condition.checkFn(this));
227+
//trace("RUNNING NORMAL SYNC!");
228+
//trace("Triggering item: " + this.name);
229+
//trace("Is exception: " + this.isException);
230+
// trace("Condition type: " + this.condition.type);
231+
// trace("Condition check result: " + this.condition.checkFn(this));
224232

225233
if (!this.isException && this.condition.type != ConditionType.Everywhere && this.condition.checkFn(this)) {
226-
trace("Setting active item to: " + this.name);
234+
//trace("Setting active item to: " + this.name);
227235
APItem.activeItem = this;
228236
} else {
229-
trace("Active item not set due to condition, exception rules, or being an Everywhere item.");
237+
//trace("Active item not set due to condition, exception rules, or being an Everywhere item.");
230238
}
231239

232240
if (this.condition.checkFn(this)) {
233-
trace("Condition passed, executing onTrigger for item: " + this.name);
241+
//trace("Condition passed, executing onTrigger for item: " + this.name);
234242
onTrigger();
235243
} else {
236-
trace("Condition failed, onTrigger not executed for item: " + this.name);
244+
//trace("Condition failed, onTrigger not executed for item: " + this.name);
237245
}
238246
}
239247

240-
trace("Removing item from allItems: " + this.name);
248+
//trace("Removing item from allItems: " + this.name);
241249
allItems.remove(this);
242250
}
243251

source/archipelago/APPlayState.hx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2076,7 +2076,8 @@ class APPlayState extends PlayState {
20762076

20772077
super.endSong();
20782078
paused = true;
2079-
states.FreeplayState.callVictory = PlayState.SONG.song == APEntryState.victorySong;
2079+
states.FreeplayState.lastSongPlayed = PlayState.SONG.song;
2080+
states.FreeplayState.lastModPlayed = currentMod;
20802081
openSubState(new substates.RankingSubstate());
20812082
return true; //why does endsong need this?????
20822083
}

source/backend/TransitionState.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ class TransitionState {
503503
{
504504
restoreSprites();
505505
CppAPI.setWindowOppacity(1);
506+
archipelago.ArchPopup.startPopupCustom("APItem: Fake Transition (Trap)", 'Gotcha!', "archWhite");
506507
}},
507508
function(num)
508509
{

source/states/FreeplayState.hx

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ import backend.Song;
88
import objects.HealthIcon;
99
import objects.MusicPlayer;
1010

11-
import archipelago.ArchPopup;
12-
import archipelago.APEntryState;
13-
import archipelago.APInfo;
14-
11+
import archipelago.*;
12+
import archipelago.PacketTypes.ClientStatus;
1513
//import states.editors.ChartingStateOG;
1614

1715
import flixel.addons.ui.FlxUIInputText;
@@ -25,7 +23,6 @@ import flixel.ui.FlxButton;
2523
import flixel.input.keyboard.FlxKey;
2624
import flixel.util.FlxDestroyUtil;
2725
import haxe.Json;
28-
import archipelago.PacketTypes.ClientStatus;
2926
import yutautil.ChanceSelector;
3027
import yutautil.ChanceSelector.Chance;
3128

@@ -102,6 +99,9 @@ class FreeplayState extends MusicBeatState
10299
var listChoices:Array<String> = [];
103100
var multiSongs:Array<String> = [];
104101

102+
public static var lastSongPlayed:String = "";
103+
public static var lastModPlayed:String = "";
104+
105105
public static var curUnlocked:Map<String, String> = new Map<String, String>();
106106
public static var curMissing:Map<String, String> = new Map<String, String>();
107107
public static var trueMissing:Array<String> = [];
@@ -134,19 +134,12 @@ class FreeplayState extends MusicBeatState
134134
if (APEntryState.apGame != null && APEntryState.apGame.info() != null && APEntryState.gonnaRunSync) {
135135
APEntryState.apGame.info().Sync();
136136
APEntryState.gonnaRunSync = false;
137+
APPlayState.deathByBlueBalls = false;
138+
}
137139

138-
function getLastParenthesesContent(input:String):String {
139-
var lastParenIndex = input.lastIndexOf("(");
140-
if (lastParenIndex != -1) {
141-
var endIndex = input.indexOf(")", lastParenIndex);
142-
if (endIndex != -1) {
143-
return input.substring(lastParenIndex + 1, endIndex);
144-
}
145-
}
146-
return "";
147-
}
148-
149-
if (curUnlocked.exists(APEntryState.victorySong.trim().toLowerCase().replace('-', ' ')) && callVictory)
140+
if (APEntryState.inArchipelagoMode) {
141+
trace('Last song: $lastSongPlayed\nFrom Mod: $lastModPlayed\nIs victory: ${isVictorySong(lastSongPlayed, lastModPlayed)}');
142+
if (isVictorySong(lastSongPlayed, lastModPlayed))
150143
{
151144
trace("GOAL COMPLETE");
152145
callVictory = false;
@@ -590,44 +583,52 @@ class FreeplayState extends MusicBeatState
590583
{
591584
if (refresh)
592585
{
593-
for (songName in (CategoryState.loadWeekForce == "unplayed" ? curMissing : curUnlocked).keys()) {
594-
if (songName.trim().toLowerCase().replace('-', ' ') == 'small argument'.trim().toLowerCase().replace('-', ' ') && (CategoryState.loadWeekForce == "unplayed" ? curMissing : curUnlocked).get(songName) == '')
595-
addSong('Small Argument', 0, "gfchibi", FlxColor.fromRGB(235, 100, 161));
596-
if (songName.trim().toLowerCase().replace('-', ' ') == 'beat battle'.trim().toLowerCase().replace('-', ' ') && (CategoryState.loadWeekForce == "unplayed" ? curMissing : curUnlocked).get(songName) == '')
597-
addSong('Beat Battle', 0, "gf", FlxColor.fromRGB(165, 0, 77));
598-
if (songName.trim().toLowerCase().replace('-', ' ') == 'beat battle 2'.trim().toLowerCase().replace('-', ' ') && (CategoryState.loadWeekForce == "unplayed" ? curMissing : curUnlocked).get(songName) == '')
599-
addSong('Beat Battle 2', 0, "gf", FlxColor.fromRGB(165, 0, 77));
586+
if (CategoryState.loadWeekForce == "all"){
587+
//Add them to Wekk 7 so they're below that week
588+
addSong('Small Argument', 7, "gfchibi", FlxColor.fromRGB(235, 100, 161));
589+
addSong('Beat Battle', 7, "gf", FlxColor.fromRGB(165, 0, 77));
590+
addSong('Beat Battle 2', 7, "gf", FlxColor.fromRGB(165, 0, 77));
591+
}
592+
else {
593+
for (songName in curUnlocked.keys()) {
594+
if (songName.trim().toLowerCase().replace('-', ' ') == 'small argument'.trim().toLowerCase().replace('-', ' ') && curUnlocked.get(songName) == '')
595+
addSong('Small Argument', 7, "gfchibi", FlxColor.fromRGB(235, 100, 161));
596+
if (songName.trim().toLowerCase().replace('-', ' ') == 'beat battle'.trim().toLowerCase().replace('-', ' ') && curUnlocked.get(songName) == '')
597+
addSong('Beat Battle', 7, "gf", FlxColor.fromRGB(165, 0, 77));
598+
if (songName.trim().toLowerCase().replace('-', ' ') == 'beat battle 2'.trim().toLowerCase().replace('-', ' ') && curUnlocked.get(songName) == '')
599+
addSong('Beat Battle 2', 7, "gf", FlxColor.fromRGB(165, 0, 77));
600+
}
600601
}
601602
}
602603
else
603604
{
604-
if ((CategoryState.loadWeekForce == "unplayed" ? curMissing : curUnlocked).exists('Small Argument'.toLowerCase()) && Std.string('Small Argument').toLowerCase().trim().contains(searchBar.text.toLowerCase().trim()) && FlxG.save.data.gotIntoAnArgument && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
605-
addSong('Small Argument', 0, "gfchibi", FlxColor.fromRGB(235, 100, 161));
606-
if ((CategoryState.loadWeekForce == "unplayed" ? curMissing : curUnlocked).exists('Beat Battle'.toLowerCase()) && Std.string('Beat Battle').toLowerCase().trim().contains(searchBar.text.toLowerCase().trim()) && FlxG.save.data.gotbeatbattle && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
607-
addSong('Beat Battle', 0, "gf", FlxColor.fromRGB(165, 0, 77));
608-
if ((CategoryState.loadWeekForce == "unplayed" ? curMissing : curUnlocked).exists('Beat Battle 2'.toLowerCase()) && Std.string('Beat Battle 2').toLowerCase().trim().contains(searchBar.text.toLowerCase().trim()) && FlxG.save.data.gotbeatbattle2 && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
609-
addSong('Beat Battle 2', 0, "gf", FlxColor.fromRGB(165, 0, 77));
605+
if (curUnlocked.exists('Small Argument'.toLowerCase()) && Std.string('Small Argument').toLowerCase().trim().contains(searchBar.text.toLowerCase().trim()) && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
606+
addSong('Small Argument', 7, "gfchibi", FlxColor.fromRGB(235, 100, 161));
607+
if (curUnlocked.exists('Beat Battle'.toLowerCase()) && Std.string('Beat Battle').toLowerCase().trim().contains(searchBar.text.toLowerCase().trim()) && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
608+
addSong('Beat Battle', 7, "gf", FlxColor.fromRGB(165, 0, 77));
609+
if (curUnlocked.exists('Beat Battle 2'.toLowerCase()) && Std.string('Beat Battle 2').toLowerCase().trim().contains(searchBar.text.toLowerCase().trim()) && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
610+
addSong('Beat Battle 2', 7, "gf", FlxColor.fromRGB(165, 0, 77));
610611
}
611612
}
612613
else
613614
{
614615
if (refresh)
615616
{
616617
if (FlxG.save.data.gotIntoAnArgument && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
617-
addSong('Small Argument', 0, "gfchibi", FlxColor.fromRGB(235, 100, 161));
618+
addSong('Small Argument', 7, "gfchibi", FlxColor.fromRGB(235, 100, 161));
618619
if (FlxG.save.data.gotbeatbattle && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
619-
addSong('Beat Battle', 0, "gf", FlxColor.fromRGB(165, 0, 77));
620+
addSong('Beat Battle', 7, "gf", FlxColor.fromRGB(165, 0, 77));
620621
if (FlxG.save.data.gotbeatbattle2 && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
621-
addSong('Beat Battle 2', 0, "gf", FlxColor.fromRGB(165, 0, 77));
622+
addSong('Beat Battle 2', 7, "gf", FlxColor.fromRGB(165, 0, 77));
622623
}
623624
else
624625
{
625626
if (Std.string('Small Argument').toLowerCase().trim().contains(searchBar.text.toLowerCase().trim()) && FlxG.save.data.gotIntoAnArgument && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
626-
addSong('Small Argument', 0, "gfchibi", FlxColor.fromRGB(235, 100, 161));
627+
addSong('Small Argument', 7, "gfchibi", FlxColor.fromRGB(235, 100, 161));
627628
if (Std.string('Beat Battle').toLowerCase().trim().contains(searchBar.text.toLowerCase().trim()) && FlxG.save.data.gotbeatbattle && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
628-
addSong('Beat Battle', 0, "gf", FlxColor.fromRGB(165, 0, 77));
629+
addSong('Beat Battle', 7, "gf", FlxColor.fromRGB(165, 0, 77));
629630
if (Std.string('Beat Battle 2').toLowerCase().trim().contains(searchBar.text.toLowerCase().trim()) && FlxG.save.data.gotbeatbattle2 && (CategoryState.loadWeekForce == "secrets" || CategoryState.loadWeekForce == "all"))
630-
addSong('Beat Battle 2', 0, "gf", FlxColor.fromRGB(165, 0, 77));
631+
addSong('Beat Battle 2', 7, "gf", FlxColor.fromRGB(165, 0, 77));
631632
}
632633
}
633634

@@ -1141,7 +1142,7 @@ class FreeplayState extends MusicBeatState
11411142
return;
11421143
}
11431144

1144-
var vicCheck:Bool = isVictorySong(songs[curSelected].songName, songs[curSelected].folder) && APInfo.ticketWinCount - APInfo.ticketCount == 0;
1145+
var vicCheck:Bool = isVictorySong(songs[curSelected].songName, songs[curSelected].folder) && APInfo.ticketWinCount - APInfo.ticketCount <= 0; //in case you go over and beyon getting the tickets you need
11451146
//You need the song AND the tickets.
11461147
trace('can play victory song: ${vicCheck}');
11471148
if (isVictorySong(songs[curSelected].songName, songs[curSelected].folder) && !vicCheck) {

0 commit comments

Comments
 (0)