From 63036c9e5ed0103475fea0c6710317f15e8cdb24 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Tue, 29 Jul 2008 22:59:35 +0000 Subject: Implemented monster spell miscasts. Spell miscasting is now handled by the MiscastEffect class, which has helper methods to make most of the non-helper code agnostic with respect to whether the miscaster is the player or a monster. Mummy death curses now affect monsters, and Zot traps now directly affect friendly and good-neutral monsters. In wizard mode you can force the player or a monster to miscast by targeting it and pressing 'M'. Todo/issues/notes: * Clouds now have a killer_type in addition to a kill_category. * There aren't any divination monster miscast effects yet. * Many of the harmless message-only miscast effects are missing monster messages. * If a monster actually miscasts a spell (not getting a mummy death curse or setting off a Zot trap) and this kills both the monster and the player then the wrong monster will be listed in hiscore entry. Since monsters can't do true spell miscasts yet, this can wait. * There was old, non-functioning code making Zot traps heal, haste or turn invisible hostile monsters that triggered it. I fixed it and then commented it out. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6723 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/decks.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/decks.cc') diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 6f6983c276..46848623ef 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -44,6 +44,7 @@ #include "spells3.h" #include "spells4.h" #include "spl-cast.h" +#include "spl-mis.h" #include "spl-util.h" #include "state.h" #include "stuff.h" @@ -2737,6 +2738,10 @@ bool card_effect(card_type which_card, deck_rarity_type rarity, bool rc = true; const int power = _card_power(rarity); + const god_type god = + (crawl_state.is_god_acting()) ? crawl_state.which_god_acting() + : GOD_NO_GOD; + #ifdef DEBUG_DIAGNOSTICS msg::streams(MSGCH_DIAGNOSTICS) << "Card power: " << power << ", rarity: " << static_cast(rarity) @@ -2844,8 +2849,9 @@ bool card_effect(card_type which_card, deck_rarity_type rarity, case CARD_WILD_MAGIC: // Yes, high power is bad here. - miscast_effect( SPTYP_RANDOM, random2(power/15) + 5, - random2(power), 0, "a card of wild magic" ); + MiscastEffect( &you, god == GOD_NO_GOD ? NON_MONSTER : -god, + SPTYP_RANDOM, random2(power/15) + 5, random2(power), + "a card of wild magic" ); break; case CARD_FAMINE: -- cgit v1.2.3-54-g00ecf