Uploading changes to test

I'm lazy and am not going to copy the files into my offline version even though using the installer is slower
This commit is contained in:
RedstonewolfX 2024-07-10 15:34:27 -04:00
parent 3468fb233a
commit fce810fa73
3 changed files with 147 additions and 5 deletions

View File

@ -61,6 +61,89 @@ export function getNatureName(nature: Nature, includeStatEffects: boolean = fals
return ret;
}
export function getNatureIncrease(nature: Nature): string {
switch (nature) {
case Nature.LONELY:
case Nature.BRAVE:
case Nature.ADAMANT:
case Nature.NAUGHTY:
return "atk";
case Nature.BOLD:
case Nature.RELAXED:
case Nature.IMPISH:
case Nature.LAX:
return "def";
case Nature.MODEST:
case Nature.MILD:
case Nature.QUIET:
case Nature.RASH:
return "spatk";
case Nature.CALM:
case Nature.GENTLE:
case Nature.SASSY:
case Nature.CAREFUL:
return "spdef";
case Nature.TIMID:
case Nature.HASTY:
case Nature.JOLLY:
case Nature.NAIVE:
return "speed"
case Nature.HARDY:
//return "atk"
case Nature.DOCILE:
//return "def"
case Nature.SERIOUS:
//return "spatk"
case Nature.BASHFUL:
//return "spdef"
case Nature.QUIRKY:
//return "speed"
default:
return ""
}
}
export function getNatureDecrease(nature: Nature): string {
switch (nature) {
case Nature.BOLD:
case Nature.TIMID:
case Nature.MODEST:
case Nature.CALM:
return "atk";
case Nature.LONELY:
case Nature.HASTY:
case Nature.MILD:
case Nature.GENTLE:
return "def"
case Nature.ADAMANT:
case Nature.IMPISH:
case Nature.JOLLY:
case Nature.CAREFUL:
return "spatk"
case Nature.NAUGHTY:
case Nature.LAX:
case Nature.NAIVE:
case Nature.RASH:
return "spdef"
case Nature.BRAVE:
case Nature.RELAXED:
case Nature.QUIET:
case Nature.SASSY:
return "speed"
case Nature.HARDY:
//return "atk"
case Nature.DOCILE:
//return "def"
case Nature.SERIOUS:
//return "spatk"
case Nature.BASHFUL:
//return "spdef"
case Nature.QUIRKY:
//return "speed"
default:
return ""
}
}
export function getNatureStatMultiplier(nature: Nature, stat: Stat): number {
switch (stat) {
case Stat.ATK:

View File

@ -2,7 +2,7 @@ import i18next from "i18next";
import * as Utils from "./utils";
import Pokemon from "./field/pokemon";
import { PlayerPokemon, EnemyPokemon } from "./field/pokemon";
import { Nature, getNatureName } from "./data/nature";
import { Nature, getNatureDecrease, getNatureIncrease, getNatureName } from "./data/nature";
import BattleScene from "./battle-scene";
import { OptionSelectItem } from "./ui/abstact-option-select-ui-handler";
import { TrainerType } from "#enums/trainer-type";
@ -26,7 +26,10 @@ export var logKeys: string[] = [
"d", // Debug
];
export const DRPD_Version = "0.1.3"
export const DRPD_Version = "1.0.0"
export const acceptedVersions = [
"1.0.0"
]
export interface DRPD {
version: string,
title?: string,
@ -42,7 +45,7 @@ export interface Wave {
type: string,
double: boolean,
actions: string[],
shop: boolean | string,
shop: string,
biome: string,
trainer?: TrainerData,
pokemon?: PokeData[]
@ -53,7 +56,7 @@ export interface PokeData {
ability: string,
isHiddenAbility: boolean,
passiveAbility: string,
nature: string,
nature: NatureData,
gender: string,
rarity: string,
captured: boolean,
@ -62,6 +65,11 @@ export interface PokeData {
ivs: IVData,
source?: Pokemon
}
export interface NatureData {
name: string,
increased: string,
decreased: string
}
export interface IVData {
hp: integer,
atk: integer,
@ -92,6 +100,25 @@ export function newDocument(name: string = "Untitled Run " + (new Date().getUTCM
filename: (new Date().getUTCMonth() + 1 < 10 ? "0" : "") + (new Date().getUTCMonth() + 1) + "-" + (new Date().getUTCDate() < 10 ? "0" : "") + new Date().getUTCDate() + "-" + new Date().getUTCFullYear() + "_untitled"
}
}
export function importDocument(drpd: string): DRPD {
return JSON.parse(drpd) as DRPD;
}
export function importPokemon(pokemon: any): PokeData {
return {
id: pokemon.id,
name: pokemon.name,
ability: pokemon.ability,
isHiddenAbility: pokemon.isHiddenAbility,
passiveAbility: pokemon.passiveAbility,
nature: importNature(pokemon.nature),
gender: pokemon.gender,
rarity: pokemon.rarity,
captured: pokemon.captured,
level: pokemon.level,
items: pokemon.items.map(itm => importItem(itm)),
ivs: importIVs(pokemon.ivs)
}
}
export function exportPokemon(pokemon: Pokemon, encounterRarity?: string): PokeData {
return {
id: pokemon.species.speciesId,
@ -99,7 +126,7 @@ export function exportPokemon(pokemon: Pokemon, encounterRarity?: string): PokeD
ability: pokemon.getAbility().name,
isHiddenAbility: pokemon.hasAbility(pokemon.species.abilityHidden),
passiveAbility: pokemon.getPassiveAbility().name,
nature: getNatureName(pokemon.nature),
nature: exportNature(pokemon.nature),
gender: pokemon.gender == 0 ? "Male" : (pokemon.gender == 1 ? "Female" : "Genderless"),
rarity: encounterRarity,
captured: false,
@ -108,6 +135,27 @@ export function exportPokemon(pokemon: Pokemon, encounterRarity?: string): PokeD
ivs: exportIVs(pokemon.ivs)
}
}
export function importNature(nature: any): NatureData {
return {
name: nature.name,
increased: nature.increased,
decreased: nature.decreased
}
}
export function exportNature(nature: Nature): NatureData {
return {
name: getNatureName(nature),
increased: getNatureIncrease(nature),
decreased: getNatureDecrease(nature),
}
}
export function importItem(item: any): ItemData {
return {
id: item.id,
name: item.name,
quantity: item.quantity
}
}
export function exportItem(item: PokemonHeldItemModifier): ItemData {
return {
id: item.type.id,
@ -115,6 +163,16 @@ export function exportItem(item: PokemonHeldItemModifier): ItemData {
quantity: item.getStackCount()
}
}
export function importIVs(ivs: any): IVData {
return {
hp: ivs[0],
atk: ivs[1],
def: ivs[2],
spatk: ivs[3],
spdef: ivs[4],
speed: ivs[5]
}
}
export function exportIVs(ivs: integer[]): IVData {
return {
hp: ivs[0],

View File

@ -342,6 +342,7 @@ export class TitlePhase extends Phase {
start(): void {
super.start();
console.log(LoggerTools.importDocument(JSON.stringify(LoggerTools.newDocument())))
this.scene.ui.clearText();
this.scene.ui.fadeIn(250);