summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monster.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/monster.cc')
-rw-r--r--crawl-ref/source/monster.cc52
1 files changed, 33 insertions, 19 deletions
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 4b706d8a47..869e65ce68 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -19,8 +19,8 @@
#include "misc.h"
#include "mon-abil.h"
#include "mon-behv.h"
-#include "monplace.h"
-#include "monstuff.h"
+#include "mon-place.h"
+#include "mon-stuff.h"
#include "mtransit.h"
#include "random.h"
#include "religion.h"
@@ -52,7 +52,7 @@ monsters::monsters()
inv(NON_ITEM), spells(), attitude(ATT_HOSTILE), behaviour(BEH_WANDER),
foe(MHITYOU), enchantments(), flags(0L), experience(0), number(0),
colour(BLACK), foe_memory(0), shield_blocks(0), god(GOD_NO_GOD), ghost(),
- seen_context("")
+ seen_context(""), props()
{
travel_path.clear();
}
@@ -105,6 +105,7 @@ void monsters::reset()
travel_path.clear();
ghost.reset(NULL);
seen_context = "";
+ props.clear();
}
void monsters::init_with(const monsters &mon)
@@ -136,6 +137,7 @@ void monsters::init_with(const monsters &mon)
colour = mon.colour;
foe_memory = mon.foe_memory;
god = mon.god;
+ props = mon.props;
if (mon.ghost.get())
ghost.reset(new ghost_demon(*mon.ghost));
@@ -1199,6 +1201,8 @@ static bool _compatible_launcher_ammo_brands(item_def *launcher,
return (bow_brand != SPWPN_FLAME && bow_brand != SPWPN_FROST);
case SPMSL_CHAOS:
return (bow_brand != SPWPN_CHAOS);
+ case SPMSL_REAPING:
+ return (bow_brand != SPWPN_HOLY_WRATH);
default:
return (true);
}
@@ -1758,7 +1762,7 @@ bool monsters::pickup_misc(item_def &item, int near)
return (pickup(item, MSLOT_MISCELLANY, near));
}
-// Eaten items are handled elsewhere, in _handle_pickup() in monstuff.cc.
+// Eaten items are handled elsewhere, in _handle_pickup() in mon-stuff.cc.
bool monsters::pickup_item(item_def &item, int near, bool force)
{
// Equipping stuff can be forced when initially equipping monsters.
@@ -2850,7 +2854,7 @@ bool monsters::asleep() const
bool monsters::backlit(bool check_haloed) const
{
- return (has_ench(ENCH_BACKLIGHT)
+ return (has_ench(ENCH_CORONA)
|| ((check_haloed) ? haloed() : false));
}
@@ -3508,7 +3512,7 @@ bool monsters::rot(actor *agent, int amount, int immediate, bool quiet)
int monsters::hurt(const actor *agent, int amount, beam_type flavour,
bool cleanup_dead)
{
- if (hit_points > 0 && type != -1)
+ if (alive())
{
if (amount == INSTANT_DEATH)
amount = hit_points;
@@ -4208,6 +4212,11 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
simple_monster_message(this, " is no longer moving quickly.");
break;
+ case ENCH_SWIFT:
+ if (!quiet)
+ simple_monster_message(this, " is no longer moving somewhat quickly.");
+ break;
+
case ENCH_MIGHT:
if (!quiet)
simple_monster_message(this, " no longer looks unusually strong.");
@@ -4322,7 +4331,7 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
behaviour_event(this, ME_EVAL);
break;
- case ENCH_BACKLIGHT:
+ case ENCH_CORONA:
if (!quiet)
{
if (visible_to(&you))
@@ -4515,12 +4524,12 @@ void monsters::timeout_enchantments(int levels)
{
switch (i->first)
{
- case ENCH_POISON: case ENCH_ROT: case ENCH_BACKLIGHT:
+ case ENCH_POISON: case ENCH_ROT: case ENCH_CORONA:
case ENCH_STICKY_FLAME: case ENCH_ABJ: case ENCH_SHORT_LIVED:
case ENCH_SLOW: case ENCH_HASTE: case ENCH_MIGHT: case ENCH_FEAR:
case ENCH_INVIS: case ENCH_CHARM: case ENCH_SLEEP_WARY:
case ENCH_SICK: case ENCH_SLEEPY: case ENCH_PARALYSIS:
- case ENCH_PETRIFYING: case ENCH_PETRIFIED:
+ case ENCH_PETRIFYING: case ENCH_PETRIFIED: case ENCH_SWIFT:
case ENCH_BATTLE_FRENZY: case ENCH_NEUTRAL:
case ENCH_LOWERED_MR: case ENCH_SOUL_RIPE:
lose_ench_levels(i->second, levels);
@@ -4654,6 +4663,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
case ENCH_SLOW:
case ENCH_HASTE:
+ case ENCH_SWIFT:
case ENCH_MIGHT:
case ENCH_FEAR:
case ENCH_PARALYSIS:
@@ -4661,7 +4671,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
case ENCH_PETRIFYING:
case ENCH_PETRIFIED:
case ENCH_SICK:
- case ENCH_BACKLIGHT:
+ case ENCH_CORONA:
case ENCH_ABJ:
case ENCH_CHARM:
case ENCH_SLEEP_WARY:
@@ -5001,6 +5011,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
int rc = create_monster(mgen_data(MONS_GIANT_SPORE,
created_behavior,
+ this,
0,
0,
adjacent,
@@ -5576,7 +5587,7 @@ bool monsters::do_shaft()
return (reveal);
}
-bool monsters::can_sleep(bool holi_only) const
+bool monsters::can_hibernate(bool holi_only) const
{
// Undead, nonliving, and plants don't sleep.
const mon_holy_type holi = holiness();
@@ -5601,9 +5612,9 @@ bool monsters::can_sleep(bool holi_only) const
return (true);
}
-void monsters::put_to_sleep(int)
+void monsters::hibernate(int)
{
- if (!can_sleep())
+ if (!can_hibernate())
return;
behaviour = BEH_SLEEP;
@@ -5624,12 +5635,14 @@ const monsterentry *monsters::find_monsterentry() const
int monsters::action_energy(energy_use_type et) const
{
+ bool swift = has_ench(ENCH_SWIFT);
+
if (const monsterentry *me = find_monsterentry())
{
const mon_energy_usage &mu = me->energy_usage;
switch (et)
{
- case EUT_MOVE: return mu.move;
+ case EUT_MOVE: return mu.move - (swift ? 2 : 0);
case EUT_SWIM:
// [ds] Amphibious monsters get a significant speed boost
// when swimming, as discussed with dpeg. We do not
@@ -5638,9 +5651,9 @@ int monsters::action_energy(energy_use_type et) const
// favour water (HT_AMPHIBIOUS_WATER, such as merfolk), but
// that's something we can think about.
if (mons_amphibious(this))
- return div_rand_round(mu.swim * 7, 10);
+ return div_rand_round(mu.swim * 7, 10) - (swift ? 2 : 0);
else
- return mu.swim;
+ return mu.swim - (swift ? 2 : 0);
case EUT_MISSILE: return mu.missile;
case EUT_ITEM: return mu.item;
case EUT_SPECIAL: return mu.special;
@@ -5835,7 +5848,7 @@ void monsters::react_to_damage(int damage, beam_type flavour, kill_category whos
continue;
const int nmons = mons_place(
- mgen_data(jelly, beha, 0, 0,
+ mgen_data(jelly, beha, this, 0, 0,
jpos, foe, 0, god));
if (nmons != -1 && nmons != NON_MONSTER)
@@ -5893,7 +5906,7 @@ static const char *enchant_names[] =
"short-lived", "paralysis", "sick", "sleep", "fatigue", "held",
"blood-lust", "neutral", "petrifying", "petrified", "magic-vulnerable",
"soul-ripe", "decay", "hungry", "flopping", "spore-producing",
- "downtrodden", "bug"
+ "downtrodden", "swift", "bug"
};
static const char *_mons_enchantment_name(enchant_type ench)
@@ -5994,6 +6007,7 @@ int mon_enchant::calc_duration(const monsters *mons,
switch (ench)
{
case ENCH_HASTE:
+ case ENCH_SWIFT:
case ENCH_MIGHT:
case ENCH_INVIS:
cturn = 1000 / _mod_speed(25, mons->speed);
@@ -6030,7 +6044,7 @@ int mon_enchant::calc_duration(const monsters *mons,
cturn = 1000 * (deg - 1) / _mod_speed(333, mons->speed);
cturn += 1000 / _mod_speed(250, mons->speed);
break;
- case ENCH_BACKLIGHT:
+ case ENCH_CORONA:
if (deg > 1)
cturn = 1000 * (deg - 1) / _mod_speed(200, mons->speed);
cturn += 1000 / _mod_speed(100, mons->speed);