From 5ea227f92acacbf799ffe6bf2d85094bdd55775c Mon Sep 17 00:00:00 2001 From: Marti Herms Date: Mon, 5 Aug 2024 23:51:04 +0200 Subject: [PATCH] implement initial models #84 --- .../project/PokemonSD/core/.gitignore | 1 + .../project/PokemonSD/core/data/models.js | 188 +++++++++++++++--- .../project/PokemonSD/doc/README.md | 15 +- 3 files changed, 171 insertions(+), 33 deletions(-) create mode 100644 staff/marti-herms/project/PokemonSD/core/.gitignore diff --git a/staff/marti-herms/project/PokemonSD/core/.gitignore b/staff/marti-herms/project/PokemonSD/core/.gitignore new file mode 100644 index 000000000..276153a96 --- /dev/null +++ b/staff/marti-herms/project/PokemonSD/core/.gitignore @@ -0,0 +1 @@ +.json \ No newline at end of file diff --git a/staff/marti-herms/project/PokemonSD/core/data/models.js b/staff/marti-herms/project/PokemonSD/core/data/models.js index 206a2a180..53c9ca9d3 100644 --- a/staff/marti-herms/project/PokemonSD/core/data/models.js +++ b/staff/marti-herms/project/PokemonSD/core/data/models.js @@ -1,45 +1,171 @@ -import { Schema, model, ObjectId } from 'mongoose' +import { Schema, model, Types } from 'mongoose' -// const pokemonList = new Schema({ -// count: { -// type: Number, -// }, -// results: { -// type: [String] -// } -// }) +const { ObjectId } = Types -const pokemon = new Schema({ - id: { +const pokemonList = new Schema({ + count: { type: Number, - required: true }, - name: { - type: String, - required: true + list: { + type: [{ + id: { + type: ObjectId, + ref: 'Pokemon' + }, + name: { type: String } + }] + } +}) + +const pokemon = new Schema({ + id: { type: Number }, + name: { type: String }, + moves: { + type: [{ + id: { + type: ObjectId, + ref: 'Move' + }, + name: { type: String } + }] }, - data: { - type: Object, - required: true + abilities: { + type: [{ + id: { + type: ObjectId, + ref: 'Ability' + }, + name: { type: String } + }] + }, + forms: { type: [String] }, + stats: { + type: { + hp: { + baseStat: { type: Number }, + evs: { type: Number }, + ivs: { type: Number } + }, + atk: { + baseStat: { type: Number }, + evs: { type: Number }, + ivs: { type: Number } + }, + def: { + baseStat: { type: Number }, + evs: { type: Number }, + ivs: { type: Number } + }, + spA: { + baseStat: { type: Number }, + evs: { type: Number }, + ivs: { type: Number } + }, + spD: { + baseStat: { type: Number }, + evs: { type: Number }, + ivs: { type: Number } + }, + spe: { + baseStat: { type: Number }, + evs: { type: Number }, + ivs: { type: Number } + }, + } + }, + type: { + type: [{ + id: { + type: ObjectId, + rer: 'Type' + }, + name: { type: String } + }] } }) -// const ability = new Schema({ -// name: { -// type: String -// }, -// isHidden: { -// type: Boolean -// } -// }) +const type = new Schema({ + name: { type: String }, + superEffective: { + type: [{ + id: { + type: ObjectId, + rer: 'Type' + }, + name: { type: String } + }] + }, + notVeryEffective: { + type: [{ + id: { + type: ObjectId, + rer: 'Type' + }, + name: { type: String } + }] + }, + noEffect: { + type: [{ + id: { + type: ObjectId, + rer: 'Type' + }, + name: { type: String } + }] + }, +}) + +const move = new Schema({ + name: { type: String }, + accuracy: { type: Number }, + damageClass: { type: String }, // Physical, Special, Status + effectChance: { type: Number }, + effect: { type: String }, + meta: { + type: { + ailment: { type: String }, + ailment_chance: { type: Number }, + category: { type: String }, + crit_rate: { type: Number }, + drain: { type: Number }, + flinch_chance: { type: Number }, + healing: { type: Number }, + max_hits: { type: Number }, + max_turns: { type: Number }, + min_hits: { type: Number }, + min_turns: { type: Number }, + stat_chance: { type: Number } + } + }, + power: { type: Number }, + powerPoints: { type: Number }, + priority: { type: Number }, + statChanges: { + type: [{ + change: { type: Number }, + stat: { type: String } + }] + }, + target: { type: String }, + type: { type: String } +}) + +const ability = new Schema({ + name: { type: String }, + effect: { type: String }, +}) -// const PokemonList = model('PokemonList', pokemonList) +const PokemonList = model('PokemonList', pokemonList) const Pokemon = model('Pokemon', pokemon) -// const Ability = model('Ability', ability) +const Type = model('Type', type) +const Move = model('Move', move) +const Ability = model('Ability', ability) export { - // PokemonList, - // Ability, - Pokemon + PokemonList, + Pokemon, + Type, + Move, + Ability } diff --git a/staff/marti-herms/project/PokemonSD/doc/README.md b/staff/marti-herms/project/PokemonSD/doc/README.md index fd96f0a2a..7fd0f2a8c 100644 --- a/staff/marti-herms/project/PokemonSD/doc/README.md +++ b/staff/marti-herms/project/PokemonSD/doc/README.md @@ -2,13 +2,24 @@ A game to build pokemon teams and fight with them -![Pokemon image](./images/) +![Pokemon image](https://media.giphy.com/media/Ml9qdzetfukLi7kCai/giphy.gif?cid=790b76112j9m649d1ezvbunwxado0yph46f46wyqdajfn0kr&ep=v1_gifs_search&rid=giphy.gif&ct=g) ## Functional ### Use Cases -[?] +V.01 +- create Pokemon team +- edit Pokemon team +- add pokemon to team +- remove pokemon from team +- edit pokemon from team + +V.02 +- find battle +- select move +- cancel move +- exit battle ### UIUX Design