|
From: <gi...@cr...> - 2012-02-27 14:19:47
|
via 7559ce0810fadc0080761caf97267eddd753790c (commit)
from 910341321a0fd25aa2defdd70884b56bd7f988cb (commit)
-----------------------------------------------------------------------
commit 7559ce0810fadc0080761caf97267eddd753790c
Author: Adam Borowski <kil...@an...>
Date: Mon Feb 27 15:16:00 2012 +0100
Record the cause of mutations.
Mutation descriptions end with a hardcoded dot, which makes the notes look
weird. Should we chomp the dot manually?
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/actor.h | 2 +-
crawl-ref/source/beam.cc | 5 ++-
crawl-ref/source/cloud.cc | 6 ++--
crawl-ref/source/decks.cc | 33 +++++++++++++++--------------
crawl-ref/source/effects.cc | 7 +++--
crawl-ref/source/food.cc | 8 +++---
crawl-ref/source/godabil.cc | 4 +-
crawl-ref/source/godwrath.cc | 6 ++--
crawl-ref/source/item_use.cc | 2 +-
crawl-ref/source/melee_attack.cc | 6 ++++-
crawl-ref/source/monster.cc | 2 +-
crawl-ref/source/monster.h | 2 +-
crawl-ref/source/mutation.cc | 41 +++++++++++++++++++++----------------
crawl-ref/source/mutation.h | 16 +++++++++-----
crawl-ref/source/notes.cc | 4 +++
crawl-ref/source/notes.h | 4 +-
crawl-ref/source/ouch.cc | 4 ++-
crawl-ref/source/player.cc | 31 ++++++++++++++-------------
crawl-ref/source/player.h | 2 +-
crawl-ref/source/potion.cc | 10 ++++----
crawl-ref/source/religion.cc | 10 ++++----
crawl-ref/source/spl-miscast.cc | 8 +++---
crawl-ref/source/wiz-you.cc | 32 ++++++++++++++--------------
crawl-ref/source/xom.cc | 14 ++++++++----
24 files changed, 143 insertions(+), 116 deletions(-)
diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h
index 6fdbf22..2b02b32 100644
--- a/crawl-ref/source/actor.h
+++ b/crawl-ref/source/actor.h
@@ -184,7 +184,7 @@ public:
virtual bool can_mutate() const = 0;
virtual bool can_safely_mutate() const = 0;
virtual bool can_bleed(bool allow_tran = true) const = 0;
- virtual bool mutate() = 0;
+ virtual bool mutate(const std::string &reason) = 0;
virtual bool drain_exp(actor *agent, bool quiet = false, int pow = 3) = 0;
virtual bool rot(actor *agent, int amount, int immediate = 0,
bool quiet = false) = 0;
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 3895061..bc98e32 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3244,7 +3244,8 @@ void bolt::affect_player_enchantment()
if (MON_KILL(thrower))
{
mpr("Strange energies course through your body.");
- you.mutate();
+ you.mutate(aux_source.empty() ? get_source_name() :
+ (get_source_name() + "/" + aux_source));
obvious_effect = true;
}
else if (get_ident_type(OBJ_WANDS, WAND_POLYMORPH_OTHER)
@@ -4726,7 +4727,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon)
return (MON_AFFECTED);
case BEAM_POLYMORPH:
- if (mon->mutate())
+ if (mon->mutate("polymorph other")) // exact source doesn't matter
obvious_effect = true;
if (YOU_KILL(thrower))
{
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index c7fa9a7..71365d5 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -991,11 +991,11 @@ bool _actor_apply_cloud_side_effects(actor *act,
{
mpr("Strange energies course through your body.");
if (one_chance_in(3))
- return you.mutate();
+ return you.mutate("mutagenic cloud");
else
- return give_bad_mutation();
+ return give_bad_mutation("mutagenic cloud");
}
- else if (mons->mutate())
+ else if (mons->mutate("mutagenic cloud"))
{
if (you.religion == GOD_ZIN && cloud.whose == KC_YOU)
did_god_conduct(DID_DELIBERATE_MUTATING, 5 + random2(3));
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 89e03e5..0ebc733 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2052,7 +2052,7 @@ static void _experience_card(int power, deck_rarity_type rarity)
static void _remove_bad_mutation()
{
// Ensure that only bad mutations are removed.
- if (!delete_mutation(RANDOM_BAD_MUTATION, false, false, false, true))
+ if (!delete_mutation(RANDOM_BAD_MUTATION, "helix card", false, false, false, true))
mpr("You feel transcendent for a moment.");
}
@@ -2065,14 +2065,14 @@ static void _helix_card(int power, deck_rarity_type rarity)
switch (how_mutated() ? random2(3) : 0)
{
case 0:
- mutate(RANDOM_MUTATION);
+ mutate(RANDOM_MUTATION, "helix card");
break;
case 1:
- delete_mutation(RANDOM_MUTATION);
- mutate(RANDOM_MUTATION);
+ delete_mutation(RANDOM_MUTATION, "helix card");
+ mutate(RANDOM_MUTATION, "helix card");
break;
case 2:
- delete_mutation(RANDOM_MUTATION);
+ delete_mutation(RANDOM_MUTATION, "helix card");
break;
}
}
@@ -2081,13 +2081,14 @@ static void _helix_card(int power, deck_rarity_type rarity)
switch (how_mutated() ? random2(3) : 0)
{
case 0:
- mutate(coinflip() ? RANDOM_GOOD_MUTATION : RANDOM_MUTATION);
+ mutate(coinflip() ? RANDOM_GOOD_MUTATION : RANDOM_MUTATION,
+ "helix card");
break;
case 1:
if (coinflip())
_remove_bad_mutation();
else
- delete_mutation(RANDOM_MUTATION);
+ delete_mutation(RANDOM_MUTATION, "helix card");
break;
case 2:
if (coinflip())
@@ -2095,18 +2096,18 @@ static void _helix_card(int power, deck_rarity_type rarity)
if (coinflip())
{
_remove_bad_mutation();
- mutate(RANDOM_MUTATION);
+ mutate(RANDOM_MUTATION, "helix card");
}
else
{
- delete_mutation(RANDOM_MUTATION);
- mutate(RANDOM_GOOD_MUTATION);
+ delete_mutation(RANDOM_MUTATION, "helix card");
+ mutate(RANDOM_GOOD_MUTATION, "helix card");
}
}
else
{
- delete_mutation(RANDOM_MUTATION);
- mutate(RANDOM_MUTATION);
+ delete_mutation(RANDOM_MUTATION, "helix card");
+ mutate(RANDOM_MUTATION, "helix card");
}
break;
}
@@ -2119,7 +2120,7 @@ static void _helix_card(int power, deck_rarity_type rarity)
_remove_bad_mutation();
break;
case 1:
- mutate(RANDOM_GOOD_MUTATION);
+ mutate(RANDOM_GOOD_MUTATION, "helix card");
break;
case 2:
if (coinflip())
@@ -2127,12 +2128,12 @@ static void _helix_card(int power, deck_rarity_type rarity)
// If you get unlucky, you could get here with no bad
// mutations and simply get a mutation effect. Oh well.
_remove_bad_mutation();
- mutate(RANDOM_MUTATION);
+ mutate(RANDOM_MUTATION, "helix card");
}
else
{
- delete_mutation(RANDOM_MUTATION);
- mutate(RANDOM_GOOD_MUTATION);
+ delete_mutation(RANDOM_MUTATION, "helix card");
+ mutate(RANDOM_GOOD_MUTATION, "helix card");
}
break;
}
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index f5f4028..2e36e24 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2285,9 +2285,9 @@ void handle_time()
// We want to warp the player, not do good stuff!
if (one_chance_in(5))
- mutate(RANDOM_MUTATION);
+ mutate(RANDOM_MUTATION, "mutagenic glow");
else
- give_bad_mutation(true, coinflip());
+ give_bad_mutation("mutagenic glow", true, coinflip());
// we're meaner now, what with explosions and whatnot, but
// we dial down the contamination a little faster if its actually
@@ -2386,12 +2386,13 @@ void handle_time()
you.attribute[ATTR_EVOL_XP] = 0;
mpr("You feel a genetic drift.");
bool evol = mutate(coinflip() ? RANDOM_GOOD_MUTATION : RANDOM_MUTATION,
+ "evolution",
false, false, false, false, false, true);
// it would kill itself anyway, but let's speed that up
if (one_chance_in(10)
&& (!wearing_amulet(AMU_RESIST_MUTATION) || one_chance_in(10)))
{
- evol |= delete_mutation(MUT_EVOLUTION, false);
+ evol |= delete_mutation(MUT_EVOLUTION, "end of evolution", false);
}
// interrupt the player only if something actually happened
if (evol)
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index f8b3a53..10013d1 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -1784,14 +1784,14 @@ static void _eat_chunk(corpse_effect_type chunk_effect, bool cannibal,
{
case CE_MUTAGEN_RANDOM:
mpr("This meat tastes really weird.");
- mutate(RANDOM_MUTATION);
+ mutate(RANDOM_MUTATION, "mutagenic meat");
did_god_conduct(DID_DELIBERATE_MUTATING, 10);
xom_is_stimulated(100);
break;
case CE_MUTAGEN_BAD:
mpr("This meat tastes *really* weird.");
- give_bad_mutation();
+ give_bad_mutation("spoiled mutagenic meat");
did_god_conduct(DID_DELIBERATE_MUTATING, 10);
xom_is_stimulated(random2(200));
break;
@@ -2290,7 +2290,7 @@ void vampire_nutrition_per_turn(const item_def &corpse, int feeding)
food_value /= 2;
if (start_feeding)
mpr("This blood tastes really weird!");
- mutate(RANDOM_MUTATION);
+ mutate(RANDOM_MUTATION, "mutagenic blood");
did_god_conduct(DID_DELIBERATE_MUTATING, 10);
xom_is_stimulated(100);
// Sometimes heal by one hp.
@@ -2302,7 +2302,7 @@ void vampire_nutrition_per_turn(const item_def &corpse, int feeding)
food_value /= 2;
if (start_feeding)
mpr("This blood tastes *really* weird!");
- give_bad_mutation();
+ give_bad_mutation("spoiled mutagenic blood");
did_god_conduct(DID_DELIBERATE_MUTATING, 10);
xom_is_stimulated(random2(200));
// No healing from bad mutagenic blood.
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index 2bc76f8..cb1af68 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -1258,7 +1258,7 @@ bool zin_remove_all_mutations()
take_note(Note(NOTE_GOD_GIFT, you.religion));
simple_god_message(" draws all chaos from your body!");
- delete_all_mutations();
+ delete_all_mutations("Zin's power");
return (true);
}
@@ -1563,7 +1563,7 @@ bool jiyva_remove_bad_mutation()
}
// Ensure that only bad mutations are removed.
- if (!delete_mutation(RANDOM_BAD_MUTATION, true, false, true, true))
+ if (!delete_mutation(RANDOM_BAD_MUTATION, "Jiyva's power", true, false, true, true))
{
canned_msg(MSG_NOTHING_HAPPENS);
return (false);
diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc
index dcf7b3f..3162f8f 100644
--- a/crawl-ref/source/godwrath.cc
+++ b/crawl-ref/source/godwrath.cc
@@ -169,8 +169,8 @@ static void _zin_remove_good_mutations()
{
// Ensure that only good mutations are removed.
if (i <= random2(10)
- && delete_mutation(RANDOM_GOOD_MUTATION, failMsg, false, true,
- true))
+ && delete_mutation(RANDOM_GOOD_MUTATION, "Zin's wrath",
+ failMsg, false, true, true))
{
success = true;
}
@@ -955,7 +955,7 @@ static bool _jiyva_retribution()
god_speaks(god, "You feel Jiyva alter your body.");
for (int i = 0; i < mutat; ++i)
- mutate(RANDOM_BAD_MUTATION, true, false, true);
+ mutate(RANDOM_BAD_MUTATION, "Jiyva's wrath", true, false, true);
}
else if (there_are_monsters_nearby() && coinflip())
{
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index fb1882a..2702113 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -4542,7 +4542,7 @@ static bool _vorpalise_weapon(bool already_known)
if (you.can_safely_mutate())
{
// not funny on the undead
- mutate(RANDOM_MUTATION);
+ mutate(RANDOM_MUTATION, "chaos affixation");
break;
}
case 1:
diff --git a/crawl-ref/source/melee_attack.cc b/crawl-ref/source/melee_attack.cc
index 7ba42b6..2f82a44 100644
--- a/crawl-ref/source/melee_attack.cc
+++ b/crawl-ref/source/melee_attack.cc
@@ -4153,7 +4153,11 @@ void melee_attack::mons_apply_attack_flavour()
case AF_MUTATE:
if (one_chance_in(4))
- defender->mutate();
+ {
+ defender->mutate(you.can_see(attacker) ?
+ apostrophise(attacker->name(DESC_PLAIN)) + " mutagenic touch" :
+ "mutagenic touch");
+ }
break;
case AF_POISON:
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 9e2e19e..f5c375c 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -4436,7 +4436,7 @@ bool monster::can_bleed(bool /*allow_tran*/) const
return (mons_has_blood(type));
}
-bool monster::mutate()
+bool monster::mutate(const std::string &reason)
{
if (!can_mutate())
return (false);
diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h
index 61bfa4f..06c2b0a 100644
--- a/crawl-ref/source/monster.h
+++ b/crawl-ref/source/monster.h
@@ -293,7 +293,7 @@ public:
bool can_mutate() const;
bool can_safely_mutate() const;
bool can_bleed(bool allow_tran = true) const;
- bool mutate();
+ bool mutate(const std::string &reason);
void banish(const std::string &who = "");
void expose_to_element(beam_type element, int strength = 0);
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index bb9f112..be29620 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -954,7 +954,8 @@ static mutation_type _get_random_mutation(mutation_type mutclass)
// 0 if we should continue processing;
// -1 if we should stop processing (failure).
static int _handle_conflicting_mutations(mutation_type mutation,
- bool override)
+ bool override,
+ const std::string &reason)
{
const int conflict[][3] = {
{ MUT_REGENERATION, MUT_SLOW_METABOLISM, 0},
@@ -1004,13 +1005,13 @@ static int _handle_conflicting_mutations(mutation_type mutation,
// Ignore if not forced, otherwise override.
// All cases but regen:slowmeta will currently trade off.
if (override)
- while (delete_mutation(b, true, true))
+ while (delete_mutation(b, reason, true, true))
;
break;
case 1:
// If we have one of the pair, delete a level of the
// other, and that's it.
- delete_mutation(b, true, true);
+ delete_mutation(b, reason, true, true);
return (1); // Nothing more to do.
default:
die("bad mutation conflict resulution");
@@ -1172,7 +1173,8 @@ static const char* _stat_mut_desc(mutation_type mut, bool gain)
return (stat_desc(stat, positive ? SD_INCREASE : SD_DECREASE));
}
-bool mutate(mutation_type which_mutation, bool failMsg,
+bool mutate(mutation_type which_mutation, const std::string &reason,
+ bool failMsg,
bool force_mutation, bool god_gift, bool stat_gain_potion,
bool demonspawn, bool no_rot)
{
@@ -1259,10 +1261,10 @@ bool mutate(mutation_type which_mutation, bool failMsg,
mpr("Your body decomposes!", MSGCH_MUTATION);
if (coinflip())
- lose_stat(STAT_RANDOM, 1, false, "mutating");
+ lose_stat(STAT_RANDOM, 1, false, reason);
else
{
- ouch(3, NON_MONSTER, KILLED_BY_ROTTING, "mutation");
+ ouch(3, NON_MONSTER, KILLED_BY_ROTTING, reason.c_str());
rot_hp(roll_dice(1, 3));
}
@@ -1281,7 +1283,7 @@ bool mutate(mutation_type which_mutation, bool failMsg,
if (!one_chance_in(3) && !god_gift && !force_mutation)
return (false);
else
- return (delete_mutation(RANDOM_MUTATION, failMsg,
+ return (delete_mutation(RANDOM_MUTATION, reason, failMsg,
force_mutation, false));
}
}
@@ -1350,7 +1352,7 @@ bool mutate(mutation_type which_mutation, bool failMsg,
}
// God gifts and forced mutations clear away conflicting mutations.
- int rc = _handle_conflicting_mutations(mutat, god_gift || force_mutation);
+ int rc = _handle_conflicting_mutations(mutat, god_gift || force_mutation, reason);
if (rc == 1)
return (true);
if (rc == -1)
@@ -1465,7 +1467,7 @@ bool mutate(mutation_type which_mutation, bool failMsg,
// Amusement value will be 12 * (11-rarity) * Xom's-sense-of-humor.
xom_is_stimulated(_calc_mutation_amusement_value(mutat));
- take_note(Note(NOTE_GET_MUTATION, mutat, you.mutation[mutat]));
+ take_note(Note(NOTE_GET_MUTATION, mutat, you.mutation[mutat], reason.c_str()));
if (crawl_state.game_is_hints()
&& your_talents(false).size() > old_talents)
@@ -1475,7 +1477,8 @@ bool mutate(mutation_type which_mutation, bool failMsg,
return (true);
}
-static bool _delete_single_mutation_level(mutation_type mutat)
+static bool _delete_single_mutation_level(mutation_type mutat,
+ const std::string &reason)
{
if (you.mutation[mutat] == 0)
return (false);
@@ -1535,12 +1538,13 @@ static bool _delete_single_mutation_level(mutation_type mutat)
if (mutat == MUT_LOW_MAGIC || mutat == MUT_HIGH_MAGIC)
calc_mp();
- take_note(Note(NOTE_LOSE_MUTATION, mutat, you.mutation[mutat]));
+ take_note(Note(NOTE_LOSE_MUTATION, mutat, you.mutation[mutat], reason.c_str()));
return (true);
}
-bool delete_mutation(mutation_type which_mutation, bool failMsg,
+bool delete_mutation(mutation_type which_mutation, const std::string &reason,
+ bool failMsg,
bool force_mutation, bool god_gift,
bool disallow_mismatch)
{
@@ -1627,14 +1631,14 @@ bool delete_mutation(mutation_type which_mutation, bool failMsg,
return false;
}
- return (_delete_single_mutation_level(mutat));
+ return (_delete_single_mutation_level(mutat, reason));
}
-bool delete_all_mutations()
+bool delete_all_mutations(const std::string &reason)
{
for (int i = 0; i < NUM_MUTATIONS; ++i)
{
- while (_delete_single_mutation_level(static_cast<mutation_type>(i)))
+ while (_delete_single_mutation_level(static_cast<mutation_type>(i), reason))
;
}
@@ -2076,7 +2080,8 @@ void adjust_racial_mutation(mutation_type mut, int diff)
}
}
-bool perma_mutate(mutation_type which_mut, int how_much)
+bool perma_mutate(mutation_type which_mut, int how_much,
+ const std::string &reason)
{
ASSERT(is_valid_mutation(which_mut));
@@ -2087,14 +2092,14 @@ bool perma_mutate(mutation_type which_mut, int how_much)
// clear out conflicting mutations
int count = 0;
while (rc == 1 && ++count < 100)
- rc = _handle_conflicting_mutations(which_mut, true);
+ rc = _handle_conflicting_mutations(which_mut, true, reason);
ASSERT(rc == 0);
int levels = 0;
while (how_much-- > 0)
{
if (you.mutation[which_mut] < cap)
- if (!mutate(which_mut, false, true, false, false, true))
+ if (!mutate(which_mut, reason, false, true, false, false, true))
return levels; // a partial success was still possible
levels++;
}
diff --git a/crawl-ref/source/mutation.h b/crawl-ref/source/mutation.h
index 28f12c9..cafd7bd 100644
--- a/crawl-ref/source/mutation.h
+++ b/crawl-ref/source/mutation.h
@@ -69,14 +69,17 @@ const mutation_def& get_mutation_def(mutation_type mut);
void fixup_mutations();
-bool mutate(mutation_type which_mutation, bool failMsg = true,
+bool mutate(mutation_type which_mutation, const std::string &reason,
+ bool failMsg = true,
bool force_mutation = false, bool god_gift = false,
bool stat_gain_potion = false, bool demonspawn = false,
bool no_rot = false);
-inline bool give_bad_mutation(bool failMsg = true, bool force_mutation = false)
+inline bool give_bad_mutation(const std::string &reason,
+ bool failMsg = true,
+ bool force_mutation = false)
{
- return (mutate(RANDOM_BAD_MUTATION, failMsg, force_mutation,
+ return (mutate(RANDOM_BAD_MUTATION, reason, failMsg, force_mutation,
false, false, false));
}
@@ -84,11 +87,12 @@ void display_mutations();
mutation_activity_type mutation_activity_level(mutation_type mut);
std::string describe_mutations();
-bool delete_mutation(mutation_type which_mutation, bool failMsg = true,
+bool delete_mutation(mutation_type which_mutation, const std::string &reason,
+ bool failMsg = true,
bool force_mutation = false, bool god_gift = false,
bool disallow_mismatch = false);
-bool delete_all_mutations();
+bool delete_all_mutations(const std::string &reason);
std::string mutation_name(mutation_type which_mutat, int level = -1,
bool colour = false);
@@ -96,7 +100,7 @@ std::string mutation_name(mutation_type which_mutat, int level = -1,
void roll_demonspawn_mutations();
void adjust_racial_mutation(mutation_type mut, int diff);
-bool perma_mutate(mutation_type which_mut, int how_much);
+bool perma_mutate(mutation_type which_mut, int how_much, const std::string &reason);
int how_mutated(bool all = false, bool levels = false);
void check_demonic_guardian();
diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc
index b85ab00..67da69d 100644
--- a/crawl-ref/source/notes.cc
+++ b/crawl-ref/source/notes.cc
@@ -368,11 +368,15 @@ std::string Note::describe(bool when, bool where, bool what) const
result << "Gained mutation: "
<< mutation_name(static_cast<mutation_type>(first),
second == 0 ? 1 : second);
+ if (!name.empty())
+ result << " [" << name << "]";
break;
case NOTE_LOSE_MUTATION:
result << "Lost mutation: "
<< mutation_name(static_cast<mutation_type>(first),
second == 3 ? 3 : second+1);
+ if (!name.empty())
+ result << " [" << name << "]";
break;
case NOTE_DEATH:
result << name;
diff --git a/crawl-ref/source/notes.h b/crawl-ref/source/notes.h
index 9d12b4a..bde73f0 100644
--- a/crawl-ref/source/notes.h
+++ b/crawl-ref/source/notes.h
@@ -27,8 +27,8 @@ enum NOTE_TYPES
NOTE_GET_GOD, /* needs: god id */
NOTE_GOD_GIFT, /* needs: god id */
NOTE_GOD_POWER, /* needs: god id, idx */
- NOTE_GET_MUTATION, /* needs: mutation idx */
- NOTE_LOSE_MUTATION, /* needs: mutation idx */
+ NOTE_GET_MUTATION, /* needs: mutation idx, reason (string) */
+ NOTE_LOSE_MUTATION, /* needs: mutation idx, reason (string) */
NOTE_ID_ITEM, /* needs: item name (string) */
NOTE_GET_ITEM, /* needs: item name (string) */
NOTE_GAIN_SKILL, /* needs: skill id, level */
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 20e7409..1d1585d 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -319,7 +319,9 @@ int check_your_resists(int hurted, beam_type flavour, std::string source,
// delete_mutation() handles MUT_MUTATION_RESISTANCE but not the amulet
&& (!wearing_amulet(AMU_RESIST_MUTATION) || one_chance_in(10)))
{
- delete_mutation(RANDOM_GOOD_MUTATION);
+ // silver stars only, if this ever changes we may want to give
+ // aux as well
+ delete_mutation(RANDOM_GOOD_MUTATION, source);
}
}
break;
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 5832847..6cc1e38 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2923,19 +2923,19 @@ static void _draconian_scale_colour_message()
case SP_RED_DRACONIAN:
mpr("Your scales start taking on a fiery red colour.",
MSGCH_INTRINSIC_GAIN);
- perma_mutate(MUT_HEAT_RESISTANCE, 1);
+ perma_mutate(MUT_HEAT_RESISTANCE, 1, "draconian maturity");
break;
case SP_WHITE_DRACONIAN:
mpr("Your scales start taking on an icy white colour.",
MSGCH_INTRINSIC_GAIN);
- perma_mutate(MUT_COLD_RESISTANCE, 1);
+ perma_mutate(MUT_COLD_RESISTANCE, 1, "draconian maturity");
break;
case SP_GREEN_DRACONIAN:
mpr("Your scales start taking on a lurid green colour.",
MSGCH_INTRINSIC_GAIN);
- perma_mutate(MUT_POISON_RESISTANCE, 1);
+ perma_mutate(MUT_POISON_RESISTANCE, 1, "draconian maturity");
break;
case SP_YELLOW_DRACONIAN:
@@ -2946,13 +2946,13 @@ static void _draconian_scale_colour_message()
case SP_GREY_DRACONIAN:
mpr("Your scales start taking on a dull grey colour.",
MSGCH_INTRINSIC_GAIN);
- perma_mutate(MUT_UNBREATHING, 1);
+ perma_mutate(MUT_UNBREATHING, 1, "draconian maturity");
break;
case SP_BLACK_DRACONIAN:
mpr("Your scales start taking on a glossy black colour.",
MSGCH_INTRINSIC_GAIN);
- perma_mutate(MUT_SHOCK_RESISTANCE, 1);
+ perma_mutate(MUT_SHOCK_RESISTANCE, 1, "draconian maturity");
break;
case SP_PURPLE_DRACONIAN:
@@ -3102,13 +3102,13 @@ void level_change(bool skip_attribute_increase)
{
mpr("You feel somewhat more resistant.",
MSGCH_INTRINSIC_GAIN);
- perma_mutate(MUT_NEGATIVE_ENERGY_RESISTANCE, 1);
+ perma_mutate(MUT_NEGATIVE_ENERGY_RESISTANCE, 1, "level up");
}
if ((you.experience_level == 9)
|| (you.experience_level == 18))
{
- perma_mutate(MUT_PASSIVE_MAPPING, 1);
+ perma_mutate(MUT_PASSIVE_MAPPING, 1, "level up");
}
if (!(you.experience_level % 4))
@@ -3235,13 +3235,13 @@ void level_change(bool skip_attribute_increase)
switch (you.species)
{
case SP_GREEN_DRACONIAN:
- perma_mutate(MUT_STINGER, 1);
+ perma_mutate(MUT_STINGER, 1, "draconian growth");
break;
case SP_YELLOW_DRACONIAN:
- perma_mutate(MUT_ACIDIC_BITE, 1);
+ perma_mutate(MUT_ACIDIC_BITE, 1, "draconian growth");
break;
case SP_BLACK_DRACONIAN:
- perma_mutate(MUT_BIG_WINGS, 1);
+ perma_mutate(MUT_BIG_WINGS, 1, "draconian growth");
break;
default:
break;
@@ -3329,7 +3329,8 @@ void level_change(bool skip_attribute_increase)
gave_message = true;
}
- perma_mutate(you.demonic_traits[i].mutation, 1);
+ perma_mutate(you.demonic_traits[i].mutation, 1,
+ "demonic ancestry");
}
}
@@ -3370,7 +3371,7 @@ void level_change(bool skip_attribute_increase)
}
if (you.experience_level == 6 || you.experience_level == 12)
- perma_mutate(MUT_SHAGGY_FUR, 1);
+ perma_mutate(MUT_SHAGGY_FUR, 1, "growing up");
_felid_extra_life();
break;
@@ -7112,7 +7113,7 @@ bool player::can_bleed(bool allow_tran) const
return (true);
}
-bool player::mutate()
+bool player::mutate(const std::string &reason)
{
ASSERT(!crawl_state.game_is_arena());
@@ -7121,14 +7122,14 @@ bool player::mutate()
if (one_chance_in(5))
{
- if (::mutate(RANDOM_MUTATION))
+ if (::mutate(RANDOM_MUTATION, reason))
{
learned_something_new(HINT_YOU_MUTATED);
return (true);
}
}
- return (give_bad_mutation());
+ return (give_bad_mutation(reason));
}
bool player::is_icy() const
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index b2f538b..66f190a 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -558,7 +558,7 @@ public:
bool can_mutate() const;
bool can_safely_mutate() const;
bool can_bleed(bool allow_tran = true) const;
- bool mutate();
+ bool mutate(const std::string &reason);
void backlight();
void banish(const std::string &who = "");
void blink(bool allow_partial_control = true);
diff --git a/crawl-ref/source/potion.cc b/crawl-ref/source/potion.cc
index 57d9e6d..4db8ada 100644
--- a/crawl-ref/source/potion.cc
+++ b/crawl-ref/source/potion.cc
@@ -214,17 +214,17 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known,
}
case POT_GAIN_STRENGTH:
- if (mutate(MUT_STRONG, true, false, false, true))
+ if (mutate(MUT_STRONG, "potion of gain strength", true, false, false, true))
learned_something_new(HINT_YOU_MUTATED);
break;
case POT_GAIN_DEXTERITY:
- if (mutate(MUT_AGILE, true, false, false, true))
+ if (mutate(MUT_AGILE, "potion of gain dexterity", true, false, false, true))
learned_something_new(HINT_YOU_MUTATED);
break;
case POT_GAIN_INTELLIGENCE:
- if (mutate(MUT_CLEVER, true, false, false, true))
+ if (mutate(MUT_CLEVER, "potion of gain intelligence", true, false, false, true))
learned_something_new(HINT_YOU_MUTATED);
break;
@@ -419,13 +419,13 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known,
mpr("It has a very clean taste.");
for (int i = 0; i < 7; i++)
if (random2(9) >= i)
- delete_mutation(RANDOM_MUTATION, false);
+ delete_mutation(RANDOM_MUTATION, "potion of cure mutation", false);
break;
case POT_MUTATION:
mpr("You feel extremely strange.");
for (int i = 0; i < 3; i++)
- mutate(RANDOM_MUTATION, false);
+ mutate(RANDOM_MUTATION, "potion of mutation", false);
learned_something_new(HINT_YOU_MUTATED);
did_god_conduct(DID_DELIBERATE_MUTATING, 10, was_known);
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 83ac439..53bf049 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -2053,15 +2053,15 @@ static bool _jiyva_mutate()
const int rand = random2(100);
if (rand < 10)
- return (delete_mutation(RANDOM_SLIME_MUTATION, true, false, true));
+ return (delete_mutation(RANDOM_SLIME_MUTATION, "Jiyva's grace", true, false, true));
else if (rand < 30)
- return (delete_mutation(RANDOM_NON_SLIME_MUTATION, true, false, true));
+ return (delete_mutation(RANDOM_NON_SLIME_MUTATION, "Jiyva's grace", true, false, true));
else if (rand < 55)
- return (mutate(RANDOM_MUTATION, true, false, true));
+ return (mutate(RANDOM_MUTATION, "Jiyva's grace", true, false, true));
else if (rand < 75)
- return (mutate(RANDOM_SLIME_MUTATION, true, false, true));
+ return (mutate(RANDOM_SLIME_MUTATION, "Jiyva's grace", true, false, true));
else
- return (mutate(RANDOM_GOOD_MUTATION, true, false, true));
+ return (mutate(RANDOM_GOOD_MUTATION, "Jiyva's grace", true, false, true));
}
bool do_god_gift(bool forced)
diff --git a/crawl-ref/source/spl-miscast.cc b/crawl-ref/source/spl-miscast.cc
index aeb5580..73c1556 100644
--- a/crawl-ref/source/spl-miscast.cc
+++ b/crawl-ref/source/spl-miscast.cc
@@ -1990,7 +1990,7 @@ void MiscastEffect::_transmutation(int severity)
case 3: // even nastier
if (target->atype() == ACT_MONSTER)
- target->mutate(); // Polymorph the monster, if possible.
+ target->mutate(cause); // Polymorph the monster, if possible.
switch (random2(3))
{
@@ -2019,7 +2019,7 @@ void MiscastEffect::_transmutation(int severity)
if (target->atype() == ACT_PLAYER)
{
you_msg = "You feel very strange.";
- delete_mutation(RANDOM_MUTATION, true, false, false, false);
+ delete_mutation(RANDOM_MUTATION, cause, true, false, false, false);
}
_ouch(5 + random2avg(23, 2));
break;
@@ -2040,9 +2040,9 @@ void MiscastEffect::_transmutation(int severity)
// We don't need messages when the mutation fails,
// because we give our own (which is justified anyway as
// you take damage).
- give_bad_mutation(false, false);
+ give_bad_mutation(cause, false, false);
if (coinflip())
- give_bad_mutation(false, false);
+ give_bad_mutation(cause, false, false);
}
_ouch(5 + random2avg(23, 2));
break;
diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc
index 8cf780b..832909d 100644
--- a/crawl-ref/source/wiz-you.cc
+++ b/crawl-ref/source/wiz-you.cc
@@ -111,36 +111,36 @@ void wizard_change_species(void)
{
case SP_RED_DRACONIAN:
if (you.experience_level >= 7)
- perma_mutate(MUT_HEAT_RESISTANCE, 1);
+ perma_mutate(MUT_HEAT_RESISTANCE, 1, "wizard race change");
break;
case SP_WHITE_DRACONIAN:
if (you.experience_level >= 7)
- perma_mutate(MUT_COLD_RESISTANCE, 1);
+ perma_mutate(MUT_COLD_RESISTANCE, 1, "wizard race change");
break;
case SP_GREEN_DRACONIAN:
if (you.experience_level >= 7)
- perma_mutate(MUT_POISON_RESISTANCE, 1);
+ perma_mutate(MUT_POISON_RESISTANCE, 1, "wizard race change");
if (you.experience_level >= 14)
- perma_mutate(MUT_STINGER, 1);
+ perma_mutate(MUT_STINGER, 1, "wizard race change");
break;
case SP_YELLOW_DRACONIAN:
if (you.experience_level >= 14)
- perma_mutate(MUT_ACIDIC_BITE, 1);
+ perma_mutate(MUT_ACIDIC_BITE, 1, "wizard race change");
break;
case SP_GREY_DRACONIAN:
if (you.experience_level >= 7)
- perma_mutate(MUT_UNBREATHING, 1);
+ perma_mutate(MUT_UNBREATHING, 1, "wizard race change");
break;
case SP_BLACK_DRACONIAN:
if (you.experience_level >= 7)
- perma_mutate(MUT_SHOCK_RESISTANCE, 1);
+ perma_mutate(MUT_SHOCK_RESISTANCE, 1, "wizard race change");
if (you.experience_level >= 14)
- perma_mutate(MUT_BIG_WINGS, 1);
+ perma_mutate(MUT_BIG_WINGS, 1, "wizard race change");
break;
case SP_DEMONSPAWN:
@@ -161,18 +161,18 @@ void wizard_change_species(void)
case SP_DEEP_DWARF:
if (you.experience_level >= 9)
- perma_mutate(MUT_PASSIVE_MAPPING, 1);
+ perma_mutate(MUT_PASSIVE_MAPPING, 1, "wizard race change");
if (you.experience_level >= 14)
- perma_mutate(MUT_NEGATIVE_ENERGY_RESISTANCE, 1);
+ perma_mutate(MUT_NEGATIVE_ENERGY_RESISTANCE, 1, "wizard race change");
if (you.experience_level >= 18)
- perma_mutate(MUT_PASSIVE_MAPPING, 1);
+ perma_mutate(MUT_PASSIVE_MAPPING, 1, "wizard race change");
break;
case SP_FELID:
if (you.experience_level >= 6)
- perma_mutate(MUT_SHAGGY_FUR, 1);
+ perma_mutate(MUT_SHAGGY_FUR, 1, "wizard race change");
if (you.experience_level >= 12)
- perma_mutate(MUT_SHAGGY_FUR, 1);
+ perma_mutate(MUT_SHAGGY_FUR, 1, "wizard race change");
break;
default:
@@ -548,7 +548,7 @@ bool wizard_add_mutation()
{
int old_resist = player_mutation_level(MUT_MUTATION_RESISTANCE);
- success = mutate(mutat, true, force, god_gift);
+ success = mutate(mutat, "wizard power", true, force, god_gift);
if (old_resist < player_mutation_level(MUT_MUTATION_RESISTANCE)
&& !force)
@@ -624,13 +624,13 @@ bool wizard_add_mutation()
else if (levels > 0)
{
for (int i = 0; i < levels; ++i)
- if (mutate(mutat, true, force, god_gift))
+ if (mutate(mutat, "wizard power", true, force, god_gift))
success = true;
}
else
{
for (int i = 0; i < -levels; ++i)
- if (delete_mutation(mutat, true, force, god_gift))
+ if (delete_mutation(mutat, "wizard power", true, force, god_gift))
success = true;
}
}
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index fab33af..555725f 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -1994,6 +1994,7 @@ static int _xom_give_mutations(bool good, bool debug = false)
for (int i = num_tries; i > 0; --i)
{
if (mutate(good ? RANDOM_GOOD_MUTATION : RANDOM_XOM_MUTATION,
+ good ? "Xom's grace" : "Xom's mischief",
failMsg, false, true, false, false))
{
rc = true;
@@ -3798,26 +3799,29 @@ static void _handle_accidental_death(const int orig_hp,
// MUT_ROUGH_BLACK_SCALES can statkill you by dex, undo it if necessary
while (you.dex() <= 0 && you.mutation[MUT_ROUGH_BLACK_SCALES] > orig_mutation[MUT_ROUGH_BLACK_SCALES])
- delete_mutation(MUT_ROUGH_BLACK_SCALES, true, true, true);
+ {
+ delete_mutation(MUT_ROUGH_BLACK_SCALES, "Xom's lifesaving",
+ true, true, true);
+ }
while (you.dex() <= 0
&& you.mutation[MUT_FLEXIBLE_WEAK] <
orig_mutation[MUT_FLEXIBLE_WEAK])
{
- mutate(MUT_FLEXIBLE_WEAK, true, true, true);
+ mutate(MUT_FLEXIBLE_WEAK, "Xom's lifesaving", true, true, true);
}
while (you.strength() <= 0
&& you.mutation[MUT_FLEXIBLE_WEAK] >
orig_mutation[MUT_FLEXIBLE_WEAK])
{
- delete_mutation(MUT_FLEXIBLE_WEAK, true, true, true);
+ delete_mutation(MUT_FLEXIBLE_WEAK, "Xom's lifesaving", true, true, true);
}
while (you.strength() <= 0
&& you.mutation[MUT_STRONG_STIFF] <
orig_mutation[MUT_STRONG_STIFF])
{
- mutate(MUT_STRONG_STIFF, true, true, true);
+ mutate(MUT_STRONG_STIFF, "Xom's lifesaving", true, true, true);
}
mutation_type bad_muts[3] = {MUT_WEAK, MUT_DOPEY, MUT_CLUMSY};
@@ -3832,7 +3836,7 @@ static void _handle_accidental_death(const int orig_hp,
if (you.mutation[bad] > orig_mutation[bad]
|| you.mutation[good] < orig_mutation[good])
{
- mutate(good, true, true, true);
+ mutate(good, "Xom's lifesaving", true, true, true);
}
else
{
--
Dungeon Crawl Stone Soup
|