Attached Files |
0001-Experience-Penance-Timeouts.patch [^] (2,511 bytes) 2012-11-23 01:00 [Show Content] [Hide Content]From 081cfccb43c1b97e5a5c607edcbd1c83d6eac4ca Mon Sep 17 00:00:00 2001
From: Brendan Hickey <brendan@bhickey.net>
Date: Wed, 21 Nov 2012 18:32:15 -0500
Subject: [PATCH 1/4] Experience Penance Timeouts
Add penance experience timeouts to tags.
---
crawl-ref/source/tag-version.h | 1 +
crawl-ref/source/tags.cc | 18 +++++++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/crawl-ref/source/tag-version.h b/crawl-ref/source/tag-version.h
index 899449c..c170b51 100644
--- a/crawl-ref/source/tag-version.h
+++ b/crawl-ref/source/tag-version.h
@@ -19,6 +19,7 @@ enum tag_minor_version
TAG_MINOR_ACTION_THROW, // Store base type of throw objects.
TAG_MINOR_TEMP_MUTATIONS, // Enable transient mutations
TAG_MINOR_AUTOINSCRIPTIONS, // Artefact inscriptions are added on the fly
+ TAG_MINOR_EXP_WRATH, // Wrath timeout is a function of experience
NUM_TAG_MINORS,
TAG_MINOR_VERSION = NUM_TAG_MINORS - 1
};
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 75d6dba..fac2d2f 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -1231,6 +1231,11 @@ static void tag_construct_you(writer &th)
marshallByte(th, NUM_GODS);
for (i = 0; i < NUM_GODS; i++)
marshallByte(th, you.penance[i]);
+
+ for (i = 0; i < NUM_GODS; ++i)
+ {
+ marshallInt(th, you.penance_exp[i]);
+ }
// which gods have been worshipped by this character?
for (i = 0; i < NUM_GODS; i++)
@@ -1258,7 +1263,6 @@ static void tag_construct_you(writer &th)
marshallInt(th, you.exp_docked);
marshallInt(th, you.exp_docked_total);
-
// elapsed time
marshallInt(th, you.elapsed_time);
@@ -2020,7 +2024,15 @@ static void tag_read_you(reader &th)
you.penance[i] = unmarshallUByte(th);
ASSERT(you.penance[i] <= MAX_PENANCE);
}
-
+ #if TAG_MAJOR_VERSION == 34
+ if (th.getMinorVersion() >= TAG_MINOR_EXP_WRATH)
+ {
+ for (i = 0; i < NUM_GODS; ++i)
+ {
+ you.penance_exp[i] = unmarshallInt(th);
+ }
+ }
+ #endif
for (i = 0; i < count; i++)
you.worshipped[i] = unmarshallByte(th);
@@ -2045,7 +2057,7 @@ static void tag_read_you(reader &th)
you.exp_docked = unmarshallInt(th);
you.exp_docked_total = unmarshallInt(th);
-
+
// elapsed time
you.elapsed_time = unmarshallInt(th);
you.elapsed_time_at_last_input = you.elapsed_time;
--
1.7.4.4
0002-Penance-and-Mollification.patch [^] (4,154 bytes) 2012-11-23 01:00 [Show Content] [Hide Content]From c9a79ab9e196b9411c8e98aeb3e71847edb85d0a Mon Sep 17 00:00:00 2001
From: Brendan Hickey <brendan@bhickey.net>
Date: Wed, 21 Nov 2012 19:26:30 -0500
Subject: [PATCH 2/4] Penance and Mollification
Begin extracting penance checks.
Simplify mollification.
---
crawl-ref/source/player.cc | 9 +++++++--
crawl-ref/source/player.h | 4 +++-
crawl-ref/source/religion.cc | 12 +++++++++++-
crawl-ref/source/religion.h | 3 +++
crawl-ref/source/wiz-you.cc | 5 ++---
5 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index d108bf9..aea9c38 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -467,8 +467,13 @@ bool player_can_open_doors()
bool player_under_penance(void)
{
- if (you.religion != GOD_NO_GOD)
- return (you.penance[you.religion]);
+ return player_under_penance(you.religion);
+}
+
+bool player_under_penance(const god_type god)
+{
+ if (god != GOD_NO_GOD)
+ return (you.penance[god] || you.penance_exp[god]);
else
return false;
}
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 04eb798..f5ba75f 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -157,7 +157,7 @@ public:
int zot_points; // ZotDef currency
int exp_docked, exp_docked_total; // Ashenzari's wrath
-
+
FixedArray<uint8_t, 6, MAX_SUBTYPES> item_description;
FixedVector<unique_item_status_type, MAX_UNRANDARTS> unique_items;
FixedVector<bool, NUM_MONSTERS> unique_creatures;
@@ -185,6 +185,7 @@ public:
uint8_t piety_hysteresis; // amount of stored-up docking
uint8_t gift_timeout;
FixedVector<uint8_t, NUM_GODS> penance;
+ FixedVector<int, NUM_GODS> penance_exp;
FixedVector<uint8_t, NUM_GODS> worshipped;
FixedVector<short, NUM_GODS> num_current_gifts;
FixedVector<short, NUM_GODS> num_total_gifts;
@@ -786,6 +787,7 @@ bool is_effectively_light_armour(const item_def *item);
bool player_effectively_in_light_armour();
bool player_under_penance(void);
+bool player_under_penance(const god_type);
bool extrinsic_amulet_effect(jewellery_type amulet);
bool wearing_amulet(jewellery_type which_am, bool calc_unid = true,
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 0b56d55..075943f 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -966,7 +966,7 @@ string get_god_dislikes(god_type which_god, bool /*verbose*/)
void dec_penance(god_type god, int val)
{
- if (val <= 0 || you.penance[god] <= 0)
+ if (val <= 0 || !player_under_penance(god))
return;
#ifdef DEBUG_PIETY
@@ -1047,6 +1047,16 @@ void dec_penance(int val)
dec_penance(you.religion, val);
}
+void mollify()
+{
+ mollify(you.religion);
+}
+
+void mollify(const god_type god)
+{
+ dec_penance(god, you.penance[god]);
+}
+
static bool _need_water_walking()
{
return (you.ground_level() && you.species != SP_MERFOLK
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 2187278..44ffd8d 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -41,6 +41,9 @@ string get_god_dislikes(god_type which_god, bool verbose = false);
void dec_penance(int val);
void dec_penance(god_type god, int val);
+void mollify(void);
+void mollify(const god_type);
+
void excommunication(god_type new_god = GOD_NO_GOD);
void gain_piety(int pgn, int denominator = 1,
diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc
index 4295210..0d4c40b 100644
--- a/crawl-ref/source/wiz-you.cc
+++ b/crawl-ref/source/wiz-you.cc
@@ -398,7 +398,7 @@ void wizard_set_piety()
while (diff != 0);
// Automatically reduce penance to 0.
- if (you.penance[you.religion] > 0)
+ if (player_under_penance())
dec_penance(you.penance[you.religion]);
}
@@ -994,8 +994,7 @@ void wizard_god_mollify()
{
for (int i = GOD_NO_GOD; i < NUM_GODS; ++i)
{
- if (you.penance[i])
- dec_penance((god_type) i, you.penance[i]);
+ mollify((god_type) i);
}
}
--
1.7.4.4
0003-Penance.patch [^] (22,368 bytes) 2012-11-23 01:00 [Show Content] [Hide Content]From 2a7698f922d57f197a37351ac434ce4b1f3b427a Mon Sep 17 00:00:00 2001
From: Brendan Hickey <brendan@bhickey.net>
Date: Wed, 21 Nov 2012 22:15:35 -0500
Subject: [PATCH 3/4] Penance
Replace you.penance conditional checks and you.religion with calls to
player_under_penance() and in_good_standing_with()
---
crawl-ref/source/actor.cc | 4 ++--
crawl-ref/source/areas.cc | 4 ++--
crawl-ref/source/attitude-change.cc | 7 +++----
crawl-ref/source/decks.cc | 11 ++++++-----
crawl-ref/source/dgn-overview.cc | 8 ++++----
crawl-ref/source/effects.cc | 2 +-
crawl-ref/source/godpassive.cc | 4 ++--
crawl-ref/source/itemname.cc | 2 +-
crawl-ref/source/main.cc | 2 +-
crawl-ref/source/melee_attack.cc | 4 ++--
crawl-ref/source/mon-act.cc | 2 +-
crawl-ref/source/mon-behv.cc | 5 +++--
crawl-ref/source/mon-pathfind.cc | 2 +-
crawl-ref/source/ouch.cc | 5 ++---
crawl-ref/source/player.cc | 3 ++-
crawl-ref/source/religion.cc | 26 +++++++++++++++-----------
crawl-ref/source/religion.h | 2 ++
crawl-ref/source/spl-cast.cc | 4 ++--
crawl-ref/source/spl-miscast.cc | 6 +++---
crawl-ref/source/wiz-you.cc | 2 +-
crawl-ref/source/xom.cc | 12 ++++++------
21 files changed, 62 insertions(+), 55 deletions(-)
diff --git a/crawl-ref/source/actor.cc b/crawl-ref/source/actor.cc
index 25396d4..21daa93 100644
--- a/crawl-ref/source/actor.cc
+++ b/crawl-ref/source/actor.cc
@@ -15,6 +15,7 @@
#include "ouch.h"
#include "player.h"
#include "random.h"
+#include "religion.h"
#include "state.h"
#include "stuff.h"
#include "terrain.h"
@@ -282,8 +283,7 @@ int actor::apply_ac(int damage, int max_damage, ac_type ac_rule,
bool actor_slime_wall_immune(const actor *act)
{
- return (act->is_player()?
- you.religion == GOD_JIYVA && !you.penance[GOD_JIYVA]
+ return (act->is_player() ? in_good_standing_with(GOD_JIYVA)
: act->res_acid() == 3);
}
/**
diff --git a/crawl-ref/source/areas.cc b/crawl-ref/source/areas.cc
index 3e80a9d..68e23e9 100644
--- a/crawl-ref/source/areas.cc
+++ b/crawl-ref/source/areas.cc
@@ -569,8 +569,8 @@ int player::halo_radius2() const
{
int size = -1;
- if (you.religion == GOD_SHINING_ONE && you.piety >= piety_breakpoint(0)
- && !you.penance[GOD_SHINING_ONE])
+ if (in_good_standing_with(GOD_SHINING_ONE)
+ && you.piety >= piety_breakpoint(0))
{
// Preserve the middle of old radii.
const int r = you.piety - 10;
diff --git a/crawl-ref/source/attitude-change.cc b/crawl-ref/source/attitude-change.cc
index 4106bfe..29075be 100644
--- a/crawl-ref/source/attitude-change.cc
+++ b/crawl-ref/source/attitude-change.cc
@@ -50,7 +50,7 @@ void good_god_follower_attitude_change(monster* mons)
{
mons->flags |= MF_ATT_CHANGE_ATTEMPT;
- if (x_chance_in_y(you.piety, MAX_PIETY) && !you.penance[you.religion])
+ if (x_chance_in_y(you.piety, MAX_PIETY) && !player_under_penance())
{
const item_def* wpn = you.weapon();
if (wpn
@@ -135,11 +135,10 @@ void slime_convert(monster* mons)
void fedhas_neutralise(monster* mons)
{
- if (you.religion == GOD_FEDHAS
+ if (in_good_standing_with(GOD_FEDHAS)
&& mons->attitude == ATT_HOSTILE
&& fedhas_neutralises(mons)
- && !testbits(mons->flags, MF_ATT_CHANGE_ATTEMPT)
- && !player_under_penance())
+ && !testbits(mons->flags, MF_ATT_CHANGE_ATTEMPT))
{
_fedhas_neutralise_plant(mons);
mons->flags |= MF_ATT_CHANGE_ATTEMPT;
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 7f821b0..435e1df 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -1330,7 +1330,7 @@ void evoke_deck(item_def& deck)
// Passive Nemelex retribution: sometimes a card gets swapped out.
// More likely to happen with marked decks.
- if (you.penance[GOD_NEMELEX_XOBEH])
+ if (player_under_penance(GOD_NEMELEX_XOBEH))
{
int c = 1;
if ((flags & (CFLAG_MARKED | CFLAG_SEEN))
@@ -1350,8 +1350,9 @@ void evoke_deck(item_def& deck)
mprf("It's actually %s.", card_name(card));
// You never completely appease Nemelex, but the effects
// get less frequent.
- you.penance[GOD_NEMELEX_XOBEH] -=
+ int penance_reduction =
random2((you.penance[GOD_NEMELEX_XOBEH]+18) / 10);
+ dec_penance(GOD_NEMELEX_XOBEH, penance_reduction);
}
}
}
@@ -1515,7 +1516,7 @@ static void _damnation_card(int power, deck_rarity_type rarity)
// Calculate how many extra banishments you get.
const int power_level = _get_power_level(power, rarity);
int nemelex_bonus = 0;
- if (you.religion == GOD_NEMELEX_XOBEH && !player_under_penance())
+ if (in_good_standing_with(GOD_NEMELEX_XOBEH))
nemelex_bonus = you.piety;
int extra_targets = power_level + random2(you.skill(SK_EVOCATIONS, 20)
@@ -2879,7 +2880,7 @@ static int _card_power(deck_rarity_type rarity)
{
int result = 0;
- if (you.penance[GOD_NEMELEX_XOBEH])
+ if (player_under_penance(GOD_NEMELEX_XOBEH))
result -= you.penance[GOD_NEMELEX_XOBEH];
else if (you.religion == GOD_NEMELEX_XOBEH)
{
@@ -2936,7 +2937,7 @@ void card_effect(card_type which_card, deck_rarity_type rarity,
god_speaks(GOD_XOM, "Xom roars with laughter!");
you.gift_timeout = 200;
}
- else if (you.penance[GOD_XOM])
+ else if (player_under_penance(GOD_XOM))
god_speaks(GOD_XOM, "Xom laughs nastily.");
}
diff --git a/crawl-ref/source/dgn-overview.cc b/crawl-ref/source/dgn-overview.cc
index e5db463..c65640a 100644
--- a/crawl-ref/source/dgn-overview.cc
+++ b/crawl-ref/source/dgn-overview.cc
@@ -459,12 +459,12 @@ static string _print_altars_for_gods(const vector<god_type>& gods,
// Good gods don't inflict penance unless they hate your god.
if (you.penance[god] && (!is_good_god(god) || god_hates_your_god(god)))
colour = (you.penance[god] > 10) ? "red" : "lightred";
+ else if (in_good_standing_with(god))
+ colour = "yellow";
// Indicate good gods that you've abandoned, though.
- else if (you.penance[god])
+ else if (player_under_penance(god))
colour = "magenta";
- else if (you.religion == god)
- colour = "yellow";
- else if (god_likes_your_god(god) && has_altar_been_seen)
+ else if (god_likes_your_god(god) && has_altar_been_seen)
colour = "brown";
if (!print_unseen && !strcmp(colour, "darkgrey"))
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index ef755a8..8693229 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -3131,7 +3131,7 @@ void slime_wall_damage(actor* act, int delay)
if (act->is_player())
{
- if (you.religion != GOD_JIYVA || you.penance[GOD_JIYVA])
+ if (!in_good_standing_with(GOD_JIYVA))
{
splash_with_acid(strength, false,
(walls > 1) ? "The walls burn you!"
diff --git a/crawl-ref/source/godpassive.cc b/crawl-ref/source/godpassive.cc
index 0e76916..3dc282f 100644
--- a/crawl-ref/source/godpassive.cc
+++ b/crawl-ref/source/godpassive.cc
@@ -27,7 +27,7 @@
int che_stat_boost(int piety)
{
- if (you.religion != GOD_CHEIBRIADOS || you.penance[GOD_CHEIBRIADOS])
+ if (in_good_standing_with(GOD_CHEIBRIADOS))
return 0;
if (piety < 30) // Since you've already begun to slow down.
return 1;
@@ -104,7 +104,7 @@ void jiyva_eat_offlevel_items()
void jiyva_slurp_bonus(int item_value, int *js)
{
- if (you.penance[GOD_JIYVA])
+ if (!in_good_standing_with(GOD_JIYVA))
return;
if (you.piety >= piety_breakpoint(1)
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 94663be..b5b50e1 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -3292,7 +3292,7 @@ bool is_useless_item(const item_def &item, bool temp)
if (you.has_spell(SPELL_ANIMATE_DEAD)
|| you.has_spell(SPELL_ANIMATE_SKELETON)
- || you.religion == GOD_YREDELEMNUL && !you.penance[GOD_YREDELEMNUL]
+ || in_good_standing_with(GOD_YREDELEMNUL)
&& you.piety >= piety_breakpoint(0))
{
return false;
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 23fac09..2026931 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -889,7 +889,7 @@ static void _start_running(int dir, int mode)
for (adjacent_iterator ai(next_pos); ai; ++ai)
{
if (env.grid(*ai) == DNGN_SLIMY_WALL
- && (you.religion != GOD_JIYVA || you.penance[GOD_JIYVA]))
+ && in_good_standing_with(GOD_JIYVA))
{
mpr("You're about to run into the slime covered wall!",
MSGCH_WARN);
diff --git a/crawl-ref/source/melee_attack.cc b/crawl-ref/source/melee_attack.cc
index d4d7927..400af7d 100644
--- a/crawl-ref/source/melee_attack.cc
+++ b/crawl-ref/source/melee_attack.cc
@@ -846,7 +846,7 @@ bool melee_attack::attack()
{
set_attack_conducts(conducts, defender->as_monster());
- if (you.penance[GOD_ELYVILON]
+ if (player_under_penance(GOD_ELYVILON)
&& god_hates_your_god(GOD_ELYVILON)
&& ev_margin >= 0
&& one_chance_in(20))
@@ -1315,7 +1315,7 @@ bool melee_attack::player_aux_test_hit()
const int evasion = defender->melee_evasion(attacker);
- if (you.penance[GOD_ELYVILON]
+ if (player_under_penance(GOD_ELYVILON)
&& god_hates_your_god(GOD_ELYVILON)
&& to_hit >= evasion
&& one_chance_in(20))
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc
index 39bb3d5..22d0b6b 100644
--- a/crawl-ref/source/mon-act.cc
+++ b/crawl-ref/source/mon-act.cc
@@ -1712,7 +1712,7 @@ void handle_monster_move(monster* mons)
// Memory is decremented here for a reason -- we only want it
// decrementing once per monster "move".
- if (mons->foe_memory > 0 && !you.penance[GOD_ASHENZARI])
+ if (mons->foe_memory > 0 && !player_under_penance(GOD_ASHENZARI))
mons->foe_memory--;
// Otherwise there are potential problems with summonings.
diff --git a/crawl-ref/source/mon-behv.cc b/crawl-ref/source/mon-behv.cc
index fc3e8db..783931c 100644
--- a/crawl-ref/source/mon-behv.cc
+++ b/crawl-ref/source/mon-behv.cc
@@ -279,7 +279,7 @@ void handle_behaviour(monster* mon)
// Ash penance makes monsters very likely to target you through
// invisibility, depending on their intelligence.
- if (you.penance[GOD_ASHENZARI] && x_chance_in_y(intel, 6))
+ if (player_under_penance(GOD_ASHENZARI) && x_chance_in_y(intel, 6))
proxPlayer = true;
}
@@ -522,7 +522,8 @@ void handle_behaviour(monster* mon)
else
{
if (x_chance_in_y(300, you.skill(SK_STEALTH, 100))
- || you.penance[GOD_ASHENZARI] && coinflip())
+ || player_under_penance(GOD_ASHENZARI)
+ && coinflip())
{
mon->target = you.pos();
}
diff --git a/crawl-ref/source/mon-pathfind.cc b/crawl-ref/source/mon-pathfind.cc
index 658d03d..b15c785 100644
--- a/crawl-ref/source/mon-pathfind.cc
+++ b/crawl-ref/source/mon-pathfind.cc
@@ -63,7 +63,7 @@ int mons_tracking_range(const monster* mon)
range++;
}
- if (you.penance[GOD_ASHENZARI])
+ if (player_under_penance(GOD_ASHENZARI))
range *= 5;
return range;
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 73896bb..a4008b1 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -607,7 +607,7 @@ static bool _expose_invent_to_element(beam_type flavour, int strength)
continue;
}
- if (you.religion == GOD_JIYVA && !player_under_penance()
+ if (in_good_standing_with(GOD_JIYVA)
&& x_chance_in_y(you.piety, MAX_PIETY))
{
++jiyva_block;
@@ -1273,8 +1273,7 @@ void ouch(int dam, int death_source, kill_method_type death_type,
// Xom should only kill his worshippers if they're under penance
// or Xom is bored.
- if (you.religion == GOD_XOM && !you.penance[GOD_XOM]
- && you.gift_timeout > 0)
+ if (in_good_standing_with(GOD_XOM) && you.gift_timeout > 0)
{
return;
}
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index aea9c38..89535f2 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2839,7 +2839,8 @@ void gain_exp(unsigned int exp_gained, unsigned int* actual_gain)
exp_gained *= 2;
}
- if (you.penance[GOD_ASHENZARI])
+ // TODO: Hook this for all gods.
+ if (player_under_penance(GOD_ASHENZARI))
ash_reduce_penance(exp_gained);
const unsigned int old_exp = you.experience;
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 075943f..f3a1366 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -964,6 +964,11 @@ string get_god_dislikes(god_type which_god, bool /*verbose*/)
return text;
}
+bool in_good_standing_with(const god_type god)
+{
+ return you.religion == god && !player_under_penance(god);
+}
+
void dec_penance(god_type god, int val)
{
if (val <= 0 || !player_under_penance(god))
@@ -974,8 +979,7 @@ void dec_penance(god_type god, int val)
#endif
if (you.penance[god] <= val)
{
- you.penance[god] = 0;
-
+ mollify(god);
mark_milestone("god.mollify",
"mollified " + god_name(god) + ".");
@@ -1066,7 +1070,7 @@ static bool _need_water_walking()
bool jiyva_is_dead()
{
return (you.royal_jelly_dead
- && you.religion != GOD_JIYVA && !you.penance[GOD_JIYVA]);
+ && in_good_standing_with(GOD_JIYVA));
}
static void _inc_penance(god_type god, int val)
@@ -1074,7 +1078,7 @@ static void _inc_penance(god_type god, int val)
if (val <= 0)
return;
- if (you.penance[god] == 0)
+ if (player_under_penance(god) == 0)
{
god_acting gdact(god, true);
@@ -2501,7 +2505,7 @@ void gain_piety(int original_gain, int denominator, bool force, bool should_scal
static void _gain_piety_point()
{
// check to see if we owe anything first
- if (you.penance[you.religion] > 0)
+ if (player_under_penance())
{
dec_penance(1);
return;
@@ -3341,7 +3345,7 @@ void god_pitch(god_type which_god)
return;
}
- if (which_god == GOD_LUGONU && you.penance[GOD_LUGONU])
+ if (which_god == GOD_LUGONU && player_under_penance(GOD_LUGONU))
{
you.turn_is_over = false;
simple_god_message(" refuses to forgive you so easily!", which_god);
@@ -3490,7 +3494,7 @@ void god_pitch(god_type which_god)
// Currently, penance is just zeroed. This could be much more
// interesting.
- you.penance[you.religion] = 0;
+ mollify();
if (is_good_god(you.religion) && is_good_god(old_god))
{
@@ -3518,19 +3522,19 @@ void god_pitch(god_type which_god)
}
// Warn if a good god is starting wrath now.
- if (old_god != GOD_ELYVILON && you.penance[GOD_ELYVILON]
+ if (old_god != GOD_ELYVILON && player_under_penance(GOD_ELYVILON)
&& god_hates_your_god(GOD_ELYVILON, you.religion))
{
simple_god_message(" says: Your evil deeds will not go unpunished!",
GOD_ELYVILON);
}
- if (old_god != GOD_SHINING_ONE && you.penance[GOD_SHINING_ONE]
+ if (old_god != GOD_SHINING_ONE && player_under_penance(GOD_SHINING_ONE)
&& god_hates_your_god(GOD_SHINING_ONE, you.religion))
{
simple_god_message(" says: You will pay for your evil ways, mortal!",
GOD_SHINING_ONE);
}
- if (old_god != GOD_ZIN && you.penance[GOD_ZIN]
+ if (old_god != GOD_ZIN && player_under_penance(GOD_ZIN)
&& god_hates_your_god(GOD_ZIN, you.religion))
{
simple_god_message(make_stringf(" says: You will suffer for embracing such %s!",
@@ -3733,7 +3737,7 @@ bool god_can_protect_from_harm(god_type god)
switch (god)
{
case GOD_BEOGH:
- return !you.penance[god];
+ return !player_under_penance(god);
case GOD_ZIN:
case GOD_SHINING_ONE:
case GOD_ELYVILON:
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 44ffd8d..9c0dce4 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -38,6 +38,8 @@ string get_god_powers(god_type which_god);
string get_god_likes(god_type which_god, bool verbose = false);
string get_god_dislikes(god_type which_god, bool verbose = false);
+bool in_good_standing_with(god_type god);
+
void dec_penance(int val);
void dec_penance(god_type god, int val);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 3aa9889..8efffa7 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1135,7 +1135,7 @@ spret_type your_spells(spell_type spell, int powc,
int spfl = random2avg(100, 3);
if (you.religion != GOD_SIF_MUNA
- && you.penance[GOD_SIF_MUNA] && one_chance_in(20))
+ && player_under_penance(GOD_SIF_MUNA) && one_chance_in(20))
{
god_speaks(GOD_SIF_MUNA, "You feel a surge of divine spite.");
@@ -1144,7 +1144,7 @@ spret_type your_spells(spell_type spell, int powc,
}
else if (spell_typematch(spell, SPTYP_NECROMANCY)
&& you.religion != GOD_KIKUBAAQUDGHA
- && you.penance[GOD_KIKUBAAQUDGHA]
+ && player_under_penance(GOD_KIKUBAAQUDGHA)
&& one_chance_in(20))
{
// And you thought you'd Necromutate your way out of penance...
diff --git a/crawl-ref/source/spl-miscast.cc b/crawl-ref/source/spl-miscast.cc
index 2ac991f..cde61f1 100644
--- a/crawl-ref/source/spl-miscast.cc
+++ b/crawl-ref/source/spl-miscast.cc
@@ -531,7 +531,7 @@ bool MiscastEffect::_ouch(int dam, beam_type flavour)
{
god_type god = static_cast<god_type>(-source);
- if (god == GOD_XOM && you.penance[GOD_XOM] == 0)
+ if (god == GOD_XOM && player_under_penance(GOD_XOM) == 0)
method = KILLED_BY_XOM;
else
method = KILLED_BY_DIVINE_WRATH;
@@ -700,7 +700,7 @@ bool MiscastEffect::_create_monster(monster_type what, int abj_deg,
// hostile_at() assumes the monster is hostile to the player,
// but should be hostile to the target monster unless the miscast
// is a result of either divine wrath or a Zot trap.
- if (target->is_monster() && you.penance[god] == 0
+ if (target->is_monster() && player_under_penance(god) == 0
&& source != ZOT_TRAP_MISCAST)
{
monster* mon_target = target_as_monster();
@@ -728,7 +728,7 @@ bool MiscastEffect::_create_monster(monster_type what, int abj_deg,
// simply be ignored.
if (data.abjuration_duration != 0)
{
- if (you.penance[god] > 0)
+ if (player_under_penance(god) > 0)
data.summon_type = MON_SUMM_WRATH;
else if (source == ZOT_TRAP_MISCAST)
data.summon_type = MON_SUMM_ZOT;
diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc
index 0d4c40b..ce71458 100644
--- a/crawl-ref/source/wiz-you.cc
+++ b/crawl-ref/source/wiz-you.cc
@@ -399,7 +399,7 @@ void wizard_set_piety()
// Automatically reduce penance to 0.
if (player_under_penance())
- dec_penance(you.penance[you.religion]);
+ mollify(you.religion);
}
//---------------------------------------------------------------
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index b827dd1..681b4c4 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -181,12 +181,12 @@ static bool _xom_feels_nasty()
{
// Xom will only directly kill you with a bad effect if you're under
// penance from him, or if he's bored.
- return (you.penance[GOD_XOM] || _xom_is_bored());
+ return (player_under_penance(GOD_XOM) || _xom_is_bored());
}
bool xom_is_nice(int tension)
{
- if (you.penance[GOD_XOM])
+ if (player_under_penance(GOD_XOM))
return false;
if (you.religion == GOD_XOM)
@@ -3329,7 +3329,7 @@ static int _xom_draining_torment_effect(int sever, bool debug = false)
static bool _has_min_animated_weapon_level()
{
- if (you.penance[GOD_XOM])
+ if (player_under_penance(GOD_XOM))
return true;
if (_xom_is_bored())
@@ -3378,7 +3378,7 @@ static int _xom_summon_hostiles(int sever, bool debug = false)
numdemons = min(numdemons + 1, 14);
// Limit number of demons by experience level.
- if (!you.penance[GOD_XOM])
+ if (!player_under_penance(GOD_XOM))
{
const int maxdemons = (you.experience_level / 2);
if (numdemons > maxdemons)
@@ -3433,7 +3433,7 @@ static bool _will_not_banish()
static bool _allow_xom_banishment()
{
// Always allowed if under penance.
- if (you.penance[GOD_XOM])
+ if (player_under_penance(GOD_XOM))
return true;
// If Xom is bored, banishment becomes viable earlier.
@@ -4305,7 +4305,7 @@ void debug_xom_effects()
fprintf(ostat, "%s\n", mpr_monster_list().c_str());
fprintf(ostat, " --> Tension: %d\n", tension);
- if (you.penance[GOD_XOM])
+ if (player_under_penance(GOD_XOM))
fprintf(ostat, "You are under Xom's penance!\n");
else if (_xom_is_bored())
fprintf(ostat, "Xom is BORED.\n");
--
1.7.4.4
0004-Penance-Timeout.patch [^] (17,237 bytes) 2012-11-23 01:00 [Show Content] [Hide Content]From 263dfffb96b8f179934c560476b2365a033d2c16 Mon Sep 17 00:00:00 2001
From: Brendan Hickey <brendan@bhickey.net>
Date: Thu, 22 Nov 2012 18:56:52 -0500
Subject: [PATCH 4/4] Penance Timeout
Penance no longer diminishes with instances of wrath.
Instead if decreases as a player accumulates experience.
---
crawl-ref/source/areas.cc | 2 +-
crawl-ref/source/godwrath.cc | 92 ++++++++++++++++++++++++++++----------
crawl-ref/source/godwrath.h | 2 +-
crawl-ref/source/melee_attack.cc | 3 -
crawl-ref/source/mon-stuff.cc | 1 -
crawl-ref/source/player.cc | 4 +-
crawl-ref/source/player.h | 3 +-
crawl-ref/source/religion.cc | 53 ++++++++++++----------
crawl-ref/source/tags.cc | 12 +++--
9 files changed, 109 insertions(+), 63 deletions(-)
diff --git a/crawl-ref/source/areas.cc b/crawl-ref/source/areas.cc
index 68e23e9..29f657d 100644
--- a/crawl-ref/source/areas.cc
+++ b/crawl-ref/source/areas.cc
@@ -569,7 +569,7 @@ int player::halo_radius2() const
{
int size = -1;
- if (in_good_standing_with(GOD_SHINING_ONE)
+ if (in_good_standing_with(GOD_SHINING_ONE)
&& you.piety >= piety_breakpoint(0))
{
// Preserve the middle of old radii.
diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc
index e00114d..06db00d 100644
--- a/crawl-ref/source/godwrath.cc
+++ b/crawl-ref/source/godwrath.cc
@@ -47,7 +47,11 @@
#include "shout.h"
#include "xom.h"
+#include <algorithm>
#include <sstream>
+#include <vector>
+
+using namespace std;
static void _god_smites_you(god_type god, const char *message = NULL,
kill_method_type death_type = NUM_KILLBY);
@@ -183,7 +187,6 @@ static void _zin_remove_good_mutations()
if (success && !how_mutated())
{
simple_god_message(" rids your body of chaos!", GOD_ZIN);
- dec_penance(GOD_ZIN, 1);
}
}
@@ -282,9 +285,6 @@ static void _ely_dull_inventory_weapons()
if (num_dulled > 0)
{
- if (x_chance_in_y(chance + 1, 100))
- dec_penance(GOD_ELYVILON, 1);
-
simple_god_message(
make_stringf(" dulls %syour weapons.",
num_dulled == 1 ? "one of " : "").c_str(),
@@ -361,7 +361,6 @@ static bool _cheibriados_retribution()
case 3:
mpr("You lose track of time.");
you.put_to_sleep(NULL, 30 + random2(20));
- dec_penance(god, 1);
if (one_chance_in(wrath_type - 2))
break;
// Medium tension
@@ -392,8 +391,6 @@ static bool _cheibriados_retribution()
break;
}
- if (wrath_type > 2)
- dec_penance(god, 1 + random2(wrath_type));
return glammer;
}
@@ -599,7 +596,6 @@ static bool _trog_retribution()
case 3:
if (!you.duration[DUR_PARALYSIS])
{
- dec_penance(god, 3);
mpr("You suddenly pass out!", MSGCH_WARN);
you.duration[DUR_PARALYSIS] = 2 + random2(6);
}
@@ -609,7 +605,6 @@ static bool _trog_retribution()
case 5:
if (you.duration[DUR_SLOW] < 180 * BASELINE_DELAY)
{
- dec_penance(god, 1);
mpr("You suddenly feel exhausted!", MSGCH_WARN);
you.set_duration(DUR_EXHAUSTED, 200);
slow_player(100);
@@ -623,7 +618,6 @@ static bool _trog_retribution()
// -- actually, this function partially exists to remove that,
// we'll leave this effect in, but we'll remove the wild
// fire magic. -- bwr
- dec_penance(god, 2);
mpr("You feel Trog's fiery rage upon you!", MSGCH_WARN);
MiscastEffect(&you, -god, SPTYP_FIRE, 8 + you.experience_level,
random2avg(98, 3), "the fiery rage of Trog");
@@ -793,7 +787,6 @@ static bool _sif_muna_retribution()
const god_type god = GOD_SIF_MUNA;
simple_god_message("'s wrath finds you.", god);
- dec_penance(god, 1);
switch (random2(10))
{
@@ -1255,10 +1248,6 @@ bool divine_retribution(god_type god, bool no_bonus, bool force)
}
}
- // Just the thought of retribution mollifies the god by at least a
- // point...the punishment might have reduced penance further.
- dec_penance(god, 1 + random2(3));
-
return true;
}
@@ -1480,20 +1469,75 @@ static void _god_smites_you(god_type god, const char *message,
simple_god_message(" smites you!", god);
ouch(divine_hurt, NON_MONSTER, death_type, aux.c_str());
- dec_penance(god, 1);
}
}
-void ash_reduce_penance(int amount)
+int _penance_factor(const god_type god)
+{
+ switch (god)
+ {
+ case GOD_XOM: return 50;
+ case GOD_KIKUBAAQUDGHA: return 30;
+ case GOD_YREDELEMNUL: return 30;
+ case GOD_VEHUMET: return 25;
+ case GOD_MAKHLEB: return 25;
+ case GOD_TROG: return 50;
+ case GOD_BEOGH: return 50;
+ case GOD_SIF_MUNA: return 50;
+ case GOD_NEMELEX_XOBEH: return 150;
+ case GOD_LUGONU: return 50;
+ case GOD_SHINING_ONE: return 30;
+ case GOD_ZIN: return 25;
+ case GOD_ELYVILON: return 30;
+ case GOD_JIYVA: return 30;
+ case GOD_FEDHAS: return 30;
+ case GOD_ASHENZARI: return 50;
+ case GOD_CHEIBRIADOS: return 25;
+ default: return 25;
+ }
+}
+
+void reduce_penance(int amount)
{
- if (!you.penance[GOD_ASHENZARI] || !you.exp_docked_total)
+ int lost = amount / 2;
+ vector<god_type> gods;
+ int mad_gods = 0;
+ int exp_owed = 0;
+ int total_penance = 0;
+ for (int i = GOD_NO_GOD ; i < NUM_GODS ; ++i)
+ {
+ god_type god = (god_type) i;
+ if (you.religion != god && you.penance_exp[god])
+ {
+ mad_gods++;
+ exp_owed += you.penance_exp[god];
+ total_penance += you.penance[god];
+ gods.push_back(god);
+ }
+ }
+ if (gods.empty())
return;
+ random_shuffle(gods.begin(), gods.end());
+ if (player_under_penance(you.religion))
+ gods.push_back(you.religion);
+ while (!gods.empty() && lost > 0)
+ {
+ god_type god = gods.back();
+ gods.pop_back();
+ if (you.penance_exp[god] > lost)
+ {
+ you.penance_exp[god] -= lost;
+ } else {
+ lost -= you.penance_exp[god];
+ mollify(god);
+ continue;
+ }
+ int factor = _penance_factor(god);
+ int new_pen = (((int64_t)you.penance_exp[god] * factor) + you.penance_exp_total[god] - 1)
+ / you.penance_exp_total[god];
- int lost = min(amount / 2, you.exp_docked);
- you.exp_docked -= lost;
+ if (new_pen < you.penance[god])
+ dec_penance(god, you.penance[god] - new_pen);
- int new_pen = (((int64_t)you.exp_docked * 50) + you.exp_docked_total - 1)
- / you.exp_docked_total;
- if (new_pen < you.penance[GOD_ASHENZARI])
- dec_penance(GOD_ASHENZARI, you.penance[GOD_ASHENZARI] - new_pen);
+ }
}
diff --git a/crawl-ref/source/godwrath.h b/crawl-ref/source/godwrath.h
index fa5befd..b8f554b 100644
--- a/crawl-ref/source/godwrath.h
+++ b/crawl-ref/source/godwrath.h
@@ -9,5 +9,5 @@
bool divine_retribution(god_type god, bool no_bonus = false, bool force = false);
bool do_god_revenge(conduct_type thing_done, const monster *victim = 0);
-void ash_reduce_penance(int amount);
+void reduce_penance(int amount);
#endif
diff --git a/crawl-ref/source/melee_attack.cc b/crawl-ref/source/melee_attack.cc
index 400af7d..0c80ec8 100644
--- a/crawl-ref/source/melee_attack.cc
+++ b/crawl-ref/source/melee_attack.cc
@@ -852,8 +852,6 @@ bool melee_attack::attack()
&& one_chance_in(20))
{
simple_god_message(" blocks your attack.", GOD_ELYVILON);
- dec_penance(GOD_ELYVILON, 1);
-
return false;
}
// Check for stab (and set stab_attempt and stab_bonus)
@@ -1321,7 +1319,6 @@ bool melee_attack::player_aux_test_hit()
&& one_chance_in(20))
{
simple_god_message(" blocks your attack.", GOD_ELYVILON);
- dec_penance(GOD_ELYVILON, 1);
return false;
}
diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc
index d5ddd10..b2b6cdf 100644
--- a/crawl-ref/source/mon-stuff.cc
+++ b/crawl-ref/source/mon-stuff.cc
@@ -764,7 +764,6 @@ static bool _ely_heal_monster(monster* mons, killer_type killer, int i)
mons->hit_points * 2 <= mons->max_hit_points ? "." : "!");
god_speaks(god, info);
- dec_penance(god, 1);
return true;
}
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 89535f2..3219095 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2839,9 +2839,7 @@ void gain_exp(unsigned int exp_gained, unsigned int* actual_gain)
exp_gained *= 2;
}
- // TODO: Hook this for all gods.
- if (player_under_penance(GOD_ASHENZARI))
- ash_reduce_penance(exp_gained);
+ reduce_penance(exp_gained);
const unsigned int old_exp = you.experience;
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index f5ba75f..c98ae5f 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -157,7 +157,7 @@ public:
int zot_points; // ZotDef currency
int exp_docked, exp_docked_total; // Ashenzari's wrath
-
+
FixedArray<uint8_t, 6, MAX_SUBTYPES> item_description;
FixedVector<unique_item_status_type, MAX_UNRANDARTS> unique_items;
FixedVector<bool, NUM_MONSTERS> unique_creatures;
@@ -186,6 +186,7 @@ public:
uint8_t gift_timeout;
FixedVector<uint8_t, NUM_GODS> penance;
FixedVector<int, NUM_GODS> penance_exp;
+ FixedVector<int, NUM_GODS> penance_exp_total;
FixedVector<uint8_t, NUM_GODS> worshipped;
FixedVector<short, NUM_GODS> num_current_gifts;
FixedVector<short, NUM_GODS> num_total_gifts;
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index f3a1366..9d93703 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -979,7 +979,6 @@ void dec_penance(god_type god, int val)
#endif
if (you.penance[god] <= val)
{
- mollify(god);
mark_milestone("god.mollify",
"mollified " + god_name(god) + ".");
@@ -1059,6 +1058,8 @@ void mollify()
void mollify(const god_type god)
{
dec_penance(god, you.penance[god]);
+ you.penance_exp[god] = 0;
+ you.penance_exp_total[god] = 0;
}
static bool _need_water_walking()
@@ -1157,9 +1158,14 @@ static void _inc_penance(int val)
_inc_penance(you.religion, val);
}
-static void _set_penance(god_type god, int val)
+static void _set_penance(god_type god, int val, int exp_cost)
{
you.penance[god] = val;
+ if (god != GOD_NEMELEX_XOBEH) {
+ you.penance_exp[god] += exp_cost;
+ you.penance_exp_total[god] =
+ max(you.penance_exp_total[god], exp_cost);
+ }
}
static void _inc_gift_timeout(int val)
@@ -2879,17 +2885,19 @@ void excommunication(god_type new_god)
_god_hates_your_god_reaction(old_god, new_god).c_str()).c_str(),
old_god);
}
+ int exp_cost = exp_needed(min<int>(you.max_level, 27) + 1)
+ - exp_needed(min<int>(you.max_level, 27));
switch (old_god)
{
case GOD_XOM:
- _set_penance(old_god, 50);
+ _set_penance(old_god, 50, exp_cost);
break;
case GOD_KIKUBAAQUDGHA:
mpr("You sense decay."); // in the state of Denmark?
add_daction(DACT_ROT_CORPSES);
- _set_penance(old_god, 30);
+ _set_penance(old_god, 30, exp_cost);
break;
case GOD_YREDELEMNUL:
@@ -2900,15 +2908,15 @@ void excommunication(god_type new_god)
GOD_YREDELEMNUL);
add_daction(DACT_ALLY_YRED_SLAVE);
}
- _set_penance(old_god, 30);
+ _set_penance(old_god, 30, exp_cost);
break;
case GOD_VEHUMET:
- _set_penance(old_god, 25);
+ _set_penance(old_god, 25, exp_cost);
break;
case GOD_MAKHLEB:
- _set_penance(old_god, 25);
+ _set_penance(old_god, 25, exp_cost);
break;
case GOD_TROG:
@@ -2917,7 +2925,7 @@ void excommunication(god_type new_god)
add_daction(DACT_ALLY_TROG);
- _set_penance(old_god, 50);
+ _set_penance(old_god, 50, exp_cost);
break;
case GOD_BEOGH:
@@ -2934,20 +2942,20 @@ void excommunication(god_type new_god)
if (_need_water_walking())
fall_into_a_pool(you.pos(), true, grd(you.pos()));
- _set_penance(old_god, 50);
+ _set_penance(old_god, 50, exp_cost);
break;
case GOD_SIF_MUNA:
- _set_penance(old_god, 50);
+ _set_penance(old_god, 50, exp_cost);
break;
case GOD_NEMELEX_XOBEH:
nemelex_shuffle_decks();
- _set_penance(old_god, 150); // Nemelex penance is special
+ _set_penance(old_god, 150, exp_cost); // Nemelex penance is special
break;
case GOD_LUGONU:
- _set_penance(old_god, 50);
+ _set_penance(old_god, 50, exp_cost);
break;
case GOD_SHINING_ONE:
@@ -2965,7 +2973,7 @@ void excommunication(god_type new_god)
else
add_daction(DACT_HOLY_PETS_GO_NEUTRAL);
- _set_penance(old_god, 30);
+ _set_penance(old_god, 30, exp_cost);
break;
case GOD_ZIN:
@@ -2980,7 +2988,7 @@ void excommunication(god_type new_god)
if (!is_good_god(new_god))
add_daction(DACT_ALLY_HOLY);
- _set_penance(old_god, 25);
+ _set_penance(old_god, 25, exp_cost);
break;
case GOD_ELYVILON:
@@ -2993,7 +3001,7 @@ void excommunication(god_type new_god)
if (!is_good_god(new_god))
add_daction(DACT_ALLY_HOLY);
- _set_penance(old_god, 30);
+ _set_penance(old_god, 30, exp_cost);
break;
case GOD_JIYVA:
@@ -3009,7 +3017,7 @@ void excommunication(god_type new_god)
if (you.duration[DUR_SLIMIFY])
you.duration[DUR_SLIMIFY] = 0;
- _set_penance(old_god, 30);
+ _set_penance(old_god, 30, exp_cost);
break;
case GOD_FEDHAS:
@@ -3018,22 +3026,19 @@ void excommunication(god_type new_god)
mpr("The plants of the dungeon turn on you.", MSGCH_GOD, GOD_FEDHAS);
add_daction(DACT_ALLY_PLANT);
}
- _set_penance(old_god, 30);
+ _set_penance(old_god, 30, exp_cost);
break;
case GOD_ASHENZARI:
if (you.transfer_skill_points > 0)
ashenzari_end_transfer(false, true);
you.duration[DUR_SCRYING] = 0;
- you.exp_docked = exp_needed(min<int>(you.max_level, 27) + 1)
- - exp_needed(min<int>(you.max_level, 27));
- you.exp_docked_total = you.exp_docked;
- _set_penance(old_god, 50);
+ _set_penance(old_god, 50, exp_cost);
break;
case GOD_CHEIBRIADOS:
default:
- _set_penance(old_god, 25);
+ _set_penance(old_god, 25, exp_cost);
break;
}
@@ -3800,6 +3805,7 @@ void handle_god_time()
}
// Now roll to see whether we get retribution and from which god.
const unsigned int which_penance = random2(100);
+
if (which_penance < penance_count)
{
unsigned int count = 0;
@@ -3810,14 +3816,13 @@ void handle_god_time()
{
if (count == which_penance)
{
- divine_retribution((god_type)i);
+ divine_retribution((god_type) i);
break;
}
count++;
}
}
}
-
// Update the god's opinion of the player.
if (you.religion != GOD_NO_GOD)
{
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index fac2d2f..8511d28 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -1231,11 +1231,12 @@ static void tag_construct_you(writer &th)
marshallByte(th, NUM_GODS);
for (i = 0; i < NUM_GODS; i++)
marshallByte(th, you.penance[i]);
-
+
for (i = 0; i < NUM_GODS; ++i)
{
marshallInt(th, you.penance_exp[i]);
- }
+ marshallInt(th, you.penance_exp_total[i]);
+ }
// which gods have been worshipped by this character?
for (i = 0; i < NUM_GODS; i++)
@@ -2030,9 +2031,10 @@ static void tag_read_you(reader &th)
for (i = 0; i < NUM_GODS; ++i)
{
you.penance_exp[i] = unmarshallInt(th);
- }
+ you.penance_exp_total[i] = unmarshallInt(th);
+ }
}
- #endif
+ #endif
for (i = 0; i < count; i++)
you.worshipped[i] = unmarshallByte(th);
@@ -2057,7 +2059,7 @@ static void tag_read_you(reader &th)
you.exp_docked = unmarshallInt(th);
you.exp_docked_total = unmarshallInt(th);
-
+
// elapsed time
you.elapsed_time = unmarshallInt(th);
you.elapsed_time_at_last_input = you.elapsed_time;
--
1.7.4.4
|