|
From: <gi...@cr...> - 2025-12-01 19:20:09
|
via 07e17c3bcb62a17a05bd36598782bf5395852c37 (commit)
via 5803638258d1efd1b2ca33dcd8a7d0f9305ad2d8 (commit)
from 47fa2142d4440ccc63a331912aedd7d94f095cce (commit)
-----------------------------------------------------------------------
commit 07e17c3bcb62a17a05bd36598782bf5395852c37
Author: hellmonk <nld...@gm...>
Date: Mon Dec 1 12:49:55 2025 -0600
Improve wizmode parchment handling.
Allow specifying a parchment spell in &o. Default to generating a parchment
rather than the first book containing a spell when providing a spell name.
commit 5803638258d1efd1b2ca33dcd8a7d0f9305ad2d8
Author: hellmonk <nld...@gm...>
Date: Mon Dec 1 00:54:18 2025 -0600
Fix: let spriggan druids boon while blind.
The type of monster_near_iterator used required the druid to actually be able
to see the monster, meaning that blinding them prevented it from working.
Appears to be unintended, so use the other monster_near_iterator instead.
Do the same for pharaoh ant bind souls, just in case.
Fixes #4308
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/items.cc | 32 ++++++++++++++++----------------
crawl-ref/source/mon-death.cc | 4 ++--
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index d1b209d190..5db21068a8 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -4570,22 +4570,12 @@ static bool _book_from_spell(const char* specs, item_def &item)
if (type == SPELL_NO_SPELL)
return false;
- for (int i = 0; i < NUM_BOOKS; ++i)
- {
- const auto bt = static_cast<book_type>(i);
- if (!book_exists(bt))
- continue;
- for (spell_type sp : spellbook_template(bt))
- {
- if (sp == type)
- {
- item.sub_type = i;
- return true;
- }
- }
- }
+ if (!is_player_book_spell(type))
+ return false;
- return false;
+ item.sub_type = BOOK_PARCHMENT;
+ item.plus = static_cast<int>(type);
+ return true;
}
bool get_item_by_name(item_def *item, const char* specs,
@@ -4650,7 +4640,7 @@ bool get_item_by_name(item_def *item, const char* specs,
switch (class_wanted)
{
case OBJ_BOOKS:
- // Try if we get a match against a spell.
+ // Make a parchment if we get a match against a spell.
if (_book_from_spell(specs, *item))
type_wanted = item->sub_type;
break;
@@ -4764,6 +4754,16 @@ bool get_item_by_name(item_def *item, const char* specs,
}
item->skill_points = random_range(2000, 3000);
}
+ else if (item->sub_type == BOOK_PARCHMENT)
+ {
+ char buf[80];
+ msgwin_get_line_autohist("What parchment spell? ", buf, sizeof(buf));
+ if (buf[0] != '\0')
+ {
+ if (!_book_from_spell(buf, *item))
+ mpr("That parchment doesn't seem to exist.");
+ }
+ }
else if (type_wanted == BOOK_RANDART_THEME)
build_themed_book(*item, capped_spell_filter(20));
else if (type_wanted == BOOK_RANDART_LEVEL)
diff --git a/crawl-ref/source/mon-death.cc b/crawl-ref/source/mon-death.cc
index 9efa81463e..a8a268e5c8 100644
--- a/crawl-ref/source/mon-death.cc
+++ b/crawl-ref/source/mon-death.cc
@@ -1326,7 +1326,7 @@ static void _infestation_create_scarab(monster* mons)
static void _pharaoh_ant_bind_souls(monster *mons)
{
bool bound = false;
- for (monster_near_iterator mi(mons, LOS_NO_TRANS); mi; ++mi)
+ for (monster_near_iterator mi(mons->pos(), LOS_NO_TRANS); mi; ++mi)
{
if (!mons_can_bind_soul(mons, *mi))
continue;
@@ -1601,7 +1601,7 @@ static void _make_derived_undead(monster* mons, bool quiet,
static void _druid_final_boon(const monster* mons)
{
vector<monster*> beasts;
- for (monster_near_iterator mi(mons); mi; ++mi)
+ for (monster_near_iterator mi(mons->pos()); mi; ++mi)
{
if (mons_is_beast(mons_base_type(**mi)) && mons_aligned(mons, *mi))
beasts.push_back(*mi);
--
Dungeon Crawl Stone Soup
|