fixed elfs being displayed as humans

reduced radius of chasing enemies
added warning to -c option
This commit is contained in:
2024-07-15 14:52:28 -04:00
parent 295b808e14
commit 9ad553706a
4 changed files with 9 additions and 10 deletions

View File

@ -168,9 +168,8 @@ void print_args_list() {
static const char *ARGS_LIST = "-n : Use ncurses for I/O\n\
-r : Randomly generate maps\n\
-m : Enabled a main menu + options\n\
-c : Enemies chase the player (through doors and up stairs)\n\
-C : Give things better coloring\n\
-i : Enable inventory (player can walk on potions)\n\
-c : Enemies chase the player (CAUTION: THEY CAN REALLY CHASE!!!)\n\
-i : Enable inventory (player can pick up potions)\n\
-t : Enable throw\n\
-R : Enable revisiting levels\n\
-e : Enable extra potions and races\n\

View File

@ -4,10 +4,10 @@
elf::elf(RNG *rng, const feature enabled_features, const position &pos,
const int gen_room_num):
enemy_base{rng, enabled_features, relf, pos, gen_room_num, "H"} {}
enemy_base{rng, enabled_features, relf, pos, gen_room_num, "E"} {}
void elf::print(display *out) {
out->print_char(pos, 'H', COLOR_PAIR(COLOR_RED));
out->print_char(pos, 'E', COLOR_PAIR(COLOR_RED));
}
const char *elf::get_race_name() const {

View File

@ -20,7 +20,7 @@ long_result enemy_base::act(level *lvl, character *pc, bool hostile) {
if (is_adjacent(pos, pc->get_pos()) && hostile)
return attack(pc);
if (enabled_features & FEATURE_ENEMIES_CHASE &&
if (enabled_features & FEATURE_ENEMIES_CHASE && hostile &&
distance_sqr(pos, pc->get_pos()) <= DIST_THRESHOLD_SQR) {
position tmp;
position target = {BIG_NUMBER, BIG_NUMBER};
@ -28,8 +28,7 @@ long_result enemy_base::act(level *lvl, character *pc, bool hostile) {
for (int i = 0; i < DIRECTION_CNT; ++i) {
tmp = pos + MOVE[i];
if (lvl->get_room(tmp) == room_num &&
lvl->is_available(tmp) &&
if (lvl->is_available(tmp) &&
distance_sqr(tmp, pc->get_pos()) <
distance_sqr(target, pc->get_pos()))
target = tmp;
@ -43,7 +42,8 @@ long_result enemy_base::act(level *lvl, character *pc, bool hostile) {
position choices[DIRECTION_CNT];
for (int i = 0; i < DIRECTION_CNT; ++i)
if (lvl->get_room(pos + MOVE[i]) == room_num &&
if (((enabled_features & FEATURE_ENEMIES_CHASE) ?
true : lvl->get_room(pos + MOVE[i]) == room_num ) &&
lvl->is_available(pos + MOVE[i])) {
choices[choices_cnt] = pos + MOVE[i];
++choices_cnt;

View File

@ -6,7 +6,7 @@
class enemy_base : public character {
private:
const static int BIG_NUMBER = 500;
const static int DIST_THRESHOLD_SQR = 8 * 8;
const static int DIST_THRESHOLD_SQR = 3 * 3;
protected:
const int room_num;