Skip to content

Commit 67cd2c2

Browse files
committed
tweaks galore
1 parent 0d62759 commit 67cd2c2

File tree

7 files changed

+106
-86
lines changed

7 files changed

+106
-86
lines changed

source/archipelago/APGameState.hx

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ class APGameState {
282282
function addSongs(song:Array<NetworkItem>)
283283
{
284284
var nonSongs:Map<String, Int> = [];
285+
var nonSongsNames:Array<String> = [];
285286
states.FreeplayState.curMissing.clear();
286287

287288

@@ -292,10 +293,11 @@ class APGameState {
292293
var itemName = info().get_item_name(songName.item);
293294

294295
if (APItems.exists(itemName) && APItems.get(itemName) == songName.item)
295-
{
296+
{
296297
nonSongs.set(itemName, songName.index);
298+
nonSongsNames.push(itemName);
297299
continue;
298-
}
300+
}
299301

300302
// Convert special keywords back to actual brackets
301303
itemName = itemName.replace("<cOpen>", "{")
@@ -381,29 +383,19 @@ class APGameState {
381383
}
382384
}
383385

384-
for (items in nonSongs.keys())
385-
{
386-
387-
if (nonSongs.get(items) <= ItemIndex)
388-
{
389-
continue;
390-
}
391-
else
392-
{
393-
if (haventranyet) {
394-
if (!trapList.contains(items)) {
395-
ItemIndex = nonSongs.get(items);
396-
archipelago.APItem.createItemByName(items);
397-
}
398-
} else {
399-
ItemIndex = nonSongs.get(items);
400-
archipelago.APItem.createItemByName(items);
386+
for (item in nonSongsNames) {
387+
trace(item);
388+
if (haventranyet) {
389+
if (!trapList.contains(item)) {
390+
ItemIndex = nonSongs.get(item);
391+
archipelago.APItem.createItemByName(item);
401392
}
393+
} else {
394+
ItemIndex = nonSongs.get(item);
395+
archipelago.APItem.createItemByName(item);
402396
}
403397
}
404-
if (!haventranyet) {
405-
archipelago.APItem.doCheck();
406-
}
398+
archipelago.APItem.doCheck();
407399
//haventranyet = false;
408400
isSync = false;
409401

source/archipelago/APItem.hx

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ConditionHelper {
2222
return condition.checkFn();
2323
}
2424
public static var Everywhere = ConditionHelper.create(function():Bool { return true; }, ConditionType.Everywhere);
25-
public static var PlayState = ConditionHelper.create(function():Bool { return Std.is(FlxG.state, states.PlayState); }, ConditionType.PlayState);
25+
public static var PlayState = ConditionHelper.create(function():Bool { return Std.is(FlxG.state, states.PlayState);}, ConditionType.PlayState);
2626
public static var Freeplay = ConditionHelper.create(function():Bool { return Std.is(FlxG.state, states.FreeplayState); }, ConditionType.Freeplay);
2727
}
2828

@@ -103,18 +103,15 @@ class APItem {
103103
this.isException = true;
104104
}
105105

106-
if (APGameState.isSync && this.toSync) {
107-
allItems.push(this); trace('Item to sync: ${this.name}');
108-
} else if (!APGameState.isSync) {
109-
allItems.push(this); trace('Item: ${this.name}');
110-
}
111-
106+
allItems.push(this);
112107
}
113108

114109
public static function popup(desc:String):Void {
115-
archipelago.ArchPopup.startPopupCustom("AP Item!", desc, "archColor", function() {
116-
FlxG.sound.playMusic(Paths.sound('secret'));
117-
});}
110+
if (!APGameState.haventranyet) {
111+
archipelago.ArchPopup.startPopupCustom("AP Item!", desc, "archColor", function() {
112+
FlxG.sound.playMusic(Paths.sound('secret'));});
113+
}
114+
}
118115

119116
public static function createItemByName(name:String):APItem {
120117
switch (name) {
@@ -123,6 +120,7 @@ class APItem {
123120
// Check if shields are available
124121
if (shields > 0) {
125122
shields--;
123+
ArchPopup.startPopupCustom("Death Avoided!", 'Shields left: $shields', "archWhite");
126124
return; // Do nothing else if shields are consumed
127125
}
128126

@@ -135,7 +133,7 @@ class APItem {
135133
// Wait for PlayState's startedCountdown to become active
136134
haxe.Timer.delay(function checkCountdown() {
137135
var playState:archipelago.APPlayState = cast states.PlayState.instance;
138-
if (playState != null && playState.startedCountdown) {
136+
if (playState != null && playState.startedCountdown && !playState.endingSong && !playState.paused) {
139137
// Call the die() function once the countdown has started
140138
// HOW AND WHY DOES THIS WORK THE WAY IT DOES???? - Yuta
141139
// Welcome back old friend - Z11
@@ -156,9 +154,31 @@ class APItem {
156154
archipelago.APInfo.ticketCount++;}
157155
);
158156
case "SvC Effect":
159-
return new APItem(name, ConditionHelper.PlayState, function() trace("SvC Effect triggered!"));
157+
return new APItem(name, ConditionHelper.PlayState, function() {
158+
// Wait for PlayState's startedCountdown to become active
159+
haxe.Timer.delay(function checkCountdown() {
160+
var playState:archipelago.APPlayState = cast states.PlayState.instance;
161+
if (playState != null && playState.startedCountdown && !playState.endingSong && !playState.paused) {
162+
APPlayState.instance.doEffect(APPlayState.instance.effectArray[APPlayState.instance.curEffect]);
163+
} else {
164+
// Retry after a short delay if countdown hasn't started
165+
haxe.Timer.delay(checkCountdown, 100);
166+
}
167+
}, 100);
168+
}, false, false);
160169
case "Ghost Chat":
161-
return new APItem(name, ConditionHelper.PlayState, function() trace("Ghost Chat triggered!"));
170+
return new APItem(name, ConditionHelper.PlayState, function() {
171+
// Wait for PlayState's startedCountdown to become active
172+
haxe.Timer.delay(function checkCountdown() {
173+
var playState:archipelago.APPlayState = cast states.PlayState.instance;
174+
if (playState != null && playState.startedCountdown && !playState.endingSong && !playState.paused) {
175+
APPlayState.instance.triggerGhostChat();
176+
} else {
177+
// Retry after a short delay if countdown hasn't started
178+
haxe.Timer.delay(checkCountdown, 100);
179+
}
180+
}, 100);
181+
}, false, false);
162182
case "Shield":
163183
return new APItem(name, ConditionHelper.Everywhere, function() {
164184
shields++;
@@ -172,7 +192,18 @@ class APItem {
172192
popup("You got a max HP up!");
173193
});
174194
case "Tutorial Trap":
175-
return new APItem(name, ConditionHelper.PlayState, function() trace("Tutorial Trap triggered!"), true);
195+
return new APItem(name, ConditionHelper.PlayState, function() {
196+
// Wait for PlayState's startedCountdown to become active
197+
haxe.Timer.delay(function checkCountdown() {
198+
var playState:archipelago.APPlayState = cast states.PlayState.instance;
199+
if (playState != null && playState.startedCountdown && !playState.endingSong && !playState.paused) {
200+
APPlayState.instance.doEffect('songSwitch');
201+
} else {
202+
// Retry after a short delay if countdown hasn't started
203+
haxe.Timer.delay(checkCountdown, 100);
204+
}
205+
}, 100);
206+
}, true, false);
176207
default:
177208
throw "Unknown item name: " + name;
178209
}

source/archipelago/APPlayState.hx

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import objects.playfields.PlayField;
2121

2222
using yutautil.Table;
2323
class APPlayState extends PlayState {
24+
public static var instance:APPlayState;
25+
2426
public static var apGame:APGameState;
2527
public static var deathByLink:Bool = false;
2628
public static var deathByBlueBalls:Bool = false;
@@ -73,7 +75,7 @@ class APPlayState extends PlayState {
7375
var picked:Int = 0;
7476
var wordList:Array<String> = [];
7577
var nonoLetters:String = "";
76-
var effectArray:Array<String> = [
78+
public var effectArray:Array<String> = [
7779
'colorblind', 'blur', 'lag', 'mine', 'warning', 'heal', 'spin', 'songslower', 'songfaster', 'scrollswitch', 'scrollfaster', 'scrollslower', 'rainbow',
7880
'cover', 'ghost', 'flashbang', 'nostrum', 'jackspam', 'spam', 'sever', 'shake', 'poison', 'dizzy', 'noise', 'flip', 'invuln',
7981
'desync', 'mute', 'ice', 'randomize', 'randomizeAlt', 'opponentPlay', 'bothplay', 'fakeheal', 'spell', 'terminate', 'lowpass', 'notif'
@@ -105,7 +107,7 @@ class APPlayState extends PlayState {
105107
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠉⠉⠉⠉⠈⠄⠄⠄⠄⠄⠄",
106108
"You know what that means, FISH!"
107109
];
108-
var curEffect:Int = 0;
110+
public var curEffect:Int = 0;
109111

110112
public var effectMap:Map<String, Void->Void>;
111113
var effectendsin:FlxText;
@@ -133,6 +135,7 @@ class APPlayState extends PlayState {
133135

134136
override public function create()
135137
{
138+
instance = this; // For traps and items
136139
if (APEntryState.inArchipelagoMode)
137140
{
138141
if (FlxG.save.data.activeItems != null)
@@ -1380,9 +1383,10 @@ effectMap = [
13801383
return true;
13811384
}
13821385

1383-
override function startSong()
1386+
// I feel bad for the poor soul that has this trigger on them multiple times
1387+
public function triggerGhostChat()
13841388
{
1385-
/*effectTimer.start(5, function(timer)
1389+
effectTimer.start(5, function(timer)
13861390
{
13871391
if (paused)
13881392
return;
@@ -1394,26 +1398,10 @@ effectMap = [
13941398

13951399
randoTimer.start(FlxG.random.float(5, 10), function(tmr:FlxTimer)
13961400
{
1397-
if (curEffect <= 38) doEffect(effectArray[curEffect]);
1398-
else if (curEffect > 38)
1399-
{
1400-
switch (curEffect)
1401-
{
1402-
case 38:
1403-
activeItems[0] += 1;
1404-
ArchPopup.startPopupCustom('You Got an Item!', '+1 Shield ( ' + activeItems[0] + ' Left)', 'archColor');
1405-
case 39:
1406-
activeItems[1] = 1;
1407-
ArchPopup.startPopupCustom('You Got an Item!', "Blue Ball's Curse", 'archWhite');
1408-
case 40:
1409-
activeItems[2] += 1;
1410-
MaxHP = 2+activeItems[2];
1411-
ArchPopup.startPopupCustom('You Got an Item!', "Max HP Up!", 'archColor');
1412-
}
1413-
}
1401+
doEffect(effectArray[curEffect]);
14141402
tmr.reset(FlxG.random.float(5, 10));
1415-
});*/
1416-
super.startSong();
1403+
});
1404+
trace("Ghost Chat Activated! L E T T H E C H A O S B E G I N !");
14171405
}
14181406

14191407
function addNonoLetters(keyBind:String) {
@@ -1446,9 +1434,8 @@ effectMap = [
14461434
var oldRate:Int = 60;
14471435
var noIcon:Bool = false;
14481436
var available:Array<Int> = [];
1449-
14501437

1451-
public function doEffect(effect:String)
1438+
public function doEffect(effect:String)
14521439
{
14531440
if (paused || endingSong) return;
14541441

@@ -1890,7 +1877,7 @@ public function doEffect(effect:String)
18901877
}
18911878
}*/
18921879
#end
1893-
curEffect = FlxG.random.int(0, 40);
1880+
curEffect = FlxG.random.int(0, 38);
18941881
if (isFrozen) boyfriend.stunned = true;
18951882
if (notes != null)
18961883
{

source/archipelago/console/MainTab.hx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,6 @@ class MainTab extends TabSprite {
145145
msgSprite.y = 0;
146146
if (msgSprite.y >= msgSprite.height)
147147
msgSprite.y = msgSprite.height;
148-
149-
for (message in messages) {
150-
message.visible = message.y <= info.y;
151-
}
152148
}
153149

154150
override function onShow() {

source/states/FreeplayState.hx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class FreeplayState extends MusicBeatState
325325
changeSelection();
326326

327327
if (APEntryState.apGame != null && APEntryState.apGame.info() != null) {
328-
ticketCounter = new FlxText(FlxG.width - 600, FlxG.height - 300, 0, "0/0", 32);
328+
ticketCounter = new FlxText(FlxG.width - 470, FlxG.height - 630, 0, "0/0", 32);
329329
ticketCounter.setFormat(Paths.font("fnf1.ttf"), 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
330330
ticketCounter.scrollFactor.set();
331331
add(ticketCounter);
@@ -630,12 +630,6 @@ class FreeplayState extends MusicBeatState
630630

631631
for (i in 0...songs.length)
632632
{
633-
634-
function isVictorySong(songName:String, modName:String):Bool {
635-
if (modName == null) modName = "";
636-
var locationId = songName;
637-
locationId += (modName.trim() != "") ? " (" + modName + ")" : "";
638-
return locationId.trim().toLowerCase().replace('-', ' ') == APEntryState.victorySong.trim().toLowerCase().replace('-', ' ');}
639633
var songName:String = '';
640634
var modName:String = '';
641635
var locationId:Array<Int> = [];
@@ -713,6 +707,13 @@ class FreeplayState extends MusicBeatState
713707
}
714708
}
715709

710+
function isVictorySong(songName:String, modName:String):Bool {
711+
if (modName == null) modName = "";
712+
var locationId = songName;
713+
locationId += (modName.trim() != "") ? " (" + modName + ")" : "";
714+
return locationId.trim().toLowerCase().replace('-', ' ') == APEntryState.victorySong.trim().toLowerCase().replace('-', ' ');
715+
}
716+
716717
var instPlaying:Int = -1;
717718
var trackPlaying:String = null;
718719
public static var vocals:FlxSound = null;
@@ -1138,7 +1139,22 @@ class FreeplayState extends MusicBeatState
11381139
return;
11391140
}
11401141

1141-
if (trueMissing.contains(songs[curSelected].songName) && !unplayedList.contains(songs[curSelected].songName)) {
1142+
//You need the song AND the tickets.
1143+
if (isVictorySong(songs[curSelected].songName, songs[curSelected].folder) && (APInfo.ticketWinCount - APInfo.ticketCount) == 0 && trueMissing.contains(songs[curSelected].songName) && !unplayedList.contains(songs[curSelected].songName)) {
1144+
FlxG.camera.shake(0.005, 0.5);
1145+
FlxG.sound.play(Paths.sound("badnoise"+FlxG.random.int(1,3)), 1);
1146+
grpSongs.forEach(function(item:FlxSprite)
1147+
{
1148+
if (item.ID == curSelected) FlxTween.color(item, 1, 0xffcc0002, 0xffffffff, {ease: FlxEase.sineIn});
1149+
});
1150+
grpLocks.forEach(function(item:FlxSprite)
1151+
{
1152+
if (item.ID == curSelected) FlxTween.color(item, 1, 0xffcc0002, 0xffffffff, {ease: FlxEase.sineIn});
1153+
});
1154+
FlxTween.color(ticketCounter, 1, 0xffcc0002, 0xffffffff, {ease: FlxEase.sineIn});
1155+
return;
1156+
}
1157+
else if (trueMissing.contains(songs[curSelected].songName) && !unplayedList.contains(songs[curSelected].songName)) {
11421158
FlxG.camera.shake(0.005, 0.5);
11431159
FlxG.sound.play(Paths.sound("badnoise"+FlxG.random.int(1,3)), 1);
11441160
grpSongs.forEach(function(item:FlxSprite)

source/states/MainMenuState.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ enum MainMenuColumn {
1717
class MainMenuState extends MusicBeatState
1818
{
1919
public static var psychEngineVersion:String = '1.0.3'; // This is also used for Discord RPC
20-
public static var mixtapeEngineVersion:String = '4.4.0'; // this is used for Discord RPC
20+
public static var mixtapeEngineVersion:String = '4.5.0'; // this is used for Discord RPC
2121
public static var curSelected:Int = 0;
2222
public static var curColumn:MainMenuColumn = CENTER;
2323
private var archButton:PsychUIButton;

0 commit comments

Comments
 (0)