diff options
-rw-r--r-- | crawl-ref/source/abl-show.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/beam.cc | 13 | ||||
-rw-r--r-- | crawl-ref/source/effects.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/enum.h | 5 | ||||
-rw-r--r-- | crawl-ref/source/invent.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/it_use2.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/itemprop.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/output.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 96 | ||||
-rw-r--r-- | crawl-ref/source/player.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 24 | ||||
-rw-r--r-- | crawl-ref/source/spells1.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/spells3.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 1 |
14 files changed, 112 insertions, 55 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 4a1ffa74ca..8fe6a359c1 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1295,7 +1295,7 @@ static bool do_ability(const ability_def& abil) } potion_effect( POT_INVISIBILITY, 2 * you.skills[SK_EVOCATIONS] + 5 ); - contaminate_player( 1 + random2(3) ); + contaminate_player( 1 + random2(3), true ); exercise( SK_EVOCATIONS, 1 ); break; diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index be7e5602c4..7e637a96cf 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3325,7 +3325,7 @@ static int affect_player( bolt &beam ) case BEAM_HASTE: potion_effect( POT_SPEED, beam.ench_power ); - contaminate_player( 1 ); + contaminate_player( 1, beam.effect_known ); beam.obvious_effect = true; nasty = false; nice = true; @@ -3350,7 +3350,7 @@ static int affect_player( bolt &beam ) case BEAM_INVISIBILITY: potion_effect( POT_INVISIBILITY, beam.ench_power ); - contaminate_player( 1 + random2(2) ); + contaminate_player( 1 + random2(2), beam.effect_known ); beam.obvious_effect = true; nasty = false; nice = true; @@ -3932,8 +3932,8 @@ static int affect_monster(bolt &beam, monsters *mon) if (YOU_KILL(beam.thrower) && hurt_final > 0) { const bool okay = - beam.aux_source == "reading a scroll of immolation" - && !beam.effect_known; + (beam.aux_source == "reading a scroll of immolation" + && !beam.effect_known); if (is_sanctuary(mon->x, mon->y) || is_sanctuary(you.x_pos, you.y_pos)) @@ -4164,7 +4164,10 @@ static int affect_monster_enchantment(bolt &beam, monsters *mon) beam.obvious_effect = true; if (YOU_KILL(beam.thrower)) - did_god_conduct(DID_DELIBERATE_MUTATING, 2 + random2(3), beam.effect_known); + { + did_god_conduct(DID_DELIBERATE_MUTATING, 2 + random2(3), + beam.effect_known); + } return (MON_AFFECTED); } diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 12ad68cb6e..fddc3d2efd 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -2437,6 +2437,7 @@ void handle_time( long time_delta ) added_contamination++; } + bool mutagenic_randart = false; if (const int randart_glow = scan_randarts(RAP_MUTAGENIC)) { // Reduced randart glow. Note that one randart will contribute @@ -2448,13 +2449,16 @@ void handle_time( long time_delta ) const int mean_glow = 500 + randart_glow * 40; const int actual_glow = mean_glow / 2 + random2(mean_glow); added_contamination += div_rand_round(actual_glow, 1000); + mutagenic_randart = true; } // we take off about .5 points per turn if (!you.duration[DUR_INVIS] && !you.duration[DUR_HASTE] && coinflip()) added_contamination -= 1; - contaminate_player( added_contamination ); + // only punish if contamination caused by mutagenic randarts + // (haste and invisibility already penalized earlier) + contaminate_player( added_contamination, mutagenic_randart ); // only check for badness once every other turn if (coinflip()) diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 0eb5b861c6..59cfb51ef9 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -657,9 +657,10 @@ enum conduct_type DID_DRINK_BLOOD, DID_CANNIBALISM, DID_EAT_MEAT, // unused - DID_EAT_SOULED_BEING, // Zin + DID_EAT_SOULED_BEING, // Zin + DID_DELIBERATE_MUTATING, // Zin + DID_CAUSE_GLOWING, // Zin DID_CREATED_LIFE, // unused - DID_DELIBERATE_MUTATING, NUM_CONDUCTS }; diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index f8c932dc69..bee34b1cb7 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -765,7 +765,7 @@ static bool item_class_selected(const item_def &i, int selector) case OBJ_SCROLLS: return (itype == OBJ_SCROLLS || itype == OBJ_BOOKS); case OSEL_RECHARGE: - return (item_is_rechargable(i), true); + return (item_is_rechargable(i, true)); case OSEL_ENCH_ARM: return (is_enchantable_armour(i, true)); case OSEL_VAMP_EAT: diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index 07d652883f..07d4e55fca 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -145,7 +145,7 @@ bool potion_effect( potion_type pot_eff, int pow ) were_mighty ? "mightier" : "very mighty"); if ( were_mighty ) - contaminate_player(1); + contaminate_player(1, was_known); else modify_stat(STAT_STRENGTH, 5, true, ""); @@ -360,7 +360,7 @@ bool potion_effect( potion_type pot_eff, int pow ) // Just one point of contamination. These potions are really rare, // and contamination is nastier. - contaminate_player(1); + contaminate_player(1, was_known); break; case NUM_POTIONS: diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index dac38ae016..9db56d82d7 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -1276,6 +1276,7 @@ bool check_armour_shape( const item_def &item, bool quiet ) return (true); } +// if known is true, only returns true for *known* weapons of electrocution bool item_is_rechargable(const item_def &it, bool known) { // These are obvious diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 23ddcba5da..eda654bffe 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -747,8 +747,8 @@ void print_stats(void) if (you.backlit()) { textcolor( - you.magic_contamination >= 5? - bad_ench_colour( you.magic_contamination, 15, 25 ) + you.magic_contamination > 5 ? + bad_ench_colour( you.magic_contamination, 15, 25 ) : LIGHTBLUE ); cprintf( "Glow " ); } diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index a1318308c9..21f3fc2ec3 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -3566,6 +3566,23 @@ static void ability_increase() } } // end ability_increase() +static const char * _get_rotting_how() +{ + ASSERT(you.rotting > 0 || you.species == SP_GHOUL); + + if (you.rotting > 15) + return (" before your eyes"); + if (you.rotting > 8) + return (" away quickly"); + if (you.rotting > 4) + return (" badly"); + + if (you.species == SP_GHOUL) + return (" faster than usual"); + + return(""); +} + void display_char_status() { if (you.species == SP_VAMPIRE && you.hunger_state == HS_ENGORGED) @@ -3799,19 +3816,10 @@ void display_char_status() } if (you.rotting || you.species == SP_GHOUL) - { - // I apologize in advance for the horrendous ugliness about to - // transpire. Avert your eyes! - mprf("Your flesh is rotting%s", - (you.rotting > 15) ? " before your eyes." : - (you.rotting > 8) ? " away quickly." : - (you.rotting > 4) ? " badly." : - ((you.species == SP_GHOUL && you.rotting) ? - " faster than usual." : ".") ); - } + mprf("Your flesh is rotting%s.", _get_rotting_how()); // prints a contamination message - contaminate_player( 0, true ); + contaminate_player( 0, false, true ); if (you.duration[DUR_CONFUSING_TOUCH]) { @@ -4757,12 +4765,32 @@ void set_mp(int new_amount, bool max_too) return; } // end set_mp() -void contaminate_player(int change, bool statusOnly) +static int _get_contamination_level() { - // get current contamination level - int old_level; - int new_level; + const int glow = you.magic_contamination; + if (glow > 60) + return (glow / 20 + 2); + if (glow > 40) + return 4; + if (glow > 25) + return 3; + if (glow > 15) + return 2; + if (glow > 5) + return 1; + + return 0; +} + +// controlled is true if the player actively did something to cause +// contamination (such as drink a known potion of resistance), +// status_only is true only for the status output +void contaminate_player(int change, bool controlled, bool status_only) +{ + // get current contamination level + int old_level = _get_contamination_level(); + int new_level = 0; #if DEBUG_DIAGNOSTICS if (change > 0 || (change < 0 && you.magic_contamination)) @@ -4772,12 +4800,6 @@ void contaminate_player(int change, bool statusOnly) } #endif - old_level = (you.magic_contamination > 60)?(you.magic_contamination / 20 + 2) : - (you.magic_contamination > 40)?4 : - (you.magic_contamination > 25)?3 : - (you.magic_contamination > 15)?2 : - (you.magic_contamination > 5)?1 : 0; - // make the change if (change + you.magic_contamination < 0) you.magic_contamination = 0; @@ -4790,13 +4812,9 @@ void contaminate_player(int change, bool statusOnly) } // figure out new level - new_level = (you.magic_contamination > 60)?(you.magic_contamination / 20 + 2) : - (you.magic_contamination > 40)?4 : - (you.magic_contamination > 25)?3 : - (you.magic_contamination > 15)?2 : - (you.magic_contamination > 5)?1 : 0; + new_level = _get_contamination_level(); - if (statusOnly) + if (status_only) { if (new_level > 0) { @@ -4818,12 +4836,24 @@ void contaminate_player(int change, bool statusOnly) return; } - if (new_level == old_level) - return; + if (new_level != old_level) + { + mprf((change > 0) ? MSGCH_WARN : MSGCH_RECOVERY, + "You feel %s contaminated with magical energies.", + (change > 0) ? "more" : "less" ); + } - mprf((change > 0) ? MSGCH_WARN : MSGCH_RECOVERY, - "You feel %s contaminated with magical energies.", - (change > 0) ? "more" : "less" ); + // Zin doesn't like mutations or mutagenic radiation. + if (you.religion == GOD_ZIN) + { + // Whenever the glow status is first reached, give a warning message. + if (old_level < 1 && new_level >= 1) + did_god_conduct(DID_CAUSE_GLOWING, 0, false); + // If the player actively did something to increase glowing, + // Zin is displeased. + else if (controlled && change > 0 && old_level > 0) + did_god_conduct(DID_CAUSE_GLOWING, 1 + new_level, true); + } } bool poison_player( int amount, bool force ) @@ -4979,7 +5009,7 @@ void haste_player( int amount ) else { mpr( "You feel as though your hastened speed will last longer." ); - contaminate_player(1); + contaminate_player(1, true); // always deliberate } you.duration[DUR_HASTE] += amount; diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 11840c558d..9ea9964557 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -400,7 +400,8 @@ void set_mp(int new_amount, bool max_too); /* *********************************************************************** * called from: * *********************************************************************** */ -void contaminate_player(int change, bool statusOnly = false); +void contaminate_player(int change, bool controlled = false, + bool status_only = false); /* @return true iff they were poisoned (false if they are immune) */ bool poison_player( int amount, bool force = false ); diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index b3cd603876..7cff471e50 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -1720,10 +1720,23 @@ bool did_god_conduct( conduct_type thing_done, int level, bool known, } break; + case DID_CAUSE_GLOWING: case DID_DELIBERATE_MUTATING: if (you.religion == GOD_ZIN) { - if (!known) + if (thing_done == DID_CAUSE_GLOWING) + { + static long last_glowing_lecture = -1L; + if (last_glowing_lecture != you.num_turns) + { + simple_god_message(" does not appreciate the mutagenic glow " + "surrounding you!"); + last_glowing_lecture = you.num_turns; + } + if (!known) + break; + } + else if (!known) { simple_god_message(" did not appreciate that!"); break; @@ -1733,11 +1746,14 @@ bool did_god_conduct( conduct_type thing_done, int level, bool known, } break; + // level depends on intelligence: normal -> 1, high -> 2 + // cannibalism is still worse case DID_EAT_SOULED_BEING: if (you.religion == GOD_ZIN) { - piety_change = -level; - penance = level * 5; + piety_change = -level * 5; + if (level > 1) + penance = 5; ret = true; } break; @@ -1788,7 +1804,7 @@ bool did_god_conduct( conduct_type thing_done, int level, bool known, static void dock_piety(int piety_loss, int penance) { - static long last_piety_lecture = -1L; + static long last_piety_lecture = -1L; static long last_penance_lecture = -1L; if (piety_loss <= 0 && penance <= 0) diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index e3dce0e5d1..8b65313412 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -161,7 +161,7 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink) // controlling teleport contaminates the player -- bwr if (!wizard_blink) - contaminate_player( 1 ); + contaminate_player( 1, true ); } if (you.duration[DUR_CONDENSATION_SHIELD] > 0 && !wizard_blink) @@ -911,7 +911,7 @@ void extension(int pow) cast_condensation_shield(pow); if (contamination) - contaminate_player( contamination ); + contaminate_player( contamination, true ); } // end extension() void ice_armour(int pow, bool extending) diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 698f2e7e3d..ead8d5698e 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -637,7 +637,7 @@ static bool teleport_player( bool allow_control, bool new_abyss_area ) else { // controlling teleport contaminates the player -- bwr - contaminate_player(1); + contaminate_player(1, true); } } } // end "if is_controlled" diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 062bc0fced..f9e3deb738 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1001,6 +1001,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) const int cont_points = div_rand_round(nastiness, 500); + // miscasts are uncontrolled contaminate_player( cont_points ); miscast_effect( sptype, spell_mana(spell), |