summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-09-05 07:46:41 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-09-05 07:46:41 +0000
commit1f5bd141dba6f05deb350f79eceef75cb68276bf (patch)
tree1e4887ed42efeb6c740c05d40aff9cb56649818e
parent17c9fad55cb3fa43bcf1bc881dba2082d792e8df (diff)
downloadcrawl-ref-1f5bd141dba6f05deb350f79eceef75cb68276bf.tar.gz
crawl-ref-1f5bd141dba6f05deb350f79eceef75cb68276bf.zip
r88@xenon: dshaligram | 2006-09-05 13:18:06 +051800
* Refixed monster displacement conditions so orc priests don't come running up to the character but stay back and smite. * Fixed Zin and The Shining One punishing deserters when they shouldn't (reported by Eva Myers). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup@33 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/mon-util.cc45
-rw-r--r--crawl-ref/source/mon-util.h5
-rw-r--r--crawl-ref/source/monstuff.cc8
-rw-r--r--crawl-ref/source/religion.cc6
4 files changed, 51 insertions, 13 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index f4e402219a..7ce15b9660 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -903,9 +903,16 @@ int exper_value( struct monsters *monster )
return (x_val);
} // end exper_value()
+void mons_spell_list(const monsters *monster, int splist[6])
+{
+ int msecc = ((monster->type == MONS_HELLION) ? MST_BURNING_DEVIL :
+ (monster->type == MONS_PANDEMONIUM_DEMON) ? MST_GHOST
+ : monster->number);
+ return mons_spell_list(msecc, splist);
+}
// this needs to be rewritten a la the monsterseek rewrite {dlb}:
-void mons_spell_list( unsigned char sec, int splist[6] )
+void mons_spell_list( int sec, int splist[6] )
{
unsigned int x;
@@ -2106,7 +2113,35 @@ const char *mons_pronoun(int mon_type, int variant)
return ("");
}
-bool monster_can_swap(const monsters *m)
+/*
+ * Checks if the monster can use smiting/torment to attack without unimpeded
+ * LOS to the player.
+ */
+static bool mons_can_smite(const monsters *monster)
+{
+ if (monster->type == MONS_FIEND)
+ return (true);
+
+ int hspell_pass[6] = { MS_NO_SPELL, MS_NO_SPELL, MS_NO_SPELL,
+ MS_NO_SPELL, MS_NO_SPELL, MS_NO_SPELL };
+ mons_spell_list(monster, hspell_pass);
+ for (unsigned i = 0; i < sizeof(hspell_pass) / sizeof(hspell_pass[0]); ++i)
+ if (hspell_pass[i] == MS_TORMENT || hspell_pass[i] == MS_SMITE)
+ return (true);
+
+ return (false);
+}
+
+/*
+ * Determines if a monster is smart and pushy enough to displace other monsters.
+ * A shover should not cause damage to the shovee by displacing it, so monsters
+ * 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
+ * smart monsters to flee.)
+ */
+bool monster_shover(const monsters *m)
{
const monsterentry *me = seekmonster(m->type);
if (!me)
@@ -2117,6 +2152,9 @@ bool monster_can_swap(const monsters *m)
if (m->type == MONS_EFREET || m->type == MONS_FIRE_ELEMENTAL
|| m->type == MONS_ROTTING_DEVIL)
return (false);
+
+ if (mons_can_smite(m))
+ return (false);
int mchar = me->showchar;
// Somewhat arbitrary: giants and dragons are too big to get past anything,
@@ -2124,7 +2162,8 @@ bool monster_can_swap(const monsters *m)
// aren't pushers and shovers, zombies are zombies. Worms and elementals
// are on the list because all 'w' are currently unrelated.
return (mchar != 'C' && mchar != 'B' && mchar != '(' && mchar != 'D'
- && mchar != 'G' && mchar != 'Z' && mchar != 'w' && mchar != '#');
+ && mchar != 'G' && mchar != 'Z' && mchar != 'z'
+ && mchar != 'w' && mchar != '#');
}
// Returns true if m1 and m2 are related, and m1 is higher up the totem pole
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 16e1d451d5..c3f55c8d50 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -348,7 +348,8 @@ const char *moname(int mcl, bool vis, char descrip, char glog[ ITEMNAME_SIZE ]);
/* ***********************************************************************
* called from: monstuff
* *********************************************************************** */
-void mons_spell_list(unsigned char sec, int splist[6]);
+void mons_spell_list(int sec, int splist[6]);
+void mons_spell_list(const monsters *monster, int splist[6]);
#if DEBUG_DIAGNOSTICS
// last updated 25sep2001 {dlb}
@@ -430,7 +431,7 @@ bool mons_is_stationary(const monsters *mons);
bool invalid_monster(const monsters *mons);
-bool monster_can_swap(const monsters *m);
+bool monster_shover(const monsters *m);
bool mons_is_paralysed(const monsters *m);
bool monster_senior(const monsters *first, const monsters *second);
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 9602023c15..f8305f5e4d 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -3073,11 +3073,7 @@ static bool handle_spell( struct monsters *monster, bolt & beem )
int hspell_pass[6] = { MS_NO_SPELL, MS_NO_SPELL, MS_NO_SPELL,
MS_NO_SPELL, MS_NO_SPELL, MS_NO_SPELL };
- int msecc = ((monster->type == MONS_HELLION) ? MST_BURNING_DEVIL :
- (monster->type == MONS_PANDEMONIUM_DEMON) ? MST_GHOST
- : monster->number);
-
- mons_spell_list( msecc, hspell_pass );
+ mons_spell_list(monster, hspell_pass);
// forces the casting of dig when player not visible - this is EVIL!
if (!monsterNearby)
@@ -4242,7 +4238,7 @@ static bool mons_can_displace(const monsters *mpusher, const monsters *mpushee)
if (mons_is_batty(mpusher) || mons_is_batty(mpushee))
return (false);
- if (!monster_can_swap(mpusher))
+ if (!monster_shover(mpusher))
return (false);
if (!monster_senior(mpusher, mpushee))
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index e8be25ec49..94cef35207 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -1873,8 +1873,9 @@ void divine_retribution( int god )
dec_penance( GOD_SHINING_ONE, 1 );
}
}
+ break;
}
- break;
+ return;
case GOD_ZIN:
// angels/creeping doom theme:
@@ -1907,8 +1908,9 @@ void divine_retribution( int god )
summon_swarm( you.experience_level * 20, true, false );
simple_god_message(" sends a plague down upon you!", god);
}
+ break;
}
- break;
+ return;
case GOD_MAKHLEB:
// demonic servant theme