summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/religion.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-28 23:00:12 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-28 23:00:12 +0000
commitca1e897a646bb9c098a1fc651a3b4aa6c976ddc7 (patch)
treedbf6313bff2e2906a4f9ee61fdefff8594849522 /crawl-ref/source/religion.cc
parent0f8c8527e5a685509462e0990a7b6ec6595e445a (diff)
downloadcrawl-ref-ca1e897a646bb9c098a1fc651a3b4aa6c976ddc7.tar.gz
crawl-ref-ca1e897a646bb9c098a1fc651a3b4aa6c976ddc7.zip
Apply r6640, r6694 (both by Darshan), r6670 (Haran), r6679 and r6703
(me) to branch. Includes TSO no longer granting permanent allies and resultant friendly pickup change, and a number of smaller changes. Also update change log. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@6709 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r--crawl-ref/source/religion.cc86
1 files changed, 39 insertions, 47 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 57e472414e..2d0e44b142 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -914,19 +914,19 @@ static bool _need_missile_gift()
static void _get_pure_deck_weights(int weights[])
{
- weights[0] = you.sacrifice_value[OBJ_ARMOUR] + 1;
- weights[1] = you.sacrifice_value[OBJ_WEAPONS]
- + you.sacrifice_value[OBJ_STAVES]
- + you.sacrifice_value[OBJ_MISSILES] + 1;
- weights[2] = you.sacrifice_value[OBJ_MISCELLANY]
- + you.sacrifice_value[OBJ_JEWELLERY]
- + you.sacrifice_value[OBJ_BOOKS]
- + you.sacrifice_value[OBJ_GOLD]; // only via acquirement
- weights[3] = you.sacrifice_value[OBJ_CORPSES] / 2;
- weights[4] = you.sacrifice_value[OBJ_POTIONS]
- + you.sacrifice_value[OBJ_SCROLLS]
- + you.sacrifice_value[OBJ_WANDS]
- + you.sacrifice_value[OBJ_FOOD];
+ weights[0] = you.sacrifice_value[OBJ_ARMOUR] + 1;
+ weights[1] = you.sacrifice_value[OBJ_WEAPONS]
+ + you.sacrifice_value[OBJ_STAVES]
+ + you.sacrifice_value[OBJ_MISSILES] + 1;
+ weights[2] = you.sacrifice_value[OBJ_MISCELLANY]
+ + you.sacrifice_value[OBJ_JEWELLERY]
+ + you.sacrifice_value[OBJ_BOOKS]
+ + you.sacrifice_value[OBJ_GOLD]; // only via acquirement
+ weights[3] = you.sacrifice_value[OBJ_CORPSES] / 2;
+ weights[4] = you.sacrifice_value[OBJ_POTIONS]
+ + you.sacrifice_value[OBJ_SCROLLS]
+ + you.sacrifice_value[OBJ_WANDS]
+ + you.sacrifice_value[OBJ_FOOD];
}
static void _update_sacrifice_weights(int which)
@@ -1294,6 +1294,22 @@ static bool _tso_blessing_holy_arm(monsters* mon)
return (true);
}
+static bool _increase_ench_duration(monsters *mon,
+ mon_enchant ench,
+ const int increase)
+{
+ // Durations are saved as 16-bit signed ints, so clamp at the largest such.
+ const int MARSHALL_MAX = (1 << 15) - 1;
+
+ const int newdur = std::min(ench.duration + increase, MARSHALL_MAX);
+ if (ench.duration >= newdur)
+ return false;
+
+ ench.duration = newdur;
+ mon->update_ench(ench);
+ return true;
+}
+
static int _tso_blessing_extend_stay(monsters* mon)
{
if (!mon->has_ench(ENCH_ABJ))
@@ -1301,25 +1317,12 @@ static int _tso_blessing_extend_stay(monsters* mon)
mon_enchant abj = mon->get_ench(ENCH_ABJ);
- const int increase = 300 + random2(300);
- const int threshold = (increase + random2(increase)) * 2;
-
- // Extend the time an abjurable monster has before disappearing.
- abj.duration += increase;
-
- // If the extended stay is long enough, make it permanent. Note
- // that we have to delete the enchantment without removing the
- // enchantment effect, in order to keep the monster from
- // disappearing.
- if (abj.duration >= threshold)
- {
- mon->del_ench(ENCH_ABJ, true, false);
- return 2;
- }
- else
- mon->update_ench(abj);
-
- return 1;
+ // [ds] Disabling permanence for balance reasons, but extending duration
+ // increase. These numbers are tenths of a player turn. Holy monsters
+ // get a much bigger boost than random beasties.
+ const int base_increase = mon->holiness() == MH_HOLY? 1100 : 500;
+ const int increase = base_increase + random2(base_increase);
+ return _increase_ench_duration(mon, abj, increase);
}
static bool _tso_blessing_friendliness(monsters* mon)
@@ -1327,21 +1330,10 @@ static bool _tso_blessing_friendliness(monsters* mon)
if (!mon->has_ench(ENCH_CHARM))
return (false);
- mon->attitude = ATT_FRIENDLY;
-
- // The monster is not really *created* friendly, but should it
- // become hostile later on, it won't count as a good kill.
- mon->flags |= MF_CREATED_FRIENDLY;
-
- mons_make_god_gift(mon, GOD_SHINING_ONE);
-
- // If the monster is charmed, make it permanently friendly. Note
- // that we have to delete the enchantment without removing the
- // enchantment effect, in order to keep the monster from turning
- // hostile.
- mon->del_ench(ENCH_CHARM, true, false);
-
- return (true);
+ // [ds] Just increase charm duration, no permanent friendliness.
+ const int base_increase = 700;
+ return _increase_ench_duration(mon, mon->get_ench(ENCH_CHARM),
+ base_increase + random2(base_increase));
}
// If you don't currently have any followers, send a small band to help