summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-23 05:40:11 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-23 05:40:11 +0000
commit8ba107149b1da7f22fa0ca7faa369a93a6d0cb29 (patch)
treee4004bc4ec62ffd8605cf7552d1e3b684553e4d2 /crawl-ref/source
parenta19dd0dd929c31c3fbeb0479a2498df3b51ad057 (diff)
downloadcrawl-ref-8ba107149b1da7f22fa0ca7faa369a93a6d0cb29.tar.gz
crawl-ref-8ba107149b1da7f22fa0ca7faa369a93a6d0cb29.zip
Make messages for animating single skeletons/corpses versus multiple
ones consistent. Also, display a proper warning message if a player tries to animate a single skeleton/corpse while not actually standing on one. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8707 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/abl-show.cc11
-rw-r--r--crawl-ref/source/item_use.cc4
-rw-r--r--crawl-ref/source/spells3.cc30
-rw-r--r--crawl-ref/source/spells3.h8
-rw-r--r--crawl-ref/source/spl-cast.cc11
5 files changed, 42 insertions, 22 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 8dbb11752d..ce87fb2f07 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -1548,9 +1548,13 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_YRED_ANIMATE_REMAINS:
- mpr("You call on the dead to walk for you...");
- animate_remains(you.pos(), CORPSE_BODY, BEH_FRIENDLY, you.pet_target,
- GOD_YREDELEMNUL);
+ mpr("You attempt to give life to the dead...");
+
+ if (animate_remains(you.pos(), CORPSE_BODY, BEH_FRIENDLY,
+ you.pet_target, GOD_YREDELEMNUL) < 0)
+ {
+ mpr("There are no remains here to animate!");
+ }
exercise(SK_INVOCATIONS, 2 + random2(4));
break;
@@ -1561,6 +1565,7 @@ static bool _do_ability(const ability_def& abil)
case ABIL_YRED_ANIMATE_DEAD:
mpr("You call on the dead to walk for you...");
+
animate_dead(&you, 1 + you.skills[SK_INVOCATIONS], BEH_FRIENDLY,
you.pet_target, GOD_YREDELEMNUL);
exercise(SK_INVOCATIONS, 2 + random2(4));
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 9b98b02c18..9a84c93cf9 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1825,8 +1825,8 @@ static bool _shadow_hit_victim(bolt& beam, actor* victim, int dmg, int corpse)
}
int midx = NON_MONSTER;
- if (!animate_remains(victim->pos(), CORPSE_BODY, beh, hitting,
- GOD_NO_GOD, true, true, &midx))
+ if (animate_remains(victim->pos(), CORPSE_BODY, beh, hitting,
+ GOD_NO_GOD, true, true, &midx) <= 0)
{
return (false);
}
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index f931e6c763..502733785f 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -872,23 +872,27 @@ static bool _raise_remains(const coord_def &a, int corps, beh_type beha,
return (false);
}
-bool animate_remains(const coord_def &a, corpse_type class_allowed,
- beh_type beha, unsigned short hitting,
- god_type god, bool actual,
- bool quiet, int* mon_index)
+int animate_remains(const coord_def &a, corpse_type class_allowed,
+ beh_type beha, unsigned short hitting,
+ god_type god, bool actual,
+ bool quiet, int* mon_index)
{
if (is_sanctuary(a))
- return (false);
+ return (0);
+ int number_found = 0;
bool success = false;
// Search all the items on the ground for a corpse.
for (stack_iterator si(a); si; ++si)
{
- if (_animatable_remains(*si)
- && (class_allowed == CORPSE_BODY
- || si->sub_type == CORPSE_SKELETON))
+ if (class_allowed == CORPSE_BODY || si->sub_type == CORPSE_SKELETON)
{
+ number_found++;
+
+ if (!_animatable_remains(*si))
+ continue;
+
const bool was_butchering = is_being_butchered(*si);
success = _raise_remains(a, si.link(), beha, hitting, god, actual,
@@ -913,7 +917,13 @@ bool animate_remains(const coord_def &a, corpse_type class_allowed,
}
}
- return (success);
+ if (number_found == 0)
+ return (-1);
+
+ if (!success)
+ return (0);
+
+ return (1);
}
int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting,
@@ -969,7 +979,7 @@ int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting,
const bool was_butchering = is_being_butchered(*si, false);
if (animate_remains(a, CORPSE_BODY, beha, hitting, god,
- actual, true))
+ actual, true) > 0)
{
number_raised++;
diff --git a/crawl-ref/source/spells3.h b/crawl-ref/source/spells3.h
index c4e33d720d..dc60cd6599 100644
--- a/crawl-ref/source/spells3.h
+++ b/crawl-ref/source/spells3.h
@@ -51,10 +51,10 @@ bool cast_shadow_creatures(god_type god = GOD_NO_GOD);
bool cast_summon_horrible_things(int pow, god_type god = GOD_NO_GOD);
void equip_undead(const coord_def &a, int corps, int monster, int monnum);
-bool animate_remains(const coord_def &a, corpse_type class_allowed,
- beh_type beha, unsigned short hitting,
- god_type god = GOD_NO_GOD, bool actual = true,
- bool quiet = false, int* mon_index = NULL);
+int animate_remains(const coord_def &a, corpse_type class_allowed,
+ beh_type beha, unsigned short hitting,
+ god_type god = GOD_NO_GOD, bool actual = true,
+ bool quiet = false, int* mon_index = NULL);
int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting,
god_type god = GOD_NO_GOD, bool actual = true);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index f26f102fbf..7b9c50fdec 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1597,12 +1597,17 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
case SPELL_ANIMATE_SKELETON:
mpr("You attempt to give life to the dead...");
- animate_remains(you.pos(), CORPSE_SKELETON, BEH_FRIENDLY,
- you.pet_target, god);
+
+ if (animate_remains(you.pos(), CORPSE_SKELETON, BEH_FRIENDLY,
+ you.pet_target, god) < 0)
+ {
+ mpr("There is no skeleton here to animate!");
+ }
break;
case SPELL_ANIMATE_DEAD:
- mpr("You call on the dead to walk for you.");
+ mpr("You call on the dead to walk for you...");
+
animate_dead(&you, powc + 1, BEH_FRIENDLY, you.pet_target, god);
break;