diff options
-rw-r--r-- | crawl-ref/source/enum.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 18 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 25 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 4 |
4 files changed, 28 insertions, 22 deletions
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 0d79dad214..314f665011 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -1858,7 +1858,8 @@ enum mon_attitude_type { ATT_HOSTILE, // 0, default in most cases ATT_FRIENDLY, // created friendly (or tamed?) - ATT_NEUTRAL + ATT_NEUTRAL, // neutral + ATT_GOOD_NEUTRAL // like friendly, but can't be ordered }; enum mon_flight_type diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index d00579881f..79a0d32b3e 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1758,6 +1758,12 @@ bool mons_aligned(int m1, int m2) fr2 = mons_attitude(mon2); } + if (fr1 == ATT_GOOD_NEUTRAL) + fr1 = ATT_FRIENDLY; + + if (fr2 == ATT_GOOD_NEUTRAL) + fr2 = ATT_FRIENDLY; + return (fr1 == fr2); } @@ -1813,7 +1819,7 @@ bool mons_neutral(const monsters *m) bool mons_good_neutral(const monsters *m) { - return (m->attitude == ATT_NEUTRAL && testbits(m->flags, MF_GOD_GIFT)); + return (m->attitude == ATT_GOOD_NEUTRAL); } bool mons_wont_attack(const monsters *m) @@ -2331,7 +2337,7 @@ static bool _mons_can_smite(const monsters *monster) * that trail clouds of badness are ineligible. The shover should also benefit * from shoving, so monsters that can smite/torment are ineligible. * - * (Smiters would be eligible for shoving when fleeing if the AI allowed for + * (Smiters would be eligible for shoving when fleeing if the AI allowed for * smart monsters to flee.) */ bool monster_shover(const monsters *m) @@ -2350,7 +2356,7 @@ bool monster_shover(const monsters *m) // Smiters profit from staying back and smiting. if (_mons_can_smite(m)) return (false); - + int mchar = me->showchar; // Somewhat arbitrary: giants and dragons are too big to get past anything, // beetles are too dumb (arguable), dancing weapons can't communicate, eyes @@ -2368,7 +2374,7 @@ bool monster_senior(const monsters *m1, const monsters *m2) { const monsterentry *me1 = get_monster_data(m1->type), *me2 = get_monster_data(m2->type); - + if (!me1 || !me2) return (false); @@ -2388,8 +2394,8 @@ bool monster_senior(const monsters *m1, const monsters *m2) if (m1->type == MONS_SKELETAL_WARRIOR && (mchar2 == 'z' || mchar2 == 'Z')) return (m1->hit_dice > m2->hit_dice); - if (m1->type == MONS_QUEEN_BEE - && (m2->type == MONS_KILLER_BEE + if (m1->type == MONS_QUEEN_BEE + && (m2->type == MONS_KILLER_BEE || m2->type == MONS_KILLER_BEE_LARVA)) return (true); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 87d26ffb1c..9074801743 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -4203,9 +4203,9 @@ static bool _handle_spell( monsters *monster, bolt & beem ) } else { - // all direct-effect/summoning/self-enchantments/etc + // all direct-effect/summoning/self-enchantments/etc. spellOK = true; - + if (is_sanctuary(you.x_pos, you.y_pos) || is_sanctuary(monster->x, monster->y)) { @@ -5230,7 +5230,7 @@ static bool _mons_can_displace(const monsters *mpusher, const monsters *mpushee) return (false); const int ipushee = monster_index(mpushee); - if (ipushee < 0 || ipushee >= MAX_MONSTERS) + if (invalid_monster_index(ipushee)) return (false); if (immobile_monster[ipushee]) @@ -5331,7 +5331,7 @@ static bool _do_move_monster(monsters *monster, int xi, int yi) monster_attack( monster_index(monster) ); return true; } - + if (!xi && !yi) { const int mx = monster_index(monster); @@ -5352,10 +5352,10 @@ static bool _do_move_monster(monsters *monster, int xi, int yi) _swim_or_move_energy(monster); mgrd[monster->x][monster->y] = NON_MONSTER; - + monster->x = fx; monster->y = fy; - + /* need to put in something so that monster picks up multiple items (eg ammunition) identical to those it's carrying. */ mgrd[monster->x][monster->y] = monster_index(monster); @@ -5499,11 +5499,11 @@ static bool _is_trap_safe(const monsters *monster, const int trap_x, const int trap_y, bool just_check = false) { const int intel = mons_intel(monster->type); - + // Dumb monsters don't care at all. if (intel == I_PLANT) return (true); - + const trap_struct &trap = env.trap[trap_at_xy(trap_x,trap_y)]; if (trap.type == TRAP_SHAFT && monster->will_trigger_shaft()) @@ -5540,7 +5540,7 @@ static bool _is_trap_safe(const monsters *monster, const int trap_x, // test for corridor-like environment const int x = trap_x - monster->x; const int y = trap_y - monster->y; - + // The question is whether the monster (m) can easily reach its // presumable destination (x) without stepping on the trap. Traps // in corridors do not allow this. See e.g @@ -5558,7 +5558,7 @@ static bool _is_trap_safe(const monsters *monster, const int trap_x, // will be made according to later tests (monster hp, trap type, ...) // If a monster still gets stuck in a corridor it will usually be // because it has less than half its maximum hp - + if ((_mon_can_move_to_pos(monster, x-1, y, true) || _mon_can_move_to_pos(monster, x+1,y, true)) && (_mon_can_move_to_pos(monster, x,y-1, true) @@ -5655,7 +5655,8 @@ bool _mon_can_move_to_pos(const monsters *monster, const int count_x, if (!inside_level_bounds(targ_x, targ_y)) return false; - // attacking monsters won't enter sanctuaries + // non-friendly and non-good neutral monsters won't enter + // sanctuaries if (!mons_wont_attack(monster) && is_sanctuary(targ_x, targ_y) && !is_sanctuary(monster->x, monster->y)) @@ -6182,7 +6183,7 @@ forget_it: ret = true; mmov_x = 0; mmov_y = 0; - + #if DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "%s is skipping movement in order to follow.", diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index c8ce4aa23b..ac445368d9 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3826,14 +3826,12 @@ void good_god_holy_attitude_change(monsters *holy) MSGCH_TALK); } - holy->attitude = ATT_NEUTRAL; + holy->attitude = ATT_GOOD_NEUTRAL; // not really *created* neutral, but should it become hostile later // on, it won't count as a good kill holy->flags |= MF_WAS_NEUTRAL; - holy->flags |= MF_GOD_GIFT; - // to avoid immobile "followers" behaviour_event(holy, ME_ALERT, MHITNOT); } |