summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-26 13:09:25 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-26 13:09:25 +0000
commit1b83dce6a779ad79baccd3ce407de402714dc69d (patch)
tree3cc509a5d4c024e750567d540001e765f1378fa7
parentfb7a3b56c6dde207c2fa6233d0738af8b20fac6d (diff)
downloadcrawl-ref-1b83dce6a779ad79baccd3ce407de402714dc69d.tar.gz
crawl-ref-1b83dce6a779ad79baccd3ce407de402714dc69d.zip
Added penalty for multiple shield blocks in a round for monsters.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3342 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/externs.h5
-rw-r--r--crawl-ref/source/fight.cc20
-rw-r--r--crawl-ref/source/mon-util.cc11
-rw-r--r--crawl-ref/source/monstuff.cc2
4 files changed, 32 insertions, 6 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 97e8c51527..68a7411044 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1023,7 +1023,9 @@ public:
int colour;
int foe_memory; // how long to 'remember' foe x,y
- // once they go out of sight
+ // once they go out of sight.
+
+ int shield_blocks; // Count of shield blocks this round.
god_type god; // Usually GOD_NO_GOD.
@@ -1199,6 +1201,7 @@ public:
int shield_bonus() const;
int shield_block_penalty() const;
+ void shield_block_succeeded();
int shield_bypass_ability(int tohit) const;
actor_type atype() const { return ACT_MONSTER; }
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index bec559af46..e7c875ae05 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -2493,6 +2493,10 @@ int melee_attack::player_to_hit(bool random_factor)
int your_to_hit = 15 + (calc_stat_to_hit_base() / 2);
+#ifdef DEBUG_DIAGNOSTICS
+ const int base_to_hit = your_to_hit;
+#endif
+
if (water_attack)
your_to_hit += 5;
@@ -2573,8 +2577,9 @@ int melee_attack::player_to_hit(bool random_factor)
your_to_hit = maybe_random2(your_to_hit, random_factor);
#if DEBUG_DIAGNOSTICS
- mprf( MSGCH_DIAGNOSTICS, "to hit die: %d; rolled value: %d",
- roll_hit, your_to_hit );
+ mprf( MSGCH_DIAGNOSTICS,
+ "to hit die: %d; rolled value: %d; base: %d",
+ roll_hit, your_to_hit, base_to_hit );
#endif
if (hand_half_bonus)
@@ -3678,6 +3683,11 @@ int melee_attack::mons_to_hit()
{
const int hd_mult = mons_class_flag(atk->type, M_FIGHTER)? 25 : 15;
int mhit = 18 + atk->hit_dice * hd_mult / 10;
+
+#ifdef DEBUG_DIAGNOSTICS
+ const int base_hit = mhit;
+#endif
+
if (water_attack)
mhit += 5;
@@ -3697,6 +3707,12 @@ int melee_attack::mons_to_hit()
if (defender->invisible() && !attacker->can_see_invisible())
mhit = mhit * 65 / 100;
+#ifdef DEBUG_DIAGNOSTICS
+ mprf(MSGCH_DIAGNOSTICS, "%s: Base to-hit: %d, Final to-hit: %d",
+ attacker->name(DESC_PLAIN).c_str(),
+ base_hit, mhit);
+#endif
+
return (mhit);
}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 40eb712310..981e6298f8 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2354,8 +2354,8 @@ monsters::monsters()
ac(0), ev(0), speed(0), speed_increment(0), x(0), y(0),
target_x(0), target_y(0), inv(), spells(), attitude(ATT_HOSTILE),
behaviour(BEH_WANDER), foe(MHITYOU), enchantments(), flags(0L),
- experience(0), number(0), colour(BLACK), foe_memory(0), god(GOD_NO_GOD),
- ghost(), seen_context("")
+ experience(0), number(0), colour(BLACK), foe_memory(0), shield_blocks(0),
+ god(GOD_NO_GOD), ghost(), seen_context("")
{
}
@@ -3542,7 +3542,12 @@ int monsters::shield_bonus() const
int monsters::shield_block_penalty() const
{
- return (0);
+ return (4 * shield_blocks * shield_blocks);
+}
+
+void monsters::shield_block_succeeded()
+{
+ ++shield_blocks;
}
int monsters::shield_bypass_ability(int) const
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 3398853f04..6dbcdb0e4f 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -4295,6 +4295,8 @@ static void handle_monster_move(int i, monsters *monster)
}
old_energy = monster->speed_increment;
+ monster->shield_blocks = 0;
+
if (env.cgrid[monster->x][monster->y] != EMPTY_CLOUD)
{
if (monster->has_ench(ENCH_SUBMERGED))