diff options
author | reaverb <reaverb.Crawl@gmail.com> | 2014-05-14 00:51:18 -0400 |
---|---|---|
committer | reaverb <reaverb.Crawl@gmail.com> | 2014-05-14 00:51:18 -0400 |
commit | f5d8342362cfa7d5b07d580ea68fbb400185b993 (patch) | |
tree | 1d08a0c538c032437a80b7f7cf7dd5acfd6c07b4 /crawl-ref/source/effects.cc | |
parent | 74aec7792b8181da1e5e644506af25dd0c428770 (diff) | |
download | crawl-ref-f5d8342362cfa7d5b07d580ea68fbb400185b993.tar.gz crawl-ref-f5d8342362cfa7d5b07d580ea68fbb400185b993.zip |
Clean up _magic_contamination_effects a little
Including renaming it to _handle_magic_contamination and giving its old
name to a helper function.
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r-- | crawl-ref/source/effects.cc | 104 |
1 files changed, 54 insertions, 50 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index e3f0068c6c..5fad5fa939 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -2027,7 +2027,58 @@ static void _handle_magic_contamination() } // Bad effects from magic contamination. -static void _magic_contamination_effects(int time_delta) +static void _magic_contamination_effects() +{ + mprf(MSGCH_WARN, "Your body shudders with the violent release " + "of wild energies!"); + + const int contam = you.magic_contamination; + + // For particularly violent releases, make a little boom. + if (contam > 10000 && coinflip()) + { + bolt beam; + + beam.flavour = BEAM_RANDOM; + beam.glyph = dchar_glyph(DCHAR_FIRED_BURST); + beam.damage = dice_def(3, div_rand_round(contam, 2000 )); + beam.target = you.pos(); + beam.name = "magical storm"; + beam.beam_source = NON_MONSTER; + beam.aux_source = "a magical explosion"; + beam.ex_size = max(1, min(9, div_rand_round(contam, 15000))); + beam.ench_power = div_rand_round(contam, 200); + beam.is_explosion = true; + + // Undead enjoy extra contamination explosion damage because + // the magical contamination has a harder time dissipating + // through non-living flesh. :-) + if (you.is_undead) + beam.damage.size *= 2; + + beam.explode(); + } + + // We want to warp the player, not do good stuff! + mutate(one_chance_in(5) ? RANDOM_MUTATION : RANDOM_BAD_MUTATION, + "mutagenic glow", true, + coinflip(), + false, false, false, false, +#if TAG_MAJOR_VERSION == 34 + you.species == SP_DJINNI +#else + false +#endif + ); + + // we're meaner now, what with explosions and whatnot, but + // we dial down the contamination a little faster if its actually + // mutating you. -- GDL + contaminate_player(-(random2(contam / 4) + 1000)); +} +// Checks if the player should be hit with magic contaimination effects, +// then actually does it if they should be. +static void _handle_magic_contamination(int time_delta) { UNUSED(time_delta); @@ -2043,54 +2094,7 @@ static void _magic_contamination_effects(int time_delta) "energies until Zin's power calms it."); } else - { - mprf(MSGCH_WARN, "Your body shudders with the violent release " - "of wild energies!"); - - // For particularly violent releases, make a little boom. - if (you.magic_contamination > 10000 && coinflip()) - { - bolt beam; - - beam.flavour = BEAM_RANDOM; - beam.glyph = dchar_glyph(DCHAR_FIRED_BURST); - beam.damage = dice_def(3, - div_rand_round(you.magic_contamination, 2000)); - beam.target = you.pos(); - beam.name = "magical storm"; - beam.beam_source = NON_MONSTER; - beam.aux_source = "a magical explosion"; - beam.ex_size = max(1, min(9, - div_rand_round(you.magic_contamination, 15000))); - beam.ench_power = div_rand_round(you.magic_contamination, 200); - beam.is_explosion = true; - - // Undead enjoy extra contamination explosion damage because - // the magical contamination has a harder time dissipating - // through non-living flesh. :-) - if (you.is_undead) - beam.damage.size *= 2; - - beam.explode(); - } - - // We want to warp the player, not do good stuff! - mutate(one_chance_in(5) ? RANDOM_MUTATION : RANDOM_BAD_MUTATION, - "mutagenic glow", true, - coinflip(), - false, false, false, false, -#if TAG_MAJOR_VERSION == 34 - you.species == SP_DJINNI -#else - false -#endif - ); - - // we're meaner now, what with explosions and whatnot, but - // we dial down the contamination a little faster if its actually - // mutating you. -- GDL - contaminate_player(-(random2(you.magic_contamination / 4) + 1000)); - } + _magic_contamination_effects(); } } @@ -2299,7 +2303,7 @@ static struct timed_effect timed_effects[] = { TIMER_CORPSES, _update_corpses, 200, 200, true }, { TIMER_HELL_EFFECTS, _hell_effects, 200, 600, false }, { TIMER_STAT_RECOVERY, _recover_stats, 100, 300, false }, - { TIMER_CONTAM, _magic_contamination_effects, 200, 600, false }, + { TIMER_CONTAM, _handle_magic_contamination, 200, 600, false }, { TIMER_DETERIORATION, _deteriorate, 100, 300, false }, { TIMER_GOD_EFFECTS, handle_god_time, 100, 300, false }, { TIMER_SCREAM, _scream, 100, 300, false }, |