finished the bulk of game

This commit is contained in:
2024-07-14 21:32:41 -04:00
parent b3475b7530
commit af8bc4112c
110 changed files with 1876 additions and 1481 deletions

View File

@ -1,36 +0,0 @@
#include "troll.h"
troll::troll(RNG *rng, const position &pos):
character{rng, race::rtroll, pos} {
gold = 0;
hostile = true;
}
result troll::attack(const direction dir, character_list &chlist) {
position tmp{pos + MOVE[dir]};
if (HP + REGAIN_HP > HP_CAP) {
HP = HP_CAP;
} else {
HP += REGAIN_HP;
}
for (auto &ch : chlist)
if (tmp == ch->get_position()) {
auto res = ch->get_hit(race, ATK, base_hit_rate);
return res;
}
return result::fine;
}
result troll::get_hit(const enum race &race, const int atk,
const fraction hitrate) {
if (rng->trial(hitrate))
HP = std::max(HP - calc_dmg(atk, DEF), 0);
if (HP == 0)
return result::died;
return result::hit;
}