Attached Files |
tukima.patch [^] (8,572 bytes) 2014-04-29 21:18 [Show Content] [Hide Content]From 241f0b454af9b981a93662e115d617cee2a4ecc3 Mon Sep 17 00:00:00 2001
From: Jeekaroose <sneakcow@gmail.com>
Date: Tue, 29 Apr 2014 18:13:57 +0000
Subject: [PATCH] Change Tukima to be a targeted spell
---
crawl-ref/source/dat/descript/spells.txt | 2 +-
crawl-ref/source/decks.cc | 2 +-
crawl-ref/source/spl-cast.cc | 6 +--
crawl-ref/source/spl-data.h | 10 ++--
crawl-ref/source/spl-summoning.cc | 88 ++++++++++++++++++++++++--------
crawl-ref/source/spl-summoning.h | 3 +-
6 files changed, 79 insertions(+), 32 deletions(-)
diff --git a/crawl-ref/source/dat/descript/spells.txt b/crawl-ref/source/dat/descript/spells.txt
index 7f25433..b36da12 100644
--- a/crawl-ref/source/dat/descript/spells.txt
+++ b/crawl-ref/source/dat/descript/spells.txt
@@ -1443,7 +1443,7 @@ Trog's Hand spell
%%%%
Tukima's Dance spell
-This spell causes a weapon held in the caster's hand to dance into the air and
+This spell causes a weapon held in the caster's or another creature's hand to dance into the air and
strike the caster's enemies. It will not function on certain wilful artefacts,
and any abilities that require evocation skill will not be active.
%%%%
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 90034e9..7e1d8ea 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2035,7 +2035,7 @@ static void _blade_card(int power, deck_rarity_type rarity)
if (power_level >= 2)
{
- cast_tukimas_dance(random2(power/4));
+ cast_tukimas_dance(random2(power/4), you.pos());
return;
}
else if (power_level == 1)
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index d09647e..efdfc0e 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1029,9 +1029,7 @@ static void _maybe_cancel_repeat(spell_type spell)
{
switch (spell)
{
- case SPELL_DELAYED_FIREBALL:
- case SPELL_TUKIMAS_DANCE:
- crawl_state.cant_cmd_repeat(make_stringf("You can't repeat %s.",
+ case SPELL_DELAYED_FIREBALL: crawl_state.cant_cmd_repeat(make_stringf("You can't repeat %s.",
spell_title(spell)));
break;
@@ -1605,7 +1603,7 @@ static spret_type _do_cast(spell_type spell, int powc,
case SPELL_TUKIMAS_DANCE:
// Temporarily turns a wielded weapon into a dancing weapon.
- return cast_tukimas_dance(powc, god, false, fail);
+ return cast_tukimas_dance(powc, beam.target, god, false, fail);
case SPELL_CONJURE_BALL_LIGHTNING:
return cast_conjure_ball_lightning(powc, god, fail);
diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h
index 5d54956..422d6ca 100644
--- a/crawl-ref/source/spl-data.h
+++ b/crawl-ref/source/spl-data.h
@@ -1049,14 +1049,14 @@ struct spell_desc
{
SPELL_TUKIMAS_DANCE, "Tukima's Dance",
SPTYP_HEXES,
- SPFLAG_NONE,
+ SPFLAG_DIR_OR_TARGET | SPFLAG_HELPFUL,
5,
- 100,
- -1, -1,
+ 200,
+ LOS_RADIUS, LOS_RADIUS,
0,
NULL,
- false,
- false
+ true,
+ true
},
{
diff --git a/crawl-ref/source/spl-summoning.cc b/crawl-ref/source/spl-summoning.cc
index d19b2bc..cbb0dd0 100644
--- a/crawl-ref/source/spl-summoning.cc
+++ b/crawl-ref/source/spl-summoning.cc
@@ -888,47 +888,93 @@ bool summon_holy_warrior(int pow, bool punish)
}
// This function seems to have very little regard for encapsulation.
-spret_type cast_tukimas_dance(int pow, god_type god, bool force_hostile,
- bool fail)
+spret_type cast_tukimas_dance(int pow, const coord_def& where, god_type god,
+ bool force_hostile, bool fail)
{
const int dur = min(2 + (random2(pow) / 5), 6);
- item_def* wpn = you.weapon();
+ monster *montarget = monster_at(where);
+ actor *target;
+ bool target_is_player;
+ string item_desc;
+ item_def* wpn;
+ if (you.pos() == where)
+ {
+ target = &you;
+ wpn = target->weapon();
+ target_is_player = true;
+ if (wpn)
+ item_desc = wpn->name(DESC_YOUR);
+ }
+ else if (montarget != NULL)
+ {
+ target = montarget;
+ wpn = target->weapon();
+ target_is_player = false;
+ if (wpn)
+ item_desc = wpn->name(DESC_ITS);
+ }
+ else
+ {
+ mprf("There's no weapon to animate there.");
+ return SPRET_ABORT;
+ }
// See if the wielded item is appropriate.
if (!wpn
|| !is_weapon(*wpn)
|| is_range_weapon(*wpn)
- || is_special_unrandom_artefact(*wpn))
+ || is_special_unrandom_artefact(*wpn)
+ || mons_class_is_animated_weapon(target->type))
{
if (wpn)
{
- mprf("%s vibrate%s crazily for a second.",
- wpn->name(DESC_YOUR).c_str(),
- wpn->quantity > 1 ? "" : "s");
+ if (mons_class_is_animated_weapon(target->type))
+ simple_monster_message(montarget, " is already dancing.");
+ else
+ mprf("%s vibrate%s crazily for a second.",
+ item_desc.c_str(),
+ wpn->quantity > 1 ? "" : "s");
}
else
- mprf("Your %s twitch.", you.hand_name(true).c_str());
-
+ {
+ if (target_is_player)
+ mprf("Your %s twitch.", target->hand_name(true).c_str());
+ else
+ mprf("Its %s twitch.", target->hand_name(true).c_str());
+ }
return SPRET_ABORT;
}
fail_check();
- item_def cp = *wpn;
- // Clear temp branding so we don't brand permanently.
- if (you.duration[DUR_WEAPON_BRAND])
- set_item_ego_type(cp, OBJ_WEAPONS, SPWPN_NORMAL);
- // Mark weapon as "thrown", so we'll autopickup it later.
- cp.flags |= ISFLAG_THROWN;
+ if (!target_is_player)
+ {
+ int res_margin = montarget->check_res_magic(pow);
+ if (res_margin > 0)
+ {
+ simple_monster_message(montarget, mons_resist_string(montarget, res_margin));
+ return SPRET_SUCCESS;
+ }
+ }
+ item_def cp = *wpn;
+ if (target_is_player)
+ {
+ // Clear temp branding so we don't brand permanently.
+ if (you.duration[DUR_WEAPON_BRAND])
+ set_item_ego_type(cp, OBJ_WEAPONS, SPWPN_NORMAL);
+
+ // Mark weapon as "thrown", so we'll autopickup it later.
+ cp.flags |= ISFLAG_THROWN;
+ }
// Cursed weapons become hostile.
const bool friendly = (!force_hostile && !wpn->cursed());
mgen_data mg(MONS_DANCING_WEAPON,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- force_hostile ? 0 : &you,
+ force_hostile ? 0 : target,
dur, SPELL_TUKIMAS_DANCE,
- you.pos(),
+ target->pos(),
MHITYOU,
MG_AUTOFOE, god);
mg.props[TUKIMA_WEAPON] = cp;
@@ -941,9 +987,11 @@ spret_type cast_tukimas_dance(int pow, god_type god, bool force_hostile,
// We are successful. Unwield the weapon, removing any wield
// effects.
- unwield_item();
-
- mprf("%s dances into the air!", wpn->name(DESC_YOUR).c_str());
+ mprf("%s dances into the air!", item_desc.c_str());
+ if (target_is_player)
+ unwield_item();
+ else
+ montarget->drop_item(MSLOT_WEAPON, false);
// Find out what our god thinks before killing the item.
conduct_type why = good_god_hates_item_handling(*wpn);
diff --git a/crawl-ref/source/spl-summoning.h b/crawl-ref/source/spl-summoning.h
index 816843d..24b1516 100644
--- a/crawl-ref/source/spl-summoning.h
+++ b/crawl-ref/source/spl-summoning.h
@@ -48,7 +48,8 @@ bool summon_berserker(int pow, actor *caster,
monster_type override_mons = MONS_PROGRAM_BUG);
bool summon_holy_warrior(int pow, bool punish);
-spret_type cast_tukimas_dance(int pow, god_type god = GOD_NO_GOD,
+spret_type cast_tukimas_dance(int pow, const coord_def& where,
+ god_type god = GOD_NO_GOD,
bool force_hostile = false, bool fail = false);
spret_type cast_conjure_ball_lightning(int pow, god_type god, bool fail);
spret_type cast_summon_lightning_spire(int pow, const coord_def& where, god_type god, bool fail);
--
1.8.3.2
|