summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-08-07 15:45:31 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-08-07 15:45:31 +0000
commitc07fe0536a4c606d80cf932c3f252036ac1e2394 (patch)
tree625f7cfa18493c3fcce26a55f2b29760725db592
parenta6bf377cd3e2c858d28227aee2d03d73c4616862 (diff)
downloadcrawl-ref-c07fe0536a4c606d80cf932c3f252036ac1e2394.tar.gz
crawl-ref-c07fe0536a4c606d80cf932c3f252036ac1e2394.zip
Brothers-in-Arms set berserk dur = abjuration dur so the summon goes away
when the berserk wears off. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1977 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/mon-util.cc15
-rw-r--r--crawl-ref/source/spells2.cc76
2 files changed, 50 insertions, 41 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index c76ec72ae6..b55b42bd75 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -3614,11 +3614,11 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
case ENCH_SHORT_LIVED:
add_ench( mon_enchant(ENCH_ABJ) );
- // just for flavour
- if (this->flags & MF_GOD_GIFT && this->has_ench(ENCH_BERSERK))
- simple_monster_message(this, " is no longer berserk.");
+ // just for flavour
+ if (this->flags & MF_GOD_GIFT && this->has_ench(ENCH_BERSERK))
+ simple_monster_message(this, " is no longer berserk.");
- monster_die( this, quiet? KILL_DISMISSED : KILL_RESET, 0 );
+ monster_die( this, quiet? KILL_DISMISSED : KILL_RESET, 0 );
break;
default:
@@ -3773,7 +3773,7 @@ bool monsters::decay_enchantment(const mon_enchant &me, bool decay_degree)
// Decay degree so that higher degrees decay faster than lower
// degrees, and a degree of 1 does not decay (it expires when the
// duration runs out).
- const int level = std::max(me.degree, 1);
+ const int level = me.degree;
if (level <= 1)
return (false);
@@ -3804,11 +3804,6 @@ void monsters::apply_enchantment(const mon_enchant &me)
if (decay_enchantment(me))
{
simple_monster_message(this, " is no longer berserk.");
-
- // this assumes that god gifts outside Trog's are rarely berserked
- if (this->flags & MF_GOD_GIFT)
- monster_die( this, KILL_RESET, 0 );
-
del_ench(ENCH_HASTE);
const int duration = random_range(70, 130);
add_ench(mon_enchant(ENCH_FATIGUE, 0, KC_OTHER, duration));
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index ed416a73a6..c69102550e 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1422,58 +1422,72 @@ void summon_berserker()
int pow = you.piety + random2(you.piety/4) - random2(you.piety/4);
int numsc = std::min(2 + (random2(pow) / 4), 6);
- int mon = MONS_TROLL;
+ monster_type mon = MONS_TROLL;
if (pow <= 100)
- { // bears
- if (coinflip())
- mon = MONS_BLACK_BEAR;
- else
- mon = MONS_GRIZZLY_BEAR;
+ {
+ // bears
+ if (coinflip())
+ mon = MONS_BLACK_BEAR;
+ else
+ mon = MONS_GRIZZLY_BEAR;
}
else if (pow <= 140)
{
- // ogres
- if (one_chance_in(3))
- mon = MONS_TWO_HEADED_OGRE;
- else
- mon = MONS_OGRE;
+ // ogres
+ if (one_chance_in(3))
+ mon = MONS_TWO_HEADED_OGRE;
+ else
+ mon = MONS_OGRE;
}
else if (pow <= 180)
{
- // trolls
- switch(random2(8))
- {
+ // trolls
+ switch(random2(8))
+ {
case 0:
- mon = MONS_DEEP_TROLL;
- break;
+ mon = MONS_DEEP_TROLL;
+ break;
case 1:
case 2:
- mon = MONS_IRON_TROLL;
- break;
+ mon = MONS_IRON_TROLL;
+ break;
case 3:
case 4:
- mon = MONS_ROCK_TROLL;
- break;
+ mon = MONS_ROCK_TROLL;
+ break;
default:
- mon = MONS_TROLL;
- break;
- }
+ mon = MONS_TROLL;
+ break;
+ }
}
else
{
- // giants
- if (coinflip())
- mon = MONS_HILL_GIANT;
- else
- mon = MONS_STONE_GIANT;
+ // giants
+ if (coinflip())
+ mon = MONS_HILL_GIANT;
+ else
+ mon = MONS_STONE_GIANT;
}
- int mons = create_monster( mon, numsc, beha, you.x_pos, you.y_pos, MHITYOU, 250 );
+ int mons = create_monster( mon, numsc, beha, you.x_pos, you.y_pos,
+ MHITYOU, 250 );
if (mons != -1)
- menv[mons].go_berserk(false);
-
+ {
+ monsters *summon = &menv[mons];
+ summon->go_berserk(false);
+ mon_enchant berserk = summon->get_ench(ENCH_BERSERK);
+ mon_enchant abj = summon->get_ench(ENCH_ABJ);
+
+ // Let Trog gifts berserk longer, and set abj timeout ==
+ // berserk timeout.
+ berserk.duration *= 2;
+ berserk.maxduration = berserk.duration;
+ abj.duration = abj.maxduration = berserk.duration;
+ summon->update_ench(berserk);
+ summon->update_ench(abj);
+ }
} // end summon_berserker()
bool summon_swarm( int pow, bool unfriendly, bool god_gift )