summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-07 21:24:45 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-07 21:24:45 +0000
commitff118ee31297737d34888c4ca07fd76f2b7ff184 (patch)
tree327eee0c681328a19d558bbe11f109c41f31c8a3
parent2b695d8b7cd4960962bcb0eed3905a90ae678f37 (diff)
downloadcrawl-ref-ff118ee31297737d34888c4ca07fd76f2b7ff184.tar.gz
crawl-ref-ff118ee31297737d34888c4ca07fd76f2b7ff184.zip
Allow the player to swap places with neutral god gifts.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4112 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/acr.cc14
-rw-r--r--crawl-ref/source/fight.cc9
-rw-r--r--crawl-ref/source/mon-util.cc5
-rw-r--r--crawl-ref/source/mon-util.h1
4 files changed, 16 insertions, 13 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 534c6117c5..596c57d734 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1674,7 +1674,7 @@ static void _experience_check()
}
#ifdef DEBUG_DIAGNOSTICS
if (wearing_amulet(AMU_THE_GOURMAND))
- mprf(MSGCH_DIAGNOSTICS, "Gourmand charge: %d",
+ mprf(MSGCH_DIAGNOSTICS, "Gourmand charge: %d",
you.duration[DUR_GOURMAND]);
mprf(MSGCH_DIAGNOSTICS, "Turns spent on this level: %d",
@@ -1682,7 +1682,7 @@ static void _experience_check()
#endif
}
-static bool _mons_hostile( const monsters *mon)
+static bool _mons_hostile(const monsters *mon)
{
return (!mons_friendly(mon) && !mons_neutral(mon));
}
@@ -4079,17 +4079,17 @@ 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 swappable 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_is_swappable(&menv[targ_monst])
&& !you.duration[DUR_CONF]
|| is_sanctuary(you.x_pos, you.y_pos)
&& is_sanctuary(targ_x, targ_y));
// cannot move away from mermaid but you CAN fight neighbouring squares
if (you.duration[DUR_BEHELD] && !you.duration[DUR_CONF])
- {
+ {
for (unsigned int i = 0; i < you.beheld_by.size(); i++)
{
monsters* mon = &menv[you.beheld_by[i]];
@@ -4134,7 +4134,7 @@ static void _move_player(int move_x, int move_y)
snprintf(info, INFO_SIZE,
"Really attack %s, despite your sanctuary?",
mon->name(DESC_NOCAP_THE).c_str());
-
+
if (!yesno(info, true, 'n'))
return;
}
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 20af770217..2069aca58a 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -3908,13 +3908,10 @@ bool monster_attack(int monster_attacking)
{
monsters *attacker = &menv[monster_attacking];
- // Friendly monsters and neutral monsters that are god gifts won't
- // attack unless confused.
- if ((mons_friendly(attacker) || mons_good_neutral(attacker))
- && !mons_is_confused(attacker))
- {
+ // Monsters that you can swap positions with won't attack unless
+ // confused.
+ if (mons_is_swappable(attacker) && !mons_is_confused(attacker))
return false;
- }
// In case the monster hasn't noticed you, bumping into it will
// change that.
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index b120b73ec1..3150fcbf64 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1816,6 +1816,11 @@ bool mons_good_neutral(const monsters *m)
return (mons_neutral(m) && testbits(m->flags, MF_GOD_GIFT));
}
+bool mons_is_swappable(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 1a250e689e..72b79b584a 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -622,6 +622,7 @@ 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_is_swappable(const monsters *m);
mon_attitude_type mons_attitude(const monsters *m);
bool mons_behaviour_perceptible(const monsters *mon);