|
From: <gi...@cr...> - 2012-02-27 19:17:48
|
via a43d331d0bf458ca50df210ecb97541b30d2ccb8 (commit)
via 3d45f371ff118b1f94ed7c86f7a078b5e243ec8d (commit)
via d1e4f0bbf1409f7811de58ce78513baadde3d4e6 (commit)
via 184aaf8f17f95588acd559c9652c38b36043125d (commit)
via 803329ac97edf71145cb0eb18d424f3c89d48528 (commit)
via 71350e569ff89dffbbee83c113b171f033a731ca (commit)
via 34df0eff5c7548547a30ef30d73deee8b5016ffe (commit)
from 23c24d6e8b1382d5a0181c8b7600371d09e83f58 (commit)
-----------------------------------------------------------------------
commit a43d331d0bf458ca50df210ecb97541b30d2ccb8
Author: David Lawrence Ramsey <dol...@us...>
Date: Mon Feb 27 13:07:46 2012 -0600
Remove (possibly?) unneeded redraw_screen() from detect_secret_doors().
commit 3d45f371ff118b1f94ed7c86f7a078b5e243ec8d
Author: David Lawrence Ramsey <dol...@us...>
Date: Mon Feb 27 12:55:18 2012 -0600
Tweak cast_detect_secret_doors() into detect_secret_doors().
This makes it consistent with the other detect_* functions.
commit d1e4f0bbf1409f7811de58ce78513baadde3d4e6
Author: David Lawrence Ramsey <dol...@us...>
Date: Mon Feb 27 12:43:04 2012 -0600
Properly make all high-int monsters with spellcaster flags able to detect scrying.
commit 184aaf8f17f95588acd559c9652c38b36043125d
Author: David Lawrence Ramsey <dol...@us...>
Date: Mon Feb 27 12:42:15 2012 -0600
Fix outdated comment.
commit 803329ac97edf71145cb0eb18d424f3c89d48528
Author: David Lawrence Ramsey <dol...@us...>
Date: Mon Feb 27 12:33:49 2012 -0600
Add shim for Detect Secret Doors cast attempts.
commit 71350e569ff89dffbbee83c113b171f033a731ca
Author: David Lawrence Ramsey <dol...@us...>
Date: Mon Feb 27 11:58:46 2012 -0600
Properly make "You detect nothing." a canned message.
commit 34df0eff5c7548547a30ef30d73deee8b5016ffe
Author: David Lawrence Ramsey <dol...@us...>
Date: Mon Feb 27 11:55:45 2012 -0600
Clean up divinations functions a bit more.
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/decks.cc | 2 +-
crawl-ref/source/enum.h | 1 +
crawl-ref/source/mon-cast.cc | 2 +-
crawl-ref/source/spl-cast.cc | 4 +---
crawl-ref/source/spl-goditem.cc | 30 +++++++++++++++---------------
crawl-ref/source/spl-goditem.h | 2 +-
crawl-ref/source/stuff.cc | 3 +++
crawl-ref/source/xom.cc | 4 ++--
8 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 0ebc733..080dae7 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2287,7 +2287,7 @@ static void _dowsing_card(int power, deck_rarity_type rarity)
}
if (things_to_do[0])
- cast_detect_secret_doors(random2(power/4));
+ detect_secret_doors(random2(power/4));
if (things_to_do[1])
detect_traps(random2(power/4));
if (things_to_do[2])
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 0e021b8..eafb076 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -514,6 +514,7 @@ enum canned_message_type
MSG_MANA_DECREASE,
MSG_DISORIENTED,
MSG_TOO_HUNGRY,
+ MSG_DETECT_NOTHING,
};
enum char_set_type
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index 05402a6..77006fb 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -1842,7 +1842,7 @@ bool handle_mon_spell(monster* mons, bolt &beem)
mons_cast(mons, beem, spell_cast);
mons->lose_energy(EUT_SPELL);
}
- } // end "if mons_class_flag(mons->type, M_SPELLCASTER)
+ } // end "if (mons->can_use_spells())"
return (true);
}
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index b4b83e0..8da259e 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1629,10 +1629,8 @@ static spret_type _do_cast(spell_type spell, int powc,
return cast_controlled_blink(powc, fail);
#if TAG_MAJOR_VERSION == 32
+ case SPELL_DETECT_SECRET_DOORS:
case SPELL_DETECT_ITEMS:
- mpr("Sorry, this spell is gone!");
- return SPRET_ABORT;
-
case SPELL_DETECT_CREATURES:
mpr("Sorry, this spell is gone!");
return SPRET_ABORT;
diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc
index c60d5d4..f226dab 100644
--- a/crawl-ref/source/spl-goditem.cc
+++ b/crawl-ref/source/spl-goditem.cc
@@ -401,32 +401,35 @@ void antimagic()
}
// The description idea was okay, but this spell just isn't that exciting.
-// So I'm converting it to the more practical expose secret doors. -- bwr
-void cast_detect_secret_doors(int pow)
+// So I'm converting it to the more practical expose secret doors. - bwr
+int detect_secret_doors(int pow)
{
- int found = 0;
+ int doors_found = 0;
for (radius_iterator ri(you.get_los()); ri; ++ri)
+ {
if (grd(*ri) == DNGN_SECRET_DOOR && random2(pow) > random2(15))
{
reveal_secret_door(*ri);
- found++;
+ doors_found++;
}
+ }
- if (found)
- redraw_screen();
+ if (doors_found == 0)
+ canned_msg(MSG_DETECT_NOTHING);
+ else
+ mpr("You detect secret doors!");
- mprf("You detect %s", (found > 0) ? "secret doors!" : "nothing.");
+ return (doors_found);
}
int detect_traps(int pow)
{
pow = std::min(50, pow);
- // Trap detection moved to traps.cc. -am
-
+ // Trap detection moved to traps.cc. -am
const int range = 8 + random2(8) + pow;
- return reveal_traps(range);
+ return (reveal_traps(range));
}
// pow -1 for passive
@@ -554,12 +557,9 @@ int detect_creatures(int pow, bool telepathic)
}
// Assuming that highly intelligent spellcasters can
- // detect scrying. -- bwr
- if (mons_intel(mon) == I_HIGH
- && mons_class_flag(mon->type, M_SPELLCASTER))
- {
+ // detect scrying. - bwr
+ if (mons_intel(mon) == I_HIGH && mon->can_use_spells())
behaviour_event(mon, ME_DISTURB, MHITYOU, you.pos());
- }
}
}
diff --git a/crawl-ref/source/spl-goditem.h b/crawl-ref/source/spl-goditem.h
index 9b54468..1f05bc1 100644
--- a/crawl-ref/source/spl-goditem.h
+++ b/crawl-ref/source/spl-goditem.h
@@ -8,7 +8,7 @@ int cast_healing(int pow, bool divine_ability = false,
void antimagic();
-void cast_detect_secret_doors(int pow);
+int detect_secret_doors(int pow);
int detect_traps(int pow);
int detect_items(int pow);
int detect_creatures(int pow, bool telepathic = false);
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 165c0c1..af5f6cc 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -484,6 +484,9 @@ void canned_msg(canned_message_type which_message)
case MSG_TOO_HUNGRY:
mpr("You're too hungry.");
break;
+ case MSG_DETECT_NOTHING:
+ mpr("You detect nothing.");
+ break;
}
}
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 7a19526..b31e459 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -624,7 +624,7 @@ static int _xom_detect_items(int sever, int tension, bool debug = false)
"divination: detect items"), true);
if (detect_items(sever) == 0)
- mpr("You detect nothing.");
+ canned_msg(MSG_DETECT_NOTHING);
else
mpr("You detect items!");
@@ -645,7 +645,7 @@ static int _xom_detect_creatures(int sever, int tension, bool debug = false)
const int num_creatures = detect_creatures(sever);
if (num_creatures == 0)
- mpr("You detect nothing.");
+ canned_msg(MSG_DETECT_NOTHING);
else if (num_creatures == prev_detected)
{
// This is not strictly true. You could have cast Detect
--
Dungeon Crawl Stone Soup
|