fixed: adjacent merchants under The World will now no move unless hostile

fixed typo
This commit is contained in:
2024-07-25 11:26:05 -04:00
parent 47fb60e1c9
commit 535533206f
7 changed files with 41 additions and 37 deletions

View File

@ -348,7 +348,7 @@ const char *POTIONS_LIST = "\
Gets 3x final ATK multiplier;\n\
Gets 0.5x final DEF multiplier;\n\
Lasts 12 turns.\n\n\
- Bezerk Brew (BB):\n\
- Berzerk Brew (BB):\n\
Gets 2x basic ATK multiplier;\n\
Gets 0.5x basic DEF multiplier;\n\
Lasts 15 turns.\n\n\

View File

@ -96,7 +96,7 @@ enum potion_type : int {RESTORE_HEALTH = 0, BOOST_ATK, BOOST_DEF,
POISON_HEALTH, WOUND_ATK, WOUND_DEF,
CONTINUOUS_RESTORATION, SAVAGE_STRIKE,
ECHOING_RESIL, TEMPEST_TANTRUM,
BEZERK_BREW, BORROW_LIFE,
BERZERK_BREW, BORROW_LIFE,
FINE_BOOZE, IRONCLAD_WARD
};

View File

@ -91,7 +91,11 @@ character *game::move_enemies() {
continue;
}
if (the_world && !(is_adjacent(ch->get_pos(), player->get_pos()) ||
if (ch->get_race() == MERCHANT) {
if (!hostile_merchants)
continue;
} else if (the_world &&
!(is_adjacent(ch->get_pos(), player->get_pos()) ||
(ch->get_race() == DRAGON &&
is_adjacent(static_cast<dragon * >(ch)->get_guards(),
player->get_pos()))))

View File

@ -11,7 +11,7 @@
#include "potions/savage_strike.h"
#include "potions/echoing_resilience.h"
#include "potions/tempest_tantrum.h"
#include "potions/bezerk_brew.h"
#include "potions/berzerk_brew.h"
#include "potions/borrow_life.h"
#include "potions/fine_booze.h"
#include "potions/ironclad_ward.h"
@ -48,8 +48,8 @@ std::unique_ptr<potion> new_potion(potion_type type, const position &pos) {
case TEMPEST_TANTRUM:
return std::make_unique<tempest_tantrum>(pos);
case BEZERK_BREW:
return std::make_unique<bezerk_brew>(pos);
case BERZERK_BREW:
return std::make_unique<berzerk_brew>(pos);
case BORROW_LIFE:
return std::make_unique<borrow_life>(pos);

View File

@ -0,0 +1,24 @@
#include "berzerk_brew.h"
#include <algorithm>
#include "../constants.h"
berzerk_brew::berzerk_brew(const position &pos):
potion{potion_type::BERZERK_BREW, DURATION, pos} {}
void berzerk_brew::apply(const enum race &race, int &HP, int &ATK,
int &DEF, fraction &base_hit_rate) {
if (remaining_duration != 0) {
ATK *= ATK_MUL * (race == DROW ? DROW_POTION_MUL : 1);
DEF *= DEF_MUL * (race == DROW ? DROW_POTION_MUL : 1);
--remaining_duration;
}
}
int berzerk_brew::get_priority() const {
return CALC_MID;
}
const char *berzerk_brew::get_name() const {
return "BB";
}

View File

@ -1,14 +1,14 @@
#ifndef __BEZERK_BREW_H__
#define __BEZERK_BREW_H__
#ifndef __BERZERK_BREW_H__
#define __BERZERK_BREW_H__
#include "../potion.h"
class bezerk_brew final: public potion {
class berzerk_brew final: public potion {
static const int ATK_MUL = 2;
inline static const float DEF_MUL = 0.5f;
static const int DURATION = 15;
public:
bezerk_brew(const position &pos);
berzerk_brew(const position &pos);
void apply(const enum race &race, int &HP, int &ATK, int &DEF,
fraction &base_hit_rate) override;
int get_priority() const override;

View File

@ -1,24 +0,0 @@
#include "bezerk_brew.h"
#include <algorithm>
#include "../constants.h"
bezerk_brew::bezerk_brew(const position &pos):
potion{potion_type::BEZERK_BREW, DURATION, pos} {}
void bezerk_brew::apply(const enum race &race, int &HP, int &ATK,
int &DEF, fraction &base_hit_rate) {
if (remaining_duration != 0) {
ATK *= ATK_MUL * (race == DROW ? DROW_POTION_MUL : 1);
DEF *= DEF_MUL * (race == DROW ? DROW_POTION_MUL : 1);
--remaining_duration;
}
}
int bezerk_brew::get_priority() const {
return CALC_MID;
}
const char *bezerk_brew::get_name() const {
return "BB";
}