summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-04 19:41:08 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-04 19:41:08 +0000
commit013e0c0e9f3d7f35d9a9f8565622f4d7f3d17dee (patch)
tree695da72afb8c5755f9a11927a8e0da4fdb0b5baa
parent55d5736219e39edcf1976aa6ac909a64e7104cf1 (diff)
downloadcrawl-ref-013e0c0e9f3d7f35d9a9f8565622f4d7f3d17dee.tar.gz
crawl-ref-013e0c0e9f3d7f35d9a9f8565622f4d7f3d17dee.zip
Fix [2187753]: friendlies with spells targeting you if you don't give
them another target. This is a hack, not a good solution, and it assumes that friendlies do not want to target you with spells (I believe this is currently true, but if we implement an enslavable monster that can heal others, it won't be.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8893 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/misc.cc74
-rw-r--r--crawl-ref/source/mon-util.cc18
-rw-r--r--crawl-ref/source/monstuff.cc2
3 files changed, 45 insertions, 49 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index c6dc6b787c..8781e201ce 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -88,46 +88,33 @@ static void _create_monster_hide(int mons_class)
if (o == NON_ITEM)
return;
+ item_def& item = mitm[o];
+
// These values are common to all: {dlb}
- mitm[o].base_type = OBJ_ARMOUR;
- mitm[o].quantity = 1;
- mitm[o].plus = 0;
- mitm[o].plus2 = 0;
- mitm[o].special = 0;
- mitm[o].flags = 0;
- mitm[o].colour = mons_class_colour(mons_class);
+ item.base_type = OBJ_ARMOUR;
+ item.quantity = 1;
+ item.plus = 0;
+ item.plus2 = 0;
+ item.special = 0;
+ item.flags = 0;
+ item.colour = mons_class_colour(mons_class);
// These values cannot be set by a reasonable formula: {dlb}
switch (mons_class)
{
- case MONS_DRAGON:
- mitm[o].sub_type = ARM_DRAGON_HIDE;
- break;
- case MONS_TROLL:
- mitm[o].sub_type = ARM_TROLL_HIDE;
- break;
- case MONS_ICE_DRAGON:
- mitm[o].sub_type = ARM_ICE_DRAGON_HIDE;
- break;
- case MONS_STEAM_DRAGON:
- mitm[o].sub_type = ARM_STEAM_DRAGON_HIDE;
- break;
- case MONS_MOTTLED_DRAGON:
- mitm[o].sub_type = ARM_MOTTLED_DRAGON_HIDE;
- break;
- case MONS_STORM_DRAGON:
- mitm[o].sub_type = ARM_STORM_DRAGON_HIDE;
- break;
- case MONS_GOLDEN_DRAGON:
- mitm[o].sub_type = ARM_GOLD_DRAGON_HIDE;
- break;
- case MONS_SWAMP_DRAGON:
- mitm[o].sub_type = ARM_SWAMP_DRAGON_HIDE;
- break;
+ case MONS_DRAGON: item.sub_type = ARM_DRAGON_HIDE; break;
+ case MONS_TROLL: item.sub_type = ARM_TROLL_HIDE; break;
+ case MONS_ICE_DRAGON: item.sub_type = ARM_ICE_DRAGON_HIDE; break;
+ case MONS_STEAM_DRAGON: item.sub_type = ARM_STEAM_DRAGON_HIDE; break;
+ case MONS_MOTTLED_DRAGON: item.sub_type = ARM_MOTTLED_DRAGON_HIDE; break;
+ case MONS_STORM_DRAGON: item.sub_type = ARM_STORM_DRAGON_HIDE; break;
+ case MONS_GOLDEN_DRAGON: item.sub_type = ARM_GOLD_DRAGON_HIDE; break;
+ case MONS_SWAMP_DRAGON: item.sub_type = ARM_SWAMP_DRAGON_HIDE; break;
+
case MONS_SHEEP:
case MONS_YAK:
default:
- mitm[o].sub_type = ARM_ANIMAL_SKIN;
+ item.sub_type = ARM_ANIMAL_SKIN;
break;
}
@@ -1002,7 +989,7 @@ void split_potions_into_decay( int obj, int amount, bool need_msg )
item.special = 0;
item.flags = 0;
item.colour = potion.colour;
- item.inscription = "";
+ item.inscription.clear();
item.pos.set(-1, -1);
you.inv[obj].quantity -= amount;
@@ -1477,6 +1464,8 @@ static int runes_in_pack()
bool check_annotation_exclusion_warning()
{
+ // Players might not realize the implications of teleport
+ // mutations in the labyrinth.
if (grd(you.pos()) == DNGN_ENTER_LABYRINTH
&& player_mutation_level(MUT_TELEPORT))
{
@@ -1779,20 +1768,11 @@ void up_stairs(dungeon_feature_type force_stair,
{
switch (old_level_id.branch)
{
- case BRANCH_COCYTUS:
- stair_find = DNGN_ENTER_COCYTUS;
- break;
- case BRANCH_DIS:
- stair_find = DNGN_ENTER_DIS;
- break;
- case BRANCH_GEHENNA:
- stair_find = DNGN_ENTER_GEHENNA;
- break;
- case BRANCH_TARTARUS:
- stair_find = DNGN_ENTER_TARTARUS;
- break;
- default:
- break;
+ case BRANCH_COCYTUS: stair_find = DNGN_ENTER_COCYTUS; break;
+ case BRANCH_DIS: stair_find = DNGN_ENTER_DIS; break;
+ case BRANCH_GEHENNA: stair_find = DNGN_ENTER_GEHENNA; break;
+ case BRANCH_TARTARUS: stair_find = DNGN_ENTER_TARTARUS; break;
+ default: break;
}
}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index a80d4affca..9241e3350d 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2724,6 +2724,24 @@ bool mons_should_fire(struct bolt &beam)
beam.friend_info.count, beam.friend_info.power,
beam.foe_ratio, beam.smart_monster ? "yes" : "no");
#endif
+
+ // Friendly monsters shouldn't be targetting you: this will happen
+ // often because the default behaviour for charmed monsters is to
+ // have you as a target. While foe_ratio will handle this, we
+ // don't want a situation where a friendly dragon breathes through
+ // you to hit other creatures...it should target the other
+ // creatures, and coincidentally hit you.
+ //
+ // FIXME: this can cause problems with reflection, bounces, etc.
+ // It would be better to have the monster fire logic never reach
+ // this point for friendlies.
+ if (!invalid_monster_index(beam.beam_source))
+ {
+ monsters& m = menv[beam.beam_source];
+ if (m.alive() && mons_friendly(&m) && beam.target == you.pos())
+ return (false);
+ }
+
// Use of foeRatio:
// The higher this number, the more monsters will _avoid_ collateral
// damage to their friends.
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 95aa729e1e..669f833d1b 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5267,8 +5267,6 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
{
bool used = false;
- FixedArray < unsigned int, 19, 19 > show;
-
const monster_type mclass = (mons_genus( monster->type ) == MONS_DRACONIAN)
? draco_subspecies( monster )
: static_cast<monster_type>( monster->type );