diff --git a/src/game/boe.combat.cpp b/src/game/boe.combat.cpp index 36602996e..04e9a4311 100644 --- a/src/game/boe.combat.cpp +++ b/src/game/boe.combat.cpp @@ -213,6 +213,23 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short nu start_outdoor_combat(encounter.what_monst, where, num_walls); } +void monst_hit_town_reaction(iLiving& monst_hit, bool print){ + if(monst_hit.is_friendly()){ + // Charmed enemy is fair game + if(monst_hit.status[eStatus::CHARM] > 0){ + monst_hit.status[eStatus::CHARM] = 0; + add_string_to_buf("Charm dispelled."); + if(cCreature* check = dynamic_cast(&monst_hit)){ + check->attitude = eAttitude::HOSTILE_A; + } + }else{ + // This message only prints when a spell was cast, not when you've confirmed attacking a friendly + if(print) add_string_to_buf("Damaged an innocent."); + make_town_hostile(); + } + } +} + bool pc_combat_move(location destination) { std::string create_line; short s1; @@ -268,8 +285,7 @@ bool pc_combat_move(location destination) { else if(result == "attack") do_attack = true; } if(do_attack) { - if(monst_hit->is_friendly()) - make_town_hostile(); + monst_hit_town_reaction(*monst_hit); univ.current_pc().last_attacked = monst_hit; pc_attack(univ.cur_pc,monst_hit); return true; @@ -1186,7 +1202,7 @@ void do_combat_cast(location target) { else { cCreature* cur_monst = dynamic_cast(victim); if(cur_monst && cur_monst->is_friendly() && spell_being_cast != eSpell::SCRY_MONSTER && spell_being_cast != eSpell::CAPTURE_SOUL) - make_town_hostile(); + monst_hit_town_reaction(*cur_monst); switch(spell_being_cast) { case eSpell::ACID_SPRAY: store_m_type = 0; diff --git a/src/game/boe.combat.hpp b/src/game/boe.combat.hpp index b0807df37..5fc4b43a4 100644 --- a/src/game/boe.combat.hpp +++ b/src/game/boe.combat.hpp @@ -28,6 +28,7 @@ bool combat_next_step(); bool pick_next_pc(); void combat_run_monst(); void do_monster_turn(); +void monst_hit_town_reaction(iLiving& monst_hit, bool print = false); void monster_attack(short who_att,iLiving* target); void monst_fire_missile(short m_num,short bless,std::pair abil,location source,iLiving* target); void monst_basic_abil(short m_num, std::pair abil, iLiving* target); diff --git a/src/game/boe.specials.cpp b/src/game/boe.specials.cpp index fbe0d5e6f..888d1b0ef 100644 --- a/src/game/boe.specials.cpp +++ b/src/game/boe.specials.cpp @@ -1576,9 +1576,7 @@ short damage_monst(cCreature& victim, short who_hit, short how_much, eDamageType if(victim.is_friendly() && who_hit < 7 && ((!processing_fields && !monsters_going) || (processing_fields && !univ.party.hostiles_present))) { - add_string_to_buf("Damaged an innocent."); - victim.attitude = eAttitude::HOSTILE_A; - make_town_hostile(); + monst_hit_town_reaction(victim, true); } return how_much; diff --git a/src/universe/creature.cpp b/src/universe/creature.cpp index 49764a6b6..92902a1c8 100644 --- a/src/universe/creature.cpp +++ b/src/universe/creature.cpp @@ -243,6 +243,7 @@ void cCreature::sleep(eStatus which_status,int amount,int penalty) { if(which_status == eStatus::CHARM) { if(amount <= 0 || amount > 3) amount = 2; attitude = eAttitude(amount); + status[eStatus::CHARM] = amount; spell_note(eSpellNote::CHARMED); } else if(which_status == eStatus::FORCECAGE) { status[eStatus::FORCECAGE] = amount;