Skip to content

Commit b58dc65

Browse files
committed
maxie groudon
1 parent 70ec6a1 commit b58dc65

File tree

7 files changed

+181
-6
lines changed

7 files changed

+181
-6
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ TODO:
1717
- Maybe revamp shop for this
1818
- New player UX analysis
1919
- Make party add/remove easier
20+
- Fix help again
21+
- Attempt to fix memory leak
2022

2123
**Stretch**
2224

src/battle/data/abilities.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,41 @@ const abilitiesToRegister = Object.freeze({
9696
battle.unregisterListener(properties.listenerId);
9797
},
9898
}),
99+
[abilityIdEnum.MAGMA_POWER]: new Ability({
100+
id: abilityIdEnum.MAGMA_POWER,
101+
name: "Magma Power",
102+
description:
103+
"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.",
104+
abilityAdd({ battle, target }) {
105+
return {
106+
listenerId: battle.registerListenerFunction({
107+
eventName: battleEventEnum.BATTLE_BEGIN,
108+
callback: () => {
109+
const allyPokemons = target.getPartyPokemon();
110+
const otherFireGroundAllies = allyPokemons.filter(
111+
(pokemon) =>
112+
pokemon !== target &&
113+
pokemon &&
114+
!pokemon.isFainted &&
115+
(pokemon.hasType(pokemonTypes.FIRE) ||
116+
pokemon.hasType(pokemonTypes.GROUND))
117+
);
118+
if (otherFireGroundAllies.length !== 1) {
119+
return;
120+
}
121+
const [allyPokemon] = otherFireGroundAllies;
122+
battle.addToLog(`${target.name} blesses ${allyPokemon.name}!`);
123+
allyPokemon.boostCombatReadiness(target, 35);
124+
125+
battle.createWeather(weatherConditions.SUN, target);
126+
},
127+
}),
128+
};
129+
},
130+
abilityRemove({ battle, properties }) {
131+
battle.unregisterListener(properties.listenerId);
132+
},
133+
}),
99134
[abilityIdEnum.REGENERATOR]: new Ability({
100135
id: abilityIdEnum.REGENERATOR,
101136
name: "Regenerator",

src/battle/data/effects.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const effectsToRegister = Object.freeze({
133133
[effectIdEnum.AQUA_BLESSING]: new Effect({
134134
id: effectIdEnum.AQUA_BLESSING,
135135
name: "Aqua Blessing",
136-
description: "The target's stat is increased by 1.5x.",
136+
description: "The target's stat is increased by 2x.",
137137
type: effectTypes.BUFF,
138138
dispellable: true,
139139
/**
@@ -145,7 +145,7 @@ const effectsToRegister = Object.freeze({
145145
const statToIncrease = statToBattleStat[stat];
146146

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

156156
battle.addToLog(`${target.name}'s ${statToIncrease} boost wore off!`);
157-
target[statToIncrease] -= Math.floor(baseStatValue * 0.5);
157+
target[statToIncrease] -= baseStatValue;
158158
},
159159
}),
160160
});

src/battle/data/moves.js

Lines changed: 117 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const {
55
targetPatterns,
66
damageTypes,
77
moveTiers,
8+
statusConditions,
89
} = require("../../config/battleConfig");
910
const { getMove } = require("./moveRegistry");
1011
const { moveIdEnum } = require("../../enums/battleEnums");
@@ -67,9 +68,9 @@ class Move {
6768
offTargetDamageMultiplier = 0.8,
6869
calculateDamageFunction = undefined,
6970
}) {
70-
const damageToDeal = (
71-
calculateDamageFunction || source.calculateMoveDamage
72-
)({
71+
const damageFunc =
72+
calculateDamageFunction || ((args) => source.calculateMoveDamage(args));
73+
const damageToDeal = damageFunc({
7374
move: getMove(this.id),
7475
target,
7576
primaryTarget,
@@ -112,9 +113,91 @@ class Move {
112113
});
113114
}
114115
}
116+
117+
// eslint-disable-next-line class-methods-use-this
118+
genericApplySingleStatus({
119+
source,
120+
target,
121+
// eslint-disable-next-line no-unused-vars
122+
primaryTarget,
123+
// eslint-disable-next-line no-unused-vars
124+
allTargets,
125+
missedTargets = [],
126+
statusId,
127+
options,
128+
probablity = 1,
129+
}) {
130+
if (!missedTargets.includes(target) && Math.random() < probablity) {
131+
return target.applyStatus(statusId, source, options);
132+
}
133+
return false;
134+
}
135+
136+
/**
137+
* @param {object} param0
138+
* @param {BattlePokemon} param0.source
139+
* @param {BattlePokemon} param0.primaryTarget
140+
* @param {Array<BattlePokemon>} param0.allTargets
141+
* @param {Array<BattlePokemon>=} param0.missedTargets
142+
* @param {StatusConditionEnum} param0.statusId
143+
* @param {object=} param0.options
144+
* @param {number=} param0.probablity
145+
*/
146+
genericApplyAllStatus({
147+
source,
148+
primaryTarget,
149+
allTargets,
150+
missedTargets = [],
151+
statusId,
152+
options,
153+
probablity = 1,
154+
}) {
155+
for (const target of allTargets) {
156+
this.genericApplySingleStatus({
157+
source,
158+
target,
159+
primaryTarget,
160+
allTargets,
161+
missedTargets,
162+
statusId,
163+
options,
164+
probablity,
165+
});
166+
}
167+
}
115168
}
116169

117170
const movesToRegister = Object.freeze({
171+
[moveIdEnum.FIRE_PUNCH]: new Move({
172+
id: moveIdEnum.FIRE_PUNCH,
173+
name: "Fire Punch",
174+
type: pokemonTypes.FIRE,
175+
power: 75,
176+
accuracy: 100,
177+
cooldown: 2,
178+
targetType: targetTypes.ENEMY,
179+
targetPosition: targetPositions.FRONT,
180+
targetPattern: targetPatterns.SINGLE,
181+
tier: moveTiers.POWER,
182+
damageType: damageTypes.PHYSICAL,
183+
description:
184+
"The target is punched with a fiery fist. It may also leave the target with a burn with a 50% chance.",
185+
execute({ source, primaryTarget, allTargets, missedTargets }) {
186+
this.genericDealAllDamage({
187+
source,
188+
primaryTarget,
189+
allTargets,
190+
missedTargets,
191+
});
192+
this.genericApplyAllStatus({
193+
source,
194+
primaryTarget,
195+
allTargets,
196+
statusId: statusConditions.BURN,
197+
probablity: 0.5,
198+
});
199+
},
200+
}),
118201
[moveIdEnum.VINE_WHIP]: new Move({
119202
id: moveIdEnum.VINE_WHIP,
120203
name: "Vine Whip",
@@ -193,6 +276,37 @@ const movesToRegister = Object.freeze({
193276
});
194277
},
195278
}),
279+
[moveIdEnum.MAGMA_IMPACT]: new Move({
280+
id: moveIdEnum.MAGMA_IMPACT,
281+
name: "Magma Impact",
282+
type: pokemonTypes.FIRE,
283+
power: 45,
284+
accuracy: 90,
285+
cooldown: 5,
286+
targetType: targetTypes.ENEMY,
287+
targetPosition: targetPositions.FRONT,
288+
targetPattern: targetPatterns.ALL,
289+
tier: moveTiers.ULTIMATE,
290+
damageType: damageTypes.PHYSICAL,
291+
description:
292+
"The targets are struck with blades of magma. If hit and the target is not a full HP, deals 1.5x damage.",
293+
execute({ source, primaryTarget, allTargets, missedTargets }) {
294+
this.genericDealAllDamage({
295+
source,
296+
primaryTarget,
297+
allTargets,
298+
missedTargets,
299+
calculateDamageFunction: (args) => {
300+
const { target } = args;
301+
const baseDamage = source.calculateMoveDamage(args);
302+
if (!missedTargets.includes(target) && target.hp < target.maxHp) {
303+
return Math.floor(baseDamage * 1.5);
304+
}
305+
return baseDamage;
306+
},
307+
});
308+
},
309+
}),
196310
});
197311

198312
module.exports = {

src/config/pokemonConfig.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7172,6 +7172,26 @@ const pokemonConfigRaw = {
71727172
rarity: rarities.LEGENDARY,
71737173
growthRate: growthRates.SLOW,
71747174
},
7175+
[pokemonIdEnum.MAXIES_GROUDON]: {
7176+
name: "Maxie's Groudon",
7177+
emoji: "<:magmagroudon:1325287156268404878>",
7178+
description:
7179+
"A Groudon under the control of Maxie, the leader of Team Magma. It uses its power to expand the land.",
7180+
type: [types.GROUND, types.FIRE],
7181+
baseStats: [99, 166, 130, 90, 90, 85],
7182+
sprite:
7183+
"https://raw.githubusercontent.com/ewei068/pokestar/main/media/images/sprites/magma-groudon-resized.gif",
7184+
shinySprite:
7185+
"https://raw.githubusercontent.com/ewei068/pokestar/main/media/images/sprites/magma-groudon-shiny-resized.gif",
7186+
abilities: {
7187+
[abilityIdEnum.MAGMA_POWER]: 1,
7188+
},
7189+
moveIds: ["m479", "m14", "m523", moveIdEnum.MAGMA_IMPACT],
7190+
battleEligible: true,
7191+
rarity: rarities.LEGENDARY,
7192+
growthRate: growthRates.SLOW,
7193+
noGacha: true,
7194+
},
71757195
384: {
71767196
name: "Rayquaza",
71777197
emoji: "<:384:1132497391535272016>",

src/enums/battleEnums.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ const effectIdEnum = Object.freeze({
1919
const moveIdEnum = Object.freeze({
2020
TEST_MOVE: "999",
2121
TEST_MOVE2: "998",
22+
FIRE_PUNCH: "m7",
2223
VINE_WHIP: "m22",
2324
AQUA_IMPACT: "m618-1",
25+
MAGMA_IMPACT: "m619-1",
2426
});
2527

2628
/**
@@ -32,6 +34,7 @@ const abilityIdEnum = Object.freeze({
3234
TEST_ABILITY: "testAbility",
3335
REGENERATOR: "144",
3436
AQUA_POWER: "2-1",
37+
MAGMA_POWER: "70-1",
3538
});
3639

3740
/** @typedef {Enum<battleEventEnum>} BattleEventEnum */

src/enums/pokemonEnums.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ const pokemonIdEnum = Object.freeze({
308308
PALMERS_RAYQUAZA: "20384",
309309
WILLOWS_MELMETAL: "20809",
310310
ARCHIES_KYOGRE: "382-1",
311+
MAXIES_GROUDON: "383-1",
311312
});
312313

313314
module.exports = { pokemonIdEnum };

0 commit comments

Comments
 (0)