diff --git a/src/app/use-item-data.ts b/src/app/use-item-data.ts index d1c183c..5b81f92 100644 --- a/src/app/use-item-data.ts +++ b/src/app/use-item-data.ts @@ -9,6 +9,7 @@ import { hideItemsMenu, learnMove, showActionOnPokemon, + showEvolution, throwPokeball, } from "../state/uiSlice"; import { getMoveMetadata } from "./use-move-metadata"; @@ -22,7 +23,7 @@ export enum ItemType { Bicycle = "bicycle", SafariBall = "safari-ball", Pokedex = "pokedex", - MoonStone = "moon-stone", + MoonStone = "moon-stone", // DONE Antidote = "antidote", BurnHeal = "burn-heal", IceHeal = "ice-heal", @@ -44,9 +45,9 @@ export enum ItemType { EscapeRope = "escape-rope", Repel = "repel", OldAmber = "old-amber", - FireStone = "fire-stone", - ThunderStone = "thunder-stone", - WaterStone = "water-stone", + FireStone = "fire-stone", // DONE + ThunderStone = "thunder-stone", // DONE + WaterStone = "water-stone", // DONE HpUp = "hp-up", Protein = "protein", Iron = "iron", @@ -58,7 +59,7 @@ export enum ItemType { SecretKey = "secret-key", BikeVoucher = "bike-voucher", XAccuracy = "x-accuracy", - LeafStone = "leaf-stone", + LeafStone = "leaf-stone", // DONE CardKey = "card-key", Nugget = "nugget", // DONE PpUp = "pp-up", // DONE @@ -614,6 +615,156 @@ const useItemData = () => { 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]: { type: ItemType.MasterBall, name: "Master Ball", diff --git a/src/maps/mt-moon-1f.ts b/src/maps/mt-moon-1f.ts index d2f3893..dba4134 100644 --- a/src/maps/mt-moon-1f.ts +++ b/src/maps/mt-moon-1f.ts @@ -300,7 +300,7 @@ const mtMoon1f: MapType = { }, }, { - item: ItemType.PokeBall, // TODO: should be MoonStone + item: ItemType.MoonStone, hidden: true, pos: { x: 2,