summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorsmokexyz <sagunkho@hotmail.com>2017-03-22 04:42:41 +0800
committersmokexyz <sagunkho@hotmail.com>2017-03-23 18:20:27 +0800
commitcb4297e6eb734c60825ebfa13f32989fa3a470eb (patch)
tree4708caf658fa180ecba358bda1b3f48450ac0b7c /src/map/battle.c
parent7ae9186ff6efac28047180ba836f480e8b158cc9 (diff)
downloadhercules-cb4297e6eb734c60825ebfa13f32989fa3a470eb.tar.gz
hercules-cb4297e6eb734c60825ebfa13f32989fa3a470eb.tar.bz2
hercules-cb4297e6eb734c60825ebfa13f32989fa3a470eb.tar.xz
hercules-cb4297e6eb734c60825ebfa13f32989fa3a470eb.zip
Fixes issue #1647
Allow skills and attacks with flags BCT_ENEMY and BCT_PARTY to affect "guild enemy units" within the party on maps with flag `gvg` and `gvg_noparty`.
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 77bb99730..8b6ac2cc0 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -6814,14 +6814,23 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
if( flag&(BCT_PARTY|BCT_ENEMY) ) {
int s_party = status->get_party_id(s_bl);
int s_guild = status->get_guild_id(s_bl);
-
- if( s_party && s_party == status->get_party_id(t_bl)
- && !(map->list[m].flag.pvp && map->list[m].flag.pvp_noparty)
- && !(map_flag_gvg(m) && map->list[m].flag.gvg_noparty && !( s_guild && s_guild == status->get_guild_id(t_bl) ))
- && (!map->list[m].flag.battleground || sbg_id == tbg_id) )
- state |= BCT_PARTY;
- else
+ int t_guild = status->get_guild_id(t_bl);
+
+ if (s_party && s_party == status->get_party_id(t_bl)) {
+ if (map_flag_gvg(m) && map->list[m].flag.gvg_noparty && !(s_guild && s_guild == t_guild)) {
+ if (t_guild && guild->isallied(s_guild, t_guild))
+ state |= BCT_PARTY;
+ else
+ state |= flag&BCT_ENEMY ? BCT_ENEMY : BCT_PARTY;
+ } else if (!(map->list[m].flag.pvp && map->list[m].flag.pvp_noparty)
+ && (!map->list[m].flag.battleground || sbg_id == tbg_id)) {
+ state |= BCT_PARTY;
+ } else {
+ state |= BCT_ENEMY;
+ }
+ } else {
state |= BCT_ENEMY;
+ }
}
if( flag&(BCT_GUILD|BCT_ENEMY) ) {
int s_guild = status->get_guild_id(s_bl);