Attached Files |
fedhas-sac.patch [^] (2,806 bytes) 2014-02-20 15:25 [Show Content] [Hide Content]From acb5c2e288c7d967dcd25f9e311a7540e41bd8b8 Mon Sep 17 00:00:00 2001
From: Sage <SageBasilMint@gmail.com>
Date: Thu, 20 Feb 2014 12:36:16 +0000
Subject: [PATCH] Make auto_sacrifice work with Fedhas.
Fedhas now favours nonskeletal corpses in god_likes_item,
and for congruence with other blood gods, whenever a
Fedhasite prays on a stack that contains corpses, only
that stack is sacrificed. If a Fedhasite prays on a space
without corpses, then all corpses in LOS are sacrificed.
---
crawl-ref/source/godabil.cc | 27 ++++++++++++++++++++++++++-
crawl-ref/source/religion.cc | 5 +++++
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index a9d6c22..d5e1a18 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -1960,8 +1960,33 @@ int fedhas_fungal_bloom()
int seen_corpses = 0;
int processed_count = 0;
bool kills = false;
+ bool standing_on_corpse = false;
- for (radius_iterator i(you.pos(), LOS_NO_TRANS); i; ++i)
+ int ig = you.visible_igrd(you.pos());
+
+ while (ig != NON_ITEM)
+ {
+ item_def &item(mitm[ig]);
+ const int next = item.link;
+
+ if (item.base_type == OBJ_CORPSES
+ && item.sub_type == CORPSE_BODY)
+ {
+ //If you're standing on >=1 corpse, only sacrifice corpses
+ //on that tile.
+ standing_on_corpse = true;
+ break;
+ }
+ ig = next;
+ }
+
+ //Ternary radius is necessary due to problems with C_ROUND and C_POINTY:
+ //at radius 0, the former checked the tiles directly up, down, left, right
+ //of your position, and the latter didn't check 8 of the tiles furthest
+ //from you at radius == LOS_RADIUS.
+ for (radius_iterator i(you.pos(), standing_on_corpse ? 0 : LOS_RADIUS_SQ,
+ C_CIRCLE, LOS_NO_TRANS);
+ i; ++i)
{
monster* target = monster_at(*i);
if (!can_spawn_mushrooms(*i))
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 5d75396..8142d59 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -3451,6 +3451,7 @@ bool god_likes_items(god_type god, bool greedy_explore)
case GOD_NEMELEX_XOBEH:
case GOD_ASHENZARI:
case GOD_ELYVILON:
+ case GOD_FEDHAS:
return true;
case NUM_GODS: case GOD_RANDOM: case GOD_NAMELESS:
@@ -3501,6 +3502,10 @@ bool god_likes_item(god_type god, const item_def& item)
return item.base_type == OBJ_SCROLLS
&& item.sub_type == SCR_REMOVE_CURSE;
+ case GOD_FEDHAS:
+ return item.base_type == OBJ_CORPSES
+ && item.sub_type == CORPSE_BODY;
+
default:
return false;
}
--
1.7.9.5
|