|
9 | 9 | } = require("../../config/battleConfig");
|
10 | 10 | const { getMove } = require("./moveRegistry");
|
11 | 11 | const { moveIdEnum } = require("../../enums/battleEnums");
|
| 12 | +const { drawIterable } = require("../../utils/gachaUtils"); |
12 | 13 |
|
13 | 14 | class Move {
|
14 | 15 | /**
|
@@ -307,6 +308,54 @@ const movesToRegister = Object.freeze({
|
307 | 308 | });
|
308 | 309 | },
|
309 | 310 | }),
|
| 311 | + [moveIdEnum.FLAME_BALL]: new Move({ |
| 312 | + id: moveIdEnum.FLAME_BALL, |
| 313 | + name: "Flame Ball", |
| 314 | + type: pokemonTypes.FIRE, |
| 315 | + power: 60, |
| 316 | + accuracy: 90, |
| 317 | + cooldown: 3, |
| 318 | + targetType: targetTypes.ENEMY, |
| 319 | + targetPosition: targetPositions.FRONT, |
| 320 | + targetPattern: targetPatterns.SQUARE, |
| 321 | + tier: moveTiers.POWER, |
| 322 | + damageType: damageTypes.PHYSICAL, |
| 323 | + description: |
| 324 | + "The user strikes the targets with an exploding fiery ball, heating up its allies. For each hit, boosts the combat readiness of a random Fire or Ground type ally by 15%.", |
| 325 | + execute({ battle, source, primaryTarget, allTargets, missedTargets }) { |
| 326 | + this.genericDealAllDamage({ |
| 327 | + source, |
| 328 | + primaryTarget, |
| 329 | + allTargets, |
| 330 | + missedTargets, |
| 331 | + }); |
| 332 | + |
| 333 | + const sourceTeamPokemons = source.getPartyPokemon(); |
| 334 | + const fireGroundAllies = sourceTeamPokemons.filter( |
| 335 | + (pokemon) => |
| 336 | + pokemon !== source && |
| 337 | + pokemon && |
| 338 | + !pokemon.isFainted && |
| 339 | + (pokemon.hasType(pokemonTypes.FIRE) || |
| 340 | + pokemon.hasType(pokemonTypes.GROUND)) |
| 341 | + ); |
| 342 | + if (fireGroundAllies.length === 0) { |
| 343 | + return; |
| 344 | + } |
| 345 | + const [randomAlly] = drawIterable(fireGroundAllies, 1); |
| 346 | + const hitCount = allTargets.reduce( |
| 347 | + (count, target) => |
| 348 | + !missedTargets.includes(target) ? count + 1 : count, |
| 349 | + 0 |
| 350 | + ); |
| 351 | + if (hitCount > 0) { |
| 352 | + battle.addToLog( |
| 353 | + `${randomAlly.name} is burning up from the Flame Ball!` |
| 354 | + ); |
| 355 | + randomAlly.boostCombatReadiness(source, hitCount * 15); |
| 356 | + } |
| 357 | + }, |
| 358 | + }), |
310 | 359 | });
|
311 | 360 |
|
312 | 361 | module.exports = {
|
|
0 commit comments