Skip to content

Commit 255324e

Browse files
committed
items
1 parent f56c441 commit 255324e

File tree

7 files changed

+960
-972
lines changed

7 files changed

+960
-972
lines changed

source/archipelago/APGameState.hx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -386,14 +386,18 @@ class APGameState {
386386

387387
for (items in nonSongsNames)
388388
{
389-
if (nonSongs.get(items) <= ItemIndex)
390-
{
391-
continue;
392-
}
393-
else
394-
{
395-
ItemIndex = nonSongs.get(items);
396-
archipelago.APItem.createItemByName(items);
389+
if (items == 'ticket') archipelago.APItem.createItemByName(items);
390+
else {
391+
if (nonSongs.get(items) <= ItemIndex)
392+
{
393+
continue;
394+
}
395+
else
396+
{
397+
trace('triggering $items');
398+
ItemIndex = nonSongs.get(items);
399+
archipelago.APItem.createItemByName(items);
400+
}
397401
}
398402
}
399403
archipelago.APItem.doCheck();

source/archipelago/APItem.hx

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ class ConditionHelper {
1818
return { checkFn: check, type: type };
1919
}
2020

21-
public static inline function check(condition:Condition):Bool {
21+
public static inline function check(condition:Condition, item:APItem):Bool {
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) && !states.PlayState.instance.startingSong;}, ConditionType.PlayState);
2626
public static var Freeplay = ConditionHelper.create(function():Bool { return Std.is(FlxG.state, states.FreeplayState); }, ConditionType.Freeplay);
2727
}
2828

@@ -133,13 +133,12 @@ class APItem {
133133
// Wait for PlayState's startedCountdown to become active
134134
haxe.Timer.delay(function checkCountdown() {
135135
var playState:archipelago.APPlayState = cast states.PlayState.instance;
136-
if (playState != null && playState.startedCountdown && !playState.endingSong && !playState.paused) {
136+
if (playState != null && playState.startedCountdown) {
137137
// Call the die() function once the countdown has started
138-
// HOW AND WHY DOES THIS WORK THE WAY IT DOES???? - Yuta
139-
// Welcome back old friend - Z11
140-
backend.COD.COD.COD = "Killed by Blue Balls Curse.";
138+
// HOW AND WHY DOES THIS WORK THE WAY IT DOES???? - Yuta
139+
// Welcome back old friend - Z11
140+
backend.COD.COD.COD = "Killed by Blue Balls Curse.";
141141
archipelago.APPlayState.deathByBlueBalls = true;
142-
143142
playState.die();
144143
} else {
145144
// Retry after a short delay if countdown hasn't started
@@ -151,52 +150,30 @@ class APItem {
151150
return new APItem(name, ConditionHelper.Everywhere, function() TransitionState.fakeTransition({transitionType:"transparent close"}), true, false);
152151
case "Ticket":
153152
return new APItem(name, ConditionHelper.Everywhere, function() {popup("You got a ticket!");
154-
archipelago.APInfo.ticketCount++;}
155-
);
153+
archipelago.APInfo.ticketCount++;
154+
}, true, true);
156155
case "SvC Effect":
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);
156+
return new APItem(name, ConditionHelper.PlayState, function() APPlayState.instance.doEffect(APPlayState.instance.effectArray[APPlayState.instance.curEffect]), true, false);
169157
case "Ghost Chat":
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);
158+
return new APItem(name, ConditionHelper.PlayState, function() APPlayState.instance.triggerGhostChat(), true, false);
182159
case "Shield":
183160
return new APItem(name, ConditionHelper.Everywhere, function() {
184161
shields++;
185162
trace("Shield acquired! Current shields: " + shields);
186163
popup("You got a shield!");
187-
});
164+
}, true, true);
188165
case "Max HP Up":
189166
return new APItem(name, ConditionHelper.Everywhere, function() {
190167
maxHPUp++;
191168
trace("Max HP increased! Current max HP: " + maxHPUp);
192169
popup("You got a max HP up!");
193-
});
170+
}, true, true);
194171
case "Tutorial Trap":
195172
return new APItem(name, ConditionHelper.PlayState, function() {
196173
// Wait for PlayState's startedCountdown to become active
197174
haxe.Timer.delay(function checkCountdown() {
198175
var playState:archipelago.APPlayState = cast states.PlayState.instance;
199-
if (playState != null && playState.startedCountdown && !playState.endingSong && !playState.paused) {
176+
if (playState != null && playState.startedCountdown) {
200177
APPlayState.instance.doEffect('songSwitch');
201178
} else {
202179
// Retry after a short delay if countdown hasn't started
@@ -211,7 +188,8 @@ class APItem {
211188

212189
public function trigger():Void {
213190
trace('is Gonna Run Sync: ${APGameState.isSync}');
214-
if (APGameState.isSync && !this.toSync) {
191+
if (APInfo.ap.firstSync && this.toSync) {
192+
trace("RUNNING FIRST SYNC!");
215193
trace("Triggering item: " + this.name);
216194
trace("Is exception: " + this.isException);
217195
trace("Condition type: " + this.condition.type);
@@ -230,7 +208,8 @@ class APItem {
230208
} else {
231209
trace("Condition failed, onTrigger not executed for item: " + this.name);
232210
}
233-
} else if (!APGameState.isSync) {
211+
} else if (!APInfo.ap.firstSync) {
212+
trace("RUNNING NORMAL SYNC!");
234213
trace("Triggering item: " + this.name);
235214
trace("Is exception: " + this.isException);
236215
trace("Condition type: " + this.condition.type);

0 commit comments

Comments
 (0)