1
+ local max ,min = math.max ,math.min
2
+ local floor ,abs = math.floor ,math.abs
3
+ local ins = table.insert
4
+ local cIntp = MATH .clampInterpolate
5
+
6
+ -- Speed of Invisible EP:
7
+ -- Phase 1: 126 BPM (476.2 ms/Beat)
8
+ -- Phase 2: 143 BPM (419.6 ms/Beat)
9
+ -- Phase 3: 160 BPM (375.0 ms/Beat)
10
+
11
+ local function haunted_p2_afterSpawn (P )
12
+ local N = P .nextQueue [# P .nextQueue ]
13
+ if not N then return end
14
+ N = N .matrix
15
+ local cellList = {}
16
+ for y = 1 ,# N do for x = 1 ,# N [1 ] do if N [y ][x ] then
17
+ ins (cellList ,N [y ][x ])
18
+ end end end
19
+ for _ ,cell in next ,cellList do
20
+ if P :roll (P .modeData .cyanizeRate / 100 ) then
21
+ cell .color = 186
22
+ end
23
+ end
24
+ end
25
+ local function haunted_p3_afterSpawn (P )
26
+ local N = P .nextQueue [# P .nextQueue ]
27
+ if not N then return end
28
+ N = N .matrix
29
+ local cellList = {}
30
+ for y = 1 ,# N do for x = 1 ,# N [1 ] do if N [y ][x ] then
31
+ ins (cellList ,N [y ][x ])
32
+ end end end
33
+ for _ ,cell in next ,cellList do
34
+ if P :roll (P .modeData .deColorRate / 100 ) then
35
+ cell .color = P :roll (P .modeData .darkRate / 100 ) and 222 or 444
36
+ end
37
+ end
38
+ end
39
+ regFuncLib (haunted_p2_afterSpawn ,' exterior_invis.haunted_p2_afterSpawn' )
40
+ regFuncLib (haunted_p3_afterSpawn ,' exterior_invis.haunted_p3_afterSpawn' )
41
+
1
42
--- @type Techmino.Mode
2
43
return {
3
44
initialize = function ()
@@ -6,43 +47,154 @@ return {
6
47
playBgm (' sugar fairy' )
7
48
end ,
8
49
settings = {brik = {
50
+ pieceVisTime = 1000 ,
51
+ pieceFadeTime = 1000 ,
9
52
event = {
10
53
playerInit = function (P )
11
- P .settings .pieceVisTime = 260
12
- P .settings .pieceFadeTime = 260
13
54
P .modeData .maxSimplicity = 0
14
55
P .modeData .simplicity = 0
15
56
P .modeData .target .line = 100
16
- mechLib .common .music .set (P ,{path = ' stat.line' ,s = 50 ,e = 100 },' afterClear' )
57
+
58
+ local T = mechLib .common .task
59
+ T .install (P )
60
+ T .add (P ,' invis_haunted' ,' modeTask_invis_haunted_title' ,' modeTask_invis_haunted_desc' ,' (0/4)' )
61
+ if PROGRESS .getExteriorModeScore (' invis' ,' showHaunted' ) then
62
+ T .add (P ,' invis_hidden' ,' modeTask_invis_hidden_title' ,' modeTask_invis_hidden_desc' )
63
+ end
64
+ if not PROGRESS .getExteriorModeScore (' invis' ,' showHaunted' ) then
65
+ T .add (P ,' invis_hidden' ,' modeTask_invis_hidden_title' ,' modeTask_invis_hidden_desc' )
66
+ end
17
67
end ,
18
68
afterClear = {
19
- mechLib .brik .misc .lineClear_event_afterClear ,
20
69
function (P ,clear )
21
- if clear .line < 4 then
22
- P .modeData .simplicity = P .modeData .simplicity + (5 - clear .line )
70
+ local T = mechLib .common .task
71
+ T .set (P ,' invis_haunted' ,P .stat .line / 4 ," (" .. P .stat .line .. " /4)" )
72
+ if clear .line >= 4 then
73
+ P .modeData .subMode = ' hidden'
74
+ T .set (P ,' invis_hidden' ,true )
23
75
else
24
- P .modeData .simplicity = P .modeData .simplicity - 2
76
+ if P .stat .line >= 4 then
77
+ P .modeData .subMode = ' haunted'
78
+ T .set (P ,' invis_haunted' ,true ," (4/4)" )
79
+ end
80
+ end
81
+ if P .modeData .subMode then
82
+ if P .modeData .subMode == ' haunted' then
83
+ -- Haunted Phase 1 init
84
+ P .settings .spawnDelay = 238
85
+ P .settings .clearDelay = 476
86
+ playBgm (' invisible' )
87
+ PROGRESS .setBgmUnlocked (' invisible mode' ,1 )
88
+ if FMOD .music .getParam (' section' )> 0 then
89
+ FMOD .music .setParam (' section' ,0 )
90
+ FMOD .music .seek (0 )
91
+ end
92
+ elseif P .modeData .subMode == ' hidden' then
93
+ P .settings .pieceVisTime = 260
94
+ P .settings .pieceFadeTime = 260
95
+ mechLib .common .music .set (P ,{path = ' stat.line' ,s = 50 ,e = 100 },' afterClear' )
96
+ end
97
+ return true
98
+ end
99
+ end ,
100
+ function (P ,clear )
101
+ --- @cast P Techmino.Player.Brik
102
+ if P .modeData .subMode == ' haunted' then
103
+ local bLine ,curLine = P .stat .line - clear .line ,P .stat .line
104
+ if bLine < 100 and curLine >= 100 then
105
+ -- Haunted Phase 2 init
106
+ P .modeData .target .line = 200
107
+ P .settings .spawnDelay = 210
108
+ P .settings .clearDelay = 420
109
+ P :addEvent (' afterSpawn' ,haunted_p2_afterSpawn )
110
+ FMOD .music .setParam (' section' ,1 )
111
+ PROGRESS .setBgmUnlocked (' invisible mode 2' ,1 )
112
+ elseif bLine < 200 and curLine >= 200 then
113
+ -- Haunted Phase 3 init
114
+ P .modeData .target .line = 260
115
+ P .settings .spawnDelay = 375
116
+ P .settings .clearDelay = 0
117
+ P .settings .dropDelay = 94
118
+ P :delEvent (' afterSpawn' ,haunted_p2_afterSpawn )
119
+ P :addEvent (' afterSpawn' ,haunted_p3_afterSpawn )
120
+ mechLib .brik .misc .haunted_turnOn (P ,62 ,120 ,600 ,1000 )
121
+ FMOD .music .setParam (' section' ,2 )
122
+ PROGRESS .setBgmUnlocked (' total mayhem' ,1 )
123
+ elseif bLine < 260 and curLine >= 260 then
124
+ P :finish (' win' )
125
+ FMOD .music .setParam (' section' ,3 )
126
+ return true
127
+ end
128
+
129
+ if curLine < 100 then
130
+ -- Haunted Phase 1 step
131
+ P .settings .dropDelay = floor (cIntp (20 ,476 ,80 ,238 ,MATH .clamp (curLine ,20 ,80 )))
132
+ mechLib .brik .misc .haunted_turnOn (P ,
133
+ floor (cIntp (70 ,5 ,90 ,20 ,curLine )),
134
+ 260 ,
135
+ floor (cIntp (0 ,1600 ,80 ,600 ,curLine )),
136
+ floor (cIntp (0 ,600 ,80 ,300 ,curLine ))
137
+ )
138
+ elseif curLine < 200 then
139
+ -- Haunted Phase 2 step
140
+ P .settings .dropDelay = floor (cIntp (120 ,210 ,180 ,105 ,MATH .clamp (curLine ,120 ,180 )))
141
+ P .modeData .cyanizeRate = floor (cIntp (102 ,16 ,126 ,100 ,curLine ))
142
+ mechLib .brik .misc .haunted_turnOn (P ,
143
+ floor (cIntp (100 ,26 ,200 ,42 ,curLine )),
144
+ 260 ,
145
+ floor (cIntp (100 ,500 ,150 ,300 ,curLine )),
146
+ floor (cIntp (100 ,300 ,150 ,200 ,curLine ))
147
+ )
148
+ else
149
+ -- Haunted Phase 3 step
150
+ P .modeData .deColorRate = floor (cIntp (200 ,0 ,230 ,42 ,curLine ))
151
+ P .modeData .darkRate = floor (cIntp (220 ,26 ,240 ,62 ,curLine ))
152
+ end
153
+ elseif P .modeData .subMode == ' hidden' then
154
+ if P .stat .line >= P .modeData .target .line then
155
+ P :finish (' win' )
156
+ else
157
+ if clear .line < 4 then
158
+ P .modeData .simplicity = P .modeData .simplicity + (5 - clear .line )
159
+ else
160
+ P .modeData .simplicity = P .modeData .simplicity - 2
161
+ end
162
+ P .modeData .simplicity = min (P .modeData .simplicity ,62 - floor (P .stat .line / 5 ))
163
+ P .modeData .maxSimplicity = max (P .modeData .maxSimplicity ,P .modeData .simplicity )
164
+ P .settings .pieceVisTime = floor (MATH .cLerp (260 ,2e3 ,P .modeData .simplicity / 62 ))
165
+ P .settings .pieceFadeTime = floor (MATH .cLerp (260 ,1e3 ,P .modeData .simplicity / 62 ))
166
+ end
25
167
end
26
- P .modeData .simplicity = math.min (P .modeData .simplicity ,62 - math.floor (P .stat .line / 5 ))
27
- P .modeData .maxSimplicity = math.max (P .modeData .maxSimplicity ,P .modeData .simplicity )
28
- P .settings .pieceVisTime = math.floor (MATH .cLerp (260 ,2e3 ,P .modeData .simplicity / 62 ))
29
- P .settings .pieceFadeTime = math.floor (MATH .cLerp (260 ,1e3 ,P .modeData .simplicity / 62 ))
30
168
end ,
31
169
},
32
170
drawInField = mechLib .brik .misc .lineClear_event_drawInField ,
33
- drawOnPlayer = mechLib .brik .misc .lineClear_event_drawOnPlayer ,
171
+ drawOnPlayer = function (P )
172
+ P :drawInfoPanel (- 380 ,- 80 ,160 ,160 )
173
+ GC .setColor (COLOR .L )
174
+ FONT .set (70 )
175
+ GC .mStr (P .stat .line ,- 300 ,- 90 )
176
+ GC .rectangle (' fill' ,- 375 ,- 2 ,150 ,4 )
177
+ GC .mStr (P .modeData .target .line ,- 300 ,- 5 )
178
+ end ,
34
179
gameOver = function (P ,reason )
35
- PROGRESS .setExteriorScore (' invis' ,' line' ,math.min (P .stat .line ,100 ))
36
- if reason == ' AC' then
37
- PROGRESS .setExteriorScore (' invis' ,' easy' ,P .gameTime ,' <' )
38
- if P .modeData .maxSimplicity <= 12 then
39
- PROGRESS .setExteriorScore (' invis' ,' hard' ,P .gameTime ,' <' )
40
- P :showInvis (1 ,P .settings .pieceFadeTime / 2 )
41
- else
42
- P :showInvis (2 ,P .settings .pieceFadeTime )
180
+ if P .modeData .subMode == ' haunted' then
181
+ PROGRESS .setExteriorScore (' invis' ,' haunted' ,min (P .stat .line ,260 ),' >' )
182
+ if reason == ' AC' then
183
+ PROGRESS .setExteriorScore (' invis' ,' haunted_time' ,P .gameTime ,' <' )
43
184
end
44
- if P .stat .clears [1 ]+ P .stat .clears [2 ]+ P .stat .clears [3 ]== 0 then
45
- PROGRESS .setSecret (' exterior_invis_superBrain' )
185
+ elseif P .modeData .subMode == ' hidden' then
186
+ PROGRESS .setExteriorScore (' invis' ,' line' ,min (P .stat .line ,100 ),' >' )
187
+ if reason == ' AC' then
188
+ PROGRESS .setExteriorScore (' invis' ,' easy' ,P .gameTime ,' <' )
189
+ if P .modeData .maxSimplicity <= 12 then
190
+ PROGRESS .setExteriorScore (' invis' ,' hard' ,P .gameTime ,' <' )
191
+ P :showInvis (1 ,P .settings .pieceFadeTime / 2 )
192
+ else
193
+ P :showInvis (2 ,P .settings .pieceFadeTime )
194
+ end
195
+ if P .stat .clears [1 ]+ P .stat .clears [2 ]+ P .stat .clears [3 ]== 0 then
196
+ PROGRESS .setSecret (' exterior_invis_superBrain' )
197
+ end
46
198
end
47
199
end
48
200
end ,
0 commit comments