summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-08 12:34:34 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-08 12:34:34 +0000
commit1688c6756463c584f8130785a7f84dfece538fdf (patch)
treedca3df0dd0848272b94eaefa1fc5db6fa9f686b8 /crawl-ref
parent98ffb74e5af50771a94e1b92a0bd97dc804ab8cf (diff)
downloadcrawl-ref-1688c6756463c584f8130785a7f84dfece538fdf.tar.gz
crawl-ref-1688c6756463c584f8130785a7f84dfece538fdf.zip
The accuracy of dragon breath is now halved if you're wielding
a weapon of dragon slaying (with the somewhat weak reasoning that a dragon will try to avert its eyes from your awful weapon). From how I read the code this function is only called if you are attacked as monsters will not breathe at other monsters, so that the above check is valid. Also fix 1865179: Airstrike now wakes (and annoys) monsters. 1861118: Evaporate now can be cancelled during potion or direction choice. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3223 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/mstuff2.cc11
-rw-r--r--crawl-ref/source/spells3.cc1
-rw-r--r--crawl-ref/source/spells4.cc30
-rw-r--r--crawl-ref/source/spells4.h2
-rw-r--r--crawl-ref/source/spl-cast.cc21
-rw-r--r--crawl-ref/source/spl-data.h2
6 files changed, 38 insertions, 29 deletions
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index d022bbc713..32ac2be14f 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -1066,6 +1066,17 @@ void setup_dragon(struct monsters *monster, struct bolt &pbolt)
pbolt.beam_source = monster_index(monster);
pbolt.thrower = KILL_MON;
pbolt.is_beam = true;
+
+ // accuracy is halved if you're wielding a weapon of dragon slaying
+ // (which makes the dragon/draconian avoid looking at you)
+ if ((mons_genus(monster->type) == MONS_DRAGON
+ || mons_genus(monster->type) == MONS_DRACONIAN)
+ && you.equip[EQ_WEAPON]
+ && get_weapon_brand(you.inv[you.equip[EQ_WEAPON]])
+ == SPWPN_DRAGON_SLAYING)
+ {
+ pbolt.hit /= 2;
+ }
} // end setup_dragon();
void setup_generic_throw(struct monsters *monster, struct bolt &pbolt)
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 39be278f5b..aa0a62dcf8 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -262,6 +262,7 @@ int airstrike(int power, dist &beam)
else
{
hurt_monster(monster, hurted);
+ behaviour_event(monster, ME_ANNOY, MHITYOU, you.x_pos, you.y_pos);
if (monster->hit_points < 1)
monster_die(monster, KILL_YOU, 0);
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 173f4ea7fd..665ebd1901 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -1680,43 +1680,21 @@ bool backlight_monsters(int x, int y, int pow, int garbage)
return (true);
} // end backlight_monsters()
-void cast_evaporate(int pow)
+bool cast_evaporate(int pow, bolt& beem, int potion)
{
// experimenting with allowing the potion to be thrown... we're
// still making it have to be "in hands" at this point. -- bwr
struct dist spelld;
- struct bolt beem;
-
- const int potion =
- prompt_invent_item( "Throw which potion?", MT_INVLIST, OBJ_POTIONS );
if (potion == -1)
- {
- msg::stream << "Wisps of steam play over your " << your_hand(true)
- << '.' << std::endl;
- return;
- }
+ return (false);
else if (you.inv[potion].base_type != OBJ_POTIONS)
{
mpr( "This spell works only on potions!" );
canned_msg(MSG_SPELL_FIZZLES);
- return;
- }
-
- message_current_target();
- direction( spelld, DIR_NONE, TARG_ENEMY );
-
- if (!spelld.isValid)
- {
- canned_msg(MSG_SPELL_FIZZLES);
- return;
+ return (false);
}
- beem.set_target(spelld);
-
- beem.source_x = you.x_pos;
- beem.source_y = you.y_pos;
-
beem.name = "potion";
beem.colour = you.inv[potion].colour;
beem.range = 9;
@@ -1812,7 +1790,7 @@ void cast_evaporate(int pow)
// both old and new code use up a potion:
dec_inv_item_quantity( potion, 1 );
- return;
+ return (true);
} // end cast_evaporate()
// The intent of this spell isn't to produce helpful potions
diff --git a/crawl-ref/source/spells4.h b/crawl-ref/source/spells4.h
index 55535bf37a..4493f40d3d 100644
--- a/crawl-ref/source/spells4.h
+++ b/crawl-ref/source/spells4.h
@@ -28,7 +28,7 @@ void cast_bend(int pow);
void cast_condensation_shield(int pow);
void cast_detect_secret_doors(int pow);
void cast_discharge(int pow);
-void cast_evaporate(int pow);
+bool cast_evaporate(int pow, bolt& beem, int potion);
void cast_fulsome_distillation(int powc);
void cast_forescry(int pow);
void cast_fragmentation(int powc);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 3fed232a04..40dde8443a 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -30,6 +30,7 @@
#include "food.h"
#include "format.h"
#include "initfile.h"
+#include "invent.h"
#include "it_use2.h"
#include "item_use.h"
#include "itemname.h"
@@ -864,12 +865,15 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
const int flags = get_spell_flags(spell);
+ int potion = -1;
+
// XXX: This handles only some of the cases where spells need targeting...
// there are others that do their own that will be missed by this
// (and thus will not properly ESC without cost because of it).
// Hopefully, those will eventually be fixed. -- bwr
if (flags & SPFLAG_TARGETING_MASK)
{
+ mpr("targeting mask is true");
targ_mode_type targ =
(testbits(flags, SPFLAG_HELPFUL) ? TARG_FRIEND : TARG_ENEMY);
@@ -890,6 +894,20 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
mprf(MSGCH_PROMPT, "Where do you want to aim %s?",
you.inv[idx].name(DESC_NOCAP_YOUR).c_str());
}
+ else if (spell == SPELL_EVAPORATE)
+ {
+ potion = prompt_invent_item( "Throw which potion?",
+ MT_INVLIST, OBJ_POTIONS );
+ if (potion == -1)
+ return (SPRET_ABORT);
+ else if (you.inv[potion].base_type != OBJ_POTIONS)
+ {
+ mpr( "This spell works only on potions!" );
+ return (SPRET_ABORT);
+ }
+ mprf(MSGCH_PROMPT, "Where do you want to aim %s?",
+ you.inv[potion].name(DESC_NOCAP_YOUR).c_str());
+ }
else if (dir == DIR_DIR)
mpr(prompt? prompt : "Which direction? ", MSGCH_PROMPT);
@@ -1813,7 +1831,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_EVAPORATE:
- cast_evaporate(powc);
+ if ( !cast_evaporate(powc, beam, potion) )
+ return SPRET_ABORT;
break;
case SPELL_FULSOME_DISTILLATION:
diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h
index f646744e7f..ed15d675f4 100644
--- a/crawl-ref/source/spl-data.h
+++ b/crawl-ref/source/spl-data.h
@@ -1989,7 +1989,7 @@
{
SPELL_EVAPORATE, "Evaporate",
SPTYP_FIRE | SPTYP_TRANSMIGRATION,
- SPFLAG_NONE,
+ SPFLAG_DIR_OR_TARGET,
2, // XXX: level 2 or 3, what should it be now? -- bwr
200,
NULL,