forgottenserver
forgottenserver copied to clipboard
Questions about monster spell range
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.
- option A) Add a warning for attack spells with a range of 0
- option B) Don't make range of 0 invalid, although these spells would only be cast when the player is on the creature
- option C) Default the range to some valid value (maybe 1 or viewport)
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.
I vote for default to range 1 plus a warning
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