diff options
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/spells2.cc | 103 | ||||
-rw-r--r-- | crawl-ref/source/spells2.h | 7 | ||||
-rw-r--r-- | crawl-ref/source/spells3.cc | 105 | ||||
-rw-r--r-- | crawl-ref/source/spells3.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 8 |
5 files changed, 110 insertions, 114 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 3fb26d3153..72ea70af2f 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -653,109 +653,6 @@ static int raise_corpse( int corps, int corx, int cory, return returnVal; } // end raise_corpse() -void cast_twisted_resurrection(int pow, bool god_gift) -{ - if (igrd[you.x_pos][you.y_pos] == NON_ITEM) - { - mpr("There's nothing here!"); - return; - } - - int objl = igrd[you.x_pos][you.y_pos]; - int next; - - int total_mass = 0; - int num_corpses = 0; - int rotted = 0; - - while (objl != NON_ITEM) - { - next = mitm[objl].link; - - if (mitm[objl].base_type == OBJ_CORPSES - && mitm[objl].sub_type == CORPSE_BODY) - { - total_mass += mons_weight(mitm[objl].plus); - - num_corpses++; - - if (food_is_rotten(mitm[objl])) - rotted++; - - destroy_item(objl); - } - - objl = next; - } - -#if DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, "Mass for abomination: %d", total_mass); -#endif - - // This is what the old statement pretty much boils down to, - // the average will be approximately 10 * pow (or about 1000 - // at the practical maximum). That's the same as the mass - // of a hippogriff, a spiny frog, or a steam dragon. Thus, - // material components are far more important to this spell. -- bwr - total_mass += roll_dice(20, pow); - -#if DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, "Mass including power bonus: %d", total_mass); -#endif - - if (total_mass < 400 + roll_dice(2, 500) - || num_corpses < (coinflip() ? 3 : 2)) - { - mpr("The spell fails."); - - mprf("The corpse%s collapse%s into a pulpy mess.", - num_corpses > 1 ? "s": "", num_corpses > 1 ? "": "s"); - return; - } - - monster_type mon = - (total_mass > 500 + roll_dice(3, 1000)) ? MONS_ABOMINATION_LARGE - : MONS_ABOMINATION_SMALL; - - char colour = (rotted == num_corpses) ? BROWN : - (rotted >= random2(num_corpses)) ? RED - : LIGHTRED; - - int monster = create_monster( - mgen_data(mon, BEH_FRIENDLY, 0, - you.pos(), you.pet_target, - god_gift ? MF_GOD_GIFT : 0, - MONS_PROGRAM_BUG, 0, colour)); - - if (monster == -1) - { - mpr("The corpses collapse into a pulpy mess."); - return; - } - - // This was probably intended, but it's really boring. (jpeg) - // Use menv[mon].number instead (set in create_monster()). -// menv[mon].colour = colour; - mpr("The heap of corpses melds into an agglomeration of writhing flesh!"); - - if (mon == MONS_ABOMINATION_LARGE) - { - menv[monster].hit_dice = 8 + total_mass / ((colour == LIGHTRED) ? 500 : - (colour == RED) ? 1000 - : 2500); - - if (menv[monster].hit_dice > 30) - menv[monster].hit_dice = 30; - - // XXX: No convenient way to get the hit dice size right now. - menv[monster].hit_points = hit_points(menv[monster].hit_dice, 2, 5); - menv[monster].max_hit_points = menv[monster].hit_points; - - if (colour == LIGHTRED) - menv[monster].ac += total_mass / 1000; - } -} - bool brand_weapon(brand_type which_brand, int power) { int temp_rand; // probability determination {dlb} diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h index 722cefa621..8570117899 100644 --- a/crawl-ref/source/spells2.h +++ b/crawl-ref/source/spells2.h @@ -108,13 +108,6 @@ void cast_toxic_radiance(void); // last updated 24may2000 {dlb} /* *********************************************************************** - * called from: spell - * *********************************************************************** */ -void cast_twisted_resurrection(int pow, bool god_gift = false); - - -// last updated 24may2000 {dlb} -/* *********************************************************************** * called from: ability * *********************************************************************** */ void drain_life(int pow); diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index b3e7cac202..1155568972 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -561,6 +561,111 @@ bool cast_shadow_creatures(bool god_gift) return (success); } +bool cast_twisted_resurrection(int pow, bool god_gift) +{ + if (igrd[you.x_pos][you.y_pos] == NON_ITEM) + { + mpr("There's nothing here!"); + return (false); + } + + int objl = igrd[you.x_pos][you.y_pos]; + int next; + + int how_many_corpses = 0; + int total_mass = 0; + int rotted = 0; + + while (objl != NON_ITEM) + { + next = mitm[objl].link; + + if (mitm[objl].base_type == OBJ_CORPSES + && mitm[objl].sub_type == CORPSE_BODY) + { + total_mass += mons_weight(mitm[objl].plus); + + how_many_corpses++; + + if (food_is_rotten(mitm[objl])) + rotted++; + + destroy_item(objl); + } + + objl = next; + } + +#if DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "Mass for abomination: %d", total_mass); +#endif + + // This is what the old statement pretty much boils down to, + // the average will be approximately 10 * pow (or about 1000 + // at the practical maximum). That's the same as the mass + // of a hippogriff, a spiny frog, or a steam dragon. Thus, + // material components are far more important to this spell. -- bwr + total_mass += roll_dice(20, pow); + +#if DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "Mass including power bonus: %d", total_mass); +#endif + + if (total_mass < 400 + roll_dice(2, 500) + || how_many_corpses < (coinflip() ? 3 : 2)) + { + mpr("The spell fails."); + + mprf("The corpse%s collapse%s into a pulpy mess.", + how_many_corpses > 1 ? "s": "", how_many_corpses > 1 ? "": "s"); + return (false); + } + + monster_type mon = + (total_mass > 500 + roll_dice(3, 1000)) ? MONS_ABOMINATION_LARGE + : MONS_ABOMINATION_SMALL; + + char colour = (rotted == how_many_corpses) ? BROWN : + (rotted >= random2(how_many_corpses)) ? RED + : LIGHTRED; + + int monster = create_monster( + mgen_data(mon, BEH_FRIENDLY, 0, + you.pos(), you.pet_target, + god_gift ? MF_GOD_GIFT : 0, + MONS_PROGRAM_BUG, 0, colour)); + + if (monster == -1) + { + mpr("The corpses collapse into a pulpy mess."); + return (false); + } + + // This was probably intended, but it's really boring. (jpeg) + // Use menv[mon].number instead (set in create_monster()). +// menv[mon].colour = colour; + mpr("The heap of corpses melds into an agglomeration of writhing flesh!"); + + if (mon == MONS_ABOMINATION_LARGE) + { + menv[monster].hit_dice = 8 + total_mass / ((colour == LIGHTRED) ? 500 : + (colour == RED) ? 1000 + : 2500); + + if (menv[monster].hit_dice > 30) + menv[monster].hit_dice = 30; + + // XXX: No convenient way to get the hit dice size right now. + menv[monster].hit_points = hit_points(menv[monster].hit_dice, 2, 5); + menv[monster].max_hit_points = menv[monster].hit_points; + + if (colour == LIGHTRED) + menv[monster].ac += total_mass / 1000; + } + + return (true); +} + bool cast_summon_wraiths(int pow, bool god_gift) { bool success = false; diff --git a/crawl-ref/source/spells3.h b/crawl-ref/source/spells3.h index e8c4fb94d6..2bba87a45f 100644 --- a/crawl-ref/source/spells3.h +++ b/crawl-ref/source/spells3.h @@ -116,6 +116,7 @@ bool cast_summon_horrible_things(int pow, bool god_gift = false); bool cast_simulacrum(int pow, bool god_gift = false); bool cast_shadow_creatures(bool god_gift = false); +bool cast_twisted_resurrection(int pow, bool god_gift = false); bool cast_summon_wraiths(int pow, bool god_gift = false); bool cast_death_channel(int pow, bool god_gift = false); diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index a5f3dc0798..97347baa5d 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1549,6 +1549,10 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) cast_shadow_creatures(); break; + case SPELL_TWISTED_RESURRECTION: + cast_twisted_resurrection(powc); + break; + case SPELL_SUMMON_WRAITHS: cast_summon_wraiths(powc); break; @@ -1584,10 +1588,6 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) return (SPRET_ABORT); break; - case SPELL_TWISTED_RESURRECTION: - cast_twisted_resurrection(powc); - break; - case SPELL_REGENERATION: cast_regen(powc); break; |