Issue information

Issue ID
#6514
Status
Fixed
Severity
Fair
Started
Hercules Elf Bot
Aug 20, 2012 10:05
Last Post
Hercules Elf Bot
Nov 9, 2012 0:27
Confirmation
Yes (1)
No (0)

Hercules Elf Bot - Aug 20, 2012 10:05

Originally posted by [b]zippy[/b]
Since r16520, @slaveclone spawns do not get targeted by monsters.

[b]Replicate:[/b]
@slaveclone
@hide
@spawn hunter_fly

Hunter Fly will never target the slave even though it's being attacked.

[b]Problem Code:[/b]
in battle.c:
[CODE]
if( (target->type == BL_MOB && t_bl->type == BL_PC && ((TBL_MOB*)target)->special_state.ai < 4) ||
( t_bl->type == BL_MOB && !((TBL_MOB*)t_bl)->special_state.ai ) )
[/CODE]

Since the slave is type BL_MOB, has a master of the player, and special_state.ai is 1, it will always be marked as friend.
(@clone isn't affected since it has no master, therefore t_bl->type == BL_MOB)

[b]Correction:[/b]
I think the easiest way to fix it is to just exclude certain ones:
[CODE]
if(
( target->type == BL_MOB && t_bl->type == BL_PC && ( ((TBL_MOB*)target)->special_state.ai != 4 && ((TBL_MOB*)target)->special_state.ai != 1 ) ) ||
( t_bl->type == BL_MOB && !((TBL_MOB*)t_bl)->special_state.ai )
)
[/CODE]

This will allow Zanzou summons and player summoned friendly slaves to be marked as enemy, while Spheres and Floras will still be marked as friendly to the attacking monster.

Hercules Elf Bot - Aug 20, 2012 22:20

Originally posted by [b]mkbu95[/b]
[s]I was able to reproduce and indeed that fix works. Only I prefered to keep [code]((TBL_MOB*)target)->special_state.ai < 4[/code] and just add [code]&& ((TBL_MOB*)target)->special_state.ai != 1[/code] :P[/s]
Nevermind, fix won't work.
But I can reproduce the bug.

This post has been edited by mkbu95 on Nov 6, 2012 13:00

Hercules Elf Bot - Aug 20, 2012 23:35

Originally posted by [b]zippy[/b]
[quote name='mkbu95' timestamp='1345501237' post='13559']
I was able to reproduce and indeed that fix works. Only I prefered to keep [code]((TBL_MOB*)target)->special_state.ai < 4[/code] and just add [code]&& ((TBL_MOB*)target)->special_state.ai != 1[/code] :P
[/quote]

Yeah, but then the Zanzou summons wouldn't get attacked.

Hercules Elf Bot - Aug 21, 2012 0:32

Originally posted by [b]mkbu95[/b]
I may be a little outdated in this subject. Zanzou? I assume it's from Renewal :/
Your fix should work on pre-re (without this Zanzou summon) right?

Hercules Elf Bot - Nov 6, 2012 13:02

Originally posted by [b]mkbu95[/b]
Can I bump this? zippy provided an one-line fix, should be committed /slur

Hercules Elf Bot - Nov 9, 2012 0:27

Originally posted by [b]mkbu95[/b]
Fixed in [rev=16881].