Skip to content

Commit a739ee7

Browse files
committed
Womp.
1 parent f63b685 commit a739ee7

File tree

3 files changed

+46
-20
lines changed

3 files changed

+46
-20
lines changed

source/archipelago/APGameState.hx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ class APGameState {
544544
// }
545545
// });
546546

547+
547548
for (item in nonSongsNames) {
548549
if (item == "Ticket") {
549550
tickets++;
@@ -582,8 +583,11 @@ class APGameState {
582583
} catch (e:Dynamic) {
583584
archipelago.APItem.popup("Error", "You need to wait for all of the data to load, silly!", true);
584585
}
585-
if (AprilFools.allowAF && FlxG.random.bool(4.444))
586-
new APItem.APrilFools();
586+
587+
588+
// if (AprilFools.allowAF && FlxG.random.bool(50))
589+
// new APItem.APrilFools(); // Not working as intended, for some reason.
590+
587591

588592
}
589593

source/archipelago/APItem.hx

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,14 @@ class APItem {
254254
//trace("Condition type: " + this.condition.type);
255255
//trace("Condition check result: " + this.condition.checkFn(this));
256256

257-
if (!this.isException && this.condition.type != ConditionType.Everywhere && this.condition.checkFn(this) && APItem.allowedToTrigger) {
257+
if (!this.isException && (this.condition.type != ConditionType.Everywhere) && this.condition.checkFn(this) && APItem.allowedToTrigger) {
258258
//trace("Setting active item to: " + this.name);
259259
APItem.activeItem = this;
260260
} else {
261261
//trace("Active item not set due to condition, exception rules, or being an Everywhere item.");
262262
}
263263

264-
if (this.condition.checkFn(this)) {
264+
if (this.condition.checkFn(this) && APItem.allowedToTrigger) {
265265
//trace("Condition passed, executing onTrigger for item: " + this.name);
266266
onTrigger();
267267
allItems.remove(this);
@@ -282,7 +282,7 @@ class APItem {
282282
//trace("Active item not set due to condition, exception rules, or being an Everywhere item.");
283283
}
284284

285-
if (this.condition.checkFn(this)) {
285+
if (this.condition.checkFn(this) && APItem.allowedToTrigger) {
286286
//trace("Condition passed, executing onTrigger for item: " + this.name);
287287
onTrigger();
288288
allItems.remove(this);
@@ -372,6 +372,8 @@ class APChartModifier extends APItem {
372372
}
373373
class APrilFools extends APItem {
374374
private static var options:Map<Int, Void->Void> = new Map();
375+
private static var initialized:Bool = false;
376+
private var triggered:Bool = false;
375377

376378
static function initializeOptions():Void {
377379
options.set(0, function() {
@@ -614,20 +616,40 @@ class APrilFools extends APItem {
614616

615617
}
616618

617-
public function new() {
618-
super("April Fools", ConditionHelper.Special(), function() {
619-
if (options.lengthTo() == 0) {
620-
initializeOptions();
621-
APItem.popup("Something odd is brewing.", "Archipelago", true);
622-
}
619+
public override function trigger():Void {
620+
if (triggered) {
621+
return; // Prevent multiple triggers
622+
}
623+
triggered = true; // Set triggered to true to prevent multiple triggers
624+
super.trigger();
625+
//trace("April Fools item triggered.");
626+
}
623627

628+
public function new() {
629+
super("April Fools", ConditionHelper.Special(), function() {
630+
// trace("April Fools item triggered.");
631+
if (!initialized) {
632+
initialized = true;
633+
trace("Initializing options for April Fools.");
634+
initializeOptions();
635+
APItem.popup("Something odd is brewing.", "Archipelago", true);
636+
}
624637

625-
var randomChoice = Std.random(options.lengthTo());
626-
var action = options.get(randomChoice);
627-
if (action != null) {
628-
action();
629-
APItem.popup("Something happened...", "Archipelago", true);
630-
}
631-
}, false, false);
638+
var optionss:Int = 0;
639+
for (o in options.keys()) {
640+
optionss++;
641+
}
642+
643+
var randomChoice = Std.random(optionss);
644+
// trace("Random choice selected: " + randomChoice);
645+
var action = options.get(randomChoice);
646+
if (action != null) {
647+
// trace("Executing action for choice: " + randomChoice);
648+
action();
649+
APItem.popup("Something happened...", "Archipelago", true);
650+
} else {
651+
// trace("No action found for choice: " + randomChoice);
652+
}
653+
}, false, false);
654+
}
632655
}
633-
}

source/archipelago/Client.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ class Client {
504504
// }
505505

506506
public function sendDeathLink(COD:String) {
507-
if (state == State.SLOT_CONNECTED && !APPlayState.deathByLink)
507+
if (state == State.SLOT_CONNECTED && !APPlayState.deathByLink && ClientPrefs.data.deathlink)
508508
InternalSend(OutgoingPacket.Bounce(null,null,['DeathLink'], {time: Timer.stamp(), cause: slot + ": " + COD, source: slot}));
509509
}
510510

0 commit comments

Comments
 (0)