otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.59k stars 1.06k forks source link

Questions about monster spell range #4161

Closed soul4soul closed 5 months ago

soul4soul commented 2 years ago

If I understand correctly a monster can only see as far as the view port https://github.com/otland/forgottenserver/blob/master/src/monster.cpp#L98-L101 (There appears to be a typo here too, I believe the last param should be maxClientViewportY + 1)

But monster spell range is double view port, should this be changed to max(maxClientViewportX, maxClientViewportY ) + 1? https://github.com/otland/forgottenserver/blame/master/src/monsters.cpp#L127-L133 https://github.com/otland/forgottenserver/blob/master/src/monsters.cpp#L563-L566 It would be nice to add a warning to this condition block, to help maintain clean monster packs, ghazbaran has an attack with range 14, which is the only attack I see exceeding the range. Tangent information, In the current monster pack only 5 attacks have a range >=8 , while over 800 attacks have a range of exactly 7.

Range seems to work a bit differently for canUseSpell and canUseAttack. These code locations https://github.com/otland/forgottenserver/blob/master/src/monster.cpp#L846-L849 https://github.com/otland/forgottenserver/blob/master/src/monster.cpp#L879-L880 For canUseSpell 0 means don't check range For canUseAttack 0 skips the spell?

I see a few options which could be mixed and matched together.

My preference would be to default the attack range to viewport (it feels more flexible and would be less work to change if someone wanted a different viewport size), make 0 a valid range for canUseSpell and canUseAttack, and show a warning if range > viewport. Given those changes, I would have to do some testing in cipbia but conceivably many attacks in the data pack with range 7 and above could have the range removed and default to the viewport.

EPuncker commented 2 years ago

I vote for default to range 1 plus a warning

ramon-bernardo commented 1 year ago

https://github.com/otland/forgottenserver/blob/master/src/monster.cpp#L98-L101 (There appears to be a typo here too, I believe the last param should be maxClientViewportY + 1)

If changed to Y, it will be easier to run away from monsters, vertically