@@ -18,6 +18,10 @@ import { NPSettingsRange } from "@/app/components/NPSettings";
18
18
import NPButton from "@/app/components/NPButton" ;
19
19
import usePersistantState from "@/app/utils/usePersistentState" ;
20
20
21
+ import Image from "next/image" ;
22
+ import crossImg from "@/public/images/thermite/cross.svg" ;
23
+ import backgroundImg from "@/public/images/thermite/background.svg" ;
24
+
21
25
import "@/app/puzzles/thermite/style.css" ;
22
26
23
27
const Thermite : FC = ( ) => {
@@ -67,6 +71,7 @@ const Thermite: FC = () => {
67
71
setComboCounter ( 0 ) ;
68
72
setLastKillTimestamp ( - 1 ) ;
69
73
setTotalCombos ( 0 ) ;
74
+ setOutOfMoves ( false ) ;
70
75
} , [ columns , rows ] ) ;
71
76
72
77
/**
@@ -78,7 +83,6 @@ const Thermite: FC = () => {
78
83
( newStatus : number ) : void => {
79
84
switch ( newStatus ) {
80
85
case 1 :
81
- setOutOfMoves ( false ) ;
82
86
setResetAnimation ( false ) ;
83
87
resetBoard ( ) ;
84
88
break ;
@@ -152,28 +156,17 @@ const Thermite: FC = () => {
152
156
const [ targetRow , targetCol ] = targetCoord ;
153
157
const [ attackerRow , attackerCol ] = attackerCoord ;
154
158
155
- let distance = 1 ;
156
- switch ( attackerPiece ) {
157
- case "long" :
158
- distance = 3 ;
159
- break ;
160
- case "medium" :
161
- distance = 2 ;
162
- break ;
163
- case "short" :
164
- distance = 1 ;
165
- break ;
166
- }
167
-
168
159
/**
169
160
* I'm pretty sure there's a much more clever way to code this
170
161
* condition but I was born dumb.
171
162
*/
172
163
return (
173
- targetCol % distance === attackerCol % distance &&
174
- targetRow % distance === attackerRow % distance &&
175
- Math . abs ( targetCol - attackerCol ) <= distance &&
176
- Math . abs ( targetRow - attackerRow ) <= distance
164
+ targetCol % attackerPiece . distance ===
165
+ attackerCol % attackerPiece . distance &&
166
+ targetRow % attackerPiece . distance ===
167
+ attackerRow % attackerPiece . distance &&
168
+ Math . abs ( targetCol - attackerCol ) <= attackerPiece . distance &&
169
+ Math . abs ( targetRow - attackerRow ) <= attackerPiece . distance
177
170
) ;
178
171
} ,
179
172
[ ]
@@ -346,8 +339,8 @@ const Thermite: FC = () => {
346
339
title = { "Target score" }
347
340
value = { settingsTargetScore }
348
341
setValue = { setSettingsTargetScore }
349
- min = { 14 }
350
- max = { 38 }
342
+ min = { 10 }
343
+ max = { 75 }
351
344
/>
352
345
< NPSettingsRange
353
346
title = { "Timer" }
@@ -469,13 +462,18 @@ const Thermite: FC = () => {
469
462
onClick = { ( ) => handleClick ( [ rowIndex , columnIndex ] ) }
470
463
>
471
464
< span className = "piece" >
472
- < embed src = { `/images/thermite-${ square . piece } .svg` } />
465
+ < Image
466
+ src = { square . piece . img }
467
+ alt = ""
468
+ width = { 75 }
469
+ height = { 75 }
470
+ />
473
471
</ span >
474
472
< div className = "crosses" >
475
- < embed src = { `/images/thermite-cross.svg` } />
476
- < embed src = { `/images/thermite-cross.svg` } />
477
- < embed src = { `/images/thermite-cross.svg` } />
478
- < embed src = { `/images/thermite-cross.svg` } />
473
+ < Image src = { crossImg } alt = "" width = { 16 } height = { 16 } />
474
+ < Image src = { crossImg } alt = "" width = { 16 } height = { 16 } />
475
+ < Image src = { crossImg } alt = "" width = { 16 } height = { 16 } />
476
+ < Image src = { crossImg } alt = "" width = { 16 } height = { 16 } />
479
477
</ div >
480
478
< div
481
479
className = "highlight"
@@ -497,7 +495,7 @@ const Thermite: FC = () => {
497
495
CRC Bypassed!
498
496
</ span >
499
497
</ div >
500
- < embed className = "background" src = { `/images/bg-circuit.svg` } />
498
+ < Image src = { backgroundImg } alt = "" fill />
501
499
</ Fragment >
502
500
</ div >
503
501
</ NPHackContainer >
0 commit comments