summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-08 05:13:41 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-08 05:14:12 -0800
commit5562dfc2a3dd500be1a98a02703eb37496b5fb8e (patch)
tree9d77c45ff9b2c0040d8c669bfff05a86966b29d7 /crawl-ref
parent5d78f4fbac5120ebee12c73624ded022abc3c933 (diff)
downloadcrawl-ref-5562dfc2a3dd500be1a98a02703eb37496b5fb8e.tar.gz
crawl-ref-5562dfc2a3dd500be1a98a02703eb37496b5fb8e.zip
Relax the one mutation per level rule for DS
Breaks saves.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/mutation.cc7
-rw-r--r--crawl-ref/source/player.cc22
-rw-r--r--crawl-ref/source/player.h14
-rw-r--r--crawl-ref/source/tags.cc15
-rw-r--r--crawl-ref/source/wiz-you.cc6
5 files changed, 48 insertions, 16 deletions
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index c105cb585a..b6d1409ccc 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -2823,7 +2823,8 @@ try_again:
}
}
- you.demon_trait.init(NUM_MUTATIONS);
+ you.demonic_traits.clear();
+ player::demon_trait dt;
// Now give mutations from the facets in some order, consistent
// with the internal order of the facets.
@@ -2871,7 +2872,9 @@ try_again:
mprf(MSGCH_DIAGNOSTICS, "Demonspawn will gain %s at level %d",
get_mutation_def(newmut).wizname, level);
#endif
- you.demon_trait[level - 2] = newmut;
+ dt.level_gained = level;
+ dt.mutation = newmut;
+ you.demonic_traits.push_back(dt);
++given[which_facet];
++ngiven;
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 59a20295ac..07ba1e784a 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -3180,10 +3180,24 @@ void level_change(bool skip_attribute_increase)
break;
case SP_DEMONSPAWN:
- if (you.demon_trait[you.experience_level - 2] != NUM_MUTATIONS)
{
- mpr("Your demonic ancestry asserts itself...", MSGCH_INTRINSIC_GAIN);
- perma_mutate(you.demon_trait[you.experience_level - 2], 1);
+ bool gave_message = false;
+
+ for (unsigned i = 0; i < you.demonic_traits.size(); ++i)
+ {
+ if (you.demonic_traits[i].level_gained
+ == you.experience_level)
+ {
+ if (!gave_message)
+ {
+ mpr("Your demonic ancestry asserts itself...",
+ MSGCH_INTRINSIC_GAIN);
+
+ gave_message = true;
+ }
+ perma_mutate(you.demonic_traits[i].mutation, 1);
+ }
+ }
}
if (!(you.experience_level % 4))
@@ -5572,7 +5586,7 @@ void player::init()
mutation.init(0);
demon_pow.init(0);
- demon_trait.init(NUM_MUTATIONS);
+ demonic_traits.clear();
had_book.init(false);
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index ff225c1105..e7cca6269b 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -12,6 +12,8 @@
#include "itemprop.h"
#include "species.h"
+#include <vector>
+
#ifdef USE_TILE
// This used to be in tiles.h. (jpeg)
#include "tiledef-main.h"
@@ -221,9 +223,15 @@ public:
FixedVector<unsigned char, NUM_MUTATIONS> mutation;
FixedVector<unsigned char, NUM_MUTATIONS> demon_pow;
- // demon_trait[i] is the mutation increased at the i'th
- // levellup, or NUM_MUTATIONS
- FixedVector<mutation_type, 26> demon_trait;
+
+ struct demon_trait
+ {
+ int level_gained;
+ mutation_type mutation;
+ };
+
+ std::vector<demon_trait> demonic_traits;
+
unsigned char magic_contamination;
FixedVector<bool, NUM_FIXED_BOOKS> had_book;
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 0d140664e5..7ba129ed01 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -949,10 +949,11 @@ static void tag_construct_you(writer &th)
marshallByte(th, you.demon_pow[j]);
}
- marshallByte(th, 26);
- for (j = 0; j < 26; j++)
+ marshallByte(th, you.demonic_traits.size());
+ for (j = 0; j < int(you.demonic_traits.size()); ++j)
{
- marshallShort(th, you.demon_trait[j]);
+ marshallByte(th, you.demonic_traits[j].level_gained);
+ marshallShort(th, you.demonic_traits[j].mutation);
}
// how many penances?
@@ -1403,8 +1404,14 @@ static void tag_read_you(reader &th, char minorVersion)
if (minorVersion >= TAG_MINOR_DSTRAITS)
{
count_c = unmarshallByte(th);
+ you.demonic_traits.clear();
for (j = 0; j < count_c; ++j)
- you.demon_trait[j] = static_cast<mutation_type>(unmarshallShort(th));
+ {
+ player::demon_trait dt;
+ dt.level_gained = unmarshallByte(th);
+ dt.mutation = static_cast<mutation_type>(unmarshallShort(th));
+ you.demonic_traits.push_back(dt);
+ }
}
// how many penances?
diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc
index ad1fb6eb15..d81e08cc39 100644
--- a/crawl-ref/source/wiz-you.cc
+++ b/crawl-ref/source/wiz-you.cc
@@ -127,11 +127,11 @@ void wizard_change_species( void )
case SP_DEMONSPAWN:
{
roll_demonspawn_mutations();
- for (i = 2; i <= you.experience_level; ++i)
+ for (i = 0; i < int(you.demonic_traits.size()); ++i)
{
- mutation_type m = you.demon_trait[i-2];
+ mutation_type m = you.demonic_traits[i].mutation;
- if (m == NUM_MUTATIONS)
+ if (you.demonic_traits[i].level_gained > you.experience_level)
continue;
++you.mutation[m];