diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/map.hpp | 1 | ||||
-rw-r--r-- | src/map/mob.cpp | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/map/map.hpp b/src/map/map.hpp index aea35b7..a247bb6 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -472,6 +472,7 @@ struct mob_data : block_list std::unique_ptr<tick_t[]> skilldelayup; // [MAX_MOBSKILL]; LevelElement def_ele; BlockId master_id; + BlockId last_master_id; int master_dist; int exclusion_src, exclusion_party; NpcEvent npc_event; diff --git a/src/map/mob.cpp b/src/map/mob.cpp index 9fe6b2d..ddfdeb6 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -1845,6 +1845,18 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick) } md->state.master_check = 0; + // Processing of summoned monster attacked by owner + if (md->last_master_id && md->state.special_mob_ai) + { + if (((bl = map_id2bl(md->last_master_id)) != nullptr && md->bl_m != bl->bl_m) || (bl = map_id2bl(md->last_master_id)) == nullptr) + { + md->last_master_id = BlockId(); + md->state.special_mob_ai = 0; + md->mode = get_mob_db(md->mob_class).mode; + md->target_id = BlockId(); + md->attacked_id = BlockId(); + } + } // Processing of slave monster if (md->master_id && md->state.special_mob_ai == 0) mob_ai_sub_hard_slavemob(md, tick); @@ -2358,6 +2370,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage, && bool(md->mode & MobMode::TURNS_AGAINST_BAD_MASTER)) { /* If the master hits a monster, have the monster turn against him */ + md->last_master_id = md->master_id; md->master_id = BlockId(); md->mode = MobMode::war; /* Regular war mode */ md->target_id = src->bl_id; |