🚀 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,
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",

View file

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