summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-18 18:58:52 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-18 18:58:52 +0000
commit6d7627cb65e54dae22237da82ea076bf17b1f9b7 (patch)
tree43eda0c3c953b041e1419650cc78a6ae9c381374 /crawl-ref/source/player.cc
parent66c0054398335a6929dd22d3690775027b9906b6 (diff)
downloadcrawl-ref-6d7627cb65e54dae22237da82ea076bf17b1f9b7.tar.gz
crawl-ref-6d7627cb65e54dae22237da82ea076bf17b1f9b7.zip
Add the Slime god as per n78291's (Shayne?) patch. Thanks! :D
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10271 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc56
1 files changed, 55 insertions, 1 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 853da7983e..09c925f2d2 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -21,6 +21,7 @@ REVISION("$Rev$");
#include <ctype.h>
#include <sstream>
+#include <algorithm>
#include "externs.h"
@@ -1554,6 +1555,9 @@ int player_res_acid(bool calc_unid, bool items)
res++;
}
+ if (you.religion == GOD_JIYVA && x_chance_in_y(you.piety, MAX_PIETY))
+ res++;
+
return (res);
}
@@ -3770,21 +3774,65 @@ static void _attribute_increase()
case 's':
case 'S':
modify_stat(STAT_STRENGTH, 1, false, "level gain");
+ you.last_chosen = STAT_STRENGTH;
return;
case 'i':
case 'I':
modify_stat(STAT_INTELLIGENCE, 1, false, "level gain");
+ you.last_chosen = STAT_INTELLIGENCE;
return;
case 'd':
case 'D':
modify_stat(STAT_DEXTERITY, 1, false, "level gain");
+ you.last_chosen = STAT_DEXTERITY;
return;
}
}
}
+// Rearrange stats, biased towards the stat chosen last at level up.
+void jiyva_stat_action()
+{
+ char* max_statp[] = { &you.max_strength, &you.max_intel, &you.max_dex };
+ char* base_statp[] = { &you.strength, &you.intel, &you.dex };
+ int incremented_weight[] = {1, 1, 1};
+ int decremented_weight[3];
+ int stat_up_choice;
+ int stat_down_choice;
+
+ incremented_weight[you.last_chosen] = 2;
+
+ for (int x = 0; x < 3; ++x)
+ decremented_weight[x] = std::min(10, std::max(0, *max_statp[x] - 7));
+
+ stat_up_choice = choose_random_weighted(incremented_weight,
+ incremented_weight + 3);
+ stat_down_choice = choose_random_weighted(decremented_weight,
+ decremented_weight + 3);
+
+ if (stat_up_choice != stat_down_choice)
+ {
+ // We have a stat change noticeable to the player at this point.
+ // This could be lethal if the player currently has 1 in a stat
+ // but has a max stat of something higher -- perhaps we should
+ // check for that?
+
+ (*max_statp[stat_up_choice])++;
+ (*max_statp[stat_down_choice])--;
+ (*base_statp[stat_up_choice])++;
+ (*base_statp[stat_down_choice])--;
+
+ mprf(MSGCH_GOD, "Jiyva's power touches on your attributes.");
+ you.redraw_strength = true;
+ you.redraw_intelligence = true;
+ you.redraw_dexterity = true;
+
+ burden_change();
+ }
+}
+
static const char * _get_rotting_how()
{
ASSERT(you.rotting > 0 || you.species == SP_GHOUL);
@@ -4417,6 +4465,9 @@ bool extrinsic_amulet_effect(jewellery_type amulet)
case AMU_CLARITY:
return (player_mutation_level(MUT_CLARITY) > 0);
case AMU_RESIST_CORROSION:
+ if (you.religion == GOD_JIYVA && you.piety > piety_breakpoint(2))
+ return (true);
+ // else fall-through
case AMU_CONSERVATION:
return (player_equip_ego_type(EQ_CLOAK, SPARM_PRESERVATION) > 0);
case AMU_THE_GOURMAND:
@@ -6057,6 +6108,7 @@ player_save_info player_save_info::operator=(const player& rhs)
species = rhs.species;
class_name = rhs.class_name;
religion = rhs.religion;
+ second_god_name = rhs.second_god_name;
#ifdef USE_TILE
held_in_net = false;
#endif
@@ -6077,7 +6129,9 @@ std::string player_save_info::short_desc() const
<< species_name(species, experience_level) << ' '
<< class_name;
- if (religion != GOD_NO_GOD)
+ if (religion == GOD_JIYVA)
+ desc << " of " << god_name_jiyva(true);
+ else if (religion != GOD_NO_GOD)
desc << " of " << god_name(religion);
#ifdef WIZARD