add-effect
Add battle effects (buffs, debuffs, shields) to the battle system. Use when creating temporary status modifiers.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Add battle effects (buffs, debuffs, shields) to the battle system. Use when creating temporary status modifiers.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Add new moves to the battle system. Use when implementing attack, status, or support moves for Pokemon.
Add a Pokemon (real or fake) to src/config/pokemonConfig.js with its moves, abilities, rarity, and evolution data. Use when the user asks to add, register, implement, or create a new Pokemon, Pokemon form, or fake/custom Pokemon in the battle system.
Find a Pokemon's Discord emoji string — canonical (e.g. `<:25:1100282072003772457>`) from `pokestar-pk-{n}`, form variants (e.g. `<:483origin:1404654211324448848>`) from `pokestar-forms-1`, or fakemon (e.g. `<:ashpikachu:1109522092283658250>`) from `pokestar-pk-extra` — via Playwright CLI. Use when the user asks for a Pokemon's emoji, emoji ID, form emoji, fakemon emoji, or needs an `<:name:snowflake>` string.
Create an implementation plan before adding one or more Pokemon via the `add-pokemon` skill. Builds Pokemon, moves, and abilities tables with all required inputs, flags unimplemented moves/abilities, and produces step-by-step implementation instructions. Use when the user asks to plan adding a Pokemon, plan a Pokemon batch, or invokes this skill before `add-pokemon`.
Verify Discord bot changes by running the bot and testing commands in Discord via Playwright CLI. Use when the user asks to test, verify, or check bot commands in Discord.
Verify a Pokemon's configuration in pokemonConfig.js by testing its moves and abilities in Discord via Playwright CLI. Use when validating a Pokemon's battle behavior after configuration changes.
| name | add-effect |
| description | Add battle effects (buffs, debuffs, shields) to the battle system. Use when creating temporary status modifiers. |
Files to modify:
src/enums/battleEnums.js - Add effectIdEnum.YOUR_EFFECT entry (ONLY if not exists)src/battle/data/effects.js - Add the effect implementationDO NOT modify other effects or battleConfig.js unless explicitly asked.
[effectIdEnum.EFFECT_NAME]: new Effect({
id: effectIdEnum.EFFECT_NAME,
name: "Effect Name",
description: "Description of the effect",
type: effectTypes.BUFF, // BUFF, DEBUFF, or NEUTRAL
dispellable: true, // Can it be removed by dispell effects?
effectAdd({ battle, target, source, initialArgs }) {
// Called when effect is applied
// initialArgs contains arguments passed when applying the effect
return {
// Properties to store for later use in effectRemove
};
},
effectRemove({ battle, target, source, properties, initialArgs }) {
// Called when effect expires or is removed
// properties contains what effectAdd returned
// Clean up any listeners or state here
},
tags: [], // Optional: ["hazard", "test"]
}),
The most important pattern is the properties pattern - return state from effectAdd that you'll need in effectRemove:
effectAdd({ battle, target, source, initialArgs }) {
return {
listenerId: battle.registerListenerFunction({...}),
originalValue: target.getStat("atk"),
counter: 0,
};
},
effectRemove({ battle, target, properties }) {
battle.unregisterListener(properties.listenerId);
}
Use battle.registerListenerFunction for effects (effects don't have a class-level helper):
effectAdd({ battle, target }) {
return {
listenerId: battle.registerListenerFunction({
eventName: battleEventEnum.BEFORE_DAMAGE,
callback: (args) => {
// Modify damage or perform logic
return { damage: Math.floor(args.damage * 0.5) };
},
conditionCallback: getIsTargetPokemonCallback(target),
}),
};
},
effectRemove({ battle, properties }) {
battle.unregisterListener(properties.listenerId);
}
| Type | Description |
|---|---|
effectTypes.BUFF | Positive effect, can be dispelled by debuff-removing abilities |
effectTypes.DEBUFF | Negative effect, can be dispelled by buff-removing abilities |
effectTypes.NEUTRAL | Neither buff nor debuff, special handling |
Effects can receive arguments when applied. Access them in both add and remove:
effectAdd({ battle, target, initialArgs }) {
const { shield } = initialArgs;
battle.addToLog(`${target.name} is shielded for ${shield} damage!`);
return { shieldAmount: shield };
},
effectRemove({ battle, target, initialArgs }) {
const { shield } = initialArgs;
// initialArgs persists through the effect's lifetime
}
Always Clean Up Listeners: Failing to unregister listeners causes memory leaks and incorrect behavior.
Event Argument Modification: Return modified values from callbacks to change event behavior:
callback: (args) => {
return { damage: Math.floor(args.damage * 0.5) };
};
State Management: Properties can be mutated during runtime - be careful with shared references.
Dispellable Flag: Set dispellable: false for effects that should persist through dispell abilities.
After implementing an effect, run the effect test suite to validate the implementation:
npm test -- src/battle/data/__tests__/effects.test.js
This runs an e2e test that verifies all effects can be applied and removed without throwing errors. If your new effect causes a test failure, fix the implementation and re-run until tests pass.
See the unit-test skill for more details on testing.
references/pattern-*.md - Common effect implementation patternsadd-event-listener skill - Common event types and condition callbacks