summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/delay.cc1
-rw-r--r--crawl-ref/source/direct.cc21
-rw-r--r--crawl-ref/source/enum.h8
-rw-r--r--crawl-ref/source/fight.cc5
-rw-r--r--crawl-ref/source/monstuff.cc11
-rw-r--r--crawl-ref/source/religion.cc18
-rw-r--r--crawl-ref/source/religion.h2
-rw-r--r--crawl-ref/source/tags.cc2
8 files changed, 50 insertions, 18 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 1e0f797446..cc3fc96a8e 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -167,6 +167,7 @@ static int recite_to_monsters(int x, int y, int pow, int unused)
default:
// permanently neutral, but same message as enchantment
mons->attitude = ATT_NEUTRAL;
+ mons->flags |= MF_WAS_NEUTRAL;
simple_monster_message(mons, " seems impressed!");
break;
}
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc
index 334793fb33..b365df2de1 100644
--- a/crawl-ref/source/direct.cc
+++ b/crawl-ref/source/direct.cc
@@ -794,9 +794,24 @@ void direction(dist& moves, targeting_type restricts,
{
monsters &m = menv[mid];
- m.attitude = (m.attitude == ATT_FRIENDLY? ATT_NEUTRAL :
- m.attitude == ATT_HOSTILE ? ATT_FRIENDLY
- : ATT_HOSTILE);
+ switch (m.attitude)
+ {
+ case ATT_FRIENDLY:
+ m.attitude = ATT_NEUTRAL;
+ m.flags &= ~MF_CREATED_FRIENDLY;
+ m.flags |= MF_WAS_NEUTRAL;
+ break;
+ case ATT_NEUTRAL:
+ m.attitude = ATT_HOSTILE;
+ m.flags &= ~MF_WAS_NEUTRAL;
+ break;
+ case ATT_HOSTILE:
+ m.attitude = ATT_FRIENDLY;
+ m.flags |= MF_CREATED_FRIENDLY;
+ break;
+ default:
+ break;
+ }
// To update visual branding of friendlies. Only
// seem capabable of adding bolding, not removing it,
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index b97b771084..7eb992672c 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -641,6 +641,7 @@ enum conduct_type
DID_KILL_WIZARD,
DID_KILL_PRIEST,
DID_KILL_ANGEL,
+ DID_KILL_NEUTRAL, // unused
DID_LIVING_KILLED_BY_UNDEAD_SLAVE,
DID_LIVING_KILLED_BY_SERVANT,
DID_UNDEAD_KILLED_BY_SERVANT,
@@ -1865,12 +1866,13 @@ enum monster_flag_type
// or that the player has inspected with ?
MF_BANISHED = 0x200, // Monster that has been banished.
MF_HARD_RESET = 0x400, // Summoned, should not drop gear on reset
- MF_ATT_CHANGE_ATTEMPT = 0x800, // Saw player and attitude changed (or
+ MF_WAS_NEUTRAL = 0x800, // mirror to CREATED_FRIENDLY for neutrals
+ MF_ATT_CHANGE_ATTEMPT = 0x1000, // Saw player and attitude changed (or
// not); currently used for holy beings
// (good god worshippers -> neutral)
// and orcs (Beogh worshippers -> friendly)
- MF_WAS_IN_VIEW = 0x1000, // Was in view during previous turn
- MF_BAND_MEMBER = 0x2000 // Created as a member of a band
+ MF_WAS_IN_VIEW = 0x2000, // Was in view during previous turn
+ MF_BAND_MEMBER = 0x4000 // Created as a member of a band
};
// Adding slots breaks saves. YHBW.
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 9e8da364e8..5170d50a56 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -970,7 +970,7 @@ bool melee_attack::player_apply_aux_unarmed()
poison_monster( def, KC_YOU );
if (mons_holiness(def) == MH_HOLY)
- did_god_conduct(DID_ATTACK_HOLY, 1);
+ did_god_conduct(DID_ATTACK_HOLY, 1, true, def);
// normal vampiric biting attack
if (damage_brand == SPWPN_VAMPIRICISM
@@ -1584,7 +1584,8 @@ void melee_attack::player_check_weapon_effects()
bool melee_attack::player_monattk_hit_effects(bool mondied)
{
if (mons_holiness(def) == MH_HOLY)
- did_god_conduct(mondied? DID_KILL_ANGEL : DID_ATTACK_HOLY, 1);
+ did_god_conduct(mondied? DID_KILL_ANGEL : DID_ATTACK_HOLY, 1,
+ true, def);
player_check_weapon_effects();
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 92a0f8c514..85e7250b04 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -403,9 +403,10 @@ static void give_adjusted_experience(monsters *monster, killer_type killer,
const bool created_friendly =
testbits(monster->flags, MF_CREATED_FRIENDLY);
+ const bool was_neutral = testbits(monster->flags, MF_WAS_NEUTRAL);
const bool no_xp = monster->has_ench(ENCH_ABJ);
- if (created_friendly || no_xp)
+ if (created_friendly || was_neutral || no_xp)
; // No experience if monster was created friendly or summoned.
else if (YOU_KILL(killer))
{
@@ -642,6 +643,8 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
{
const bool created_friendly =
testbits(monster->flags, MF_CREATED_FRIENDLY);
+ const bool was_neutral =
+ testbits(monster->flags, MF_WAS_NEUTRAL);
if (death_message)
{
@@ -650,7 +653,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
monster->name(DESC_NOCAP_THE).c_str());
}
- if (created_friendly && gives_xp && death_message)
+ if ((created_friendly || was_neutral) && gives_xp && death_message)
mpr("That felt strangely unrewarding.");
// killing triggers tutorial lesson
@@ -695,6 +698,10 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
if (mons_holiness(monster) == MH_HOLY)
did_god_conduct(DID_KILL_ANGEL, monster->hit_dice,
true, monster);
+
+ if (created_friendly)
+ did_god_conduct(DID_KILL_NEUTRAL, monster->hit_dice,
+ true, monster);
}
// Divine health and mp restoration doesn't happen when killing
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 7716ffe60f..9ab03c81be 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -762,7 +762,7 @@ static void do_god_gift(bool prayed_for)
break;
case GOD_ZIN:
- //jmf: "good" god will feed you (a la Nethack)
+ //jmf: this "good" god will feed you (a la Nethack)
if (you.hunger_state <= HS_STARVING
&& you.piety >= 30)
{
@@ -1147,7 +1147,7 @@ void god_speaks( god_type god, const char *mesg )
// This function is the merger of done_good() and naughty().
// Returns true if god was interested (good or bad) in conduct.
bool did_god_conduct( conduct_type thing_done, int level, bool known,
- const actor *victim )
+ const monsters *victim )
{
bool ret = false;
int piety_change = 0;
@@ -1217,7 +1217,7 @@ bool did_god_conduct( conduct_type thing_done, int level, bool known,
break;
}
piety_change = -level;
- if (known)
+ if (known || DID_ATTACK_HOLY && victim->attitude != ATT_HOSTILE)
penance = level * ((you.religion == GOD_SHINING_ONE) ? 2 : 1);
ret = true;
break;
@@ -1431,9 +1431,13 @@ bool did_god_conduct( conduct_type thing_done, int level, bool known,
case GOD_ZIN:
case GOD_SHINING_ONE:
case GOD_ELYVILON:
- level *= 3;
+ if (testbits(victim->flags, MF_CREATED_FRIENDLY)
+ || testbits(victim->flags, MF_WAS_NEUTRAL))
+ {
+ level *= 3;
+ penance = level * ((you.religion == GOD_ZIN) ? 2 : 1);
+ }
piety_change = -level;
- penance = level * ((you.religion == GOD_ZIN) ? 2 : 1);
ret = true;
break;
@@ -1636,6 +1640,7 @@ bool did_god_conduct( conduct_type thing_done, int level, bool known,
}
break;
+ case DID_KILL_NEUTRAL: // unused
case DID_STIMULANTS: // unused
case DID_EAT_MEAT: // unused
case DID_CREATED_LIFE: // unused
@@ -2952,7 +2957,7 @@ void beogh_idol_revenge()
dummy.attitude = ATT_FRIENDLY;
did_god_conduct(DID_ATTACK_FRIEND, 8, true,
- static_cast<actor *>(&dummy));
+ static_cast<const monsters *>(&dummy));
}
}
}
@@ -3080,6 +3085,7 @@ void good_god_convert_holy(monsters *holy)
holy->attitude = ATT_NEUTRAL;
holy->flags |= MF_GOD_GIFT;
+ holy->flags |= MF_WAS_NEUTRAL;
// to avoid immobile "followers"
behaviour_event(holy, ME_ALERT, MHITNOT);
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 76eae4ae65..147022b21b 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -40,7 +40,7 @@ void dec_penance(int val);
void dec_penance(god_type god, int val);
bool did_god_conduct(conduct_type thing_done, int pgain, bool known = true,
- const actor *victim = NULL);
+ const monsters *victim = NULL);
void excommunication(void);
void gain_piety(int pgn);
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index ab03c40274..7e54a35bef 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -2128,7 +2128,7 @@ void tag_missing_level_attitude()
break;
}
- menv[i].attitude = (isFriendly)?ATT_FRIENDLY : ATT_HOSTILE;
+ menv[i].attitude = (isFriendly)? ATT_FRIENDLY : ATT_HOSTILE;
menv[i].behaviour = static_cast<beh_type>(new_beh);
menv[i].foe_memory = 0;
}