diff --git a/src/characters.cc b/src/characters.cc index 976ea15..0d664f4 100644 --- a/src/characters.cc +++ b/src/characters.cc @@ -67,7 +67,7 @@ void character::discard_level_effects() { tmp.reserve(effects.size()); for (auto p : effects) - if (p->get_duration() != -1) + if (p->get_duration() > 0) tmp.push_back(p); tmp.shrink_to_fit(); diff --git a/src/game.cc b/src/game.cc index b034444..7e9c596 100644 --- a/src/game.cc +++ b/src/game.cc @@ -144,7 +144,6 @@ game_result game::run() { break; } - player->start_turn(); player->calc_effects(); if (player->is_dead()) diff --git a/src/player.cc b/src/player.cc index afaff69..3604228 100644 --- a/src/player.cc +++ b/src/player.cc @@ -110,7 +110,10 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) { if (cmd == game_command_terminate) { return {result::terminate, ""}; } else if (cmd >= move_north && cmd <= move_southwest) { - return move(lvl, pos + MOVE[cmd - move_north]); + auto res = move(lvl, pos + MOVE[cmd - move_north]); + gold g = get_gold_at(pos, lvl->get_glist()); + gold_cnt += g.amount; + return res; } else if (cmd >= apply_north && cmd <= apply_southwest) { return apply(get_potion_at(pos + MOVE[cmd - apply_north], lvl->get_plist())); diff --git a/src/potions/boost_atk.cc b/src/potions/boost_atk.cc index f788b25..9740bb1 100644 --- a/src/potions/boost_atk.cc +++ b/src/potions/boost_atk.cc @@ -11,7 +11,7 @@ boost_atk::boost_atk(const position &pos): void boost_atk::apply(const enum race &race, int &HP, int &ATK, int &DEF, fraction &base_hit_rate) { - if (remaining_duration > 0) { + if (remaining_duration != 0) { if (race == rdrow) ATK += BOOST_ATK_DROW; else diff --git a/src/potions/boost_def.cc b/src/potions/boost_def.cc index c740a1a..669327d 100644 --- a/src/potions/boost_def.cc +++ b/src/potions/boost_def.cc @@ -12,7 +12,7 @@ boost_def::boost_def(const position &pos): void boost_def::apply(const enum race &race, int &HP, int &ATK, int &DEF, fraction &base_hit_rate) { - if (remaining_duration > 0) { + if (remaining_duration != 0) { if (race == rdrow) DEF += BOOST_DEF_DROW; else diff --git a/src/potions/poison_health.cc b/src/potions/poison_health.cc index 995be0a..02d3965 100644 --- a/src/potions/poison_health.cc +++ b/src/potions/poison_health.cc @@ -8,7 +8,7 @@ poison_health::poison_health(const position &pos): void poison_health::apply(const enum race &race, int &HP, int &ATK, int &DEF, fraction &base_hit_rate) { - if (remaining_duration > 0) { + if (remaining_duration != 0) { if (race == rdrow) HP = std::max(HP - 7, 0); else diff --git a/src/potions/restore_health.cc b/src/potions/restore_health.cc index b427891..95b15ff 100644 --- a/src/potions/restore_health.cc +++ b/src/potions/restore_health.cc @@ -4,11 +4,11 @@ #include "../constants.h" restore_health::restore_health(const position &pos): - potion{potion_type::restore_health, -1, pos} {} + potion{potion_type::restore_health, 1, pos} {} void restore_health::apply(const enum race &race, int &HP, int &ATK, int &DEF, fraction &base_hit_rate) { - if (remaining_duration > 0) { + if (remaining_duration != 0) { if (race == rdrow) HP = std::min(HP + 7, MAX_HP[race]); else diff --git a/src/potions/wound_atk.cc b/src/potions/wound_atk.cc index 9ed62c5..2eef100 100644 --- a/src/potions/wound_atk.cc +++ b/src/potions/wound_atk.cc @@ -11,7 +11,7 @@ wound_atk::wound_atk(const position &pos): void wound_atk::apply(const enum race &race, int &HP, int &ATK, int &DEF, fraction &base_hit_rate) { - if (remaining_duration > 0) { + if (remaining_duration != 0) { if (race == rdrow) ATK = std::max(ATK - WOUND_ATK_DROW, 0); else diff --git a/src/potions/wound_def.cc b/src/potions/wound_def.cc index ebfdabf..561133b 100644 --- a/src/potions/wound_def.cc +++ b/src/potions/wound_def.cc @@ -11,7 +11,7 @@ wound_def::wound_def(const position &pos): void wound_def::apply(const enum race &race, int &HP, int &ATK, int &DEF, fraction &base_hit_rate) { - if (remaining_duration > 0) { + if (remaining_duration != 0) { if (race == rdrow) DEF = std::max(DEF - WOUND_DEF_DROW, 0); else