Skip to content

Commit

Permalink
maxie groudon
Browse files Browse the repository at this point in the history
  • Loading branch information
ewei068 committed Jan 5, 2025
1 parent 70ec6a1 commit b58dc65
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 6 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ TODO:
- Maybe revamp shop for this
- New player UX analysis
- Make party add/remove easier
- Fix help again
- Attempt to fix memory leak

**Stretch**

Expand Down
35 changes: 35 additions & 0 deletions src/battle/data/abilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,41 @@ const abilitiesToRegister = Object.freeze({
battle.unregisterListener(properties.listenerId);
},
}),
[abilityIdEnum.MAGMA_POWER]: new Ability({
id: abilityIdEnum.MAGMA_POWER,
name: "Magma Power",
description:
"At the start of battle, if there's only one other Ground or Fire type ally, increase its combat readiness by 35%, and start harsh sunlight.",
abilityAdd({ battle, target }) {
return {
listenerId: battle.registerListenerFunction({
eventName: battleEventEnum.BATTLE_BEGIN,
callback: () => {
const allyPokemons = target.getPartyPokemon();
const otherFireGroundAllies = allyPokemons.filter(
(pokemon) =>
pokemon !== target &&
pokemon &&
!pokemon.isFainted &&
(pokemon.hasType(pokemonTypes.FIRE) ||
pokemon.hasType(pokemonTypes.GROUND))
);
if (otherFireGroundAllies.length !== 1) {
return;
}
const [allyPokemon] = otherFireGroundAllies;
battle.addToLog(`${target.name} blesses ${allyPokemon.name}!`);
allyPokemon.boostCombatReadiness(target, 35);

battle.createWeather(weatherConditions.SUN, target);
},
}),
};
},
abilityRemove({ battle, properties }) {
battle.unregisterListener(properties.listenerId);
},
}),
[abilityIdEnum.REGENERATOR]: new Ability({
id: abilityIdEnum.REGENERATOR,
name: "Regenerator",
Expand Down
6 changes: 3 additions & 3 deletions src/battle/data/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const effectsToRegister = Object.freeze({
[effectIdEnum.AQUA_BLESSING]: new Effect({
id: effectIdEnum.AQUA_BLESSING,
name: "Aqua Blessing",
description: "The target's stat is increased by 1.5x.",
description: "The target's stat is increased by 2x.",
type: effectTypes.BUFF,
dispellable: true,
/**
Expand All @@ -145,7 +145,7 @@ const effectsToRegister = Object.freeze({
const statToIncrease = statToBattleStat[stat];

battle.addToLog(`${target.name}'s ${statToIncrease} rose!`);
target[statToIncrease] += Math.floor(baseStatValue * 0.5);
target[statToIncrease] += baseStatValue;
return {};
},
effectRemove({ battle, target, initialArgs }) {
Expand All @@ -154,7 +154,7 @@ const effectsToRegister = Object.freeze({
const statToIncrease = statToBattleStat[stat];

battle.addToLog(`${target.name}'s ${statToIncrease} boost wore off!`);
target[statToIncrease] -= Math.floor(baseStatValue * 0.5);
target[statToIncrease] -= baseStatValue;
},
}),
});
Expand Down
120 changes: 117 additions & 3 deletions src/battle/data/moves.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {
targetPatterns,
damageTypes,
moveTiers,
statusConditions,
} = require("../../config/battleConfig");
const { getMove } = require("./moveRegistry");
const { moveIdEnum } = require("../../enums/battleEnums");
Expand Down Expand Up @@ -67,9 +68,9 @@ class Move {
offTargetDamageMultiplier = 0.8,
calculateDamageFunction = undefined,
}) {
const damageToDeal = (
calculateDamageFunction || source.calculateMoveDamage
)({
const damageFunc =
calculateDamageFunction || ((args) => source.calculateMoveDamage(args));
const damageToDeal = damageFunc({
move: getMove(this.id),
target,
primaryTarget,
Expand Down Expand Up @@ -112,9 +113,91 @@ class Move {
});
}
}

// eslint-disable-next-line class-methods-use-this
genericApplySingleStatus({
source,
target,
// eslint-disable-next-line no-unused-vars
primaryTarget,
// eslint-disable-next-line no-unused-vars
allTargets,
missedTargets = [],
statusId,
options,
probablity = 1,
}) {
if (!missedTargets.includes(target) && Math.random() < probablity) {
return target.applyStatus(statusId, source, options);
}
return false;
}

/**
* @param {object} param0
* @param {BattlePokemon} param0.source
* @param {BattlePokemon} param0.primaryTarget
* @param {Array<BattlePokemon>} param0.allTargets
* @param {Array<BattlePokemon>=} param0.missedTargets
* @param {StatusConditionEnum} param0.statusId
* @param {object=} param0.options
* @param {number=} param0.probablity
*/
genericApplyAllStatus({
source,
primaryTarget,
allTargets,
missedTargets = [],
statusId,
options,
probablity = 1,
}) {
for (const target of allTargets) {
this.genericApplySingleStatus({
source,
target,
primaryTarget,
allTargets,
missedTargets,
statusId,
options,
probablity,
});
}
}
}

const movesToRegister = Object.freeze({
[moveIdEnum.FIRE_PUNCH]: new Move({
id: moveIdEnum.FIRE_PUNCH,
name: "Fire Punch",
type: pokemonTypes.FIRE,
power: 75,
accuracy: 100,
cooldown: 2,
targetType: targetTypes.ENEMY,
targetPosition: targetPositions.FRONT,
targetPattern: targetPatterns.SINGLE,
tier: moveTiers.POWER,
damageType: damageTypes.PHYSICAL,
description:
"The target is punched with a fiery fist. It may also leave the target with a burn with a 50% chance.",
execute({ source, primaryTarget, allTargets, missedTargets }) {
this.genericDealAllDamage({
source,
primaryTarget,
allTargets,
missedTargets,
});
this.genericApplyAllStatus({
source,
primaryTarget,
allTargets,
statusId: statusConditions.BURN,
probablity: 0.5,
});
},
}),
[moveIdEnum.VINE_WHIP]: new Move({
id: moveIdEnum.VINE_WHIP,
name: "Vine Whip",
Expand Down Expand Up @@ -193,6 +276,37 @@ const movesToRegister = Object.freeze({
});
},
}),
[moveIdEnum.MAGMA_IMPACT]: new Move({
id: moveIdEnum.MAGMA_IMPACT,
name: "Magma Impact",
type: pokemonTypes.FIRE,
power: 45,
accuracy: 90,
cooldown: 5,
targetType: targetTypes.ENEMY,
targetPosition: targetPositions.FRONT,
targetPattern: targetPatterns.ALL,
tier: moveTiers.ULTIMATE,
damageType: damageTypes.PHYSICAL,
description:
"The targets are struck with blades of magma. If hit and the target is not a full HP, deals 1.5x damage.",
execute({ source, primaryTarget, allTargets, missedTargets }) {
this.genericDealAllDamage({
source,
primaryTarget,
allTargets,
missedTargets,
calculateDamageFunction: (args) => {
const { target } = args;
const baseDamage = source.calculateMoveDamage(args);
if (!missedTargets.includes(target) && target.hp < target.maxHp) {
return Math.floor(baseDamage * 1.5);
}
return baseDamage;
},
});
},
}),
});

module.exports = {
Expand Down
20 changes: 20 additions & 0 deletions src/config/pokemonConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -7172,6 +7172,26 @@ const pokemonConfigRaw = {
rarity: rarities.LEGENDARY,
growthRate: growthRates.SLOW,
},
[pokemonIdEnum.MAXIES_GROUDON]: {
name: "Maxie's Groudon",
emoji: "<:magmagroudon:1325287156268404878>",
description:
"A Groudon under the control of Maxie, the leader of Team Magma. It uses its power to expand the land.",
type: [types.GROUND, types.FIRE],
baseStats: [99, 166, 130, 90, 90, 85],
sprite:
"https://raw.githubusercontent.com/ewei068/pokestar/main/media/images/sprites/magma-groudon-resized.gif",
shinySprite:
"https://raw.githubusercontent.com/ewei068/pokestar/main/media/images/sprites/magma-groudon-shiny-resized.gif",
abilities: {
[abilityIdEnum.MAGMA_POWER]: 1,
},
moveIds: ["m479", "m14", "m523", moveIdEnum.MAGMA_IMPACT],
battleEligible: true,
rarity: rarities.LEGENDARY,
growthRate: growthRates.SLOW,
noGacha: true,
},
384: {
name: "Rayquaza",
emoji: "<:384:1132497391535272016>",
Expand Down
3 changes: 3 additions & 0 deletions src/enums/battleEnums.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ const effectIdEnum = Object.freeze({
const moveIdEnum = Object.freeze({
TEST_MOVE: "999",
TEST_MOVE2: "998",
FIRE_PUNCH: "m7",
VINE_WHIP: "m22",
AQUA_IMPACT: "m618-1",
MAGMA_IMPACT: "m619-1",
});

/**
Expand All @@ -32,6 +34,7 @@ const abilityIdEnum = Object.freeze({
TEST_ABILITY: "testAbility",
REGENERATOR: "144",
AQUA_POWER: "2-1",
MAGMA_POWER: "70-1",
});

/** @typedef {Enum<battleEventEnum>} BattleEventEnum */
Expand Down
1 change: 1 addition & 0 deletions src/enums/pokemonEnums.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ const pokemonIdEnum = Object.freeze({
PALMERS_RAYQUAZA: "20384",
WILLOWS_MELMETAL: "20809",
ARCHIES_KYOGRE: "382-1",
MAXIES_GROUDON: "383-1",
});

module.exports = { pokemonIdEnum };

0 comments on commit b58dc65

Please sign in to comment.