summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-12 06:11:11 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-12 06:11:11 +0000
commit7048b8fc932d93367720044a9e4d9f837cdd7b62 (patch)
tree34a7ca4f3558a9253dd97b39f27e62724105e198
parent70ddc82fc900a147e25e0c273a657f3abe891e83 (diff)
downloadcrawl-ref-7048b8fc932d93367720044a9e4d9f837cdd7b62.tar.gz
crawl-ref-7048b8fc932d93367720044a9e4d9f837cdd7b62.zip
Recalculate permanent mutations when changing species, but leave non-permanent
mutations in place. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5753 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/debug.cc100
-rw-r--r--crawl-ref/source/newgame.cc5
-rw-r--r--crawl-ref/source/newgame.h5
3 files changed, 100 insertions, 10 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 29bba0cff6..6a19fc1014 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -273,20 +273,106 @@ void debug_change_species( void )
}
if (sp == SP_UNKNOWN)
+ {
mpr( "That species isn't available." );
- else
+ return;
+ }
+
+ // Re-scale skill-points.
+ for (i = 0; i < NUM_SKILLS; i++)
+ {
+ you.skill_points[i] *= species_skills( i, sp );
+ you.skill_points[i] /= species_skills( i, you.species );
+ }
+
+ you.species = sp;
+ you.is_undead = get_undead_state(sp);
+
+ // Change permanent mutations, but preserve non-permanent ones.
+ unsigned char prev_muts[NUM_MUTATIONS];
+ you.attribute[ATTR_NUM_DEMONIC_POWERS] = 0;
+ for (i = 0; i < NUM_MUTATIONS; ++i)
+ {
+ if (you.demon_pow[i] > 0)
+ {
+ if (you.demon_pow[i] > you.mutation[i])
+ you.mutation[i] = 0;
+ else
+ you.mutation[i] -= you.demon_pow[i];
+
+ you.demon_pow[i] = 0;
+ }
+ prev_muts[i] = you.mutation[i];
+ }
+ give_basic_mutations(sp);
+ for (i = 0; i < NUM_MUTATIONS; ++i)
+ {
+ if (prev_muts[i] > you.demon_pow[i])
+ you.demon_pow[i] = 0;
+ else
+ you.demon_pow[i] -= prev_muts[i];
+ }
+
+ switch(sp)
{
- for (i = 0; i < NUM_SKILLS; i++)
+ case SP_GREEN_DRACONIAN:
+ if (you.experience_level >= 7)
+ perma_mutate(MUT_POISON_RESISTANCE, 1);
+ break;
+
+ case SP_RED_DRACONIAN:
+ if (you.experience_level >= 14)
+ perma_mutate(MUT_HEAT_RESISTANCE, 1);
+ break;
+
+ case SP_WHITE_DRACONIAN:
+ if (you.experience_level >= 14)
+ perma_mutate(MUT_COLD_RESISTANCE, 1);
+ break;
+
+
+ case SP_BLACK_DRACONIAN:
+ if (you.experience_level >= 18)
+ perma_mutate(MUT_SHOCK_RESISTANCE, 1);
+ break;
+
+ case SP_DEMONSPAWN:
+ {
+ int powers;
+
+ if (you.experience_level < 4)
+ powers = 0;
+ else if (you.experience_level < 9)
+ powers = 1;
+ else if (you.experience_level < 14)
+ powers = 2;
+ else if (you.experience_level < 19)
+ powers = 3;
+ else if (you.experience_level < 24)
+ powers = 4;
+ else if (you.experience_level == 27)
+ powers = 5;
+
+ int levels[] = {4, 9, 14, 19, 27};
+ int real_level = you.experience_level;
+
+ for (i = 0; i < powers; i++)
{
- you.skill_points[i] *= species_skills( i, sp );
- you.skill_points[i] /= species_skills( i, you.species );
+ // The types of demonspawn mutations you get depends on your
+ // experience level at the time of gaining it.
+ you.experience_level = levels[i];
+ demonspawn();
}
+ you.experience_level = real_level;
- you.species = sp;
- you.is_undead = get_undead_state(sp);
+ break;
+ }
- redraw_screen();
+ default:
+ break;
}
+
+ redraw_screen();
}
#endif
//---------------------------------------------------------------
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index 42a3623a76..1aee867768 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -112,7 +112,6 @@ static bool _choose_weapon(void);
static void _enter_player_name(bool blankOK);
static void _give_basic_knowledge(job_type which_job);
static void _give_basic_spells(job_type which_job);
-static void _give_basic_mutations(species_type speci);
static void _give_last_paycheck(job_type which_job);
static void _init_player(void);
static void _jobs_stat_init(job_type which_job);
@@ -1303,7 +1302,7 @@ game_start:
// tmpfile purging removed in favour of marking
tmp_file_pairs.init(false);
- _give_basic_mutations(you.species);
+ give_basic_mutations(you.species);
_initialise_branch_depths();
_save_newgame_options();
@@ -2272,7 +2271,7 @@ static void _jobs_stat_init(job_type which_job)
set_mp( mp, true );
}
-static void _give_basic_mutations(species_type speci)
+void give_basic_mutations(species_type speci)
{
// We should switch over to a size-based system
// for the fast/slow metabolism when we get around to it.
diff --git a/crawl-ref/source/newgame.h b/crawl-ref/source/newgame.h
index eca56fac60..3a25c11a51 100644
--- a/crawl-ref/source/newgame.h
+++ b/crawl-ref/source/newgame.h
@@ -46,4 +46,9 @@ int give_first_conjuration_book();
bool choose_race(void);
bool choose_class(void);
+/* ***********************************************************************
+ * called from: debug newgame
+ * *********************************************************************** */
+void give_basic_mutations(species_type speci);
+
#endif