forgottenserver icon indicating copy to clipboard operation
forgottenserver copied to clipboard

Questions about monster spell range

Open soul4soul opened this issue 2 years ago • 2 comments

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.

soul4soul avatar Jun 12 '22 14:06 soul4soul

I vote for default to range 1 plus a warning

EPuncker avatar Jun 12 '22 18:06 EPuncker

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

ramon-bernardo avatar Nov 20 '22 11:11 ramon-bernardo