diff --git a/src/characters.cc b/src/characters.cc index 6203f55..aea13d0 100644 --- a/src/characters.cc +++ b/src/characters.cc @@ -9,12 +9,12 @@ character::character(RNG *rng, const feature enabled_features, rng{rng}, enabled_features{enabled_features}, race{nrace}, HP{STARTING_HP[race]}, pos{pos}, ATK{STARTING_ATK[race]}, DEF{STARTING_DEF[race]}, - base_hit_rate{1, 1}, base_hit_rate_reset{1, 1} {} + base_hit_rate{STARTING_HR[race]} {} void character::start_turn() { ATK = STARTING_ATK[race]; DEF = STARTING_DEF[race]; - base_hit_rate = base_hit_rate_reset; + base_hit_rate = STARTING_HR[race]; } enum race character::get_race() const { diff --git a/src/characters.h b/src/characters.h index 5b9543f..980c985 100644 --- a/src/characters.h +++ b/src/characters.h @@ -56,7 +56,6 @@ protected: int ATK; int DEF; fraction base_hit_rate; - fraction base_hit_rate_reset; potion_list effects; diff --git a/src/constants.h b/src/constants.h index fbaa5cc..5768ca7 100644 --- a/src/constants.h +++ b/src/constants.h @@ -4,6 +4,7 @@ #include #include #include "position.h" +#include "fraction.h" static const int INF = 0x3F3F3F3F; @@ -41,27 +42,33 @@ enum game_command : int {game_command_terminate = 0, }; // Character generation related -static const int RACE_CNT = 12; +static const int RACE_CNT = 13; enum race : int {rshade = 0, rdrow, rvampire, rtroll, rgoblin, rhuman, rdwarf, relf, - rorc, rmerchant, rdragon, rhalfling + rorc, rmerchant, rdragon, rhalfling, + rt_800 }; static const char CHAR_REP[RACE_CNT] = { - 's', 'd', 'v', 't', 'g', 'H', 'W', 'E', 'O', 'M', 'D', 'L' + 's', 'd', 'v', 't', 'g', 'H', 'W', 'E', 'O', 'M', 'D', 'L', 't' }; static const int MAX_HP[RACE_CNT] = { - 125, 150, INF, 120, 110, 140, 100, 140, 180, 30, 150, 100 + 125, 150, INF, 120, 110, 140, 100, 140, 180, 30, 150, 100, 500 }; static const int STARTING_HP[RACE_CNT] = { - 125, 150, 50, 120, 110, 140, 100, 140, 180, 30, 150, 100 + 125, 150, 50, 120, 110, 140, 100, 140, 180, 30, 150, 100, 500 }; static const int STARTING_ATK[RACE_CNT] = { - 25, 25, 25, 25, 15, 20, 20, 30, 30, 70, 20, 15 + 25, 25, 25, 25, 15, 20, 20, 30, 30, 70, 20, 15, 40 }; static const int STARTING_DEF[RACE_CNT] = { - 25, 15, 25, 15, 20, 20, 30, 10, 25, 5, 20, 20 + 25, 15, 25, 15, 20, 20, 30, 10, 25, 5, 20, 20, 50 +}; +static const fraction STARTING_HR[RACE_CNT] = { + {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, + {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, + {1, 1} }; diff --git a/src/enemy.cc b/src/enemy.cc index 40810c8..45b64ae 100644 --- a/src/enemy.cc +++ b/src/enemy.cc @@ -8,9 +8,7 @@ enemy_base::enemy_base(RNG *rng, const feature enabled_features, const enum race &nrace, const position &pos, const int gen_room_num, std::string abbrev): character{rng, enabled_features, nrace, pos}, - room_num{gen_room_num}, abbrev{abbrev} { - base_hit_rate_reset = {1, 2}; -} + room_num{gen_room_num}, abbrev{abbrev} {} int enemy_base::get_room_num() const { return room_num; diff --git a/src/pc.cc b/src/pc.cc index a5df804..b87b1cd 100644 --- a/src/pc.cc +++ b/src/pc.cc @@ -6,6 +6,7 @@ #include "player/shade.h" #include "player/troll.h" #include "player/vampire.h" +#include "player/t_800.h" void init_player(RNG *rng, std::unique_ptr &pc, const feature enabled_features, const enum race &r) { @@ -34,6 +35,10 @@ void init_player(RNG *rng, std::unique_ptr &pc, pc = make_unique(rng, enabled_features); break; + case rt_800: + pc = make_unique(rng, enabled_features); + break; + default: break; } diff --git a/src/player.cc b/src/player.cc index 2640d7b..d897e6e 100644 --- a/src/player.cc +++ b/src/player.cc @@ -39,6 +39,10 @@ long_result player_base::apply(potion *p) { apply_effect(p); + if (race == rt_800) + return {result::applied, + "PC gets rusty joints (-5 HP). "}; + return {result::applied, (std::string)"PC applied potion of " + p->get_name() + ". "}; } diff --git a/src/player/t_800.cc b/src/player/t_800.cc new file mode 100644 index 0000000..b9bddb2 --- /dev/null +++ b/src/player/t_800.cc @@ -0,0 +1,15 @@ +#include "t_800.h" + +#include "../constants.h" + +t_800::t_800(RNG *rng, const feature enabled_features): + player_base{rng, enabled_features, race::rt_800} {} + +const char *t_800::get_race_name() const { + return "T-800"; +} + +void t_800::apply_effect(potion *p) { + HP -= RUSTY; + return; +} diff --git a/src/player/t_800.h b/src/player/t_800.h new file mode 100644 index 0000000..987bbb6 --- /dev/null +++ b/src/player/t_800.h @@ -0,0 +1,15 @@ +#ifndef __T_800_H__ +#define __T_800_H__ + +#include "../player.h" +class potion; + +class t_800 final: public player_base { + static const int RUSTY = 5; +public: + t_800(RNG *rng, const feature enabled_features); + const char *get_race_name() const override; + void apply_effect(potion *p) override; +}; + +#endif