summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-07 22:50:11 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-07 22:50:11 +0000
commit0915163a542776844b0ce664221417f86c05245c (patch)
treec24191aacde143a54c20ba2180a05b4db4577019 /crawl-ref/source
parentefd814414b3ee9043cb7195fb048d1e4bf9843db (diff)
downloadcrawl-ref-0915163a542776844b0ce664221417f86c05245c.tar.gz
crawl-ref-0915163a542776844b0ce664221417f86c05245c.zip
More neutrality cleanups. Holy beings neutralized on sight by your
piety will not attack you and can swap positions with you. All other neutral beings behave the same as before. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4119 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/acr.cc8
-rw-r--r--crawl-ref/source/delay.cc2
-rw-r--r--crawl-ref/source/fight.cc10
-rw-r--r--crawl-ref/source/mon-util.cc10
-rw-r--r--crawl-ref/source/mon-util.h2
-rw-r--r--crawl-ref/source/spells1.cc2
6 files changed, 21 insertions, 13 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index db64284252..9605fc733f 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -2199,7 +2199,7 @@ void process_command( command_type cmd )
flush_input_buffer( FLUSH_ON_FAILURE );
break;
}
-
+
if (Options.tutorial_left)
Options.tut_spell_counter++;
if (!cast_a_spell())
@@ -4079,10 +4079,10 @@ static void _move_player(int move_x, int move_y)
const unsigned short targ_monst = mgrd[ targ_x ][ targ_y ];
const bool targ_pass = you.can_pass_through(targ_x, targ_y);
- // you can swap places with a friendly monster if you're not
- // confused, or if both of you are inside a sanctuary
+ // you can swap places with a friendly or good neutral monster if
+ // you're not confused, or if both of you are inside a sanctuary
const bool can_swap_places = targ_monst != NON_MONSTER
- && (mons_friendly(&menv[targ_monst])
+ && (mons_wont_attack(&menv[targ_monst])
&& !you.duration[DUR_CONF]
|| is_sanctuary(you.x_pos, you.y_pos)
&& is_sanctuary(targ_x, targ_y));
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 144093598e..c704083560 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -187,8 +187,6 @@ static int recite_to_monsters(int x, int y, int pow, int unused)
mons->attitude = ATT_NEUTRAL;
mons->flags |= MF_WAS_NEUTRAL;
- mons->flags |= MF_GOD_GIFT;
-
// give half of the monster's xp
unsigned int exp_gain = 0, avail_gain = 0;
gain_exp( exper_value(mons) / 2 + 1, &exp_gain, &avail_gain );
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 0bba6838c7..998a3147e4 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -310,7 +310,7 @@ melee_attack::melee_attack(actor *attk, actor *defn,
void melee_attack::check_hand_half_bonus_eligible()
{
- hand_half_bonus =
+ hand_half_bonus =
unarmed_ok
&& !can_do_unarmed
&& !shield
@@ -326,14 +326,14 @@ void melee_attack::init_attack()
if (defender && defender->atype() == ACT_MONSTER)
def = dynamic_cast<monsters*>(defender);
-
+
weapon = attacker->weapon(attack_number);
damage_brand = attacker->damage_brand(attack_number);
if (weapon && weapon->base_type == OBJ_WEAPONS
&& is_random_artefact( *weapon ))
{
- randart_wpn_properties( *weapon, art_props );
+ randart_wpn_properties( *weapon, art_props );
}
wpn_skill = weapon? weapon_skill( *weapon ) : SK_UNARMED_COMBAT;
@@ -3908,8 +3908,8 @@ bool monster_attack(int monster_attacking)
{
monsters *attacker = &menv[monster_attacking];
- // Friendly monsters won't attack unless confused.
- if (mons_friendly(attacker) && !mons_is_confused(attacker))
+ // Friendly and good neutral monsters won't attack unless confused.
+ if (mons_wont_attack(attacker) && !mons_is_confused(attacker))
return false;
// In case the monster hasn't noticed you, bumping into it will
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 402aeac188..ebe98245b6 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1811,6 +1811,16 @@ bool mons_neutral(const monsters *m)
return (m->attitude == ATT_NEUTRAL || m->has_ench(ENCH_NEUTRAL));
}
+bool mons_good_neutral(const monsters *m)
+{
+ return (mons_neutral(m) && testbits(m->flags, MF_GOD_GIFT));
+}
+
+bool mons_wont_attack(const monsters *m)
+{
+ return (mons_friendly(m) || mons_good_neutral(m));
+}
+
mon_attitude_type mons_attitude(const monsters *m)
{
return (m->has_ench(ENCH_CHARM)? ATT_FRIENDLY : m->attitude);
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index ae69af7e15..f33713b878 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -621,6 +621,8 @@ bool mons_aligned(int m1, int m2);
* *********************************************************************** */
bool mons_friendly(const monsters *m);
bool mons_neutral(const monsters *m);
+bool mons_good_neutral(const monsters *m);
+bool mons_wont_attack(const monsters *m);
mon_attitude_type mons_attitude(const monsters *m);
bool mons_behaviour_perceptible(const monsters *mon);
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 4a559dcf8f..f01a93f4d1 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -705,8 +705,6 @@ static int _healing_spell( int healed, int target_x = -1, int target_y = -1)
monster->attitude = ATT_NEUTRAL;
monster->flags |= MF_WAS_NEUTRAL;
- monster->flags |= MF_GOD_GIFT;
-
// give half of the monster's xp
unsigned int exp_gain = 0, avail_gain = 0;
gain_exp( exper_value(monster) / 2 + 1, &exp_gain, &avail_gain );