summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-07 08:50:09 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-07 08:50:42 +0200
commit60bbd0964c8b9d44b9a217cccba6d87de5656abe (patch)
treecde797854813bafc0017cf3e5f0742b44e1d52d5
parent55957d0f93dfcd45cba025520c239aa4af70a6c5 (diff)
downloadcrawl-ref-60bbd0964c8b9d44b9a217cccba6d87de5656abe.tar.gz
crawl-ref-60bbd0964c8b9d44b9a217cccba6d87de5656abe.zip
Enable monsters to drink potions of berserk rage.
-rw-r--r--crawl-ref/source/beam.cc11
-rw-r--r--crawl-ref/source/enum.h21
-rw-r--r--crawl-ref/source/mon-util.cc16
3 files changed, 34 insertions, 14 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 5974d3433a..9983c00882 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1394,6 +1394,7 @@ static beam_type _chaos_beam_flavour()
10, BEAM_SLOW,
10, BEAM_HASTE,
10, BEAM_MIGHT,
+ 10, BEAM_BERSERK,
10, BEAM_HEALING,
10, BEAM_PARALYSIS,
10, BEAM_CONFUSION,
@@ -4826,6 +4827,7 @@ bool bolt::has_saving_throw() const
{
case BEAM_HASTE:
case BEAM_MIGHT:
+ case BEAM_BERSERK:
case BEAM_HEALING:
case BEAM_INVISIBILITY:
case BEAM_DISPEL_UNDEAD:
@@ -5194,6 +5196,15 @@ mon_resist_type bolt::apply_enchantment_to_monster(monsters* mon)
}
return (MON_AFFECTED);
+ case BEAM_BERSERK:
+ if (!mon->has_ench(ENCH_BERSERK)) {
+ // currently from potion, hence voluntary
+ mon->go_berserk(true);
+ // can't return this from go_berserk, unfortunately
+ obvious_effect = mons_near(mon);
+ }
+ return (MON_AFFECTED);
+
case BEAM_HEALING:
if (YOU_KILL(thrower))
{
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 439b1373df..64b6193955 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -233,34 +233,35 @@ enum beam_type // beam[].flavour
BEAM_TELEPORT,
BEAM_POLYMORPH,
BEAM_CHARM,
- BEAM_BANISH, // 35
+ BEAM_BANISH, // 35
BEAM_DEGENERATE,
BEAM_ENSLAVE_UNDEAD,
BEAM_ENSLAVE_SOUL,
BEAM_PAIN,
- BEAM_DISPEL_UNDEAD, // 40
+ BEAM_DISPEL_UNDEAD, // 40
BEAM_DISINTEGRATION,
BEAM_ENSLAVE_DEMON,
BEAM_BLINK,
BEAM_PETRIFY,
- BEAM_BACKLIGHT, // 45
+ BEAM_BACKLIGHT, // 45
BEAM_PORKALATOR,
BEAM_SLIME,
BEAM_SLEEP,
- BEAM_LAST_ENCHANTMENT = BEAM_SLEEP,
+ BEAM_BERSERK,
+ BEAM_LAST_ENCHANTMENT = BEAM_BERSERK,
// new beams for evaporate
- BEAM_POTION_STINKING_CLOUD,
+ BEAM_POTION_STINKING_CLOUD, // 50
BEAM_POTION_POISON,
BEAM_POTION_MIASMA,
- BEAM_POTION_STEAM, // 50
+ BEAM_POTION_STEAM,
BEAM_POTION_FIRE,
- BEAM_POTION_COLD,
+ BEAM_POTION_COLD, // 55
BEAM_POTION_BLACK_SMOKE,
BEAM_POTION_GREY_SMOKE,
- BEAM_POTION_BLUE_SMOKE, // 55
- BEAM_POTION_PURP_SMOKE,
BEAM_POTION_MUTAGENIC,
+ BEAM_POTION_BLUE_SMOKE,
+ BEAM_POTION_PURP_SMOKE, // 60
BEAM_POTION_RANDOM,
BEAM_LAST_REAL = BEAM_POTION_RANDOM,
@@ -268,7 +269,7 @@ enum beam_type // beam[].flavour
// For getting the visual effect of a beam.
BEAM_VISUAL,
- BEAM_TORMENT_DAMAGE, // 60: Pseudo-beam for damage flavour.
+ BEAM_TORMENT_DAMAGE, // Pseudo-beam for damage flavour.
BEAM_FIRST_PSEUDO = BEAM_TORMENT_DAMAGE,
BEAM_STEAL_FOOD, // Pseudo-beam for harpies stealing food.
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 89426adf22..1bc758ab4f 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -5887,10 +5887,8 @@ void monsters::go_berserk(bool /* intentional */)
add_ench(mon_enchant(ENCH_BERSERK, 0, KC_OTHER, duration * 10));
add_ench(mon_enchant(ENCH_HASTE, 0, KC_OTHER, duration * 10));
add_ench(mon_enchant(ENCH_MIGHT, 0, KC_OTHER, duration * 10));
- simple_monster_message( this, " goes berserk!" );
-
- // Xom likes monsters going berserk.
- if (mons_near(this))
+ if (simple_monster_message( this, " goes berserk!" ))
+ // Xom likes monsters going berserk.
xom_is_stimulated(mons_friendly(this) ? 32 : 128);
}
@@ -8315,6 +8313,7 @@ bool monsters::can_drink_potion(potion_type ptype) const
return (mons_species() == MONS_VAMPIRE);
case POT_SPEED:
case POT_MIGHT:
+ case POT_BERSERK_RAGE:
case POT_INVISIBILITY:
// If there are any item using monsters that are permanently
// invisible, this might have to be restricted.
@@ -8345,6 +8344,10 @@ bool monsters::should_drink_potion(potion_type ptype) const
return (!has_ench(ENCH_HASTE));
case POT_MIGHT:
return (!has_ench(ENCH_MIGHT) && foe_distance() <= 2);
+ case POT_BERSERK_RAGE:
+ // this implies !has_ench(ENCH_BERSERK_RAGE)
+ return (!has_ench(ENCH_MIGHT) && !has_ench(ENCH_HASTE)
+ && needs_berserk());
case POT_INVISIBILITY:
// We're being nice: friendlies won't go invisible if the player
// won't be able to see them.
@@ -8412,6 +8415,11 @@ item_type_id_state_type monsters::drink_potion_effect(potion_type ptype)
ident = ID_KNOWN_TYPE;
break;
+ case POT_BERSERK_RAGE:
+ if (enchant_monster_with_flavour(this, this, BEAM_BERSERK))
+ ident = ID_KNOWN_TYPE;
+ break;
+
default:
break;
}