@@ -679,7 +679,7 @@ class APItem {
679679 return new APTrap (name , ConditionHelper . PlayState ().funcAndReturn (function (c ) {
680680 c .extraConditions = [];
681681 c .extraConditions .push (function (e ) {
682- return states. PlayState .instance ?. startedSong == true ;
682+ return states. PlayState .instance ?. startedSong == true && APPlayState . resisting == false ;
683683 });
684684 }), function () {
685685 popup (' Oh god no here she comes' , " Resistance Trap" , true );
@@ -690,6 +690,80 @@ class APItem {
690690 t .isTrap = true ;
691691 });
692692
693+ case " Mute Trap" :
694+ return new APTrap (name , ConditionHelper . Special (), function () {
695+ popup (' ...' , " Mute Trap" , true );
696+ // Random between 1 to 30 seconds
697+ var muteDuration = FlxG .random .int (1 , 30 );
698+ new FlxTimer ().start (muteDuration , function (tmr : FlxTimer )
699+ {
700+ // Randomly choose between toggling mute or changing volume with a tween
701+ if (FlxG .random .bool (50 )) {
702+ // Toggle mute immediately
703+ FlxG .sound .toggleMuted ();
704+ } else {
705+ // // Decide reduction target: usually reduce to 0, 1% chance to reduce by a random 0-1 amount
706+ // var currentVol:Float = FlxG.sound.volume;
707+ // var reduction:Float = if (FlxG.random.bool(1)) FlxG.random.float(0, 1) else currentVol;
708+ // reduction = Math.min(reduction, currentVol); // never reduce below 0
709+ // var duration:Float = FlxG.random.float(1, 2); // 1 to 2 seconds
710+
711+ // // First attempt: tween from 0 -> reduction and call changeVolume with the incremental negative delta
712+ // var prev:Float = 0;
713+ // flixel.tweens.FlxTween.num(0, reduction, duration, null, function(value:Float) {
714+ // var delta:Float = value - prev;
715+ // prev = value;
716+ // try {
717+ // FlxG.sound.changeVolume(-delta);
718+ // } catch (e:Dynamic) {
719+ // // ignore any errors calling changeVolume
720+ // }
721+ // }, { onComplete: function() {
722+ // // If volume still not 0 because player fought it, try once more
723+ // try {
724+ // if (FlxG.sound.volume > 0) {
725+ // var currentVol2:Float = FlxG.sound.volume;
726+ // var reduction2:Float = if (FlxG.random.bool(1)) FlxG.random.float(0, 1) else currentVol2;
727+ // reduction2 = Math.min(reduction2, currentVol2);
728+ // var duration2:Float = FlxG.random.float(0.8, 1.6);
729+
730+ // var prev2:Float = 0;
731+ // flixel.tweens.FlxTween.num(0, reduction2, duration2, function(value2:Float) {
732+ // var delta2:Float = value2 - prev2;
733+ // prev2 = value2;
734+ // try {
735+ // FlxG.sound.changeVolume(-delta2);
736+ // } catch (e:Dynamic) {
737+ // // ignore
738+ // }
739+ // }, { onComplete: function() {
740+ // // After second attempt, force volume to 0 by applying remaining negative delta
741+ // try {
742+ // var need:Float = FlxG.sound.volume;
743+ // if (need > 0) {
744+ // FlxG.sound.changeVolume(-need);
745+ // }
746+ // } catch (e:Dynamic) {
747+ // // ignore
748+ // }
749+ // }});
750+ // } else {
751+ // // Already at 0, nothing to do
752+ // }
753+ // } catch (e:Dynamic) {
754+ // // ignore any unexpected errors
755+ // }
756+ // }});
757+ }
758+
759+ FlxDestroyUtil .destroy (tmr );
760+ });
761+ }, true , true ).funcAndReturn (function (t : APItem ) {
762+ // Set it as a trap.
763+ t .isTrap = true ;
764+ });
765+
766+
693767 case " Ultimate Confusion Trap" :
694768 return new APTrap (name , ConditionHelper . Everywhere (), function () {
695769 unknownSongs = true ;
0 commit comments