Attached Files |
wretched_star.patch [^] (5,141 bytes) 2013-09-23 21:00 [Show Content] [Hide Content]From c4e8772f4554ccf13cc63b5f827ca975edb86cd8 Mon Sep 17 00:00:00 2001
From: pubby <pubby8@gmail.com>
Date: Mon, 23 Sep 2013 13:34:52 -0500
Subject: [PATCH] Make wretched stars increase muts more often.
Getting temp mutated by a wretched star now strongly favors increasing
an existing mutation rather than adding a new one.
This leads to fewer but more significant mutations.
---
crawl-ref/source/enum.h | 2 ++
crawl-ref/source/mon-abil.cc | 9 ++++---
crawl-ref/source/mutation.cc | 60 +++++++++++++++++++++++++++++++++++++++++---
3 files changed, 63 insertions(+), 8 deletions(-)
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index b1e4522..38fed3c 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2953,6 +2953,8 @@ enum mutation_type
RANDOM_BAD_MUTATION,
RANDOM_SLIME_MUTATION,
RANDOM_NON_SLIME_MUTATION,
+ RANDOM_INCREASE_GOOD_MUTATION, // increases level of existing mutations
+ RANDOM_INCREASE_BAD_MUTATION,
};
enum object_class_type // mitm[].base_type
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index f8c348a..998f21a 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -4001,7 +4001,7 @@ bool mon_special_ability(monster* mons, bolt & beem)
if (is_sanctuary(mons->pos()))
break;
- if (one_chance_in(5))
+ if (one_chance_in(4))
{
if (cell_see_cell(you.pos(), mons->pos(), LOS_DEFAULT))
{
@@ -4012,9 +4012,10 @@ bool mon_special_ability(monster* mons, bolt & beem)
if (!is_sanctuary(you.pos())
&& cell_see_cell(you.pos(), mons->pos(), LOS_SOLID))
{
- int num_mutations = 2 + random2(3);
- for (int i = 0; i < num_mutations; ++i)
- temp_mutate(RANDOM_BAD_MUTATION, "wretched star");
+ temp_mutate(one_chance_in(6)
+ ? RANDOM_BAD_MUTATION
+ : RANDOM_INCREASE_BAD_MUTATION,
+ "wretched star");
}
}
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index cfd75bd..482ed5a 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -1132,14 +1132,63 @@ static mutation_type _get_random_xom_mutation()
static mutation_type _get_random_mutation(mutation_type mutclass)
{
mut_total mt;
+ bool increase = false;
switch (mutclass)
{
- case RANDOM_MUTATION: mt = MT_ALL; break;
- case RANDOM_BAD_MUTATION: mt = MT_BAD; break;
- case RANDOM_GOOD_MUTATION: mt = MT_GOOD; break;
+ case RANDOM_MUTATION:
+ mt = MT_ALL;
+ break;
+
+ case RANDOM_INCREASE_BAD_MUTATION:
+ increase = true;
+ // intentional fall-through
+ case RANDOM_BAD_MUTATION:
+ mt = MT_BAD;
+ break;
+
+ case RANDOM_INCREASE_GOOD_MUTATION:
+ increase = true;
+ // intentional fall-through
+ case RANDOM_GOOD_MUTATION:
+ mt = MT_GOOD;
+ break;
+
default: die("invalid mutation class: %d", mutclass);
}
+ if (increase == true)
+ {
+ int cweight = 0;
+ for (unsigned i = 0; i < ARRAYSZ(mut_data); ++i)
+ {
+ if (!mut_data[i].bad == mt)
+ continue;
+
+ int level = you.temp_mutations[mut_data[i].mutation];
+ if (level > 0 && level < mut_data[i].levels)
+ cweight += mut_data[i].rarity;
+ }
+
+ if (cweight > 0)
+ {
+ cweight = random2(cweight);
+
+ for (unsigned i = 0; i < ARRAYSZ(mut_data); ++i)
+ {
+ int level = you.temp_mutations[mut_data[i].mutation];
+ if (level <= 0 || level >= mut_data[i].levels)
+ continue;
+ if (!mut_data[i].bad == mt)
+ continue;
+ if ((cweight -= mut_data[i].rarity) >= 0)
+ continue;
+
+ if (_accept_mutation(mut_data[i].mutation, true))
+ return mut_data[i].mutation;
+ }
+ }
+ }
+
int tries = 0;
retry:
@@ -1458,7 +1507,8 @@ bool mutate(mutation_type which_mutation, const string &reason, bool failMsg,
bool force_mutation, bool god_gift, bool beneficial,
bool demonspawn, bool no_rot, bool temporary)
{
- if (which_mutation == RANDOM_BAD_MUTATION
+ if ((which_mutation == RANDOM_BAD_MUTATION
+ || which_mutation == RANDOM_INCREASE_BAD_MUTATION)
&& crawl_state.disables[DIS_AFFLICTIONS])
{
return true; // no fallbacks
@@ -1559,6 +1609,8 @@ bool mutate(mutation_type which_mutation, const string &reason, bool failMsg,
case RANDOM_MUTATION:
case RANDOM_GOOD_MUTATION:
case RANDOM_BAD_MUTATION:
+ case RANDOM_INCREASE_GOOD_MUTATION:
+ case RANDOM_INCREASE_BAD_MUTATION:
mutat = _get_random_mutation(which_mutation);
break;
case RANDOM_XOM_MUTATION:
--
1.8.2.3
|