Skip to content

Commit e854ab7

Browse files
committed
e
1 parent 7ce2f32 commit e854ab7

File tree

6 files changed

+54
-6
lines changed

6 files changed

+54
-6
lines changed

source/archipelago/APInfo.hx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ abstract APSlotData(APSlotDataType) from APSlotDataType to APSlotDataType {
8888
return Reflect.hasField(this, key);
8989
}
9090
}
91+
92+
enum APMinigame {
93+
None;
94+
Uno;
95+
Pong;
96+
}
97+
9198
class APInfo {
9299
public static var ap:Client;
93100
public static var apGame:APGameState;
@@ -105,6 +112,12 @@ class APInfo {
105112
public static var hasSongChecks(get, never):Bool;
106113
public static var hintPoints(get, never):Int;
107114
public static var hintCost(get, never):Int;
115+
public static var inMinigame:APMinigame = None;
116+
117+
public static var inSongTrap(get, never):Bool;
118+
public static function get_inSongTrap():Bool {
119+
return FlxG.save.data.manualOverride == true;
120+
}
108121

109122
public static var slotData(get, never):APSlotData;
110123
public static function get_slotData():APSlotData {

source/archipelago/APItem.hx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,12 @@ class APItem {
322322
t.isTrap = true;
323323
});
324324
case "UNO Challenge":
325-
return new APTrap(name, ConditionHelper.Everywhere(), function() {
325+
return new APTrap(name, ConditionHelper.Everywhere().funcAndReturn(function(c) {
326+
c.extraConditions = [];
327+
c.extraConditions.push(function(e) {
328+
return archipelago.APInfo.inMinigame == archipelago.APInfo.APMinigame.None;
329+
});
330+
}), function() {
326331
popup('Win the round to survive!', "APItem: UNO Challenge", true);
327332
if (MusicBeatState.getState() == APPlayState.instance) {
328333
APPlayState.instance.paused = true;
@@ -331,6 +336,7 @@ class APItem {
331336
LoadingState.noteCache = [];
332337
states.PlayState.curChart = [];
333338
MusicBeatState.allowNuke = true;
339+
archipelago.APInfo.inMinigame = archipelago.APInfo.APMinigame.Uno;
334340
}
335341
FlxG.switchState(new archipelago.traps.games.APUnoTrapState(MusicBeatState.getState()));
336342
}, true, false).funcAndReturn(function(t:APItem) {
@@ -1721,7 +1727,12 @@ class APPongTrap extends APTrap {
17211727
// If no difficulty specified, use random 1-3 (reasonable range)
17221728
this.difficulty = difficulty != null ? difficulty : (1 + Std.random(3));
17231729

1724-
super("Pong Challenge (" + getDifficultyName(this.difficulty) + ")", ConditionHelper.Everywhere(), function() {
1730+
super("Pong Challenge (" + getDifficultyName(this.difficulty) + ")", ConditionHelper.Everywhere().funcAndReturn(function(c) {
1731+
c.extraConditions = [];
1732+
c.extraConditions.push(function(e) {
1733+
return archipelago.APInfo.inMinigame == archipelago.APInfo.APMinigame.None;
1734+
});
1735+
}), function() {
17251736
// If already in a pong trap, queue this difficulty
17261737
if (activeTrapState != null) {
17271738
difficultyQueue.push(this.difficulty);
@@ -1734,6 +1745,7 @@ class APPongTrap extends APTrap {
17341745
if (Std.isOfType(currentState, MusicBeatState)) {
17351746
var previousState = cast(currentState, MusicBeatState);
17361747
activeTrapState = new archipelago.traps.games.APPongTrapState(previousState, this.difficulty);
1748+
archipelago.APInfo.inMinigame = archipelago.APInfo.APMinigame.Pong;
17371749
MusicBeatState.switchState(activeTrapState);
17381750
APItem.popup("Pong Challenge (" + getDifficultyName(this.difficulty) + ") activated!");
17391751
}

source/archipelago/APPlayState.hx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,22 @@ class APPlayState extends PlayState {
186186
return;
187187
}
188188

189+
if (archipelago.APInfo.inMinigame != None)
190+
{
191+
switch (archipelago.APInfo.inMinigame) {
192+
case Uno:
193+
FlxG.switchState(new archipelago.traps.games.APUnoTrapState());
194+
return;
195+
case Pong:
196+
FlxG.switchState(new archipelago.traps.games.APPongTrapState());
197+
return;
198+
case None:
199+
}
200+
}
201+
{
202+
203+
}
204+
189205
MaxHP += archipelago.APItem.maxHPUp / 2;
190206

191207
for (func in updateFunctions)

source/states/freeplay/FreeplayState.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ class FreeplayState extends MusicBeatState
431431
}
432432
}
433433

434-
if (!APFreeplayManager.unplayedList.contains(songName) && isMissing) {
434+
if (!APFreeplayManager.unplayedList.contains({song: songName, mod: modName}) && isMissing) {
435435
color = someLocationsNotMissing ? FlxColor.GRAY : FlxColor.WHITE;
436436
}
437437
}
@@ -472,7 +472,7 @@ class FreeplayState extends MusicBeatState
472472

473473
songText.visible = songText.active = songText.isMenuItem = false;
474474

475-
var isLock:Bool = APEntryState.inArchipelagoMode && CategoryState.loadWeekForce == "all" && isMissing && !APFreeplayManager.unplayedList.contains(songName);
475+
var isLock:Bool = APEntryState.inArchipelagoMode && CategoryState.loadWeekForce == "all" && isMissing && !APFreeplayManager.unplayedList.contains({song: songName, mod: modName}) && !someLocationsNotMissing;
476476
var iconName = isLock ? "lock" : (archipelago.APItem.unknownSongs ? "face" : fpManager.songList[i].songCharacter);
477477
var icon:HealthIcon = new HealthIcon(iconName);
478478
icon.sprTracker = songText;

source/states/freeplay/OsuFreeplayState.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ class OsuFreeplayState extends MusicBeatState
695695
}
696696
}
697697

698-
if (!APFreeplayManager.unplayedList.contains(songName) && isMissing) {
698+
if (!APFreeplayManager.unplayedList.contains({song: songName, mod: modName}) && isMissing) {
699699
color = someLocationsNotMissing ? FlxColor.GRAY : FlxColor.WHITE;
700700
}
701701
}
@@ -722,7 +722,7 @@ class OsuFreeplayState extends MusicBeatState
722722
songBox.ID = i;
723723
this.songBox.add(songBox);
724724

725-
var isLock:Bool = APEntryState.inArchipelagoMode && CategoryState.loadWeekForce == "all" && isMissing && !APFreeplayManager.unplayedList.contains(songName);
725+
var isLock:Bool = APEntryState.inArchipelagoMode && CategoryState.loadWeekForce == "all" && isMissing && !APFreeplayManager.unplayedList.contains({song: songName, mod: modName});
726726
var iconName = isLock ? "lock" : (APEntryState.inArchipelagoMode && archipelago.APItem.unknownSongs ? "face" : fpManager.songList[i].songCharacter);
727727
var icon:HealthIcon = new HealthIcon(iconName, false);
728728
icon.setPosition(320, 100);

source/substates/PauseSubState.hx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class PauseSubState extends MusicBeatSubstate
6868

6969
override function create()
7070
{
71+
7172
if(Difficulty.list.length < 2) menuItemsOG.remove('Change Difficulty'); //No need to change difficulty if there is only one!
7273
if(PlayState.chartingMode)
7374
{
@@ -88,6 +89,12 @@ class PauseSubState extends MusicBeatSubstate
8889
if (archipelago.APEntryState.inArchipelagoMode)
8990
menuItemsOG.insert(3, 'Skip Check');
9091

92+
if (archipelago.APEntryState.inArchipelagoMode && archipelago.APInfo.inSongTrap)
93+
{
94+
menuItemsOG.remove('Exit to menu');
95+
menuItemsOG.remove('Skip Check');
96+
}
97+
9198
for (i in 0...Difficulty.list.length) {
9299
var diff:String = Difficulty.getString(i);
93100
difficultyChoices.push(diff);

0 commit comments

Comments
 (0)