@@ -4,7 +4,7 @@ let enemyHp = 160;
44let playerMaxHp = 100 ;
55let enemyMaxHp = 160 ;
66let playerExtraDmg = 1 ;
7- let enemyExtraDmg = 1.1 ;
7+ let enemyExtraDmg = 1.05 ;
88let moveNames = [ ] ;
99let selectableMoves = [ ] ;
1010let movePool = [ ] ;
@@ -121,7 +121,7 @@ function evalUse(name, user) {
121121}
122122
123123class Move {
124- constructor ( name , dmg , target , effect , heal , codeName ) {
124+ constructor ( name , dmg , target , effect , heal , codeName , specialMsg ) {
125125 this . name = name ;
126126 this . dmg = dmg ;
127127 if ( target != "$D" ) {
@@ -140,6 +140,7 @@ class Move {
140140 this . addFunction = `${ codeName } .addToMoves()`
141141 this . useFunction = `${ codeName } .useMove("player")`
142142 $ ( "#moveSelector" ) . append ( `<button class="move" id="add-${ codeName } " onclick="${ this . addFunction } ">${ name } </button>` )
143+ this . specialMsg = specialMsg ;
143144 }
144145
145146 addToMoves ( ) {
@@ -163,14 +164,19 @@ class Move {
163164 enemyHp -= pDamageDealt ;
164165 playerHp += this . heal * playerExtraDmg ;
165166 playerHp = Math . min ( playerHp , playerMaxHp ) ;
167+ enemyHp = Math . min ( enemyHp , enemyMaxHp )
166168 if ( this . target === "user" ) {
167169 playerExtraDmg += this . effect ;
168170 } else if ( this . target === "enemy" ) {
169171 enemyExtraDmg += this . effect ;
170172 }
171173
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+ }
174180 } else if ( this . target === "user" ) {
175181 display ( `You used ${ this . name } !` , `Your attack increased by ${ this . effect * 100 } %.` )
176182 } else if ( this . target === "enemy" ) {
@@ -180,6 +186,17 @@ class Move {
180186 } else if ( this . heal < 0 ) {
181187 display ( `You use ${ this . name } !` , `It dealt ${ Math . round ( pDamageDealt ) } damage with ${ Math . round ( this . heal * playerExtraDmg * - 1 ) } recoil.` )
182188 }
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+
183200 toggleButtons ( ) ;
184201 setTimeout ( loop2 , 1500 )
185202 break ;
@@ -191,13 +208,18 @@ class Move {
191208 playerHp -= eDamageDealt ;
192209 enemyHp += this . heal * enemyExtraDmg ;
193210 enemyHp = Math . min ( enemyHp , enemyMaxHp ) ;
211+ playerHp = Math . min ( playerHp , playerMaxHp ) ;
194212 if ( this . target === "user" ) {
195213 enemyExtraDmg += this . effect ;
196214 } else if ( this . target === "enemy" ) {
197215 playerExtraDmg += this . effect ;
198216 }
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+ }
201223 } else if ( this . target === "user" ) {
202224 display ( `The opponent used ${ this . name } !` , `The opponent's attack increased by ${ this . effect * 100 } %.` )
203225 } else if ( this . target === "enemy" ) {
@@ -208,6 +230,14 @@ class Move {
208230 display ( `The opponent used ${ this . name } !` , `It dealt ${ Math . round ( eDamageDealt ) } damage with ${ Math . round ( this . heal * enemyExtraDmg * - 1 ) } recoil.` )
209231 }
210232
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+
211241 break ;
212242 }
213243 roundAndUpdate ( )
@@ -216,12 +246,15 @@ class Move {
216246}
217247
218248// 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 )
225258// 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 ) ;
227260setupAi ( )
0 commit comments