summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2009-11-25 14:02:38 +0100
committerAdam Borowski <kilobyte@angband.pl>2009-11-25 14:03:09 +0100
commit9e4ff27375df190391c1a7bbfe8851dd1bf26293 (patch)
treee1a88f6b5bdba42de22f54dfa5b4bddf350fb719 /crawl-ref/source
parent9a1056ab7e0feb88bb8bcf84411441de3dc32ba6 (diff)
downloadcrawl-ref-9e4ff27375df190391c1a7bbfe8851dd1bf26293.tar.gz
crawl-ref-9e4ff27375df190391c1a7bbfe8851dd1bf26293.zip
Implement reaping as a melee brand.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/describe.cc13
-rw-r--r--crawl-ref/source/fight.cc11
-rw-r--r--crawl-ref/source/item_use.cc40
-rw-r--r--crawl-ref/source/mon-stuff.cc41
-rw-r--r--crawl-ref/source/mon-stuff.h1
5 files changed, 62 insertions, 44 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 475ce9a72b..06d1ba722d 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -840,10 +840,15 @@ static std::string _describe_weapon(const item_def &item, bool verbose)
"its path until it reaches maximum range.";
break;
case SPWPN_REAPING:
- description += "If ammo fired by it kills a monster, "
- "causing it to leave a corpse, the corpse will be "
- "animated as a zombie friendly to the one who fired "
- "it.";
+ if (is_range_weapon(item))
+ description += "If ammo fired by it kills a monster, "
+ "causing it to leave a corpse, the corpse will be "
+ "animated as a zombie friendly to the one who fired "
+ "it.";
+ else
+ description += "All monsters killed with it which leave "
+ "corpses in good enough shape will be reanimated as "
+ "a zombie friendly to the killer.";
break;
}
}
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 45dc832c59..7a3288680e 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -2111,10 +2111,11 @@ void melee_attack::_monster_die(monsters* monster, killer_type killer,
int killer_index)
{
const bool chaos = (damage_brand == SPWPN_CHAOS);
+ const bool reaping = (damage_brand == SPWPN_REAPING);
// Copy defender before it gets reset by monster_die().
monsters* def_copy = NULL;
- if (chaos)
+ if (chaos || reaping)
def_copy = new monsters(*monster);
// The monster is about to die, so restore its original attitude
@@ -2125,13 +2126,19 @@ void melee_attack::_monster_die(monsters* monster, killer_type killer,
if (monster == defender && killer != KILL_RESET)
monster->attitude = defender_starting_attitude;
- monster_die(monster, killer, killer_index);
+ int corpse = monster_die(monster, killer, killer_index);
if (chaos)
{
chaos_killed_defender(def_copy);
delete def_copy;
}
+ else if (reaping)
+ {
+ if (corpse != -1)
+ mons_reaped(attacker, def_copy);
+ delete def_copy;
+ }
}
static bool is_boolean_resist(beam_type flavour)
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index cde532b561..698a066220 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1767,48 +1767,12 @@ static bool _silver_damages_victim(bolt &beam, actor* victim, int &dmg,
static bool _reaping_hit_victim(bolt& beam, actor* victim, int dmg, int corpse)
{
if (beam.is_tracer || victim->alive() || corpse == -1
- || corpse == NON_ITEM)
+ || corpse == NON_ITEM || victim->atype() == ACT_PLAYER)
{
return (false);
}
- actor* agent = beam.agent();
- beh_type beh;
- unsigned short hitting;
-
- if (agent->atype() == ACT_PLAYER)
- {
- hitting = MHITYOU;
- beh = BEH_FRIENDLY;
- }
- else
- {
- monsters *mon = dynamic_cast<monsters*>(agent);
-
- beh = SAME_ATTITUDE(mon);
-
- // Get a new foe for the zombie to target.
- behaviour_event(mon, ME_EVAL);
- hitting = mon->foe;
- }
-
- int midx = NON_MONSTER;
- if (animate_remains(victim->pos(), CORPSE_BODY, beh, hitting, agent, "",
- GOD_NO_GOD, true, true, true, &midx) <= 0)
- {
- return (false);
- }
-
- monsters *zombie = &menv[midx];
-
- if (you.can_see(victim))
- mprf("%s turns into a zombie!", victim->name(DESC_CAP_THE).c_str());
- else if (you.can_see(zombie))
- mprf("%s appears out of thin air!", zombie->name(DESC_CAP_THE).c_str());
-
- player_angers_monster(zombie);
-
- return (true);
+ return (mons_reaped(beam.agent(), dynamic_cast<monsters*>(victim)));
}
static bool _dispersal_hit_victim(bolt& beam, actor* victim, int dmg,
diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc
index af891dc167..c24de9ed47 100644
--- a/crawl-ref/source/mon-stuff.cc
+++ b/crawl-ref/source/mon-stuff.cc
@@ -49,6 +49,7 @@
#include "tutorial.h"
#include "view.h"
#include "shout.h"
+#include "spells3.h"
#include "viewchar.h"
#include "stash.h"
#include "xom.h"
@@ -3958,3 +3959,43 @@ std::string summoned_poof_msg(const monsters* monster, const item_def &item)
return summoned_poof_msg(monster, item.quantity > 1);
}
+
+bool mons_reaped(actor *killer, monsters *victim)
+{
+ beh_type beh;
+ unsigned short hitting;
+
+ if (killer->atype() == ACT_PLAYER)
+ {
+ hitting = MHITYOU;
+ beh = BEH_FRIENDLY;
+ }
+ else
+ {
+ monsters *mon = dynamic_cast<monsters*>(killer);
+
+ beh = SAME_ATTITUDE(mon);
+
+ // Get a new foe for the zombie to target.
+ behaviour_event(mon, ME_EVAL);
+ hitting = mon->foe;
+ }
+
+ int midx = NON_MONSTER;
+ if (animate_remains(victim->pos(), CORPSE_BODY, beh, hitting, killer, "",
+ GOD_NO_GOD, true, true, true, &midx) <= 0)
+ {
+ return (false);
+ }
+
+ monsters *zombie = &menv[midx];
+
+ if (you.can_see(victim))
+ mprf("%s turns into a zombie!", victim->name(DESC_CAP_THE).c_str());
+ else if (you.can_see(zombie))
+ mprf("%s appears out of thin air!", zombie->name(DESC_CAP_THE).c_str());
+
+ player_angers_monster(zombie);
+
+ return (true);
+}
diff --git a/crawl-ref/source/mon-stuff.h b/crawl-ref/source/mon-stuff.h
index 4c69d6b58a..97acee430f 100644
--- a/crawl-ref/source/mon-stuff.h
+++ b/crawl-ref/source/mon-stuff.h
@@ -174,4 +174,5 @@ std::string summoned_poof_msg(const int midx, const item_def &item);
std::string summoned_poof_msg(const monsters* monster, const item_def &item);
void pikel_band_neutralise();
+bool mons_reaped(actor *killer, monsters *victim);
#endif