Skip to content

Commit

Permalink
Gen3 Wrap up Part 1 (#75)
Browse files Browse the repository at this point in the history
* archie kyogre

* fully finish archie's kyogre

* maxie groudon

* add numel and camerupt

* magma camerupt

* aqua sharpedo

* update changelog

* update gitignore

* new banners

* new dungeon

* add butler npc

* aqua vs magma event base
  • Loading branch information
ewei068 authored Jan 9, 2025
1 parent 5bbe596 commit fb1c283
Show file tree
Hide file tree
Showing 18 changed files with 1,034 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ ssh.txt
.DS_Store
notes.md
venv/
Heap.*
17 changes: 11 additions & 6 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@

TODO:

- Increase spawn duration
- Gen 3 wrap-up event
- Special Groudon and Kyogre Variants
- Special epic variants of Gen 3 Pokemon
- Gen 3 wrap-up update
- Add Jirachi
- New event
- Add some more Pokemon
- New raids?
- New raids
- Gen 3 wrap-up event
- Special Groudon and Kyogre Variants
- Special Aqua Sharpedo and Magma Camerupt
- New limited dungeon
- New limited NPC
- Temp increase rewards from new Gen 3 raid
- Rebalance raids
- Add raid tokens or something
- Maybe revamp shop for this
- New player UX analysis
- Make party add/remove easier
- Add Pokemon Emojis wherever possible

**Stretch**

- Stretch: Quests (Achievements)
- Stretch: Ability slots

### 1.1.1 (1/8)

Expand Down
175 changes: 173 additions & 2 deletions src/battle/data/abilities.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
/* eslint-disable no-param-reassign */
const { abilityIdEnum, battleEventEnum } = require("../../enums/battleEnums");
const { weatherConditions } = require("../../config/battleConfig");
const { types: pokemonTypes } = require("../../config/pokemonConfig");
const {
abilityIdEnum,
battleEventEnum,
effectIdEnum,
} = require("../../enums/battleEnums");
const { logger } = require("../../log");
const { getIsActivePokemonCallback } = require("../engine/eventConditions");
const {
getIsActivePokemonCallback,
getIsTargetPokemonCallback,
} = require("../engine/eventConditions");

/**
* @template T
Expand Down Expand Up @@ -43,6 +52,113 @@ class Ability {
}

const abilitiesToRegister = Object.freeze({
[abilityIdEnum.AQUA_POWER]: new Ability({
id: abilityIdEnum.AQUA_POWER,
name: "Aqua Power",
description:
"At the start of battle, if there's only one other Water or Dark type ally, increase its highest base stat (excluding HP or Speed) by 2x for 3 turns, and start rain.",
abilityAdd({ battle, target }) {
return {
listenerId: battle.registerListenerFunction({
eventName: battleEventEnum.BATTLE_BEGIN,
callback: () => {
const allyPokemons = target.getPartyPokemon();
const otherWaterDarkAllies = allyPokemons.filter(
(pokemon) =>
pokemon !== target &&
pokemon &&
!pokemon.isFainted &&
(pokemon.hasType(pokemonTypes.WATER) ||
pokemon.hasType(pokemonTypes.DARK))
);
if (otherWaterDarkAllies.length !== 1) {
return;
}
const [allyPokemon] = otherWaterDarkAllies;
battle.addToLog(`${target.name} blesses ${allyPokemon.name}!`);
const baseStats = allyPokemon.getAllBaseStats();
const highestStatIndex =
baseStats
.slice(1, 5)
.reduce(
(maxIndex, stat, index, arr) =>
stat > arr[maxIndex] ? index : maxIndex,
0
) + 1; // +1 to account for HP
allyPokemon.applyEffect(effectIdEnum.AQUA_BLESSING, 3, target, {
// @ts-ignore
stat: highestStatIndex,
});

battle.createWeather(weatherConditions.RAIN, target);
},
}),
};
},
abilityRemove({ battle, properties }) {
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.ANGER_POINT]: new Ability({
id: abilityIdEnum.ANGER_POINT,
name: "Anger Point",
description:
"When the user takes more than 33% of its health of damage at once, sharply raise its Atk and Spa for 3 turns.",
abilityAdd({ battle, target }) {
return {
listenerId: battle.registerListenerFunction({
eventName: battleEventEnum.AFTER_DAMAGE_TAKEN,
callback: ({ damage }) => {
if (damage < target.maxHp * 0.33) {
return;
}
battle.addToLog(`${target.name}'s Anger Point activates!`);
target.applyEffect("greaterAtkUp", 3, target, {});
target.applyEffect("greaterSpaUp", 3, target, {});
},
conditionCallback: getIsTargetPokemonCallback(target),
}),
};
},
abilityRemove({ battle, properties }) {
battle.unregisterListener(properties.listenerId);
},
}),
[abilityIdEnum.REGENERATOR]: new Ability({
id: abilityIdEnum.REGENERATOR,
name: "Regenerator",
Expand All @@ -69,6 +185,61 @@ const abilitiesToRegister = Object.freeze({
battle.unregisterListener(properties.listenerId);
},
}),
[abilityIdEnum.BURNING_DRAFT]: new Ability({
id: abilityIdEnum.BURNING_DRAFT,
name: "Burning Draft",
description:
"When the user's turn ends, increase the combat readiness of all allies by 10%.",
abilityAdd({ battle, target }) {
return {
listenerId: battle.registerListenerFunction({
eventName: battleEventEnum.TURN_END,
callback: () => {
const allyPokemons = target.getPartyPokemon();
battle.addToLog(
`${target.name}'s Burning Draft increases its allies' combat readiness!`
);
allyPokemons.forEach((ally) => {
if (!ally) {
return;
}
ally.boostCombatReadiness(target, 10);
});
},
conditionCallback: getIsActivePokemonCallback(battle, target),
}),
};
},
abilityRemove({ battle, properties }) {
battle.unregisterListener(properties.listenerId);
},
}),
[abilityIdEnum.JET_SPEED]: new Ability({
id: abilityIdEnum.JET_SPEED,
name: "Jet Speed",
description:
"When the weather is set to rain, increase the user's combat readiness by 20% and raise its Special Attack for 2 turns.",
abilityAdd({ battle, target }) {
return {
listenerId: battle.registerListenerFunction({
eventName: battleEventEnum.AFTER_WEATHER_SET,
callback: () => {
const { weather } = battle;
if (weather.weatherId !== weatherConditions.RAIN) {
return;
}

battle.addToLog(`${target.name} is pumped by the Rain!`);
target.boostCombatReadiness(target, 20);
target.applyEffect("spaUp", 2, target, {});
},
}),
};
},
abilityRemove({ battle, properties }) {
battle.unregisterListener(properties.listenerId);
},
}),
});

module.exports = {
Expand Down
29 changes: 28 additions & 1 deletion src/battle/data/effects.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-param-reassign */
const { effectTypes } = require("../../config/battleConfig");
const { effectTypes, statToBattleStat } = require("../../config/battleConfig");
const { effectIdEnum, battleEventEnum } = require("../../enums/battleEnums");
const { getIsTargetPokemonCallback } = require("../engine/eventConditions");
const { getEffect } = require("./effectRegistry");
Expand Down Expand Up @@ -130,6 +130,33 @@ const effectsToRegister = Object.freeze({
battle.unregisterListener(properties.listenerId);
},
}),
[effectIdEnum.AQUA_BLESSING]: new Effect({
id: effectIdEnum.AQUA_BLESSING,
name: "Aqua Blessing",
description: "The target's stat is increased by 2x.",
type: effectTypes.BUFF,
dispellable: true,
/**
* @param {EffectAddBasicArgs & {initialArgs: {stat: StatEnum}}} args
*/
effectAdd({ battle, target, initialArgs }) {
const { stat } = initialArgs;
const baseStatValue = target.getAllBaseStats()[stat];
const statToIncrease = statToBattleStat[stat];

battle.addToLog(`${target.name}'s ${statToIncrease} rose!`);
target[statToIncrease] += baseStatValue;
return {};
},
effectRemove({ battle, target, initialArgs }) {
const { stat } = initialArgs;
const baseStatValue = target.getAllBaseStats()[stat];
const statToIncrease = statToBattleStat[stat];

battle.addToLog(`${target.name}'s ${statToIncrease} boost wore off!`);
target[statToIncrease] -= baseStatValue;
},
}),
});

module.exports = {
Expand Down
Loading

0 comments on commit fb1c283

Please sign in to comment.