terminull-arcade 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,11 +6,18 @@ import {
6
6
  APP_VERSION,
7
7
  AchievementManager,
8
8
  ArcadeMenu,
9
+ ByteHopperGame,
10
+ Cyber2048Game,
11
+ CyberBreakoutGame,
12
+ CyberDinoGame,
13
+ CyberSweeperGame,
14
+ CyberTowerGame,
9
15
  CyberViperGame,
10
16
  DeterministicRNG,
11
17
  HashMatrixGame,
12
18
  MIN_TERMINAL_COLUMNS,
13
19
  MIN_TERMINAL_ROWS,
20
+ NeonFlapGame,
14
21
  PacketManGame,
15
22
  StorageManager,
16
23
  THEMES,
@@ -34,7 +41,7 @@ import {
34
41
  stripAnsi,
35
42
  visibleLength,
36
43
  wordWrap
37
- } from "./chunk-BIOTUQT7.js";
44
+ } from "./chunk-Z5UIN4FP.js";
38
45
 
39
46
  // src/games/neon-circuit/index.ts
40
47
  var NeonCircuitGame = class {
@@ -987,6 +994,749 @@ ${trackLines.join("\n")}
987
994
  return this.state;
988
995
  }
989
996
  };
997
+
998
+ // src/games/level-devil/index.ts
999
+ var ARENA_WIDTH = 60;
1000
+ var ARENA_HEIGHT = 12;
1001
+ var DEVIL_TAUNTS = [
1002
+ "Did you really think it would be that simple?",
1003
+ "Oops! That floor looked sturdy, did it not?",
1004
+ "Spikes: 1, You: 0.",
1005
+ "Rule #1 of Level Devil: NEVER trust the door.",
1006
+ "Why are you walking into danger?",
1007
+ "Gravity is purely a suggestion here.",
1008
+ "Take a deep breath and try not to rage-quit.",
1009
+ "Almost had it! (Not really).",
1010
+ "Trust issues? You have not seen anything yet."
1011
+ ];
1012
+ var LEVELS = [
1013
+ // Level 1: "Trust Issues" - Simple jump, but as you approach the door, floor drops!
1014
+ {
1015
+ number: 1,
1016
+ title: "Trust Issues",
1017
+ taunt: "Just walk to the door. Simple, right?",
1018
+ playerStart: { x: 4, y: 9 },
1019
+ doorStart: { x: 52, y: 9 },
1020
+ map: [
1021
+ " ",
1022
+ " ",
1023
+ " ",
1024
+ " ",
1025
+ " ",
1026
+ " ",
1027
+ " ",
1028
+ " ",
1029
+ " ",
1030
+ " ",
1031
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
1032
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"
1033
+ ],
1034
+ traps: [
1035
+ { id: 1, type: "falling-floor", triggerX: 40, triggered: false, x: 44, y: 10, width: 6 }
1036
+ ]
1037
+ },
1038
+ // Level 2: "Pop Goes the Spike" - Hallway where hidden spikes pop up!
1039
+ {
1040
+ number: 2,
1041
+ title: "Pop Goes the Spike",
1042
+ taunt: "Watch your step. The floor is sensitive.",
1043
+ playerStart: { x: 4, y: 9 },
1044
+ doorStart: { x: 52, y: 9 },
1045
+ map: [
1046
+ " ",
1047
+ " ",
1048
+ " ",
1049
+ " ",
1050
+ " ",
1051
+ " ",
1052
+ " ",
1053
+ " ",
1054
+ " ",
1055
+ " ",
1056
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
1057
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"
1058
+ ],
1059
+ traps: [
1060
+ { id: 2, type: "rising-spike", triggerX: 20, triggered: false, x: 23, y: 9, width: 2 },
1061
+ { id: 3, type: "rising-spike", triggerX: 35, triggered: false, x: 38, y: 9, width: 2 }
1062
+ ]
1063
+ },
1064
+ // Level 3: "Vanishing Bridge" - Middle bridge over spikes vanishes on touch!
1065
+ {
1066
+ number: 3,
1067
+ title: "Vanishing Bridge",
1068
+ taunt: "The bridge is safe. We promise.",
1069
+ playerStart: { x: 4, y: 9 },
1070
+ doorStart: { x: 52, y: 9 },
1071
+ map: [
1072
+ " ",
1073
+ " ",
1074
+ " ",
1075
+ " ",
1076
+ " ",
1077
+ " ",
1078
+ " ",
1079
+ " ",
1080
+ " ",
1081
+ " \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 ",
1082
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
1083
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2\u25B2 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"
1084
+ ],
1085
+ traps: [
1086
+ { id: 4, type: "falling-floor", triggerX: 24, triggered: false, x: 20, y: 9, width: 12 }
1087
+ ]
1088
+ },
1089
+ // Level 4: "Ceiling Smasher" - Huge ceiling spike slams down when jumping!
1090
+ {
1091
+ number: 4,
1092
+ title: "Ceiling Smasher",
1093
+ taunt: "Do not jump too high.",
1094
+ playerStart: { x: 4, y: 9 },
1095
+ doorStart: { x: 52, y: 9 },
1096
+ map: [
1097
+ "\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550",
1098
+ " ",
1099
+ " ",
1100
+ " ",
1101
+ " ",
1102
+ " ",
1103
+ " ",
1104
+ " ",
1105
+ " ",
1106
+ " \u25B2\u25B2 ",
1107
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
1108
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"
1109
+ ],
1110
+ traps: [
1111
+ { id: 5, type: "ceiling-spike", triggerX: 20, triggered: false, x: 24, y: 1, width: 4 }
1112
+ ]
1113
+ },
1114
+ // Level 5: "Mind Warp" - Controls invert halfway through!
1115
+ {
1116
+ number: 5,
1117
+ title: "Mind Warp",
1118
+ taunt: "Left is right, right is left. Or is it?",
1119
+ playerStart: { x: 4, y: 9 },
1120
+ doorStart: { x: 52, y: 9 },
1121
+ map: [
1122
+ " ",
1123
+ " ",
1124
+ " ",
1125
+ " ",
1126
+ " ",
1127
+ " ",
1128
+ " ",
1129
+ " ",
1130
+ " ",
1131
+ " \u25B2\u25B2\u25B2 \u25B2\u25B2\u25B2 ",
1132
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
1133
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"
1134
+ ],
1135
+ traps: [
1136
+ { id: 6, type: "inverted-controls", triggerX: 22, triggered: false, x: 22, y: 0 }
1137
+ ]
1138
+ },
1139
+ // Level 6: "The Cowardly Door" - Door runs away when you approach!
1140
+ {
1141
+ number: 6,
1142
+ title: "The Cowardly Door",
1143
+ taunt: "Why are you chasing the door? It is shy.",
1144
+ playerStart: { x: 4, y: 9 },
1145
+ doorStart: { x: 36, y: 9 },
1146
+ map: [
1147
+ " ",
1148
+ " ",
1149
+ " ",
1150
+ " ",
1151
+ " \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 ",
1152
+ " ",
1153
+ " ",
1154
+ " ",
1155
+ " ",
1156
+ " ",
1157
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
1158
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"
1159
+ ],
1160
+ traps: [
1161
+ { id: 7, type: "runaway-door", triggerX: 30, triggered: false, x: 36, y: 9, targetX: 48, targetY: 3 },
1162
+ { id: 12, type: "runaway-door", triggerX: 44, triggered: false, x: 48, y: 3, targetX: 54, targetY: 9 }
1163
+ ]
1164
+ },
1165
+ // Level 7: "Anti-Gravity" - Floor pad flips gravity to the ceiling!
1166
+ {
1167
+ number: 7,
1168
+ title: "Anti-Gravity",
1169
+ taunt: "Up is down, down is up. Enjoy the ceiling.",
1170
+ playerStart: { x: 4, y: 9 },
1171
+ doorStart: { x: 52, y: 2 },
1172
+ map: [
1173
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
1174
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
1175
+ " \u25BC\u25BC\u25BC\u25BC ",
1176
+ " ",
1177
+ " ",
1178
+ " ",
1179
+ " ",
1180
+ " ",
1181
+ " ",
1182
+ " \u2591\u2591 ",
1183
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
1184
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"
1185
+ ],
1186
+ traps: [
1187
+ { id: 8, type: "gravity-pad", triggerX: 18, triggered: false, x: 18, y: 9 }
1188
+ ]
1189
+ },
1190
+ // Level 8: "The Final Betrayal" - Falling floor + rising spike + running door gauntlet!
1191
+ {
1192
+ number: 8,
1193
+ title: "The Final Betrayal",
1194
+ taunt: "Everything you have learned is a lie.",
1195
+ playerStart: { x: 4, y: 9 },
1196
+ doorStart: { x: 46, y: 9 },
1197
+ map: [
1198
+ " ",
1199
+ " ",
1200
+ " ",
1201
+ " ",
1202
+ " \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 ",
1203
+ " ",
1204
+ " ",
1205
+ " ",
1206
+ " ",
1207
+ " ",
1208
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
1209
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"
1210
+ ],
1211
+ traps: [
1212
+ { id: 9, type: "rising-spike", triggerX: 18, triggered: false, x: 22, y: 9, width: 2 },
1213
+ { id: 10, type: "falling-floor", triggerX: 30, triggered: false, x: 34, y: 10, width: 6 },
1214
+ { id: 11, type: "runaway-door", triggerX: 42, triggered: false, x: 46, y: 9, targetX: 52, targetY: 3 }
1215
+ ]
1216
+ }
1217
+ ];
1218
+ var LevelDevilGame = class {
1219
+ id = "level-devil";
1220
+ metadata = ALL_GAMES_METADATA["level-devil"];
1221
+ config = null;
1222
+ renderer = defaultRenderer;
1223
+ input = new TerminalInputHandler();
1224
+ rng = new DeterministicRNG();
1225
+ gameLoopTimer = null;
1226
+ tickIntervalMs = 45;
1227
+ // Smooth 22 FPS physics
1228
+ state = {
1229
+ currentLevel: 1,
1230
+ deaths: 0,
1231
+ levelDeaths: 0,
1232
+ playerX: 4,
1233
+ playerY: 9,
1234
+ playerVx: 0,
1235
+ playerVy: 0,
1236
+ isGrounded: true,
1237
+ doorX: 52,
1238
+ doorY: 9,
1239
+ doorOpen: false,
1240
+ gravityFlipped: false,
1241
+ controlsInverted: false,
1242
+ activeTraps: [],
1243
+ dynamicTiles: {},
1244
+ isLevelComplete: false,
1245
+ isGameWon: false,
1246
+ isGameOver: false,
1247
+ isDying: false,
1248
+ deathTicks: 0,
1249
+ tauntText: "Just walk to the door. Simple, right?"
1250
+ };
1251
+ isPaused = false;
1252
+ pauseMenuIndex = 0;
1253
+ showTutorial = true;
1254
+ init(config) {
1255
+ this.config = config;
1256
+ this.renderer.setTheme(config.theme);
1257
+ this.rng = new DeterministicRNG(config.seed || Date.now());
1258
+ if (config.skipTutorial !== void 0) {
1259
+ this.showTutorial = !config.skipTutorial;
1260
+ }
1261
+ this.loadLevel(1);
1262
+ }
1263
+ start() {
1264
+ this.isPaused = false;
1265
+ this.render();
1266
+ this.input.start(
1267
+ (key) => this.handleInput(key),
1268
+ () => {
1269
+ this.destroy();
1270
+ this.config?.onExit?.();
1271
+ }
1272
+ );
1273
+ if (!this.showTutorial) {
1274
+ this.scheduleNextTick();
1275
+ }
1276
+ }
1277
+ pause() {
1278
+ this.isPaused = true;
1279
+ if (this.gameLoopTimer) {
1280
+ clearTimeout(this.gameLoopTimer);
1281
+ this.gameLoopTimer = null;
1282
+ }
1283
+ }
1284
+ resume() {
1285
+ this.isPaused = false;
1286
+ this.scheduleNextTick();
1287
+ }
1288
+ restart() {
1289
+ this.loadLevel(this.state.currentLevel);
1290
+ this.render();
1291
+ this.scheduleNextTick();
1292
+ }
1293
+ saveState() {
1294
+ return {
1295
+ state: this.state,
1296
+ showTutorial: this.showTutorial
1297
+ };
1298
+ }
1299
+ loadState(saved) {
1300
+ if (saved["state"]) this.state = saved["state"];
1301
+ if (saved["showTutorial"] !== void 0) this.showTutorial = !!saved["showTutorial"];
1302
+ }
1303
+ getState() {
1304
+ return this.state;
1305
+ }
1306
+ handleInputForTest(key) {
1307
+ this.handleInput(key);
1308
+ }
1309
+ destroy() {
1310
+ if (this.gameLoopTimer) {
1311
+ clearTimeout(this.gameLoopTimer);
1312
+ this.gameLoopTimer = null;
1313
+ }
1314
+ this.input.stop();
1315
+ }
1316
+ loadLevel(levelNum) {
1317
+ const lvlIdx = Math.max(0, Math.min(LEVELS.length - 1, levelNum - 1));
1318
+ const lvl = LEVELS[lvlIdx];
1319
+ this.state.currentLevel = lvl.number;
1320
+ this.state.levelDeaths = 0;
1321
+ this.state.playerX = lvl.playerStart.x;
1322
+ this.state.playerY = lvl.playerStart.y;
1323
+ this.state.playerVx = 0;
1324
+ this.state.playerVy = 0;
1325
+ this.state.isGrounded = true;
1326
+ this.state.doorX = lvl.doorStart.x;
1327
+ this.state.doorY = lvl.doorStart.y;
1328
+ this.state.doorOpen = false;
1329
+ this.state.gravityFlipped = false;
1330
+ this.state.controlsInverted = false;
1331
+ this.state.activeTraps = JSON.parse(JSON.stringify(lvl.traps));
1332
+ this.state.dynamicTiles = {};
1333
+ this.state.isLevelComplete = false;
1334
+ this.state.isDying = false;
1335
+ this.state.deathTicks = 0;
1336
+ this.state.tauntText = lvl.taunt;
1337
+ }
1338
+ triggerDeath() {
1339
+ if (this.state.isDying) return;
1340
+ this.state.deaths++;
1341
+ this.state.levelDeaths++;
1342
+ this.state.isDying = true;
1343
+ this.state.deathTicks = 3;
1344
+ if (this.state.deaths === 1) {
1345
+ this.config?.onAchievementUnlock?.("first_betrayal");
1346
+ }
1347
+ const randTaunt = DEVIL_TAUNTS[Math.floor(this.rng.next() * DEVIL_TAUNTS.length)];
1348
+ this.state.tauntText = randTaunt;
1349
+ if (this.config?.soundEnabled) playTerminalBell();
1350
+ }
1351
+ scheduleNextTick() {
1352
+ if (this.isPaused || this.state.isGameOver || this.showTutorial) return;
1353
+ this.gameLoopTimer = setTimeout(() => {
1354
+ this.tick();
1355
+ this.scheduleNextTick();
1356
+ }, this.tickIntervalMs);
1357
+ }
1358
+ tick() {
1359
+ if (this.isPaused || this.showTutorial || this.state.isGameWon) return;
1360
+ if (this.state.isDying) {
1361
+ this.state.deathTicks--;
1362
+ if (this.state.deathTicks <= 0) {
1363
+ const lvl = LEVELS[this.state.currentLevel - 1];
1364
+ this.state.playerX = lvl.playerStart.x;
1365
+ this.state.playerY = lvl.playerStart.y;
1366
+ this.state.playerVx = 0;
1367
+ this.state.playerVy = 0;
1368
+ this.state.isGrounded = true;
1369
+ this.state.gravityFlipped = false;
1370
+ this.state.controlsInverted = false;
1371
+ this.state.activeTraps = JSON.parse(JSON.stringify(lvl.traps));
1372
+ this.state.dynamicTiles = {};
1373
+ this.state.doorX = lvl.doorStart.x;
1374
+ this.state.doorY = lvl.doorStart.y;
1375
+ this.state.isDying = false;
1376
+ }
1377
+ this.render();
1378
+ return;
1379
+ }
1380
+ const px = Math.round(this.state.playerX);
1381
+ for (const trap of this.state.activeTraps) {
1382
+ if (!trap.triggered && px >= trap.triggerX) {
1383
+ trap.triggered = true;
1384
+ this.activateTrap(trap);
1385
+ }
1386
+ }
1387
+ const grav = this.state.gravityFlipped ? -0.22 : 0.22;
1388
+ this.state.playerVy += grav;
1389
+ this.state.playerX += this.state.playerVx;
1390
+ this.state.playerY += this.state.playerVy;
1391
+ if (this.state.isGrounded) {
1392
+ this.state.playerVx *= 0.65;
1393
+ } else {
1394
+ this.state.playerVx *= 0.92;
1395
+ }
1396
+ if (Math.abs(this.state.playerVx) < 0.05) this.state.playerVx = 0;
1397
+ if (this.state.playerX < 1) this.state.playerX = 1;
1398
+ if (this.state.playerX > ARENA_WIDTH - 2) this.state.playerX = ARENA_WIDTH - 2;
1399
+ this.resolveCollisions();
1400
+ const intPx = Math.round(this.state.playerX);
1401
+ const intPy = Math.round(this.state.playerY);
1402
+ if (Math.abs(intPx - this.state.doorX) <= 1 && Math.abs(intPy - this.state.doorY) <= 1) {
1403
+ this.advanceLevel();
1404
+ return;
1405
+ }
1406
+ if (this.state.playerY >= ARENA_HEIGHT || this.state.playerY < 0) {
1407
+ this.triggerDeath();
1408
+ }
1409
+ this.render();
1410
+ }
1411
+ activateTrap(trap) {
1412
+ if (trap.type === "rising-spike") {
1413
+ const width = trap.width || 2;
1414
+ for (let w = 0; w < width; w++) {
1415
+ this.state.dynamicTiles[`${trap.x + w},${trap.y}`] = "\u25B2";
1416
+ }
1417
+ } else if (trap.type === "falling-floor") {
1418
+ const width = trap.width || 6;
1419
+ for (let w = 0; w < width; w++) {
1420
+ this.state.dynamicTiles[`${trap.x + w},${trap.y}`] = " ";
1421
+ if (trap.y === 10) {
1422
+ this.state.dynamicTiles[`${trap.x + w},11`] = " ";
1423
+ }
1424
+ }
1425
+ } else if (trap.type === "ceiling-spike") {
1426
+ const width = trap.width || 4;
1427
+ for (let w = 0; w < width; w++) {
1428
+ for (let dy = 1; dy <= 7; dy++) {
1429
+ this.state.dynamicTiles[`${trap.x + w},${trap.y + dy}`] = "\u25BC";
1430
+ }
1431
+ }
1432
+ } else if (trap.type === "inverted-controls") {
1433
+ this.state.controlsInverted = true;
1434
+ this.state.tauntText = "\u26A0 CONTROLS INVERTED! LEFT IS RIGHT! \u26A0";
1435
+ if (this.config?.soundEnabled) playTerminalBell();
1436
+ } else if (trap.type === "gravity-pad") {
1437
+ this.state.gravityFlipped = true;
1438
+ this.state.tauntText = "\u{1F300} GRAVITY FLIPPED! YOU WALK ON THE CEILING!";
1439
+ if (this.config?.soundEnabled) playTerminalBell();
1440
+ } else if (trap.type === "runaway-door") {
1441
+ if (trap.targetX !== void 0 && trap.targetY !== void 0) {
1442
+ this.state.doorX = trap.targetX;
1443
+ this.state.doorY = trap.targetY;
1444
+ this.state.tauntText = "NOPE! The door ran away!";
1445
+ if (this.config?.soundEnabled) playTerminalBell();
1446
+ }
1447
+ }
1448
+ }
1449
+ getTileAt(x, y) {
1450
+ const key = `${x},${y}`;
1451
+ if (this.state.dynamicTiles[key] !== void 0) {
1452
+ return this.state.dynamicTiles[key];
1453
+ }
1454
+ const lvl = LEVELS[this.state.currentLevel - 1];
1455
+ if (!lvl || y < 0 || y >= lvl.map.length) return " ";
1456
+ const row = lvl.map[y];
1457
+ if (!row || x < 0 || x >= row.length) return " ";
1458
+ return row[x] || " ";
1459
+ }
1460
+ resolveCollisions() {
1461
+ const px = Math.round(this.state.playerX);
1462
+ const py = Math.round(this.state.playerY);
1463
+ const currentTile = this.getTileAt(px, py);
1464
+ if (currentTile === "\u25B2" || currentTile === "\u25BC" || currentTile === "\u203B") {
1465
+ this.triggerDeath();
1466
+ return;
1467
+ }
1468
+ if (this.state.playerVx > 0) {
1469
+ const tileRight = this.getTileAt(px + 1, py);
1470
+ if (tileRight === "\u2588" || tileRight === "\u2550") {
1471
+ this.state.playerVx = 0;
1472
+ }
1473
+ } else if (this.state.playerVx < 0) {
1474
+ const tileLeft = this.getTileAt(px - 1, py);
1475
+ if (tileLeft === "\u2588" || tileLeft === "\u2550") {
1476
+ this.state.playerVx = 0;
1477
+ }
1478
+ }
1479
+ if (!this.state.gravityFlipped) {
1480
+ const tileBelow = this.getTileAt(px, py + 1);
1481
+ if (tileBelow === "\u2588" || tileBelow === "\u2550") {
1482
+ this.state.playerY = py;
1483
+ this.state.playerVy = 0;
1484
+ this.state.isGrounded = true;
1485
+ } else {
1486
+ this.state.isGrounded = false;
1487
+ }
1488
+ const tileAbove = this.getTileAt(px, py - 1);
1489
+ if (tileAbove === "\u2588" || tileAbove === "\u2550") {
1490
+ if (this.state.playerVy < 0) this.state.playerVy = 0;
1491
+ } else if (tileAbove === "\u25B2" || tileAbove === "\u25BC") {
1492
+ this.triggerDeath();
1493
+ return;
1494
+ }
1495
+ } else {
1496
+ const tileAbove = this.getTileAt(px, py - 1);
1497
+ if (tileAbove === "\u2588" || tileAbove === "\u2550") {
1498
+ this.state.playerY = py;
1499
+ this.state.playerVy = 0;
1500
+ this.state.isGrounded = true;
1501
+ } else {
1502
+ this.state.isGrounded = false;
1503
+ }
1504
+ const tileBelow = this.getTileAt(px, py + 1);
1505
+ if (tileBelow === "\u2588" || tileBelow === "\u2550") {
1506
+ if (this.state.playerVy > 0) this.state.playerVy = 0;
1507
+ } else if (tileBelow === "\u25B2" || tileBelow === "\u25BC") {
1508
+ this.triggerDeath();
1509
+ return;
1510
+ }
1511
+ }
1512
+ }
1513
+ advanceLevel() {
1514
+ if (this.state.currentLevel === 4) {
1515
+ this.config?.onAchievementUnlock?.("midway_survivor");
1516
+ }
1517
+ if (this.state.currentLevel >= LEVELS.length) {
1518
+ this.state.isGameWon = true;
1519
+ this.config?.onAchievementUnlock?.("devil_conquered");
1520
+ this.config?.onGameOver?.(Math.max(0, 1e3 - this.state.deaths * 25));
1521
+ if (this.config?.soundEnabled) playTerminalBell();
1522
+ this.render();
1523
+ return;
1524
+ }
1525
+ this.loadLevel(this.state.currentLevel + 1);
1526
+ if (this.config?.soundEnabled) playTerminalBell();
1527
+ this.render();
1528
+ }
1529
+ handleInput(key) {
1530
+ if (this.showTutorial) {
1531
+ if (key.name === "return" || key.name === "space") {
1532
+ this.showTutorial = false;
1533
+ this.scheduleNextTick();
1534
+ this.render();
1535
+ } else if (key.name === "escape" || key.name === "q") {
1536
+ this.destroy();
1537
+ this.config?.onExit?.();
1538
+ }
1539
+ return;
1540
+ }
1541
+ if (this.isPaused) {
1542
+ if (key.name === "up" || key.name === "w") {
1543
+ this.pauseMenuIndex = (this.pauseMenuIndex - 1 + 3) % 3;
1544
+ this.render();
1545
+ } else if (key.name === "down" || key.name === "s") {
1546
+ this.pauseMenuIndex = (this.pauseMenuIndex + 1) % 3;
1547
+ this.render();
1548
+ } else if (key.name === "return" || key.name === "space") {
1549
+ if (this.pauseMenuIndex === 0) {
1550
+ this.isPaused = false;
1551
+ this.scheduleNextTick();
1552
+ this.render();
1553
+ } else if (this.pauseMenuIndex === 1) {
1554
+ this.isPaused = false;
1555
+ this.restart();
1556
+ } else if (this.pauseMenuIndex === 2) {
1557
+ this.destroy();
1558
+ this.config?.onExit?.();
1559
+ }
1560
+ } else if (key.name === "escape" || key.name === "p") {
1561
+ this.isPaused = false;
1562
+ this.scheduleNextTick();
1563
+ this.render();
1564
+ } else if (key.name === "q") {
1565
+ this.destroy();
1566
+ this.config?.onExit?.();
1567
+ }
1568
+ return;
1569
+ }
1570
+ if (key.name === "escape" || key.name === "p") {
1571
+ this.isPaused = true;
1572
+ this.pauseMenuIndex = 0;
1573
+ if (this.gameLoopTimer) {
1574
+ clearTimeout(this.gameLoopTimer);
1575
+ this.gameLoopTimer = null;
1576
+ }
1577
+ this.render();
1578
+ return;
1579
+ }
1580
+ if (key.name === "q") {
1581
+ this.destroy();
1582
+ this.config?.onExit?.();
1583
+ return;
1584
+ }
1585
+ if (key.name === "r") {
1586
+ this.restart();
1587
+ return;
1588
+ }
1589
+ if (this.state.isGameWon) {
1590
+ if (key.name === "return" || key.name === "space" || key.name === "r") {
1591
+ this.state.deaths = 0;
1592
+ this.loadLevel(1);
1593
+ this.render();
1594
+ this.scheduleNextTick();
1595
+ }
1596
+ return;
1597
+ }
1598
+ const moveLeft = this.state.controlsInverted ? key.name === "right" || key.name === "d" : key.name === "left" || key.name === "a";
1599
+ const moveRight = this.state.controlsInverted ? key.name === "left" || key.name === "a" : key.name === "right" || key.name === "d";
1600
+ if (moveLeft) {
1601
+ this.state.playerVx = this.state.isGrounded ? -1.05 : -0.85;
1602
+ this.state.playerX -= 0.5;
1603
+ if (this.state.playerX < 1) this.state.playerX = 1;
1604
+ this.resolveCollisions();
1605
+ this.render();
1606
+ } else if (moveRight) {
1607
+ this.state.playerVx = this.state.isGrounded ? 1.05 : 0.85;
1608
+ this.state.playerX += 0.5;
1609
+ if (this.state.playerX > ARENA_WIDTH - 2) this.state.playerX = ARENA_WIDTH - 2;
1610
+ this.resolveCollisions();
1611
+ this.render();
1612
+ }
1613
+ if (key.name === "space" || key.name === "up" || key.name === "w") {
1614
+ if (this.state.isGrounded) {
1615
+ this.state.playerVy = this.state.gravityFlipped ? 1.35 : -1.35;
1616
+ this.state.playerY += this.state.gravityFlipped ? 0.35 : -0.35;
1617
+ this.state.isGrounded = false;
1618
+ if (this.config?.soundEnabled) playTerminalBell();
1619
+ this.render();
1620
+ }
1621
+ }
1622
+ if (key.name === "down" || key.name === "s") {
1623
+ if (!this.state.isGrounded) {
1624
+ this.state.playerVy = this.state.gravityFlipped ? -1.35 : 1.35;
1625
+ this.render();
1626
+ }
1627
+ }
1628
+ }
1629
+ render() {
1630
+ const t = this.renderer.getTheme();
1631
+ const totalWidth = ARENA_WIDTH + 2;
1632
+ if (this.showTutorial) {
1633
+ const lines = [
1634
+ "",
1635
+ t.highlight("LEVEL DEVIL // SURVIVAL PROTOCOL"),
1636
+ "",
1637
+ "\u2022 Your only objective is to step through the EXIT DOOR.",
1638
+ "\u2022 BUT: Expect betrayal. Nothing is what it seems.",
1639
+ "\u2022 Spikes pop up. Floors vanish beneath your feet.",
1640
+ "\u2022 The door will run away. Controls will invert.",
1641
+ "\u2022 Tap R at any time to instantly retry.",
1642
+ "",
1643
+ t.border("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
1644
+ t.primary("Press Space or Enter to begin \u2502 Q to Return to Game List")
1645
+ ];
1646
+ const box = this.renderer.createBox(lines, 64, "LEVEL DEVIL MANUAL");
1647
+ this.renderer.renderFrame(this.renderer.centerBlock(box, 64));
1648
+ return;
1649
+ }
1650
+ if (this.isPaused) {
1651
+ const pauseItems = ["Resume Run (Esc / Enter)", "Restart Level (R)", "Return to Game List (Q)"];
1652
+ const pauseLines = [
1653
+ "",
1654
+ t.highlight("\u2550\u2550\u2550 LEVEL DEVIL PAUSED \u2550\u2550\u2550"),
1655
+ "",
1656
+ ...pauseItems.map((item, idx) => {
1657
+ if (idx === this.pauseMenuIndex) {
1658
+ return t.primary(` \u25B6 ${t.highlight(item)}`);
1659
+ }
1660
+ return t.muted(` ${item}`);
1661
+ }),
1662
+ "",
1663
+ t.border("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
1664
+ t.muted("Use Up/Down to navigate \u2502 Enter: Select \u2502 Q: Return to Game List")
1665
+ ];
1666
+ const pauseBox = this.renderer.createBox(pauseLines, 64, "SYSTEM PAUSE");
1667
+ this.renderer.renderFrame(this.renderer.centerBlock(pauseBox, 64));
1668
+ return;
1669
+ }
1670
+ if (this.state.isGameWon) {
1671
+ const rating = this.state.deaths <= 5 ? "DEVIL SLAYER (GOD TIER)" : this.state.deaths <= 20 ? "TACTICAL GENIUS" : this.state.deaths <= 50 ? "RAGE MASTER" : "KEYBOARD SMASHER";
1672
+ const winLines = [
1673
+ "",
1674
+ t.highlight("\u2605 YOU CONQUERED THE LEVEL DEVIL! \u2605"),
1675
+ "",
1676
+ `${t.muted("Total Deaths:")} ${t.accent(this.state.deaths.toString())}`,
1677
+ `${t.muted("Final Rating:")} ${t.success(rating)}`,
1678
+ "",
1679
+ t.secondary("You endured falling floors, runaway doors, and mind warps!"),
1680
+ "",
1681
+ t.border("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
1682
+ t.primary("Press Enter or R to Play Again \u2502 Q: Return to Game List")
1683
+ ];
1684
+ const winBox = this.renderer.createBox(winLines, 64, "VICTORY ARCHIVE");
1685
+ this.renderer.renderFrame(this.renderer.centerBlock(winBox, 64));
1686
+ return;
1687
+ }
1688
+ const lvl = LEVELS[this.state.currentLevel - 1];
1689
+ const header = this.renderer.renderHeader({
1690
+ title: `LEVEL DEVIL [${lvl.number}/8: ${lvl.title.toUpperCase()}]`,
1691
+ category: "RAGE",
1692
+ difficulty: this.config?.difficulty,
1693
+ score: this.state.deaths
1694
+ }, totalWidth);
1695
+ const grid = [];
1696
+ for (let y = 0; y < ARENA_HEIGHT; y++) {
1697
+ const row = [];
1698
+ for (let x = 0; x < ARENA_WIDTH; x++) {
1699
+ row.push(this.getTileAt(x, y));
1700
+ }
1701
+ grid.push(row);
1702
+ }
1703
+ const dx = this.state.doorX;
1704
+ const dy = this.state.doorY;
1705
+ if (dy >= 0 && dy < ARENA_HEIGHT && dx >= 0 && dx + 2 < ARENA_WIDTH) {
1706
+ grid[dy][dx] = "[";
1707
+ grid[dy][dx + 1] = "D";
1708
+ grid[dy][dx + 2] = "]";
1709
+ }
1710
+ const px = Math.round(this.state.playerX);
1711
+ const py = Math.round(this.state.playerY);
1712
+ if (py >= 0 && py < ARENA_HEIGHT && px >= 0 && px < ARENA_WIDTH) {
1713
+ grid[py][px] = this.state.isDying ? "\u{1F4A5}" : "\u25A3";
1714
+ }
1715
+ const arenaLines = [
1716
+ t.border("\u250C" + "\u2500".repeat(ARENA_WIDTH) + "\u2510"),
1717
+ ...grid.map((row) => {
1718
+ const coloredRow = row.map((ch) => {
1719
+ if (ch === "\u2588" || ch === "\u2550") return t.border(ch);
1720
+ if (ch === "\u25B2" || ch === "\u25BC" || ch === "\u203B") return t.error(ch);
1721
+ if (ch === "\u25A3") return t.highlight(ch);
1722
+ if (ch === "\u{1F4A5}") return t.error(ch);
1723
+ if (ch === "[" || ch === "]" || ch === "D") return t.success(ch);
1724
+ if (ch === "\u2591") return t.secondary(ch);
1725
+ return ch;
1726
+ }).join("");
1727
+ return `${t.border("\u2502")}${coloredRow}${t.border("\u2502")}`;
1728
+ }),
1729
+ t.border("\u2514" + "\u2500".repeat(ARENA_WIDTH) + "\u2518")
1730
+ ];
1731
+ const hud = ` ${t.error("DEVIL:")} "${t.secondary(this.state.tauntText)}" ${t.muted("Deaths:")} ${t.accent(this.state.deaths.toString())}`;
1732
+ const controls = ` ${t.muted("A/D / \u2190/\u2192: Move \u2502 Space/W: Jump \u2502 R: Retry \u2502 Q: Exit")}`;
1733
+ const fullCanvas = `${header}
1734
+ ${hud}
1735
+ ${arenaLines.join("\n")}
1736
+ ${controls}`;
1737
+ this.renderer.renderFrame(this.renderer.centerBlock(fullCanvas, totalWidth));
1738
+ }
1739
+ };
990
1740
  export {
991
1741
  ALL_GAMES_METADATA,
992
1742
  APP_NAME,
@@ -994,13 +1744,21 @@ export {
994
1744
  APP_VERSION,
995
1745
  AchievementManager,
996
1746
  ArcadeMenu,
1747
+ ByteHopperGame,
997
1748
  ByteRunnerGame,
1749
+ Cyber2048Game,
1750
+ CyberBreakoutGame,
1751
+ CyberDinoGame,
1752
+ CyberSweeperGame,
1753
+ CyberTowerGame,
998
1754
  CyberViperGame,
999
1755
  DeterministicRNG,
1000
1756
  HashMatrixGame,
1757
+ LevelDevilGame,
1001
1758
  MIN_TERMINAL_COLUMNS,
1002
1759
  MIN_TERMINAL_ROWS,
1003
1760
  NeonCircuitGame,
1761
+ NeonFlapGame,
1004
1762
  PacketManGame,
1005
1763
  StorageManager,
1006
1764
  THEMES,