Prompt file imported from bcollazo/deckgym-core (
.github/prompts/tool.prompt.md). Copyright stays with the author.
-
Decide what tool you want to implement. You can use:
cargo run --bin card_statusto see what tools are missing implementation.
-
Get the details of the tool card that you want to implement by using the following script:
cargo run --bin search "Leaf Cape" -
Copy the ids of cards to implement (including full art versions) in the given JSON.
-
In
tool_ids.rsadd the tool to theToolIdenum and theTOOL_ID_MAPmap.- Keep the file ordered by set and number.
- If the tool has attachment restrictions (e.g., only Grass pokémon), implement the
can_attach_to()method to enforce these restrictions. This counts as the "move generation" for the tool.
-
Implement the "on attach" logic in
on_attach_toolinhooks/core.rs.- This is where you handle immediate effects when the tool is attached (e.g., +HP, stat modifications).
- Review similar tools to ensure consistency in implementation.
- Keep the
match tool_idcases as one-liners when possible.
-
Implement the "forecast action" logic in
forecast_trainer_actioninapply_trainer_action.rs.- Add the tool's CardId to the match branch that calls
doutcome(attach_tool). - Tools should be grouped together in a single match arm (e.g.,
CardId::A2147GiantCape | CardId::A2148RockyHelmet | CardId::A3147LeafCape).
- Add the tool's CardId to the match branch that calls
-
For tools with ongoing effects (not just on-attach):
- Implement hooks in
hooks/core.rsor other appropriate hook files. - Examples: Rocky Helmet deals damage when the holder is attacked.
- Implement hooks in
-
Make sure to run
cargo clippy --fix --allow-dirty -- -D warningsandcargo fmtto format the code.