summaryrefslogtreecommitdiff
path: root/src/map/battle.cpp
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2019-08-26 18:27:03 -0400
committergumi <git@gumi.ca>2019-08-26 18:27:03 -0400
commitac0d6abbcce17a9e2ed51a82271a618433e450e5 (patch)
treeb882defae64231081e3cf78ed8933030e87d8dd3 /src/map/battle.cpp
parent2a9166cbacba332dd39154800a9bc5c75e3bb78d (diff)
downloadtmwa-ac0d6abbcce17a9e2ed51a82271a618433e450e5.tar.gz
tmwa-ac0d6abbcce17a9e2ed51a82271a618433e450e5.tar.bz2
tmwa-ac0d6abbcce17a9e2ed51a82271a618433e450e5.tar.xz
tmwa-ac0d6abbcce17a9e2ed51a82271a618433e450e5.zip
fix mob slaves not attacking
Diffstat (limited to 'src/map/battle.cpp')
-rw-r--r--src/map/battle.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index a4596e9..6379b60 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -2072,28 +2072,22 @@ int battle_check_target(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
dumb_ptr<mob_data> md = src->is_mob();
if (md && (md->master_id || md->parent_id))
{
- if (md->master_id == target->bl_id || md->parent_id == target->bl_id) // 主なら肯定
+ if (md->master_id == target->bl_id || md->parent_id == target->bl_id) // can't attack my master or my parent
return 1;
- if (md->state.special_mob_ai)
+
+ if (target->bl_type == BL::MOB)
{
- if (target->bl_type == BL::MOB)
- { //special_mob_aiで対象がMob
- dumb_ptr<mob_data> tmd = target->is_mob();
- if (tmd)
- {
- if (tmd->master_id != md->master_id) //召喚主が一緒でなければ否定
- return 0;
- else
- { //召喚主が一緒なので肯定したいけど自爆は否定
- if (md->state.special_mob_ai > 2)
- return 0;
- else
- return 1;
- }
- }
+ dumb_ptr<mob_data> tmd = target->is_mob();
+ if (tmd)
+ {
+ if (tmd->master_id != md->master_id && tmd->parent_id != md->parent_id) // different master and parent
+ return 0;
+ else
+ return 1; // can't attack a mob that has the same master or parent as me
}
}
- if ((ss = map_id2bl(md->master_id)) == nullptr)
+
+ if ((ss = map_id2bl(md->parent_id)) == nullptr)
return -1;
}
}