diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-12 16:09:42 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-12 16:09:42 +0000 |
commit | f2903290696c79d076a099db8b0eba67793ddbb9 (patch) | |
tree | 1fb2036dde32321527a756d8c9f90971e10d9dc8 /crawl-ref/source | |
parent | aba7dd7d985d82d217a40c7aea7b2051a9b1d035 (diff) | |
download | crawl-ref-f2903290696c79d076a099db8b0eba67793ddbb9.tar.gz crawl-ref-f2903290696c79d076a099db8b0eba67793ddbb9.zip |
Broke up the monolithic miscast_effect function (used to be 1500 lines long!)
Removed the return value as it was never getting used.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1850 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 2671 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.h | 2 |
2 files changed, 1340 insertions, 1333 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 81e8ed05b2..ab2d4d648f 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -56,6 +56,10 @@ #include <conio.h> #endif +/* This determines how likely it is that more powerful wild magic effects + * will occur. Set to 100 for the old probabilities (although the individual + * effects have been made much nastier since then). + */ #define WILD_MAGIC_NASTINESS 150 static bool surge_identify_boosters(spell_type spell) @@ -1918,1570 +1922,1573 @@ static bool send_abyss(const char *cause) } } -/* This determines how likely it is that more powerful wild magic effects - * will occur. Set to 100 for the old probabilities (although the individual - * effects have been made much nastier since then). - */ - -bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, - int force_effect, const char *cause ) +static void miscast_conjuration(int severity, const char* cause) { -/* sp_type is the type of the spell - * mag_pow is overall power of the spell or effect (ie its level) - * mag_fail is the degree to which you failed - * force_effect forces a certain severity of effect to occur. - */ - struct bolt beam; - bool failMsg = true; - - int loopj; - - if (sp_type == SPTYP_RANDOM) - sp_type = 1 << (random2(12)); - - int spec_effect = (mag_pow * mag_fail * (10 + mag_pow) / 7 - * WILD_MAGIC_NASTINESS) / 100; - - if (force_effect == 100 - && random2(40) > spec_effect && random2(40) > spec_effect) - { - canned_msg(MSG_NOTHING_HAPPENS); - return (false); - } - - // setup beam - beam.is_tracer = false; - - spec_effect /= 100; - -#if DEBUG_DIAGNOSTICS - const int old_fail = spec_effect; -#endif - - spec_effect = random2(spec_effect); - - if (spec_effect > 3) - spec_effect = 3; - else if (spec_effect < 0) - spec_effect = 0; - -#if DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, "Sptype: %d, failure1: %d, failure2: %d", - sp_type, old_fail, spec_effect ); -#endif - - if (force_effect != 100) - spec_effect = force_effect; - - switch (sp_type) + bolt beam; + switch (severity) { - case SPTYP_CONJURATION: - switch (spec_effect) + case 0: // just a harmless message + switch (random2(10)) { - case 0: // just a harmless message - switch (random2(10)) - { - case 0: - msg::stream << "Sparks fly from your " << your_hand(true) - << '!' << std::endl; - break; - case 1: - mpr("The air around you crackles with energy!"); - break; - case 2: - msg::stream << "Wisps of smoke drift from your " - << your_hand(true) << '.' << std::endl; - break; - case 3: - mpr("You feel a strange surge of energy!"); - break; - case 4: - mpr("You are momentarily dazzled by a flash of light!"); - break; - case 5: - mpr("Strange energies run through your body."); - break; - case 6: - mpr("Your skin tingles."); - break; - case 7: - mpr("Your skin glows momentarily."); - break; - case 8: - canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - if (player_can_smell()) - mpr("You smell something strange."); - else if (you.species == SP_MUMMY) - mpr("Your bandages flutter."); - } + case 0: + msg::stream << "Sparks fly from your " << your_hand(true) + << '!' << std::endl; break; - - case 1: // a bit less harmless stuff - switch (random2(2)) - { - case 0: - msg::stream << "Smoke pours from your " << your_hand(true) - << '!' << std::endl; - big_cloud( CLOUD_GREY_SMOKE, KC_YOU, - you.x_pos, you.y_pos, 20, - 7 + random2(7) ); - break; - case 1: - mpr("A wave of violent energy washes through your body!"); - ouch(6 + random2avg(7, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; - } + case 1: + mpr("The air around you crackles with energy!"); + break; + case 2: + msg::stream << "Wisps of smoke drift from your " + << your_hand(true) << '.' << std::endl; + break; + case 3: + mpr("You feel a strange surge of energy!"); + break; + case 4: + mpr("You are momentarily dazzled by a flash of light!"); + break; + case 5: + mpr("Strange energies run through your body."); + break; + case 6: + mpr("Your skin tingles."); break; + case 7: + mpr("Your skin glows momentarily."); + break; + case 8: + canned_msg(MSG_NOTHING_HAPPENS); + break; + case 9: + if (player_can_smell()) + mpr("You smell something strange."); + else if (you.species == SP_MUMMY) + mpr("Your bandages flutter."); + } + break; - case 2: // rather less harmless stuff - switch (random2(2)) - { - case 0: - mpr("Energy rips through your body!"); - ouch(9 + random2avg(17, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; - case 1: - mpr("You are caught in a violent explosion!"); - beam.type = SYM_BURST; - beam.damage = dice_def( 3, 12 ); - beam.flavour = BEAM_MISSILE; // unsure about this - // BEAM_EXPLOSION instead? {dlb} - - beam.target_x = you.x_pos; - beam.target_y = you.y_pos; - beam.name = "explosion"; - beam.colour = random_colour(); - beam.beam_source = NON_MONSTER; - beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source.clear(); - if (cause) - beam.aux_source = cause; - beam.ex_size = 1; - beam.is_explosion = true; + case 1: // a bit less harmless stuff + switch (random2(2)) + { + case 0: + msg::stream << "Smoke pours from your " << your_hand(true) + << '!' << std::endl; + big_cloud( CLOUD_GREY_SMOKE, KC_YOU, + you.x_pos, you.y_pos, 20, + 7 + random2(7) ); + break; + case 1: + mpr("A wave of violent energy washes through your body!"); + ouch(6 + random2avg(7, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; + } + break; - explosion(beam); - break; - } + case 2: // rather less harmless stuff + switch (random2(2)) + { + case 0: + mpr("Energy rips through your body!"); + ouch(9 + random2avg(17, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; + case 1: + mpr("You are caught in a violent explosion!"); + beam.type = SYM_BURST; + beam.damage = dice_def( 3, 12 ); + beam.flavour = BEAM_MISSILE; // unsure about this + // BEAM_EXPLOSION instead? {dlb} + + beam.target_x = you.x_pos; + beam.target_y = you.y_pos; + beam.name = "explosion"; + beam.colour = random_colour(); + beam.beam_source = NON_MONSTER; + beam.thrower = (cause) ? KILL_MISC : KILL_YOU; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; + beam.ex_size = 1; + beam.is_explosion = true; + + explosion(beam); break; + } + break; - case 3: // considerably less harmless stuff - switch (random2(2)) - { - case 0: - mpr("You are blasted with magical energy!"); - ouch(12 + random2avg(29, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; - case 1: - mpr("There is a sudden explosion of magical energy!"); - beam.type = SYM_BURST; - beam.damage = dice_def( 3, 20 ); - beam.flavour = BEAM_MISSILE; // unsure about this - // BEAM_EXPLOSION instead? {dlb} - beam.target_x = you.x_pos; - beam.target_y = you.y_pos; - beam.name = "explosion"; - beam.colour = random_colour(); - beam.beam_source = NON_MONSTER; - beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source.clear(); - if (cause) - beam.aux_source = cause; - beam.ex_size = coinflip()?1:2; - beam.is_explosion = true; + case 3: // considerably less harmless stuff + switch (random2(2)) + { + case 0: + mpr("You are blasted with magical energy!"); + ouch(12 + random2avg(29, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; + case 1: + mpr("There is a sudden explosion of magical energy!"); + beam.type = SYM_BURST; + beam.damage = dice_def( 3, 20 ); + beam.flavour = BEAM_MISSILE; // unsure about this + // BEAM_EXPLOSION instead? {dlb} + beam.target_x = you.x_pos; + beam.target_y = you.y_pos; + beam.name = "explosion"; + beam.colour = random_colour(); + beam.beam_source = NON_MONSTER; + beam.thrower = (cause) ? KILL_MISC : KILL_YOU; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; + beam.ex_size = coinflip()?1:2; + beam.is_explosion = true; - explosion(beam); - break; - } + explosion(beam); break; } - break; // end conjuration + } +} - case SPTYP_ENCHANTMENT: - switch (spec_effect) +static void miscast_enchantment(int severity, const char* cause) +{ + switch (severity) + { + case 0: // harmless messages only + switch (random2(10)) { - case 0: // harmless messages only - switch (random2(10)) - { - case 0: - msg::stream << "Your " << your_hand(true) - << " glow momentarily." << std::endl; - break; - case 1: - mpr("The air around you crackles with energy!"); - break; - case 2: - mpr("Multicolored lights dance before your eyes!"); - break; - case 3: - mpr("You feel a strange surge of energy!"); - break; - case 4: - mpr("Waves of light ripple over your body."); - break; - case 5: - mpr("Strange energies run through your body."); - break; - case 6: - mpr("Your skin tingles."); - break; - case 7: - mpr("Your skin glows momentarily."); - break; - case 8: + case 0: + msg::stream << "Your " << your_hand(true) + << " glow momentarily." << std::endl; + break; + case 1: + mpr("The air around you crackles with energy!"); + break; + case 2: + mpr("Multicolored lights dance before your eyes!"); + break; + case 3: + mpr("You feel a strange surge of energy!"); + break; + case 4: + mpr("Waves of light ripple over your body."); + break; + case 5: + mpr("Strange energies run through your body."); + break; + case 6: + mpr("Your skin tingles."); + break; + case 7: + mpr("Your skin glows momentarily."); + break; + case 8: + canned_msg(MSG_NOTHING_HAPPENS); + break; + case 9: + if (!silenced(you.x_pos, you.y_pos)) + mpr("You hear something strange.", MSGCH_SOUND); + else if (you.attribute[ATTR_TRANSFORMATION] != TRAN_AIR) + mpr("Your skull vibrates slightly."); + else canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - if (!silenced(you.x_pos, you.y_pos)) - mpr("You hear something strange.", MSGCH_SOUND); - else if (you.attribute[ATTR_TRANSFORMATION] != TRAN_AIR) - mpr("Your skull vibrates slightly."); - else - canned_msg(MSG_NOTHING_HAPPENS); - break; - } break; + } + break; - case 1: // slightly annoying - switch (random2(2)) - { - case 0: - potion_effect(POT_LEVITATION, 20); - break; - case 1: - random_uselessness(2 + random2(7), 0); - break; - } + case 1: // slightly annoying + switch (random2(2)) + { + case 0: + potion_effect(POT_LEVITATION, 20); + break; + case 1: + random_uselessness(2 + random2(7), 0); break; + } + break; - case 2: // much more annoying - switch (random2(7)) - { - case 0: - case 1: - case 2: - mpr("You sense a malignant aura."); - curse_an_item(false); - break; - case 3: - case 4: - case 5: - potion_effect(POT_SLOWING, 10); - break; - case 6: - potion_effect(POT_BERSERK_RAGE, 10); - break; - } + case 2: // much more annoying + switch (random2(7)) + { + case 0: + case 1: + case 2: + mpr("You sense a malignant aura."); + curse_an_item(false); + break; + case 3: + case 4: + case 5: + potion_effect(POT_SLOWING, 10); break; + case 6: + potion_effect(POT_BERSERK_RAGE, 10); + break; + } + break; - case 3: // potentially lethal - switch (random2(4)) - { - case 0: - do { - curse_an_item(false); - } while ( !one_chance_in(3) ); + case 3: // potentially lethal + switch (random2(4)) + { + case 0: + do { + curse_an_item(false); + } while ( !one_chance_in(3) ); - mpr("You sense an overwhelmingly malignant aura!"); - break; - case 1: - potion_effect(POT_PARALYSIS, 10); - break; - case 2: - potion_effect(POT_CONFUSION, 10); - break; - case 3: - mpr("You feel saturated with unharnessed energies!"); - you.magic_contamination += random2avg(19,3); - break; - } + mpr("You sense an overwhelmingly malignant aura!"); + break; + case 1: + potion_effect(POT_PARALYSIS, 10); + break; + case 2: + potion_effect(POT_CONFUSION, 10); + break; + case 3: + mpr("You feel saturated with unharnessed energies!"); + you.magic_contamination += random2avg(19,3); break; } - break; // end enchantments + break; + } +} - case SPTYP_TRANSLOCATION: - switch (spec_effect) +static void miscast_translocation(int severity, const char* cause) +{ + switch (severity) + { + case 0: // harmless messages only + switch (random2(10)) { - case 0: // harmless messages only - switch (random2(10)) - { - case 0: - mpr("Space warps around you."); - break; - case 1: - mpr("The air around you crackles with energy!"); - break; - case 2: - mpr("You feel a wrenching sensation."); - break; - case 3: - mpr("You feel a strange surge of energy!"); - break; - case 4: - mpr("You spin around."); - break; - case 5: - mpr("Strange energies run through your body."); - break; - case 6: - mpr("Your skin tingles."); - break; - case 7: - mpr("The world appears momentarily distorted!"); - break; - case 8: - canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - mpr("You feel uncomfortable."); - break; - } + case 0: + mpr("Space warps around you."); + break; + case 1: + mpr("The air around you crackles with energy!"); + break; + case 2: + mpr("You feel a wrenching sensation."); + break; + case 3: + mpr("You feel a strange surge of energy!"); + break; + case 4: + mpr("You spin around."); + break; + case 5: + mpr("Strange energies run through your body."); + break; + case 6: + mpr("Your skin tingles."); + break; + case 7: + mpr("The world appears momentarily distorted!"); + break; + case 8: + canned_msg(MSG_NOTHING_HAPPENS); + break; + case 9: + mpr("You feel uncomfortable."); break; + } + break; - case 1: // mostly harmless - switch (random2(6)) - { - case 0: - case 1: - case 2: - mpr("You are caught in a localised field of spatial distortion."); - ouch(4 + random2avg(9, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; - case 3: - case 4: - mpr("Space bends around you!"); - random_blink(false); - ouch(4 + random2avg(7, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; - case 5: - mpr("Space twists in upon itself!"); - create_monster( MONS_SPATIAL_VORTEX, 3, BEH_HOSTILE, - you.x_pos, you.y_pos, MHITYOU, 250 ); - break; - } + case 1: // mostly harmless + switch (random2(6)) + { + case 0: + case 1: + case 2: + mpr("You are caught in a localised field of spatial distortion."); + ouch(4 + random2avg(9, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; + case 3: + case 4: + mpr("Space bends around you!"); + random_blink(false); + ouch(4 + random2avg(7, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; + case 5: + mpr("Space twists in upon itself!"); + create_monster( MONS_SPATIAL_VORTEX, 3, BEH_HOSTILE, + you.x_pos, you.y_pos, MHITYOU, 250 ); break; + } + break; - case 2: // less harmless - switch (random2(7)) - { - case 0: - case 1: - case 2: - mpr("You are caught in a strong localised spatial distortion."); - ouch(9 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; - case 3: - case 4: - mpr("Space warps around you!"); + case 2: // less harmless + switch (random2(7)) + { + case 0: + case 1: + case 2: + mpr("You are caught in a strong localised spatial distortion."); + ouch(9 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; + case 3: + case 4: + mpr("Space warps around you!"); - if (one_chance_in(3)) - you_teleport_now( true ); - else - random_blink( false ); + if (one_chance_in(3)) + you_teleport_now( true ); + else + random_blink( false ); - ouch(5 + random2avg(9, 2), 0, KILLED_BY_WILD_MAGIC, cause); - potion_effect(POT_CONFUSION, 40); - break; - case 5: - mpr("Space twists in upon itself!"); - loopj = 2 + random2(3); - for (int i = 0; i < loopj; ++i) + ouch(5 + random2avg(9, 2), 0, KILLED_BY_WILD_MAGIC, cause); + potion_effect(POT_CONFUSION, 40); + break; + case 5: + mpr("Space twists in upon itself!"); + { + const int count = 2 + random2(3); + for (int i = 0; i < count; ++i) { create_monster( MONS_SPATIAL_VORTEX, 3, BEH_HOSTILE, you.x_pos, you.y_pos, MHITYOU, 250 ); } - break; - case 6: - send_abyss(cause); - break; } break; + case 6: + send_abyss(cause); + break; + } + break; - case 3: // much less harmless + case 3: // much less harmless - switch (random2(4)) - { - case 0: - mpr("You are caught in an extremely strong localised spatial distortion!"); - ouch(15 + random2avg(29, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; - case 1: - mpr("Space warps crazily around you!"); - you_teleport_now( true ); + switch (random2(4)) + { + case 0: + mpr("You are caught in an extremely strong localised spatial distortion!"); + ouch(15 + random2avg(29, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; + case 1: + mpr("Space warps crazily around you!"); + you_teleport_now( true ); - ouch(9 + random2avg(17, 2), 0, KILLED_BY_WILD_MAGIC, cause); - potion_effect(POT_CONFUSION, 60); - break; - case 2: - send_abyss(cause); - break; - case 3: - mpr("You feel saturated with unharnessed energies!"); - you.magic_contamination += random2avg(19,3); - break; - } + ouch(9 + random2avg(17, 2), 0, KILLED_BY_WILD_MAGIC, cause); + potion_effect(POT_CONFUSION, 60); + break; + case 2: + send_abyss(cause); + break; + case 3: + mpr("You feel saturated with unharnessed energies!"); + you.magic_contamination += random2avg(19,3); break; } - break; // end translocations + break; + } +} - case SPTYP_SUMMONING: - switch (spec_effect) +static void miscast_summoning(int severity, const char* cause) +{ + switch (severity) + { + case 0: // harmless messages only + switch (random2(10)) { - case 0: // harmless messages only - switch (random2(10)) - { - case 0: - mpr("Shadowy shapes form in the air around you, then vanish."); - break; - case 1: - if (!silenced(you.x_pos, you.y_pos)) - mpr("You hear strange voices.", MSGCH_SOUND); - else - mpr("You feel momentarily dizzy."); - break; - case 2: - mpr("Your head hurts."); - break; - case 3: - mpr("You feel a strange surge of energy!"); - break; - case 4: - mpr("Your brain hurts!"); - break; - case 5: - mpr("Strange energies run through your body."); - break; - case 6: - mpr("The world appears momentarily distorted."); - break; - case 7: - mpr("Space warps around you."); - break; - case 8: - canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - mpr("Distant voices call out to you!"); - break; - } + case 0: + mpr("Shadowy shapes form in the air around you, then vanish."); + break; + case 1: + if (!silenced(you.x_pos, you.y_pos)) + mpr("You hear strange voices.", MSGCH_SOUND); + else + mpr("You feel momentarily dizzy."); + break; + case 2: + mpr("Your head hurts."); + break; + case 3: + mpr("You feel a strange surge of energy!"); + break; + case 4: + mpr("Your brain hurts!"); + break; + case 5: + mpr("Strange energies run through your body."); + break; + case 6: + mpr("The world appears momentarily distorted."); break; + case 7: + mpr("Space warps around you."); + break; + case 8: + canned_msg(MSG_NOTHING_HAPPENS); + break; + case 9: + mpr("Distant voices call out to you!"); + break; + } + break; - case 1: // a little bad - switch (random2(6)) - { - case 0: // identical to translocation - case 1: - case 2: - mpr("You are caught in a localised spatial distortion."); - ouch(5 + random2avg(9, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; + case 1: // a little bad + switch (random2(6)) + { + case 0: // identical to translocation + case 1: + case 2: + mpr("You are caught in a localised spatial distortion."); + ouch(5 + random2avg(9, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; - case 3: - mpr("Space twists in upon itself!"); - create_monster( MONS_SPATIAL_VORTEX, 3, BEH_HOSTILE, - you.x_pos, you.y_pos, MHITYOU, 250 ); - break; + case 3: + mpr("Space twists in upon itself!"); + create_monster( MONS_SPATIAL_VORTEX, 3, BEH_HOSTILE, + you.x_pos, you.y_pos, MHITYOU, 250 ); + break; - case 4: - case 5: - if (create_monster( summon_any_demon(DEMON_LESSER), 5, - BEH_HOSTILE, you.x_pos, you.y_pos, - MHITYOU, 250 ) != -1) - { - mpr("Something appears in a flash of light!"); - } - break; + case 4: + case 5: + if (create_monster( summon_any_demon(DEMON_LESSER), 5, + BEH_HOSTILE, you.x_pos, you.y_pos, + MHITYOU, 250 ) != -1) + { + mpr("Something appears in a flash of light!"); } + break; + } - case 2: // more bad - switch (random2(6)) + case 2: // more bad + switch (random2(6)) + { + case 0: + mpr("Space twists in upon itself!"); { - case 0: - mpr("Space twists in upon itself!"); - loopj = 2 + random2(3); - for (int i = 0; i < loopj; ++i) + const int count = 2 + random2(3); + for (int i = 0; i < count; ++i) { create_monster( MONS_SPATIAL_VORTEX, 3, BEH_HOSTILE, you.x_pos, you.y_pos, MHITYOU, 250 ); } - break; - - case 1: - case 2: - if (create_monster( summon_any_demon(DEMON_COMMON), 5, - BEH_HOSTILE, you.x_pos, you.y_pos, - MHITYOU, 250) != -1) - { - mpr("Something forms out of thin air!"); - } - break; - - case 3: - case 4: - case 5: - mpr("A chorus of chattering voices calls out to you!"); - create_monster( summon_any_demon(DEMON_LESSER), 5, - BEH_HOSTILE, you.x_pos, you.y_pos, - MHITYOU, 250 ); - - create_monster( summon_any_demon(DEMON_LESSER), 5, - BEH_HOSTILE, you.x_pos, you.y_pos, - MHITYOU, 250 ); - - if (coinflip()) - { - create_monster( summon_any_demon(DEMON_LESSER), 5, - BEH_HOSTILE, you.x_pos, you.y_pos, - MHITYOU, 250 ); - } - - if (coinflip()) - { - create_monster( summon_any_demon(DEMON_LESSER), 5, - BEH_HOSTILE, you.x_pos, you.y_pos, - MHITYOU, 250 ); - } - break; } break; - case 3: // more bad - switch (random2(4)) + case 1: + case 2: + if (create_monster( summon_any_demon(DEMON_COMMON), 5, + BEH_HOSTILE, you.x_pos, you.y_pos, + MHITYOU, 250) != -1) { - case 0: - if (create_monster( MONS_ABOMINATION_SMALL, 0, BEH_HOSTILE, - you.x_pos, you.y_pos, MHITYOU, 250 ) != -1) - { - mpr("Something forms out of thin air."); - } - break; + mpr("Something forms out of thin air!"); + } + break; - case 1: - if (create_monster( summon_any_demon(DEMON_GREATER), 0, - BEH_HOSTILE, you.x_pos, you.y_pos, - MHITYOU, 250 ) != -1) - { - mpr("You sense a hostile presence."); - } - break; + case 3: + case 4: + case 5: + mpr("A chorus of chattering voices calls out to you!"); + create_monster( summon_any_demon(DEMON_LESSER), 5, + BEH_HOSTILE, you.x_pos, you.y_pos, + MHITYOU, 250 ); - case 2: - mpr("Something turns its malign attention towards you..."); + create_monster( summon_any_demon(DEMON_LESSER), 5, + BEH_HOSTILE, you.x_pos, you.y_pos, + MHITYOU, 250 ); - create_monster( summon_any_demon(DEMON_COMMON), 3, - BEH_HOSTILE, you.x_pos, you.y_pos, + if (coinflip()) + { + create_monster( summon_any_demon(DEMON_LESSER), 5, + BEH_HOSTILE, you.x_pos, you.y_pos, MHITYOU, 250 ); + } - create_monster( summon_any_demon(DEMON_COMMON), 3, - BEH_HOSTILE, you.x_pos, you.y_pos, - MHITYOU, 250); - - if (coinflip()) - { - create_monster(summon_any_demon(DEMON_COMMON), 3, - BEH_HOSTILE, you.x_pos, you.y_pos, - MHITYOU, 250); - } - break; - - case 3: - send_abyss(cause); - break; + if (coinflip()) + { + create_monster( summon_any_demon(DEMON_LESSER), 5, + BEH_HOSTILE, you.x_pos, you.y_pos, + MHITYOU, 250 ); } break; - } // end Summonings + } break; - case SPTYP_DIVINATION: - switch (spec_effect) + case 3: // more bad + switch (random2(4)) { - case 0: // just a harmless message - switch (random2(10)) + case 0: + if (create_monster( MONS_ABOMINATION_SMALL, 0, BEH_HOSTILE, + you.x_pos, you.y_pos, MHITYOU, 250 ) != -1) { - case 0: - mpr("Weird images run through your mind."); - break; - case 1: - if (!silenced(you.x_pos, you.y_pos)) - mpr("You hear strange voices.", MSGCH_SOUND); - else - mpr("Your nose twitches."); - break; - case 2: - mpr("Your head hurts."); - break; - case 3: - mpr("You feel a strange surge of energy!"); - break; - case 4: - mpr("Your brain hurts!"); - break; - case 5: - mpr("Strange energies run through your body."); - break; - case 6: - mpr("Everything looks hazy for a moment."); - break; - case 7: - mpr("You seem to have forgotten something, but you can't remember what it was!"); - break; - case 8: - canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - mpr("You feel uncomfortable."); - break; + mpr("Something forms out of thin air."); } break; - case 1: // more annoying things - switch (random2(2)) + case 1: + if (create_monster( summon_any_demon(DEMON_GREATER), 0, + BEH_HOSTILE, you.x_pos, you.y_pos, + MHITYOU, 250 ) != -1) { - case 0: - mpr("You feel slightly disoriented."); - forget_map(10 + random2(10)); - break; - case 1: - potion_effect(POT_CONFUSION, 10); - break; + mpr("You sense a hostile presence."); } break; - case 2: // even more annoying things - switch (random2(2)) + case 2: + mpr("Something turns its malign attention towards you..."); + + create_monster( summon_any_demon(DEMON_COMMON), 3, + BEH_HOSTILE, you.x_pos, you.y_pos, + MHITYOU, 250 ); + + create_monster( summon_any_demon(DEMON_COMMON), 3, + BEH_HOSTILE, you.x_pos, you.y_pos, + MHITYOU, 250); + + if (coinflip()) { - case 0: - if (you.is_undead) - mpr("You suddenly recall your previous life!"); - else if (lose_stat(STAT_INTELLIGENCE, 1 + random2(3))) - mpr("You have damaged your brain!"); - else - mpr("You have a terrible headache."); - break; - case 1: - mpr("You feel lost."); - forget_map(40 + random2(40)); - break; + create_monster(summon_any_demon(DEMON_COMMON), 3, + BEH_HOSTILE, you.x_pos, you.y_pos, + MHITYOU, 250); } + break; - potion_effect(POT_CONFUSION, 1); // common to all cases here {dlb} + case 3: + send_abyss(cause); break; + } + break; + } +} - case 3: // nasty - switch (random2(3)) - { - case 0: - mpr( forget_spell() ? "You have forgotten a spell!" - : "You get a splitting headache." ); - break; - case 1: - mpr("You feel completely lost."); - forget_map(100); - break; - case 2: - if (you.is_undead) - mpr("You suddenly recall your previous life."); - else if (lose_stat(STAT_INTELLIGENCE, 3 + random2(3))) - mpr("You have damaged your brain!"); - else - mpr("You have a terrible headache."); - break; - } +static void miscast_divination(int severity, const char* cause) +{ + switch (severity) + { + case 0: // just a harmless message + switch (random2(10)) + { + case 0: + mpr("Weird images run through your mind."); + break; + case 1: + if (!silenced(you.x_pos, you.y_pos)) + mpr("You hear strange voices.", MSGCH_SOUND); + else + mpr("Your nose twitches."); + break; + case 2: + mpr("Your head hurts."); + break; + case 3: + mpr("You feel a strange surge of energy!"); + break; + case 4: + mpr("Your brain hurts!"); + break; + case 5: + mpr("Strange energies run through your body."); + break; + case 6: + mpr("Everything looks hazy for a moment."); + break; + case 7: + mpr("You seem to have forgotten something, but you can't remember what it was!"); + break; + case 8: + canned_msg(MSG_NOTHING_HAPPENS); + break; + case 9: + mpr("You feel uncomfortable."); + break; + } + break; - potion_effect(POT_CONFUSION, 1); // common to all cases here {dlb} + case 1: // more annoying things + switch (random2(2)) + { + case 0: + mpr("You feel slightly disoriented."); + forget_map(10 + random2(10)); + break; + case 1: + potion_effect(POT_CONFUSION, 10); break; } - break; // end divinations + break; - case SPTYP_NECROMANCY: - if (you.religion == GOD_KIKUBAAQUDGHA - && (!player_under_penance() && you.piety >= piety_breakpoint(1) - && random2(150) <= you.piety)) + case 2: // even more annoying things + switch (random2(2)) { + case 0: + if (you.is_undead) + mpr("You suddenly recall your previous life!"); + else if (lose_stat(STAT_INTELLIGENCE, 1 + random2(3))) + mpr("You have damaged your brain!"); + else + mpr("You have a terrible headache."); + break; + case 1: + mpr("You feel lost."); + forget_map(40 + random2(40)); + break; + } + + potion_effect(POT_CONFUSION, 1); // common to all cases here {dlb} + break; + + case 3: // nasty + switch (random2(3)) + { + case 0: + mpr( forget_spell() ? "You have forgotten a spell!" + : "You get a splitting headache." ); + break; + case 1: + mpr("You feel completely lost."); + forget_map(100); + break; + case 2: + if (you.is_undead) + mpr("You suddenly recall your previous life."); + else if (lose_stat(STAT_INTELLIGENCE, 3 + random2(3))) + mpr("You have damaged your brain!"); + else + mpr("You have a terrible headache."); + break; + } + + potion_effect(POT_CONFUSION, 1); // common to all cases here {dlb} + break; + } +} + +static void miscast_necromancy(int severity, const char* cause) +{ + if (you.religion == GOD_KIKUBAAQUDGHA + && (!player_under_penance() && you.piety >= piety_breakpoint(1) + && random2(150) <= you.piety)) + { + canned_msg(MSG_NOTHING_HAPPENS); + return; + } + + switch (severity) + { + case 0: + switch (random2(10)) + { + case 0: + if (player_can_smell()) + mpr("You smell decay."); + break; + case 1: + if (!silenced(you.x_pos, you.y_pos)) + mpr("You hear strange and distant voices.", MSGCH_SOUND); + else + mpr("You feel homesick."); + break; + case 2: + mpr("Pain shoots through your body."); + break; + case 3: + mpr("Your bones ache."); + break; + case 4: + mpr("The world around you seems to dim momentarily."); + break; + case 5: + mpr("Strange energies run through your body."); + break; + case 6: + mpr("You shiver with cold."); + break; + case 7: + mpr("You sense a malignant aura."); + break; + case 8: canned_msg(MSG_NOTHING_HAPPENS); break; + case 9: + mpr("You feel very uncomfortable."); + break; } + break; - switch (spec_effect) + case 1: // a bit nasty + switch (random2(3)) { case 0: - switch (random2(10)) + if (you.is_undead) { - case 0: - if (player_can_smell()) - mpr("You smell decay."); - break; - case 1: - if (!silenced(you.x_pos, you.y_pos)) - mpr("You hear strange and distant voices.", MSGCH_SOUND); - else - mpr("You feel homesick."); - break; - case 2: - mpr("Pain shoots through your body."); - break; - case 3: - mpr("Your bones ache."); - break; - case 4: - mpr("The world around you seems to dim momentarily."); - break; - case 5: - mpr("Strange energies run through your body."); - break; - case 6: - mpr("You shiver with cold."); - break; - case 7: - mpr("You sense a malignant aura."); - break; - case 8: - canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - mpr("You feel very uncomfortable."); + mpr("You feel weird for a moment."); break; } + mpr("Pain shoots through your body!"); + ouch(5 + random2avg(15, 2), 0, KILLED_BY_WILD_MAGIC, cause); break; - - case 1: // a bit nasty - switch (random2(3)) + case 1: + mpr("You feel horribly lethargic."); + potion_effect(POT_SLOWING, 15); + break; + case 2: + // josh declares mummies cannot smell {dlb} + if (player_can_smell()) { - case 0: - if (you.is_undead) - { - mpr("You feel weird for a moment."); - break; - } - mpr("Pain shoots through your body!"); - ouch(5 + random2avg(15, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; - case 1: - mpr("You feel horribly lethargic."); - potion_effect(POT_SLOWING, 15); - break; - case 2: - // josh declares mummies cannot smell {dlb} - if (player_can_smell()) - { - mpr("You smell decay."); // identical to a harmless message - you.rotting++; - } - break; + mpr("You smell decay."); // identical to a harmless message + you.rotting++; } break; + } + break; - case 2: // much nastier - switch (random2(3)) + case 2: // much nastier + switch (random2(3)) + { + case 0: + mpr("Flickering shadows surround you."); + + create_monster( MONS_SHADOW, 2, BEH_HOSTILE, + you.x_pos, you.y_pos, MHITYOU, 250 ); + + if (coinflip()) { - case 0: - mpr("Flickering shadows surround you."); + create_monster( MONS_SHADOW, 2, BEH_HOSTILE, + you.x_pos, you.y_pos, MHITYOU, 250 ); + } + if (coinflip()) + { create_monster( MONS_SHADOW, 2, BEH_HOSTILE, you.x_pos, you.y_pos, MHITYOU, 250 ); + } + break; - if (coinflip()) - { - create_monster( MONS_SHADOW, 2, BEH_HOSTILE, - you.x_pos, you.y_pos, MHITYOU, 250 ); - } - - if (coinflip()) - { - create_monster( MONS_SHADOW, 2, BEH_HOSTILE, - you.x_pos, you.y_pos, MHITYOU, 250 ); - } + case 1: + if (!player_prot_life() && one_chance_in(3)) + { + drain_exp(); break; + } // otherwise it just flows through... - case 1: - if (!player_prot_life() && one_chance_in(3)) - { - drain_exp(); - break; - } // otherwise it just flows through... - - case 2: - if (you.is_undead) - { - mpr("You feel weird for a moment."); - break; - } - mpr("You convulse helplessly as pain tears through your body!"); - ouch(15 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause); + case 2: + if (you.is_undead) + { + mpr("You feel weird for a moment."); break; } + mpr("You convulse helplessly as pain tears through your body!"); + ouch(15 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause); break; + } + break; - case 3: // even nastier - switch (random2(6)) + case 3: // even nastier + switch (random2(6)) + { + case 0: + if (you.is_undead) { - case 0: - if (you.is_undead) - { - mpr("Something just walked over your grave. No, really!"); - break; - } - - torment_monsters(you.x_pos, you.y_pos, 0, TORMENT_GENERIC); - break; - - case 1: - mpr("You are engulfed in negative energy!"); - - if (!player_prot_life()) - { - drain_exp(); - break; - } // otherwise it just flows through... - - case 2: - lose_stat(STAT_RANDOM, 1 + random2avg(7, 2)); + mpr("Something just walked over your grave. No, really!"); break; + } - case 3: - if (you.is_undead) - { - mpr("You feel terrible."); - break; - } + torment_monsters(you.x_pos, you.y_pos, 0, TORMENT_GENERIC); + break; - rot_player( random2avg(7, 2) + 1 ); - break; + case 1: + mpr("You are engulfed in negative energy!"); - case 4: - if (create_monster( MONS_SOUL_EATER, 4, BEH_HOSTILE, - you.x_pos, you.y_pos, MHITYOU, 250) != -1) - { - mpr("Something reaches out for you..."); - } + if (!player_prot_life()) + { + drain_exp(); break; + } // otherwise it just flows through... - case 5: - if (create_monster( MONS_REAPER, 4, BEH_HOSTILE, - you.x_pos, you.y_pos, MHITYOU, 250) != -1) - { - mpr("Death has come for you..."); - } - break; - } + case 2: + lose_stat(STAT_RANDOM, 1 + random2avg(7, 2)); break; - } - break; // end necromancy - case SPTYP_TRANSMIGRATION: - switch (spec_effect) - { - case 0: // just a harmless message - switch (random2(10)) + case 3: + if (you.is_undead) { - case 0: - msg::stream << "Your " << your_hand(true) - << " glow momentarily." << std::endl; - break; - case 1: - mpr("The air around you crackles with energy!"); - break; - case 2: - mpr("Multicolored lights dance before your eyes!"); - break; - case 3: - mpr("You feel a strange surge of energy!"); - break; - case 4: - mpr("Waves of light ripple over your body."); - break; - case 5: - mpr("Strange energies run through your body."); - break; - case 6: - mpr("Your skin tingles."); - break; - case 7: - mpr("Your skin glows momentarily."); - break; - case 8: - canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - if (player_can_smell()) - mpr("You smell something strange."); + mpr("You feel terrible."); break; } + + rot_player( random2avg(7, 2) + 1 ); break; - case 1: // slightly annoying - switch (random2(2)) + case 4: + if (create_monster( MONS_SOUL_EATER, 4, BEH_HOSTILE, + you.x_pos, you.y_pos, MHITYOU, 250) != -1) { - case 0: - mpr("Your body is twisted painfully."); - ouch(1 + random2avg(11, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; - case 1: - random_uselessness(2 + random2(7), 0); - break; + mpr("Something reaches out for you..."); } break; - case 2: // much more annoying - switch (random2(4)) + case 5: + if (create_monster( MONS_REAPER, 4, BEH_HOSTILE, + you.x_pos, you.y_pos, MHITYOU, 250) != -1) { - case 0: - mpr("Your body is twisted very painfully!"); - ouch(3 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; - case 1: - mpr("You feel saturated with unharnessed energies!"); - you.magic_contamination += random2avg(19,3); - break; - case 2: - potion_effect(POT_PARALYSIS, 10); - break; - case 3: - potion_effect(POT_CONFUSION, 10); - break; + mpr("Death has come for you..."); } break; + } + break; + } +} + +static void miscast_transmigration(int severity, const char* cause) +{ + switch (severity) + { + case 0: // just a harmless message + switch (random2(10)) + { + case 0: + msg::stream << "Your " << your_hand(true) + << " glow momentarily." << std::endl; + break; + case 1: + mpr("The air around you crackles with energy!"); + break; + case 2: + mpr("Multicolored lights dance before your eyes!"); + break; + case 3: + mpr("You feel a strange surge of energy!"); + break; + case 4: + mpr("Waves of light ripple over your body."); + break; + case 5: + mpr("Strange energies run through your body."); + break; + case 6: + mpr("Your skin tingles."); + break; + case 7: + mpr("Your skin glows momentarily."); + break; + case 8: + canned_msg(MSG_NOTHING_HAPPENS); + break; + case 9: + if (player_can_smell()) + mpr("You smell something strange."); + break; + } + break; - case 3: // even nastier + case 1: // slightly annoying + switch (random2(2)) + { + case 0: + mpr("Your body is twisted painfully."); + ouch(1 + random2avg(11, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; + case 1: + random_uselessness(2 + random2(7), 0); + break; + } + break; - switch (random2(3)) - { - case 0: - mpr("Your body is flooded with distortional energies!"); - you.magic_contamination += random2avg(35, 3); + case 2: // much more annoying + switch (random2(4)) + { + case 0: + mpr("Your body is twisted very painfully!"); + ouch(3 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; + case 1: + mpr("You feel saturated with unharnessed energies!"); + you.magic_contamination += random2avg(19,3); + break; + case 2: + potion_effect(POT_PARALYSIS, 10); + break; + case 3: + potion_effect(POT_CONFUSION, 10); + break; + } + break; - ouch(3 + random2avg(18, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; + case 3: // even nastier - case 1: - mpr("You feel very strange."); - delete_mutation(RANDOM_MUTATION); - ouch(5 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; + switch (random2(3)) + { + case 0: + mpr("Your body is flooded with distortional energies!"); + you.magic_contamination += random2avg(35, 3); - case 2: - mpr("Your body is distorted in a weirdly horrible way!"); - failMsg = !give_bad_mutation(); - if (coinflip()) - give_bad_mutation(false, failMsg); + ouch(3 + random2avg(18, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; + case 1: + mpr("You feel very strange."); + delete_mutation(RANDOM_MUTATION); + ouch(5 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause); + break; + + case 2: + mpr("Your body is distorted in a weirdly horrible way!"); + { + const bool failMsg = !give_bad_mutation(); + if (coinflip()) + give_bad_mutation(false, failMsg); ouch(5 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; } break; } - break; // end transmigrations + break; + } +} - case SPTYP_FIRE: - switch (spec_effect) +static void miscast_fire(int severity, const char* cause) +{ + bolt beam; + switch (severity) + { + case 0: // just a harmless message + switch (random2(10)) { - case 0: // just a harmless message - switch (random2(10)) - { - case 0: - msg::stream << "Sparks fly from your " << your_hand(true) - << '!' << std::endl; - break; - case 1: - mpr("The air around you burns with energy!"); - break; - case 2: - msg::stream << "Wisps of smoke drift from your " - << your_hand(true) << '.' << std::endl; - break; - case 3: - mpr("You feel a strange surge of energy!"); - break; - case 4: - if (player_can_smell()) - mpr("You smell smoke."); - break; - case 5: - mpr("Heat runs through your body."); - break; - case 6: - mpr("You feel uncomfortably hot."); - break; - case 7: - mpr("Lukewarm flames ripple over your body."); - break; - case 8: - canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - if (!silenced(you.x_pos, you.y_pos)) - mpr("You hear a sizzling sound.", MSGCH_SOUND); - else - mpr("You feel like you have heartburn."); - break; - } + case 0: + msg::stream << "Sparks fly from your " << your_hand(true) + << '!' << std::endl; break; + case 1: + mpr("The air around you burns with energy!"); + break; + case 2: + msg::stream << "Wisps of smoke drift from your " + << your_hand(true) << '.' << std::endl; + break; + case 3: + mpr("You feel a strange surge of energy!"); + break; + case 4: + if (player_can_smell()) + mpr("You smell smoke."); + break; + case 5: + mpr("Heat runs through your body."); + break; + case 6: + mpr("You feel uncomfortably hot."); + break; + case 7: + mpr("Lukewarm flames ripple over your body."); + break; + case 8: + canned_msg(MSG_NOTHING_HAPPENS); + break; + case 9: + if (!silenced(you.x_pos, you.y_pos)) + mpr("You hear a sizzling sound.", MSGCH_SOUND); + else + mpr("You feel like you have heartburn."); + break; + } + break; - case 1: // a bit less harmless stuff - switch (random2(2)) - { - case 0: - msg::stream << "Smoke pours from your " - << your_hand(true) << "!" << std::endl; - big_cloud( random_smoke_type(), KC_YOU, - you.x_pos, you.y_pos, 20, 7 + random2(7) ); - break; - - case 1: - mpr("Flames sear your flesh."); - expose_player_to_element(BEAM_FIRE, 3); - - if (player_res_fire() < 0) - { - ouch(2 + random2avg(13, 2), 0, KILLED_BY_WILD_MAGIC, cause); - } - break; - } + case 1: // a bit less harmless stuff + switch (random2(2)) + { + case 0: + msg::stream << "Smoke pours from your " + << your_hand(true) << "!" << std::endl; + big_cloud( random_smoke_type(), KC_YOU, + you.x_pos, you.y_pos, 20, 7 + random2(7) ); break; - case 2: // rather less harmless stuff - switch (random2(2)) - { - case 0: - mpr("You are blasted with fire."); + case 1: + mpr("Flames sear your flesh."); + expose_player_to_element(BEAM_FIRE, 3); - ouch( check_your_resists( 5 + random2avg(29, 2), 2 ), 0, - KILLED_BY_WILD_MAGIC, cause ); + if (player_res_fire() < 0) + ouch(2 + random2avg(13, 2), 0, KILLED_BY_WILD_MAGIC, cause); - expose_player_to_element(BEAM_FIRE, 5); - break; + break; + } + break; - case 1: - mpr("You are caught in a fiery explosion!"); - - beam.type = SYM_BURST; - beam.damage = dice_def( 3, 14 ); - beam.flavour = BEAM_FIRE; - beam.target_x = you.x_pos; - beam.target_y = you.y_pos; - beam.name = "explosion"; - beam.colour = RED; - beam.beam_source = NON_MONSTER; - beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source.clear(); - if (cause) - beam.aux_source = cause; - beam.ex_size = 1; - beam.is_explosion = true; + case 2: // rather less harmless stuff + switch (random2(2)) + { + case 0: + mpr("You are blasted with fire."); - explosion(beam); - break; - } - break; + ouch( check_your_resists( 5 + random2avg(29, 2), 2 ), 0, + KILLED_BY_WILD_MAGIC, cause ); - case 3: // considerably less harmless stuff - switch (random2(3)) - { - case 0: - mpr("You are blasted with searing flames!"); + expose_player_to_element(BEAM_FIRE, 5); + break; - ouch( check_your_resists( 9 + random2avg(33, 2), 2 ), 0, - KILLED_BY_WILD_MAGIC, cause ); + case 1: + mpr("You are caught in a fiery explosion!"); + beam.type = SYM_BURST; + beam.damage = dice_def( 3, 14 ); + beam.flavour = BEAM_FIRE; + beam.target_x = you.x_pos; + beam.target_y = you.y_pos; + beam.name = "explosion"; + beam.colour = RED; + beam.beam_source = NON_MONSTER; + beam.thrower = (cause) ? KILL_MISC : KILL_YOU; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; + beam.ex_size = 1; + beam.is_explosion = true; + explosion(beam); + break; + } + break; - expose_player_to_element(BEAM_FIRE, 10); - break; - case 1: - mpr("There is a sudden and violent explosion of flames!"); - - beam.type = SYM_BURST; - beam.damage = dice_def( 3, 20 ); - beam.flavour = BEAM_FIRE; - beam.target_x = you.x_pos; - beam.target_y = you.y_pos; - beam.name = "fireball"; - beam.colour = RED; - beam.beam_source = NON_MONSTER; - beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source.clear(); - if (cause) - beam.aux_source = cause; - beam.ex_size = coinflip()?1:2; - beam.is_explosion = true; + case 3: // considerably less harmless stuff + switch (random2(3)) + { + case 0: + mpr("You are blasted with searing flames!"); - explosion(beam); - break; + ouch( check_your_resists( 9 + random2avg(33, 2), 2 ), 0, + KILLED_BY_WILD_MAGIC, cause ); - case 2: - mpr("You are covered in liquid fire!"); - you.duration[DUR_LIQUID_FLAMES] += random2avg(7, 3) + 1; - break; - } + expose_player_to_element(BEAM_FIRE, 10); + break; + case 1: + mpr("There is a sudden and violent explosion of flames!"); + beam.type = SYM_BURST; + beam.damage = dice_def( 3, 20 ); + beam.flavour = BEAM_FIRE; + beam.target_x = you.x_pos; + beam.target_y = you.y_pos; + beam.name = "fireball"; + beam.colour = RED; + beam.beam_source = NON_MONSTER; + beam.thrower = (cause) ? KILL_MISC : KILL_YOU; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; + beam.ex_size = coinflip()?1:2; + beam.is_explosion = true; + explosion(beam); + break; + + case 2: + mpr("You are covered in liquid fire!"); + you.duration[DUR_LIQUID_FLAMES] += random2avg(7, 3) + 1; break; } - break; // end fire + break; + } +} - case SPTYP_ICE: - switch (spec_effect) +static void miscast_ice(int severity, const char* cause) +{ + bolt beam; + switch (severity) + { + case 0: // just a harmless message + switch (random2(10)) { - case 0: // just a harmless message - switch (random2(10)) - { - case 0: - mpr("You shiver with cold."); - break; - case 1: - mpr("A chill runs through your body."); - break; - case 2: - msg::stream << "Wisps of condensation drift from your " - << your_hand(true) << "." << std::endl; - break; - case 3: - mpr("You feel a strange surge of energy!"); - break; - case 4: - msg::stream << "Your " << your_hand(true) - << " feel numb with cold." << std::endl; - break; - case 5: - mpr("A chill runs through your body."); - break; - case 6: - mpr("You feel uncomfortably cold."); - break; - case 7: - mpr("Frost covers your body."); - break; - case 8: - canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - if (!silenced(you.x_pos, you.y_pos)) - mpr("You hear a crackling sound.", MSGCH_SOUND); - else - mpr("A snowflake lands on your nose."); - break; - } + case 0: + mpr("You shiver with cold."); + break; + case 1: + mpr("A chill runs through your body."); + break; + case 2: + msg::stream << "Wisps of condensation drift from your " + << your_hand(true) << "." << std::endl; + break; + case 3: + mpr("You feel a strange surge of energy!"); + break; + case 4: + msg::stream << "Your " << your_hand(true) + << " feel numb with cold." << std::endl; + break; + case 5: + mpr("A chill runs through your body."); + break; + case 6: + mpr("You feel uncomfortably cold."); break; + case 7: + mpr("Frost covers your body."); + break; + case 8: + canned_msg(MSG_NOTHING_HAPPENS); + break; + case 9: + if (!silenced(you.x_pos, you.y_pos)) + mpr("You hear a crackling sound.", MSGCH_SOUND); + else + mpr("A snowflake lands on your nose."); + break; + } + break; - case 1: // a bit less harmless stuff - switch (random2(2)) - { - case 0: - mpr("You feel extremely cold."); - break; - case 1: - mpr("You are covered in a thin layer of ice"); - expose_player_to_element(BEAM_COLD, 2); + case 1: // a bit less harmless stuff + switch (random2(2)) + { + case 0: + mpr("You feel extremely cold."); + break; + case 1: + mpr("You are covered in a thin layer of ice"); + expose_player_to_element(BEAM_COLD, 2); - if (player_res_cold() < 0) - ouch(4 + random2avg(5, 2), 0, KILLED_BY_WILD_MAGIC, cause); - break; - } + if (player_res_cold() < 0) + ouch(4 + random2avg(5, 2), 0, KILLED_BY_WILD_MAGIC, cause); break; + } + break; - case 2: // rather less harmless stuff - switch (random2(2)) - { - case 0: - mpr("Heat is drained from your body."); + case 2: // rather less harmless stuff + switch (random2(2)) + { + case 0: + mpr("Heat is drained from your body."); - ouch(check_your_resists(5 + random2(6) + random2(7), 3), 0, - KILLED_BY_WILD_MAGIC, cause); + ouch(check_your_resists(5 + random2(6) + random2(7), 3), 0, + KILLED_BY_WILD_MAGIC, cause); - expose_player_to_element(BEAM_COLD, 4); - break; + expose_player_to_element(BEAM_COLD, 4); + break; - case 1: - mpr("You are caught in an explosion of ice and frost!"); - - beam.type = SYM_BURST; - beam.damage = dice_def( 3, 11 ); - beam.flavour = BEAM_COLD; - beam.target_x = you.x_pos; - beam.target_y = you.y_pos; - beam.name = "explosion"; - beam.colour = WHITE; - beam.beam_source = NON_MONSTER; - beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source.clear(); - if (cause) + case 1: + mpr("You are caught in an explosion of ice and frost!"); + beam.type = SYM_BURST; + beam.damage = dice_def( 3, 11 ); + beam.flavour = BEAM_COLD; + beam.target_x = you.x_pos; + beam.target_y = you.y_pos; + beam.name = "explosion"; + beam.colour = WHITE; + beam.beam_source = NON_MONSTER; + beam.thrower = (cause) ? KILL_MISC : KILL_YOU; + beam.aux_source.clear(); + if (cause) beam.aux_source = cause; - beam.ex_size = 1; - beam.is_explosion = true; - - explosion(beam); - break; - } + beam.ex_size = 1; + beam.is_explosion = true; + + explosion(beam); break; + } + break; - case 3: // less harmless stuff - switch (random2(2)) - { - case 0: - mpr("You are blasted with ice!"); + case 3: // less harmless stuff + switch (random2(2)) + { + case 0: + mpr("You are blasted with ice!"); - ouch(check_your_resists(9 + random2avg(23, 2), 3), 0, - KILLED_BY_WILD_MAGIC, cause); + ouch(check_your_resists(9 + random2avg(23, 2), 3), 0, + KILLED_BY_WILD_MAGIC, cause); - expose_player_to_element(BEAM_COLD, 9); - break; - case 1: - msg::stream << "Freezing gasses pour from your " - << your_hand(true) << "!" << std::endl; - big_cloud(CLOUD_COLD, KC_YOU, you.x_pos, you.y_pos, 20, - 8 + random2(4)); - break; - } + expose_player_to_element(BEAM_COLD, 9); + break; + case 1: + msg::stream << "Freezing gasses pour from your " + << your_hand(true) << "!" << std::endl; + big_cloud(CLOUD_COLD, KC_YOU, you.x_pos, you.y_pos, 20, + 8 + random2(4)); break; } - break; // end ice + break; + } +} - case SPTYP_EARTH: - switch (spec_effect) +static void miscast_earth(int severity, const char* cause) +{ + bolt beam; + switch (severity) + { + case 0: // just a harmless message + case 1: + switch (random2(10)) { - case 0: // just a harmless message + case 0: + mpr("You feel earthy."); + break; case 1: - switch (random2(10)) - { - case 0: - mpr("You feel earthy."); - break; - case 1: - mpr("You are showered with tiny particles of grit."); - break; - case 2: - msg::stream << "Sand pours from your " - << your_hand(true) << "." << std::endl; - break; - case 3: - mpr("You feel a surge of energy from the ground."); - break; - case 4: - if (!silenced(you.x_pos, you.y_pos)) - mpr("You hear a distant rumble.", MSGCH_SOUND); - else - mpr("You sympathise with the stones."); - break; - case 5: - mpr("You feel gritty."); - break; - case 6: - mpr("You feel momentarily lethargic."); - break; - case 7: - mpr("Motes of dust swirl before your eyes."); - break; - case 8: - canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - mprf("Your %s warm.", - (you.species == SP_NAGA) ? "underbelly feels" : - (you.species == SP_CENTAUR) ? "hooves feel" - : "feet feel"); - break; - } + mpr("You are showered with tiny particles of grit."); break; - - case 2: // slightly less harmless stuff - switch (random2(1)) - { - case 0: - switch (random2(3)) - { - case 0: - mpr("You are hit by flying rocks!"); - break; - case 1: - mpr("You are blasted with sand!"); - break; - case 2: - mpr("Rocks fall onto you out of nowhere!"); - break; - } - ouch( random2avg(13,2) + 10 - random2(1 + player_AC()), - 0, KILLED_BY_WILD_MAGIC, cause); - break; - } + case 2: + msg::stream << "Sand pours from your " + << your_hand(true) << "." << std::endl; break; - - case 3: // less harmless stuff - switch (random2(1)) - { - case 0: - mpr("You are caught in an explosion of flying shrapnel!"); - - beam.type = SYM_BURST; - beam.damage = dice_def( 3, 15 ); - beam.flavour = BEAM_FRAG; - beam.target_x = you.x_pos; - beam.target_y = you.y_pos; - beam.name = "explosion"; - beam.colour = CYAN; - - if (one_chance_in(5)) - beam.colour = BROWN; - if (one_chance_in(5)) - beam.colour = LIGHTCYAN; - - beam.beam_source = NON_MONSTER; - beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source.clear(); - if (cause) - beam.aux_source = cause; - beam.ex_size = 1; - beam.is_explosion = true; - - explosion(beam); - break; - } + case 3: + mpr("You feel a surge of energy from the ground."); + break; + case 4: + if (!silenced(you.x_pos, you.y_pos)) + mpr("You hear a distant rumble.", MSGCH_SOUND); + else + mpr("You sympathise with the stones."); + break; + case 5: + mpr("You feel gritty."); + break; + case 6: + mpr("You feel momentarily lethargic."); + break; + case 7: + mpr("Motes of dust swirl before your eyes."); + break; + case 8: + canned_msg(MSG_NOTHING_HAPPENS); + break; + case 9: + mprf("Your %s warm.", + (you.species == SP_NAGA) ? "underbelly feels" : + (you.species == SP_CENTAUR) ? "hooves feel" + : "feet feel"); break; } - break; // end Earth + break; - case SPTYP_AIR: - switch (spec_effect) + case 2: // slightly less harmless stuff + switch (random2(1)) { - case 0: // just a harmless message - switch (random2(10)) + case 0: + switch (random2(3)) { case 0: - mpr("Ouch! You gave yourself an electric shock."); + mpr("You are hit by flying rocks!"); break; case 1: - mpr("You feel momentarily weightless."); + mpr("You are blasted with sand!"); break; case 2: - msg::stream << "Wisps of vapour drift from your " - << your_hand(true) << "." << std::endl; - break; - case 3: - mpr("You feel a strange surge of energy!"); - break; - case 4: - mpr("You feel electric!"); - break; - case 5: - msg::stream << "Sparks of electricity dance between your " - << your_hand(true) << "." << std::endl; - break; - case 6: - mpr("You are blasted with air!"); - break; - case 7: - if (!silenced(you.x_pos, you.y_pos)) - mpr("You hear a whooshing sound.", MSGCH_SOUND); - else if (player_can_smell()) - mpr("You smell ozone."); - break; - case 8: - canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - if (!silenced(you.x_pos, you.y_pos)) - mpr("You hear a crackling sound.", MSGCH_SOUND); - else if (player_can_smell()) - mpr("You smell something musty."); + mpr("Rocks fall onto you out of nowhere!"); break; } + ouch( random2avg(13,2) + 10 - random2(1 + player_AC()), + 0, KILLED_BY_WILD_MAGIC, cause); break; + } + break; - case 1: // a bit less harmless stuff - switch (random2(2)) - { - case 0: - mpr("There is a short, sharp shower of sparks."); - break; - case 1: - mprf("The wind %s around you!", - silenced(you.x_pos, you.y_pos) ? "whips" : "howls"); - break; - } + case 3: // less harmless stuff + switch (random2(1)) + { + case 0: + mpr("You are caught in an explosion of flying shrapnel!"); + beam.type = SYM_BURST; + beam.damage = dice_def( 3, 15 ); + beam.flavour = BEAM_FRAG; + beam.target_x = you.x_pos; + beam.target_y = you.y_pos; + beam.name = "explosion"; + beam.colour = CYAN; + + if (one_chance_in(5)) + beam.colour = BROWN; + if (one_chance_in(5)) + beam.colour = LIGHTCYAN; + + beam.beam_source = NON_MONSTER; + beam.thrower = (cause) ? KILL_MISC : KILL_YOU; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; + beam.ex_size = 1; + beam.is_explosion = true; + + explosion(beam); break; + } + break; + } +} - case 2: // rather less harmless stuff - switch (random2(2)) - { - case 0: - mpr("Electricity courses through your body."); - ouch(check_your_resists(4 + random2avg(9, 2), 5), 0, - KILLED_BY_WILD_MAGIC, cause); - break; - case 1: - msg::stream << "Noxious gasses pour from your " - << your_hand(true) << "!" << std::endl; - big_cloud(CLOUD_STINK, KC_YOU, you.x_pos, you.y_pos, 20, - 9 + random2(4)); - break; - } +static void miscast_air(int severity, const char* cause) +{ + bolt beam; + switch (severity) + { + case 0: // just a harmless message + switch (random2(10)) + { + case 0: + mpr("Ouch! You gave yourself an electric shock."); + break; + case 1: + mpr("You feel momentarily weightless."); + break; + case 2: + msg::stream << "Wisps of vapour drift from your " + << your_hand(true) << "." << std::endl; + break; + case 3: + mpr("You feel a strange surge of energy!"); + break; + case 4: + mpr("You feel electric!"); + break; + case 5: + msg::stream << "Sparks of electricity dance between your " + << your_hand(true) << "." << std::endl; break; + case 6: + mpr("You are blasted with air!"); + break; + case 7: + if (!silenced(you.x_pos, you.y_pos)) + mpr("You hear a whooshing sound.", MSGCH_SOUND); + else if (player_can_smell()) + mpr("You smell ozone."); + break; + case 8: + canned_msg(MSG_NOTHING_HAPPENS); + break; + case 9: + if (!silenced(you.x_pos, you.y_pos)) + mpr("You hear a crackling sound.", MSGCH_SOUND); + else if (player_can_smell()) + mpr("You smell something musty."); + break; + } + break; - case 3: // less harmless stuff - switch (random2(2)) - { - case 0: - mpr("You are caught in an explosion of electrical discharges!"); - - beam.type = SYM_BURST; - beam.damage = dice_def( 3, 8 ); - beam.flavour = BEAM_ELECTRICITY; - beam.target_x = you.x_pos; - beam.target_y = you.y_pos; - beam.name = "explosion"; - beam.colour = LIGHTBLUE; - beam.beam_source = NON_MONSTER; - beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source.clear(); - if (cause) - beam.aux_source = cause; - beam.ex_size = one_chance_in(4)?1:2; - beam.is_explosion = true; + case 1: // a bit less harmless stuff + switch (random2(2)) + { + case 0: + mpr("There is a short, sharp shower of sparks."); + break; + case 1: + mprf("The wind %s around you!", + silenced(you.x_pos, you.y_pos) ? "whips" : "howls"); + break; + } + break; - explosion(beam); - break; - case 1: - msg::stream << "Venomous gasses pour from your " - << your_hand(true) << "!" << std::endl; - big_cloud( CLOUD_POISON, KC_YOU, you.x_pos, you.y_pos, 20, - 8 + random2(5) ); - break; - } + case 2: // rather less harmless stuff + switch (random2(2)) + { + case 0: + mpr("Electricity courses through your body."); + ouch(check_your_resists(4 + random2avg(9, 2), 5), 0, + KILLED_BY_WILD_MAGIC, cause); + break; + case 1: + msg::stream << "Noxious gasses pour from your " + << your_hand(true) << "!" << std::endl; + big_cloud(CLOUD_STINK, KC_YOU, you.x_pos, you.y_pos, 20, + 9 + random2(4)); break; } - break; // end air + break; - case SPTYP_POISON: - switch (spec_effect) + case 3: // less harmless stuff + switch (random2(2)) { - case 0: // just a harmless message - switch (random2(10)) - { - case 0: - mpr("You feel mildly nauseous."); - break; - case 1: - mpr("You feel slightly ill."); - break; - case 2: - msg::stream << "Wisps of poison gas drift from your " - << your_hand(true) << "." << std::endl; - break; - case 3: - mpr("You feel a strange surge of energy!"); - break; - case 4: - mpr("You feel faint for a moment."); - break; - case 5: - mpr("You feel sick."); - break; - case 6: - mpr("You feel odd."); - break; - case 7: - mpr("You feel weak for a moment."); - break; - case 8: - canned_msg(MSG_NOTHING_HAPPENS); - break; - case 9: - if (!silenced(you.x_pos, you.y_pos)) - mpr("You hear a slurping sound.", MSGCH_SOUND); - else if (you.species != SP_MUMMY) - mpr("You taste almonds."); - break; - } + case 0: + mpr("You are caught in an explosion of electrical discharges!"); + beam.type = SYM_BURST; + beam.damage = dice_def( 3, 8 ); + beam.flavour = BEAM_ELECTRICITY; + beam.target_x = you.x_pos; + beam.target_y = you.y_pos; + beam.name = "explosion"; + beam.colour = LIGHTBLUE; + beam.beam_source = NON_MONSTER; + beam.thrower = (cause) ? KILL_MISC : KILL_YOU; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; + beam.ex_size = one_chance_in(4)?1:2; + beam.is_explosion = true; + + explosion(beam); + break; + case 1: + msg::stream << "Venomous gasses pour from your " + << your_hand(true) << "!" << std::endl; + big_cloud( CLOUD_POISON, KC_YOU, you.x_pos, you.y_pos, 20, + 8 + random2(5) ); break; + } + } +} - case 1: // a bit less harmless stuff - switch (random2(2)) - { - case 0: - if (player_res_poison()) - { - canned_msg(MSG_NOTHING_HAPPENS); - return (false); - } +static void miscast_poison(int severity, const char* cause) +{ + switch (severity) + { + case 0: // just a harmless message + switch (random2(10)) + { + case 0: + mpr("You feel mildly nauseous."); + break; + case 1: + mpr("You feel slightly ill."); + break; + case 2: + msg::stream << "Wisps of poison gas drift from your " + << your_hand(true) << "." << std::endl; + break; + case 3: + mpr("You feel a strange surge of energy!"); + break; + case 4: + mpr("You feel faint for a moment."); + break; + case 5: + mpr("You feel sick."); + break; + case 6: + mpr("You feel odd."); + break; + case 7: + mpr("You feel weak for a moment."); + break; + case 8: + canned_msg(MSG_NOTHING_HAPPENS); + break; + case 9: + if (!silenced(you.x_pos, you.y_pos)) + mpr("You hear a slurping sound.", MSGCH_SOUND); + else if (you.species != SP_MUMMY) + mpr("You taste almonds."); + break; + } + break; + case 1: // a bit less harmless stuff + switch (random2(2)) + { + case 0: + if (player_res_poison()) + canned_msg(MSG_NOTHING_HAPPENS); + else + { mpr("You feel sick."); poison_player( 2 + random2(3) ); - break; - - case 1: - msg::stream << "Noxious gasses pour from your " - << your_hand(true) << "!" << std::endl; - place_cloud(CLOUD_STINK, you.x_pos, you.y_pos, - 2 + random2(4), KC_YOU); - break; } break; - case 2: // rather less harmless stuff - switch (random2(3)) - { - case 0: - if (player_res_poison()) - { - canned_msg(MSG_NOTHING_HAPPENS); - return (false); - } + case 1: + msg::stream << "Noxious gasses pour from your " + << your_hand(true) << "!" << std::endl; + place_cloud(CLOUD_STINK, you.x_pos, you.y_pos, + 2 + random2(4), KC_YOU); + break; + } + break; + case 2: // rather less harmless stuff + switch (random2(3)) + { + case 0: + if (player_res_poison()) + canned_msg(MSG_NOTHING_HAPPENS); + else + { mpr("You feel very sick."); poison_player( 3 + random2avg(9, 2) ); - break; + } + break; - case 1: - mpr("Noxious gasses pour from your hands!"); - big_cloud(CLOUD_STINK, KC_YOU, you.x_pos, you.y_pos, 20, - 8 + random2(5)); - break; + case 1: + mpr("Noxious gasses pour from your hands!"); + big_cloud(CLOUD_STINK, KC_YOU, you.x_pos, you.y_pos, 20, + 8 + random2(5)); + break; - case 2: - if (player_res_poison()) - { - canned_msg(MSG_NOTHING_HAPPENS); - return (false); - } + case 2: + if (player_res_poison()) + canned_msg(MSG_NOTHING_HAPPENS); + else lose_stat(STAT_RANDOM, 1); - break; - } break; + } + break; - case 3: // less harmless stuff - switch (random2(3)) + case 3: // less harmless stuff + switch (random2(3)) + { + case 0: + if (player_res_poison()) + canned_msg(MSG_NOTHING_HAPPENS); + else { - case 0: - if (player_res_poison()) - { - canned_msg(MSG_NOTHING_HAPPENS); - return (false); - } - mpr("You feel incredibly sick."); poison_player( 10 + random2avg(19, 2) ); - break; - case 1: - msg::stream << "Venomous gasses pour from your " - << your_hand(true) << "!" << std::endl; - big_cloud(CLOUD_POISON, KC_YOU, you.x_pos, you.y_pos, 20, - 7 + random2(7)); - break; - case 2: - if (player_res_poison()) - { - canned_msg(MSG_NOTHING_HAPPENS); - return (false); - } - - lose_stat(STAT_RANDOM, 1 + random2avg(5, 2)); - break; } break; + case 1: + msg::stream << "Venomous gasses pour from your " + << your_hand(true) << "!" << std::endl; + big_cloud(CLOUD_POISON, KC_YOU, you.x_pos, you.y_pos, 20, + 7 + random2(7)); + break; + case 2: + if (player_res_poison()) + canned_msg(MSG_NOTHING_HAPPENS); + else + lose_stat(STAT_RANDOM, 1 + random2avg(5, 2)); + break; } - break; // end poison + break; } +} - xom_is_stimulated(spec_effect); - return (true); +/* sp_type is the type of the spell + * mag_pow is overall power of the spell or effect (i.e. its level) + * mag_fail is the degree to which you failed + * force_effect forces a certain severity of effect to occur + * (set to 100 to avoid forcing.) + */ +void miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, + int force_effect, const char *cause ) +{ + if (sp_type == SPTYP_RANDOM) + sp_type = 1 << (random2(SPTYP_LAST_EXPONENT)); + + int sever = (mag_pow*mag_fail*(10+mag_pow)/7 * WILD_MAGIC_NASTINESS)/100; + + if (force_effect == 100 && random2(40) > sever && random2(40) > sever) + { + canned_msg(MSG_NOTHING_HAPPENS); + return; + } + + sever /= 100; + +#if DEBUG_DIAGNOSTICS + const int old_fail = sever; +#endif + + sever = random2(sever); + + if (sever > 3) + sever = 3; + else if (sever < 0) + sever = 0; + +#if DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "Sptype: %u, failure1: %d, failure2: %d", + sp_type, old_fail, sever ); +#endif + + if (force_effect != 100) + sever = force_effect; + + switch (sp_type) + { + case SPTYP_CONJURATION: miscast_conjuration(sever, cause); break; + case SPTYP_ENCHANTMENT: miscast_enchantment(sever, cause); break; + case SPTYP_TRANSLOCATION: miscast_translocation(sever, cause); break; + case SPTYP_SUMMONING: miscast_summoning(sever, cause); break; + case SPTYP_DIVINATION: miscast_divination(sever, cause); break; + case SPTYP_NECROMANCY: miscast_necromancy(sever, cause); break; + case SPTYP_TRANSMIGRATION: miscast_transmigration(sever, cause); break; + case SPTYP_FIRE: miscast_fire(sever, cause); break; + case SPTYP_ICE: miscast_ice(sever, cause); break; + case SPTYP_EARTH: miscast_earth(sever, cause); break; + case SPTYP_AIR: miscast_air(sever, cause); break; + case SPTYP_POISON: miscast_poison(sever, cause); break; + } + + xom_is_stimulated(sever); + return; } // end miscast_effect() const char* failure_rate_to_string( int fail ) diff --git a/crawl-ref/source/spl-cast.h b/crawl-ref/source/spl-cast.h index f69a70c72a..6021cd634b 100644 --- a/crawl-ref/source/spl-cast.h +++ b/crawl-ref/source/spl-cast.h @@ -50,7 +50,7 @@ spret_type your_spells( spell_type spell, int powc = 0, * called from: acr - decks - fight - it_use2 - it_use3 - item_use - items - * misc - mstuff2 - religion - spell - spl-book - spells4 * *********************************************************************** */ -bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, +void miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, int force_effect, const char *cause = NULL ); const char* failure_rate_to_string( int fail ); |