HerculesWS / Hercules

Hercules is a collaborative software development project revolving around the creation of a robust massively multiplayer online role playing game (MMORPG) server package. Written in C, the program is very versatile and provides NPCs, warps and modifications. The project is jointly managed by a group of volunteers located around the world as well as a tremendous community providing QA and support. Hercules is a continuation of the original Athena project.
http://herc.ws
GNU General Public License v3.0
892 stars 757 forks source link

Sleeping monster still can continue attacking. #939

Open Emistry opened 8 years ago

Emistry commented 8 years ago

The monsters still can continue to attack the players when sleep status is casted on the monsters.

But, if i walk away from the monsters and return to them, it will not attacking because they're still under sleep status.

Skill used : Goodnight, Sweetie from Angra Manyu (item id: 1599).

Image of Yaktocat

AnnieRuru commented 8 years ago

confirm this, cast on monster, it still attack but if @pvpon, cast on player, the player does stop attacking though, which is correct

EDIT: test on rathena test server, they don't have this bug, only hercules

AnisotropicDefixation commented 8 years ago

The status cast by that skill isn't the same as normal sleep though.

AnnieRuru commented 8 years ago

GM_SANDMAN ? yea it force the target into sleep status indefinitely by changeoption OPT1_SLEEP, https://github.com/HerculesWS/Hercules/blob/master/src/map/skill.c#L9346 not using SC_SLEEP or SC_DEEP_SLEEP

EDIT: if the monster hit you once, it stop the attack animation there must be a clif ... missing to stop attack animation for monster

AnisotropicDefixation commented 8 years ago

Doesn't happen to me, using a slightly old version though. Comparing files, everything related to sleep is the same, could this be client related?

AnnieRuru commented 8 years ago

hmm .. I tested bonus2 bAddEff, Eff_Sleep, 10000; the monster did sleep properly stop attacking though, because it uses SC_SLEEP

just the OPT1_SLEEP the monster still attacking, until it actually hit you, or move out of its attack range

I also dunno the actual fix after comparing with rathena, looks almost the same as when I tested on rathena doesn't have this issue

latest hercules with client 20140115 latest rathena with client 20130807

MishimaHaruna commented 8 years ago

Hmm I could've sworn it was a clientside glitch (I remember with certain clients, sleeping units are still shown as walking in-place...) I'm surprised that there's a difference between Hercules and rAthena though. Can anyone check if, with the same client, there's a different behavior?

Playtester commented 8 years ago

If it was just a client issue, why are there damage numbers in the GIF? They can only be calculated by the server. So seems that the monster still keeps attacking.

Unlike PC, monster don't actually have any checks if they can attack, the only reason they don't is because their AI becomes lazy.

In "status_change_start" you need to call unit->stop_attack on SC_SLEEP, but that's already in the code on Herc. So I assume why it doesn't work is because you don't actually call status_change_start at all or it returns too early.

    // Abnormalities
    if(( md->sc.opt1 > 0 && md->sc.opt1 != OPT1_STONEWAIT && md->sc.opt1 != OPT1_BURNING && md->sc.opt1 != OPT1_CRYSTALIZE )
      || md->sc.data[SC_DEEP_SLEEP] || md->sc.data[SC_BLADESTOP] || md->sc.data[SC__MANHOLE] || md->sc.data[SC_CURSEDCIRCLE_TARGET]) {
        //Should reset targets.
        md->target_id = md->attacked_id = 0;
        return false;
    }

Also need to make sure that md->sc.opt1 > 0, but that's also correctly set in status.c already.