summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-12 14:39:38 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-12 14:39:38 +0000
commit1bff3c05ddd42eda0d5310b4d1f2671aae52815d (patch)
treef368dee0160428d811be9f91e403a5cdec83c3c8 /crawl-ref/source/beam.cc
parenta6faebe0c260af46518fa09ed6fce3992ce478a2 (diff)
downloadcrawl-ref-1bff3c05ddd42eda0d5310b4d1f2671aae52815d.tar.gz
crawl-ref-1bff3c05ddd42eda0d5310b4d1f2671aae52815d.zip
Implement the Petrify spell in a rather basic variant, and replace the
player spell "Paralyse" with it, i.e. not the wand/potion/misc. effects. Petrify is a 4th level spell of the Enchantment/Transmigrations school (a unique combination, I believe), all other values (incl. the level) were shamelessly stolen from Paralysis. Anyway, it consists of two elements (so I actually added TWO new enchantments), Petrifying and Petrified. A monster that is petrifying cannot move around but can perform actions like hitting adjacent monsters or casting spells at a slowed rate (1.5 of the normal cost). Once this sub-enchantment runs out (happens faster) the monster cannot move or act anymore, so it works like Paralysis. The damage you do during stabbing is one third of what you'd do otherwise, for both states of enchantment, and for both stabbing counts as unchivalric behaviour. It has not been implemented as a monster spell, and ghosts of characters that had it will use Paralyse instead. Consequently, the effect on the player (in self targetting) only handles the Petrified part. Numbers, esp. enchantment timeout, will need tweaking. They're currently Petrifying: cturn = 50 / _mod_speed(10, mons->speed); Petrified: cturn = std::max(8, 150 / (1 + modded_speed(mons, 5))) because I wanted the first to always run out faster than the second, but at the same time make the ratio of Petrifying/Petrified tilt in favour of the first for powerful monsters. The numbers are more or less made up, and tested with different monsters in wizard mode. Still, could be anything between too weak and overpowered, though the latter is more likely. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5761 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc61
1 files changed, 57 insertions, 4 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 50b7af8611..bd7e702624 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -96,6 +96,7 @@ static int _affect_player(bolt &beam, item_def *item = NULL);
static int _affect_monster(bolt &beam, monsters *mon, item_def *item = NULL);
static int _affect_monster_enchantment(bolt &beam, monsters *mon);
static void _beam_paralyses_monster( bolt &pbolt, monsters *monster );
+static void _beam_petrifies_monster( bolt &pbolt, monsters *monster );
static int _range_used_on_hit(bolt &beam);
static void _explosion1(bolt &pbolt);
static void _explosion_map(bolt &beam, int x, int y,
@@ -571,6 +572,12 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt )
pbolt.flavour = BEAM_PARALYSIS;
break;
+ case ZAP_PETRIFY:
+ pbolt.name = "0";
+ pbolt.rangeMax = 12;
+ pbolt.flavour = BEAM_PETRIFY;
+ break;
+
case ZAP_CONFUSION:
pbolt.name = "0";
pbolt.rangeMax = 12;
@@ -953,6 +960,7 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt )
case ZAP_SLOWING:
case ZAP_HASTING:
case ZAP_PARALYSIS:
+ case ZAP_PETRIFY:
case ZAP_BACKLIGHT:
case ZAP_SLEEP:
case ZAP_CONFUSION:
@@ -1540,6 +1548,12 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt )
// pbolt.is_beam = true;
break;
+ case ZAP_PETRIFY:
+ pbolt.name = "0";
+ pbolt.flavour = BEAM_PETRIFY;
+ // pbolt.is_beam = true;
+ break;
+
case ZAP_CONFUSION:
pbolt.name = "0";
pbolt.flavour = BEAM_CONFUSION;
@@ -2495,7 +2509,7 @@ int mons_ench_f2(monsters *monster, bolt &pbolt)
&& !mons_is_stationary(monster)
&& monster->add_ench(mon_enchant(ENCH_SLOW, 0, _whose_kill(pbolt))))
{
- if (!mons_is_paralysed(monster)
+ if (!mons_is_paralysed(monster) && !mons_is_petrified(monster)
&& simple_monster_message(monster, " seems to slow down."))
{
pbolt.obvious_effect = true;
@@ -2517,7 +2531,7 @@ int mons_ench_f2(monsters *monster, bolt &pbolt)
&& !mons_is_stationary(monster)
&& monster->add_ench(ENCH_HASTE))
{
- if (!mons_is_paralysed(monster)
+ if (!mons_is_paralysed(monster) && !mons_is_petrified(monster)
&& simple_monster_message(monster, " seems to speed up."))
{
pbolt.obvious_effect = true;
@@ -2554,6 +2568,10 @@ int mons_ench_f2(monsters *monster, bolt &pbolt)
_beam_paralyses_monster(pbolt, monster);
return (MON_AFFECTED);
+ case BEAM_PETRIFY:
+ _beam_petrifies_monster(pbolt, monster);
+ return (MON_AFFECTED);
+
case BEAM_CONFUSION:
if (!mons_class_is_confusable(monster->type))
return (MON_UNAFFECTED);
@@ -2635,7 +2653,9 @@ static void _slow_monster(monsters *mon, int /* degree */)
static void _beam_paralyses_monster(bolt &pbolt, monsters *monster)
{
if (!monster->has_ench(ENCH_PARALYSIS)
- && monster->add_ench(ENCH_PARALYSIS))
+ && monster->add_ench(ENCH_PARALYSIS)
+ && (!monster->has_ench(ENCH_PETRIFIED)
+ || monster->has_ench(ENCH_PETRIFYING)))
{
if (simple_monster_message(monster, " suddenly stops moving!"))
pbolt.obvious_effect = true;
@@ -2644,6 +2664,32 @@ static void _beam_paralyses_monster(bolt &pbolt, monsters *monster)
}
}
+static void _beam_petrifies_monster(bolt &pbolt, monsters *monster)
+{
+ int petrifying = monster->has_ench(ENCH_PETRIFYING);
+ if (monster->has_ench(ENCH_PETRIFIED))
+ {
+ if (petrifying > 0)
+ {
+ monster->del_ench(ENCH_PETRIFYING, true);
+ if (!monster->has_ench(ENCH_PARALYSIS)
+ && simple_monster_message(monster, " stops moving altogether!"))
+ {
+ pbolt.obvious_effect = true;
+ }
+ }
+ }
+ else if (monster->add_ench(ENCH_PETRIFIED)
+ && !monster->has_ench(ENCH_PARALYSIS))
+ {
+ monster->add_ench(ENCH_PETRIFYING);
+ if (simple_monster_message(monster, " is moving more slowly."))
+ pbolt.obvious_effect = true;
+
+ mons_check_pool(monster, pbolt.killer(), pbolt.beam_source);
+ }
+}
+
// Returns true if the curare killed the monster.
bool curare_hits_monster( const bolt &beam,
monsters *monster,
@@ -3786,6 +3832,11 @@ static int _affect_player( bolt &beam, item_def *item )
beam.obvious_effect = true;
break; // paralysis
+ case BEAM_PETRIFY:
+ you.petrify( beam.ench_power );
+ beam.obvious_effect = true;
+ break;
+
case BEAM_CONFUSION:
potion_effect( POT_CONFUSION, beam.ench_power );
beam.obvious_effect = true;
@@ -4986,6 +5037,7 @@ static int _range_used_on_hit(bolt &beam)
case BEAM_HASTE:
case BEAM_HEALING:
case BEAM_PARALYSIS:
+ case BEAM_PETRIFY:
case BEAM_CONFUSION:
case BEAM_INVISIBILITY:
case BEAM_TELEPORT:
@@ -5557,7 +5609,8 @@ killer_type bolt::killer() const
{
case KILL_YOU:
case KILL_YOU_MISSILE:
- return (flavour == BEAM_PARALYSIS? KILL_YOU : KILL_YOU_MISSILE);
+ return (flavour == BEAM_PARALYSIS
+ || flavour == BEAM_PETRIFY) ? KILL_YOU : KILL_YOU_MISSILE;
case KILL_MON:
case KILL_MON_MISSILE: