summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-03 23:02:32 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-03 23:02:32 +0000
commit49815faa5cfe1cce614f4d2bbab9341613a662c5 (patch)
tree9bf29a86509e1cbbf39674875d832d080fb0bdda /crawl-ref
parent72aae92fdbbe1afa692ebe0bf9dc32e59ae9e368 (diff)
downloadcrawl-ref-49815faa5cfe1cce614f4d2bbab9341613a662c5.tar.gz
crawl-ref-49815faa5cfe1cce614f4d2bbab9341613a662c5.zip
[2070013]: newly created, animated, etc. friendly monsters now default to
'follow me' behaviour, rather than following your last command (even if was before they were summoned.) Their behaviour can still be changed by giving them commands, of course. The previous behaviour was clearly intentional so I'm not too sure about this change; feel free to revert if I'm missing something. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8886 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/abl-show.cc7
-rw-r--r--crawl-ref/source/decks.cc18
-rw-r--r--crawl-ref/source/it_use3.cc12
-rw-r--r--crawl-ref/source/item_use.cc4
-rw-r--r--crawl-ref/source/monstuff.cc2
-rw-r--r--crawl-ref/source/player.cc2
-rw-r--r--crawl-ref/source/religion.cc5
-rw-r--r--crawl-ref/source/spells2.cc36
-rw-r--r--crawl-ref/source/spells3.cc25
-rw-r--r--crawl-ref/source/spl-cast.cc4
-rw-r--r--crawl-ref/source/xom.cc15
11 files changed, 48 insertions, 82 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 9ee74cd549..0d290f460e 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -1376,8 +1376,7 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_RAISE_DEAD:
- animate_dead(&you, you.experience_level * 5, BEH_FRIENDLY,
- you.pet_target);
+ animate_dead(&you, you.experience_level * 5, BEH_FRIENDLY, MHITYOU);
break;
case ABIL_CONTROL_DEMON:
@@ -1551,7 +1550,7 @@ static bool _do_ability(const ability_def& abil)
mpr("You attempt to give life to the dead...");
if (animate_remains(you.pos(), CORPSE_BODY, BEH_FRIENDLY,
- you.pet_target, GOD_YREDELEMNUL) < 0)
+ MHITYOU, GOD_YREDELEMNUL) < 0)
{
mpr("There are no remains here to animate!");
}
@@ -1567,7 +1566,7 @@ static bool _do_ability(const ability_def& abil)
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);
+ MHITYOU, GOD_YREDELEMNUL);
exercise(SK_INVOCATIONS, 2 + random2(4));
break;
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 0a68bc629f..5007625023 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2510,7 +2510,7 @@ static bool _trowel_card(int power, deck_rarity_type rarity)
if (create_monster(
mgen_data(RANDOM_ELEMENT(golems),
BEH_FRIENDLY, 5, 0,
- you.pos(), you.pet_target)) != -1)
+ you.pos(), MHITYOU)) != -1)
{
mpr("You construct a golem!");
num_made++;
@@ -2694,7 +2694,7 @@ static void _summon_demon_card(int power, deck_rarity_type rarity)
create_monster(
mgen_data(summon_any_demon(dct), BEH_FRIENDLY,
std::min(power / 50, 6), 0,
- you.pos(), you.pet_target));
+ you.pos(), MHITYOU));
}
static void _summon_any_monster(int power, deck_rarity_type rarity)
@@ -2748,7 +2748,7 @@ static void _summon_any_monster(int power, deck_rarity_type rarity)
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
3, 0,
chosen_spot,
- friendly ? you.pet_target : MHITYOU));
+ MHITYOU));
}
static void _summon_dancing_weapon(int power, deck_rarity_type rarity)
@@ -2760,8 +2760,7 @@ static void _summon_dancing_weapon(int power, deck_rarity_type rarity)
create_monster(
mgen_data(MONS_DANCING_WEAPON,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- power_level + 3, 0, you.pos(),
- friendly ? you.pet_target : MHITYOU));
+ power_level + 3, 0, you.pos(), MHITYOU));
// Given the abundance of Nemelex decks, not setting hard reset
// leaves a trail of weapons behind, most of which just get
@@ -2833,8 +2832,7 @@ static void _summon_flying(int power, deck_rarity_type rarity)
mgen_data(result,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
std::min(power / 50, 6), 0,
- you.pos(),
- friendly ? you.pet_target : MHITYOU));
+ you.pos(), MHITYOU));
}
}
@@ -2851,8 +2849,7 @@ static void _summon_skeleton(int power, deck_rarity_type rarity)
skeltypes[power_level],
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
std::min(power / 50, 6), 0,
- you.pos(),
- friendly ? you.pet_target : MHITYOU));
+ you.pos(), MHITYOU));
}
static void _summon_ugly(int power, deck_rarity_type rarity)
@@ -2871,8 +2868,7 @@ static void _summon_ugly(int power, deck_rarity_type rarity)
mgen_data(ugly,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
std::min(power / 50, 6), 0,
- you.pos(),
- friendly ? you.pet_target : MHITYOU));
+ you.pos(), MHITYOU));
}
static int _card_power(deck_rarity_type rarity)
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index e4dadc298b..460059ad27 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -227,8 +227,7 @@ void special_wielded()
if (x_chance_in_y(player_spec_death() + 1, 8))
{
create_monster(
- mgen_data(MONS_SHADOW, BEH_FRIENDLY,
- 2, 0, you.pos(), you.pet_target));
+ mgen_data(MONS_SHADOW, BEH_FRIENDLY, 2, 0, you.pos(), MHITYOU));
did_god_conduct(DID_NECROMANCY, 1);
}
break;
@@ -718,8 +717,7 @@ static bool efreet_flask(void)
mgen_data(MONS_EFREET,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
0, 0, you.pos(),
- friendly ? you.pet_target : MHITYOU,
- MG_FORCE_BEH));
+ MHITYOU, MG_FORCE_BEH));
if (monster != -1)
{
@@ -986,17 +984,13 @@ static bool box_of_beasts()
while (player_will_anger_monster(beasty));
beh_type beha = BEH_FRIENDLY;
- unsigned short hitting = you.pet_target;
if (one_chance_in(you.skills[SK_EVOCATIONS] + 5))
- {
beha = BEH_HOSTILE;
- hitting = MHITYOU;
- }
if (create_monster(
mgen_data(beasty, beha, 2 + random2(4), 0,
- you.pos(), hitting)) != -1)
+ you.pos(), MHITYOU)) != -1)
{
success = true;
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index e124618f5e..cbe90a4083 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1810,7 +1810,7 @@ static bool _shadow_hit_victim(bolt& beam, actor* victim, int dmg, int corpse)
if (agent->atype() == ACT_PLAYER)
{
- hitting = you.pet_target;
+ hitting = MHITYOU;
beh = BEH_FRIENDLY;
}
else
@@ -4857,7 +4857,7 @@ void read_scroll(int slot)
{
const int monster = create_monster(
mgen_data(MONS_ABOMINATION_SMALL, BEH_FRIENDLY,
- 0, 0, you.pos(), you.pet_target,
+ 0, 0, you.pos(), MHITYOU,
MG_FORCE_BEH));
if (monster != -1)
{
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 87cb8ae73e..b41ddefabe 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1377,7 +1377,7 @@ int monster_die(monsters *monster, killer_type killer,
const int spectre =
create_monster(
mgen_data(MONS_SPECTRAL_THING, BEH_FRIENDLY,
- 0, 0, monster->pos(), you.pet_target,
+ 0, 0, monster->pos(), MHITYOU,
0, static_cast<god_type>(you.attribute[ATTR_DIVINE_DEATH_CHANNEL]),
spectre_type, monster->number));
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 8fae69b5f7..786cb8f58d 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6538,7 +6538,7 @@ void player::attacking(actor *other)
{
const monsters *mon = dynamic_cast<monsters*>(other);
if (!mons_friendly(mon) && !mons_neutral(mon))
- pet_target = monster_index(mon);
+ pet_target = mon->mindex();
}
if (player_mutation_level(MUT_BERSERK)
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 7206d08bdc..31a2ccd18a 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -944,8 +944,7 @@ static int _yred_random_servants(int threshold, bool force_hostile = false)
how_many = 2 + random2(4);
mgen_data mg(mon, !force_hostile ? BEH_FRIENDLY : BEH_HOSTILE,
- 0, 0, you.pos(), !force_hostile ? you.pet_target : MHITYOU,
- 0, GOD_YREDELEMNUL);
+ 0, 0, you.pos(), MHITYOU, 0, GOD_YREDELEMNUL);
int created = 0;
if (force_hostile)
@@ -1562,7 +1561,7 @@ static void _beogh_blessing_reinforcement()
_delayed_monster(
mgen_data(follower_type, BEH_FRIENDLY, 0, 0,
- you.pos(), you.pet_target, 0, GOD_BEOGH),
+ you.pos(), MHITYOU, 0, GOD_BEOGH),
_beogh_reinf_callback);
}
}
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 2b4f7c7641..7f3f04a494 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -934,8 +934,7 @@ bool summon_animals(int pow)
if (create_monster(
mgen_data(mon,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- 4, 0, you.pos(),
- friendly ? you.pet_target : MHITYOU)) != -1)
+ 4, 0, you.pos(), MHITYOU)) != -1)
{
success = true;
}
@@ -955,7 +954,7 @@ bool cast_summon_butterflies(int pow, god_type god)
if (create_monster(
mgen_data(MONS_BUTTERFLY, BEH_FRIENDLY,
3, SPELL_SUMMON_BUTTERFLIES,
- you.pos(), you.pet_target,
+ you.pos(), MHITYOU,
0, god)) != -1)
{
success = true;
@@ -1015,7 +1014,7 @@ bool cast_summon_small_mammals(int pow, god_type god)
if (create_monster(
mgen_data(mon, BEH_FRIENDLY,
3, SPELL_SUMMON_SMALL_MAMMALS,
- you.pos(), you.pet_target,
+ you.pos(), MHITYOU,
0, god)) != -1)
{
success = true;
@@ -1050,7 +1049,6 @@ bool cast_sticks_to_snakes(int pow, god_type god)
int how_many_max = 1 + random2(1 + you.skills[SK_TRANSMUTATION]) / 4;
const bool friendly = (!item_cursed(wpn));
const beh_type beha = (friendly) ? BEH_FRIENDLY : BEH_HOSTILE;
- const unsigned short hitting = (friendly) ? you.pet_target : MHITYOU;
int count = 0;
@@ -1073,7 +1071,7 @@ bool cast_sticks_to_snakes(int pow, god_type god)
if (create_monster(
mgen_data(mon, beha,
dur, SPELL_STICKS_TO_SNAKES,
- you.pos(), hitting,
+ you.pos(), MHITYOU,
0, god)) != -1)
{
count++;
@@ -1121,7 +1119,7 @@ bool cast_sticks_to_snakes(int pow, god_type god)
if (create_monster(
mgen_data(mon, beha,
dur, SPELL_STICKS_TO_SNAKES,
- you.pos(), hitting,
+ you.pos(), MHITYOU,
0, god)) != -1)
{
count++;
@@ -1161,8 +1159,7 @@ bool cast_summon_scorpions(int pow, god_type god)
mgen_data(MONS_SCORPION,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
3, SPELL_SUMMON_SCORPIONS,
- you.pos(),
- friendly ? you.pet_target : MHITYOU,
+ you.pos(), MHITYOU,
0, god)) != -1)
{
success = true;
@@ -1247,7 +1244,7 @@ bool cast_summon_swarm(int pow, god_type god,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
dur, !permanent ? SPELL_SUMMON_SWARM : 0,
you.pos(),
- friendly ? you.pet_target : MHITYOU,
+ MHITYOU,
0, god)) != -1)
{
success = true;
@@ -1307,7 +1304,7 @@ bool cast_call_canine_familiar(int pow, god_type god)
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
dur, SPELL_CALL_CANINE_FAMILIAR,
you.pos(),
- friendly ? you.pet_target : MHITYOU,
+ MHITYOU,
0, god)) != -1)
{
success = true;
@@ -1447,7 +1444,7 @@ bool cast_summon_elemental(int pow, god_type god,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
dur, SPELL_SUMMON_ELEMENTAL,
targ,
- friendly ? you.pet_target : MHITYOU,
+ MHITYOU,
0, god)) == -1)
{
canned_msg(MSG_NOTHING_HAPPENS);
@@ -1471,7 +1468,7 @@ bool cast_summon_ice_beast(int pow, god_type god)
if (create_monster(
mgen_data(mon, BEH_FRIENDLY,
dur, SPELL_SUMMON_ICE_BEAST,
- you.pos(), you.pet_target,
+ you.pos(), MHITYOU,
0, god)) != -1)
{
mpr("A chill wind blows around you.");
@@ -1497,7 +1494,7 @@ bool cast_summon_ugly_thing(int pow, god_type god)
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
dur, SPELL_SUMMON_UGLY_THING,
you.pos(),
- friendly ? you.pet_target : MHITYOU,
+ MHITYOU,
0, god)) != -1)
{
mpr((mon == MONS_VERY_UGLY_THING) ? "A very ugly thing appears."
@@ -1527,7 +1524,7 @@ bool cast_summon_dragon(int pow, god_type god)
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
3, SPELL_SUMMON_DRAGON,
you.pos(),
- friendly ? you.pet_target : MHITYOU,
+ MHITYOU,
0, god)) != -1)
{
mpr("A dragon appears.");
@@ -1593,10 +1590,7 @@ bool summon_berserker(int pow, god_type god, int spell,
create_monster(
mgen_data(mon,
!force_hostile ? BEH_FRIENDLY : BEH_HOSTILE,
- dur, spell,
- you.pos(),
- !force_hostile ? you.pet_target : MHITYOU,
- 0, god));
+ dur, spell, you.pos(), MHITYOU, 0, god));
if (monster == -1)
return (false);
@@ -1632,7 +1626,7 @@ static bool _summon_holy_being_wrapper(int pow, god_type god, int spell,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
dur, spell,
you.pos(),
- friendly ? you.pet_target : MHITYOU,
+ MHITYOU,
MG_FORCE_BEH, god));
if (monster == -1)
@@ -1725,7 +1719,7 @@ bool cast_tukimas_dance(int pow, god_type god,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
dur, SPELL_TUKIMAS_DANCE,
you.pos(),
- friendly ? you.pet_target : MHITYOU,
+ MHITYOU,
0, god));
if (monster == -1)
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index da8b438a4d..a80762d568 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -404,10 +404,8 @@ bool cast_call_imp(int pow, god_type god)
const int monster =
create_monster(
- mgen_data(mon, BEH_FRIENDLY,
- dur, SPELL_CALL_IMP,
- you.pos(), you.pet_target,
- MG_FORCE_BEH, god));
+ mgen_data(mon, BEH_FRIENDLY, dur, SPELL_CALL_IMP,
+ you.pos(), MHITYOU, MG_FORCE_BEH, god));
if (monster != -1)
{
@@ -436,10 +434,7 @@ static bool _summon_demon_wrapper(int pow, god_type god, int spell,
mgen_data(mon,
friendly ? BEH_FRIENDLY :
charmed ? BEH_CHARMED : BEH_HOSTILE,
- dur, spell,
- you.pos(),
- friendly ? you.pet_target : MHITYOU,
- MG_FORCE_BEH, god));
+ dur, spell, you.pos(), MHITYOU, MG_FORCE_BEH, god));
if (monster != -1)
{
@@ -550,7 +545,7 @@ bool cast_shadow_creatures(god_type god)
create_monster(
mgen_data(RANDOM_MONSTER, BEH_FRIENDLY,
2, SPELL_SHADOW_CREATURES,
- you.pos(), you.pet_target,
+ you.pos(), MHITYOU,
MG_FORCE_BEH, god), false);
if (monster == -1)
@@ -595,7 +590,7 @@ bool cast_summon_horrible_things(int pow, god_type god)
if (create_monster(
mgen_data(MONS_TENTACLED_MONSTROSITY, BEH_FRIENDLY,
6, SPELL_SUMMON_HORRIBLE_THINGS,
- you.pos(), you.pet_target,
+ you.pos(), MHITYOU,
0, god)) != -1)
{
count++;
@@ -609,7 +604,7 @@ bool cast_summon_horrible_things(int pow, god_type god)
if (create_monster(
mgen_data(MONS_ABOMINATION_LARGE, BEH_FRIENDLY,
6, SPELL_SUMMON_HORRIBLE_THINGS,
- you.pos(), you.pet_target,
+ you.pos(), MHITYOU,
0, god)) != -1)
{
count++;
@@ -1003,7 +998,7 @@ bool cast_simulacrum(int pow, god_type god)
if (create_monster(
mgen_data(MONS_SIMULACRUM_SMALL, BEH_FRIENDLY,
6, SPELL_SIMULACRUM,
- you.pos(), you.pet_target,
+ you.pos(), MHITYOU,
0, god, mon)) != -1)
{
count++;
@@ -1088,7 +1083,7 @@ bool cast_twisted_resurrection(int pow, god_type god)
create_monster(
mgen_data(mon, BEH_FRIENDLY,
0, SPELL_TWISTED_RESURRECTION,
- you.pos(), you.pet_target,
+ you.pos(), MHITYOU,
MG_FORCE_BEH, god,
MONS_PROGRAM_BUG, 0, colour));
@@ -1140,9 +1135,7 @@ bool cast_summon_wraiths(int pow, god_type god)
mgen_data(mon,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
5, SPELL_SUMMON_WRAITHS,
- you.pos(),
- friendly ? you.pet_target : MHITYOU,
- MG_FORCE_BEH, god));
+ you.pos(), MHITYOU, MG_FORCE_BEH, god));
if (monster != -1)
{
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 52643974dd..016c168260 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1606,7 +1606,7 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
mpr("You attempt to give life to the dead...");
if (animate_remains(you.pos(), CORPSE_SKELETON, BEH_FRIENDLY,
- you.pet_target, god) < 0)
+ MHITYOU, god) < 0)
{
mpr("There is no skeleton here to animate!");
}
@@ -1615,7 +1615,7 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
case SPELL_ANIMATE_DEAD:
mpr("You call on the dead to walk for you...");
- animate_dead(&you, powc + 1, BEH_FRIENDLY, you.pet_target, god);
+ animate_dead(&you, powc + 1, BEH_FRIENDLY, MHITYOU, god);
break;
case SPELL_SIMULACRUM:
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index b06a91be40..eac3d1a241 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -815,7 +815,7 @@ static bool _xom_send_allies(int sever)
create_monster(
mgen_data(monster, BEH_FRIENDLY,
3, MON_SUMM_AID,
- you.pos(), you.pet_target,
+ you.pos(), MHITYOU,
MG_FORCE_BEH, GOD_XOM));
if (summons[i] != -1)
@@ -898,20 +898,16 @@ static bool _xom_send_one_ally(int sever)
bool different = !is_demonic;
beh_type beha = BEH_FRIENDLY;
- unsigned short hitting = you.pet_target;
// There's a chance that a non-demon may be hostile.
if (different && one_chance_in(4))
- {
beha = BEH_HOSTILE;
- hitting = MHITYOU;
- }
const int summons =
create_monster(
mgen_data(mon, beha,
6, MON_SUMM_AID,
- you.pos(), hitting,
+ you.pos(), MHITYOU,
MG_FORCE_BEH, GOD_XOM));
if (summons != -1)
@@ -1046,20 +1042,15 @@ static bool _xom_send_major_ally(int sever)
const bool is_demonic = (mons_class_holiness(mon) == MH_DEMONIC);
beh_type beha = BEH_FRIENDLY;
- unsigned short hitting = you.pet_target;
// There's a chance that a non-demon may be hostile.
if (!is_demonic && one_chance_in(4))
- {
beha = BEH_HOSTILE;
- hitting = MHITYOU;
- }
const int summons =
create_monster(
mgen_data(_xom_random_demon(sever, one_chance_in(8)), beha,
- 0, 0, you.pos(), hitting,
- MG_FORCE_BEH, GOD_XOM));
+ 0, 0, you.pos(), MHITYOU, MG_FORCE_BEH, GOD_XOM));
if (summons != -1)
{