88 lines
1.6 KiB
C++
88 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
#include "sqrt.hpp"
|
|
|
|
#include "gen/pokemon/moves.hpp"
|
|
#include "pokemon.hpp"
|
|
#include "ailment.hpp"
|
|
|
|
struct determinant_values_t {
|
|
uint16_t dvs;
|
|
|
|
inline constexpr uint8_t attack()
|
|
{
|
|
return (dvs >> 12) & 0b1111;
|
|
}
|
|
|
|
inline constexpr uint8_t defense()
|
|
{
|
|
return (dvs >> 8) & 0b1111;
|
|
}
|
|
|
|
inline constexpr uint8_t speed()
|
|
{
|
|
return (dvs >> 4) & 0b1111;
|
|
}
|
|
|
|
inline constexpr uint8_t special()
|
|
{
|
|
return (dvs >> 0) & 0b1111;
|
|
}
|
|
|
|
inline constexpr uint8_t hit_points()
|
|
{
|
|
return ((attack() & 1) << 3)
|
|
| ((defense() & 1) << 2)
|
|
| ((speed() & 1) << 1)
|
|
| ((special() & 1) << 0);
|
|
}
|
|
};
|
|
|
|
struct stat_experience_t {
|
|
uint16_t hit_points;
|
|
uint16_t attack;
|
|
uint16_t defense;
|
|
uint16_t speed;
|
|
uint16_t special;
|
|
};
|
|
|
|
// unlike base_stat_values, stat_values is uint16_t
|
|
struct stat_values_t {
|
|
union {
|
|
struct {
|
|
uint16_t hit_points;
|
|
uint16_t attack;
|
|
uint16_t defense;
|
|
uint16_t speed;
|
|
uint16_t special;
|
|
};
|
|
uint16_t value[5];
|
|
};
|
|
};
|
|
|
|
static_assert((sizeof (stat_values_t)) == 10);
|
|
|
|
struct pokemon_instance_t {
|
|
uint8_t nickname[12];
|
|
enum pokemon_t::pokemon species;
|
|
uint8_t level;
|
|
uint32_t total_experience;
|
|
determinant_values_t determinant_values;
|
|
stat_values_t stat_values;
|
|
stat_experience_t stat_experience;
|
|
enum move_t::move moves[4];
|
|
uint16_t current_hit_points;
|
|
enum ailment_t::ailment ailment;
|
|
|
|
// missing attributes:
|
|
// "fluff" attributes:
|
|
// - id number
|
|
// - original trainer
|
|
|
|
void determine_stats();
|
|
|
|
void learn_move(enum move_t::move move, int32_t index);
|
|
};
|