🚀 implement all stones

This commit is contained in:
Chase Manning 2023-11-28 18:06:30 +00:00
commit 81dfd7c1b5
2 changed files with 157 additions and 6 deletions

View file

@ -9,6 +9,7 @@ import {
hideItemsMenu, hideItemsMenu,
learnMove, learnMove,
showActionOnPokemon, showActionOnPokemon,
showEvolution,
throwPokeball, throwPokeball,
} from "../state/uiSlice"; } from "../state/uiSlice";
import { getMoveMetadata } from "./use-move-metadata"; import { getMoveMetadata } from "./use-move-metadata";
@ -22,7 +23,7 @@ export enum ItemType {
Bicycle = "bicycle", Bicycle = "bicycle",
SafariBall = "safari-ball", SafariBall = "safari-ball",
Pokedex = "pokedex", Pokedex = "pokedex",
MoonStone = "moon-stone", MoonStone = "moon-stone", // DONE
Antidote = "antidote", Antidote = "antidote",
BurnHeal = "burn-heal", BurnHeal = "burn-heal",
IceHeal = "ice-heal", IceHeal = "ice-heal",
@ -44,9 +45,9 @@ export enum ItemType {
EscapeRope = "escape-rope", EscapeRope = "escape-rope",
Repel = "repel", Repel = "repel",
OldAmber = "old-amber", OldAmber = "old-amber",
FireStone = "fire-stone", FireStone = "fire-stone", // DONE
ThunderStone = "thunder-stone", ThunderStone = "thunder-stone", // DONE
WaterStone = "water-stone", WaterStone = "water-stone", // DONE
HpUp = "hp-up", HpUp = "hp-up",
Protein = "protein", Protein = "protein",
Iron = "iron", Iron = "iron",
@ -58,7 +59,7 @@ export enum ItemType {
SecretKey = "secret-key", SecretKey = "secret-key",
BikeVoucher = "bike-voucher", BikeVoucher = "bike-voucher",
XAccuracy = "x-accuracy", XAccuracy = "x-accuracy",
LeafStone = "leaf-stone", LeafStone = "leaf-stone", // DONE
CardKey = "card-key", CardKey = "card-key",
Nugget = "nugget", // DONE Nugget = "nugget", // DONE
PpUp = "pp-up", // DONE PpUp = "pp-up", // DONE
@ -614,6 +615,156 @@ const useItemData = () => {
dispatch(consumeItem(ItemType.MaxElixer)); dispatch(consumeItem(ItemType.MaxElixer));
}, },
}, },
[ItemType.MoonStone]: {
type: ItemType.MoonStone,
name: "Moon Stone",
countable: true,
consumable: true,
usableInBattle: false,
pokeball: false,
badge: false,
cost: null,
sellPrice: 0,
action: () => {
const EVOLUTIONS: Record<number, number> = {
133: 136, // TODO
};
dispatch(
showActionOnPokemon((index: number) => {
const evolveToId = EVOLUTIONS[index];
if (!evolveToId) return;
dispatch(
showEvolution({
index,
evolveToId,
})
);
dispatch(consumeItem(ItemType.MoonStone));
})
);
},
},
[ItemType.LeafStone]: {
type: ItemType.LeafStone,
name: "Leaf Stone",
countable: true,
consumable: true,
usableInBattle: false,
pokeball: false,
badge: false,
cost: null,
sellPrice: 0,
action: () => {
const EVOLUTIONS: Record<number, number> = {
133: 136, // TODO
};
dispatch(
showActionOnPokemon((index: number) => {
const evolveToId = EVOLUTIONS[index];
if (!evolveToId) return;
dispatch(
showEvolution({
index,
evolveToId,
})
);
dispatch(consumeItem(ItemType.LeafStone));
})
);
},
},
[ItemType.FireStone]: {
type: ItemType.FireStone,
name: "Fire Stone",
countable: true,
consumable: true,
usableInBattle: false,
pokeball: false,
badge: false,
cost: null,
sellPrice: 0,
action: () => {
const EVOLUTIONS: Record<number, number> = {
133: 136, // TODO
};
dispatch(
showActionOnPokemon((index: number) => {
const evolveToId = EVOLUTIONS[index];
if (!evolveToId) return;
dispatch(
showEvolution({
index,
evolveToId,
})
);
dispatch(consumeItem(ItemType.FireStone));
})
);
},
},
[ItemType.WaterStone]: {
type: ItemType.WaterStone,
name: "Water Stone",
countable: true,
consumable: true,
usableInBattle: false,
pokeball: false,
badge: false,
cost: null,
sellPrice: 0,
action: () => {
const EVOLUTIONS: Record<number, number> = {
133: 136, // TODO
};
dispatch(
showActionOnPokemon((index: number) => {
const evolveToId = EVOLUTIONS[index];
if (!evolveToId) return;
dispatch(
showEvolution({
index,
evolveToId,
})
);
dispatch(consumeItem(ItemType.WaterStone));
})
);
},
},
[ItemType.ThunderStone]: {
type: ItemType.ThunderStone,
name: "Thunder Stone",
countable: true,
consumable: true,
usableInBattle: false,
pokeball: false,
badge: false,
cost: null,
sellPrice: 0,
action: () => {
const EVOLUTIONS: Record<number, number> = {
133: 136, // TODO
};
dispatch(
showActionOnPokemon((index: number) => {
const evolveToId = EVOLUTIONS[index];
if (!evolveToId) return;
dispatch(
showEvolution({
index,
evolveToId,
})
);
dispatch(consumeItem(ItemType.ThunderStone));
})
);
},
},
[ItemType.MasterBall]: { [ItemType.MasterBall]: {
type: ItemType.MasterBall, type: ItemType.MasterBall,
name: "Master Ball", name: "Master Ball",

View file

@ -300,7 +300,7 @@ const mtMoon1f: MapType = {
}, },
}, },
{ {
item: ItemType.PokeBall, // TODO: should be MoonStone item: ItemType.MoonStone,
hidden: true, hidden: true,
pos: { pos: {
x: 2, x: 2,