@@ -4,7 +4,7 @@ let enemyHp = 160;
4
4
let playerMaxHp = 100 ;
5
5
let enemyMaxHp = 160 ;
6
6
let playerExtraDmg = 1 ;
7
- let enemyExtraDmg = 1.1 ;
7
+ let enemyExtraDmg = 1.05 ;
8
8
let moveNames = [ ] ;
9
9
let selectableMoves = [ ] ;
10
10
let movePool = [ ] ;
@@ -121,7 +121,7 @@ function evalUse(name, user) {
121
121
}
122
122
123
123
class Move {
124
- constructor ( name , dmg , target , effect , heal , codeName ) {
124
+ constructor ( name , dmg , target , effect , heal , codeName , specialMsg ) {
125
125
this . name = name ;
126
126
this . dmg = dmg ;
127
127
if ( target != "$D" ) {
@@ -140,6 +140,7 @@ class Move {
140
140
this . addFunction = `${ codeName } .addToMoves()`
141
141
this . useFunction = `${ codeName } .useMove("player")`
142
142
$ ( "#moveSelector" ) . append ( `<button class="move" id="add-${ codeName } " onclick="${ this . addFunction } ">${ name } </button>` )
143
+ this . specialMsg = specialMsg ;
143
144
}
144
145
145
146
addToMoves ( ) {
@@ -163,14 +164,19 @@ class Move {
163
164
enemyHp -= pDamageDealt ;
164
165
playerHp += this . heal * playerExtraDmg ;
165
166
playerHp = Math . min ( playerHp , playerMaxHp ) ;
167
+ enemyHp = Math . min ( enemyHp , enemyMaxHp )
166
168
if ( this . target === "user" ) {
167
169
playerExtraDmg += this . effect ;
168
170
} else if ( this . target === "enemy" ) {
169
171
enemyExtraDmg += this . effect ;
170
172
}
171
173
172
- if ( this . dmg != 0 && this . heal >= 0 ) {
173
- display ( `You used ${ this . name } !` , `It dealt ${ Math . round ( pDamageDealt ) } damage.` )
174
+ if ( this . dmg > 0 && this . heal >= 0 ) {
175
+ if ( this . target != "attack" || this . heal > 0 ) {
176
+ display ( `You used ${ this . name } !` , `It dealt ${ Math . round ( pDamageDealt ) } damage and some other stuff.` )
177
+ } else {
178
+ display ( `You used ${ this . name } !` , `It dealt ${ Math . round ( pDamageDealt ) } damage.` )
179
+ }
174
180
} else if ( this . target === "user" ) {
175
181
display ( `You used ${ this . name } !` , `Your attack increased by ${ this . effect * 100 } %.` )
176
182
} else if ( this . target === "enemy" ) {
@@ -180,6 +186,17 @@ class Move {
180
186
} else if ( this . heal < 0 ) {
181
187
display ( `You use ${ this . name } !` , `It dealt ${ Math . round ( pDamageDealt ) } damage with ${ Math . round ( this . heal * playerExtraDmg * - 1 ) } recoil.` )
182
188
}
189
+
190
+ if ( this . specialMsg ) {
191
+ console . log ( "sure" )
192
+ switch ( this . codeName ) {
193
+ case "beast" :
194
+ console . log ( "perhaps" )
195
+ display ( "MRBEASTTTT" , "You healed both yourself and your enemy." ) ;
196
+ break ;
197
+ }
198
+ }
199
+
183
200
toggleButtons ( ) ;
184
201
setTimeout ( loop2 , 1500 )
185
202
break ;
@@ -191,13 +208,18 @@ class Move {
191
208
playerHp -= eDamageDealt ;
192
209
enemyHp += this . heal * enemyExtraDmg ;
193
210
enemyHp = Math . min ( enemyHp , enemyMaxHp ) ;
211
+ playerHp = Math . min ( playerHp , playerMaxHp ) ;
194
212
if ( this . target === "user" ) {
195
213
enemyExtraDmg += this . effect ;
196
214
} else if ( this . target === "enemy" ) {
197
215
playerExtraDmg += this . effect ;
198
216
}
199
- if ( this . dmg != 0 && this . heal >= 0 ) {
200
- display ( `The opponent used ${ this . name } !` , `It dealt ${ Math . round ( eDamageDealt ) } damage.` )
217
+ if ( this . dmg > 0 && this . heal >= 0 ) {
218
+ if ( this . target != "attack" || this . heal > 0 ) {
219
+ display ( `The opponent used ${ this . name } !` , `It dealt ${ Math . round ( eDamageDealt ) } damage and some other stuff.` )
220
+ } else {
221
+ display ( `The opponent used ${ this . name } !` , `It dealt ${ Math . round ( eDamageDealt ) } damage.` )
222
+ }
201
223
} else if ( this . target === "user" ) {
202
224
display ( `The opponent used ${ this . name } !` , `The opponent's attack increased by ${ this . effect * 100 } %.` )
203
225
} else if ( this . target === "enemy" ) {
@@ -208,6 +230,14 @@ class Move {
208
230
display ( `The opponent used ${ this . name } !` , `It dealt ${ Math . round ( eDamageDealt ) } damage with ${ Math . round ( this . heal * enemyExtraDmg * - 1 ) } recoil.` )
209
231
}
210
232
233
+ if ( this . specialMsg ) {
234
+ switch ( this . codeName ) {
235
+ case "beast" :
236
+ display ( "MRBEASTTTT" , "Both the enemy and you were healed." ) ;
237
+ break ;
238
+ }
239
+ }
240
+
211
241
break ;
212
242
}
213
243
roundAndUpdate ( )
@@ -216,12 +246,15 @@ class Move {
216
246
}
217
247
218
248
// let name = new Move("name", dmg, effectTarget, effectPower, heal, "codename")
219
- let bonk = new Move ( "Bonk" , 40 , "$D" , 0 , 0 , "bonk" ) ;
220
- let stronk = new Move ( "Stronkify" , 0 , "user" , 0.15 , 0 , "stronk" ) ;
221
- let belittle = new Move ( "Belittle" , 0 , "enemy" , - 0.15 , 0 , "belittle" ) ;
222
- let tickle = new Move ( "Tickle" , 10 , "enemy" , - 0.1 , 0 , "tickle" ) ;
223
- let lick = new Move ( "Lick Wounds" , 0 , "$D" , 0 , 30 , "lick" ) ;
224
- let hyperbonk = new Move ( "HYPERBONK" , 50 , "$D" , 0 , - 40 , "hyperbonk" )
249
+ let bonk = new Move ( "Bonk" , 40 , "attack" , 0 , 0 , "bonk" , false ) ;
250
+ let stronk = new Move ( "Stronkify" , 0 , "user" , 0.15 , 0 , "stronk" , false ) ;
251
+ let belittle = new Move ( "Belittle" , 0 , "enemy" , - 0.15 , 0 , "belittle" , false ) ;
252
+ let tickle = new Move ( "Tickle" , 10 , "enemy" , - 0.1 , 0 , "tickle" , false ) ;
253
+ let lick = new Move ( "Lick Wounds" , 0 , "attack" , 0 , 30 , "lick" , false ) ;
254
+ let hyperbonk = new Move ( "HYPERBONK" , 50 , "attack" , 0 , - 40 , "hyperbonk" , false ) ;
255
+ let triangulate = new Move ( "Triangulate 🤓" , 15 , "user" , 0.05 , 10 , "triangulate" , false ) ;
256
+ let munch = new Move ( "Gremlin Munch" , 30 , "attack" , 0 , 15 , "munch" , false )
257
+ let beast = new Move ( "MRBEASTTTT" , - 20 , "attack" , 0 , 40 , "beast" , true )
225
258
// Kalob was a special child. He belittled people so they could not lick their wounds using a baseball bat to bonk them
226
- document . addEventListener ( "keydown" , debug )
259
+ document . addEventListener ( "keydown" , debug ) ;
227
260
setupAi ( )
0 commit comments