kaansoral / adventureland

Adventure Land The Open Source CODE MMORPG
Other
189 stars 60 forks source link

Fix infinite range for `curse`, `cburst`, and `3shot`/`5shot` #104

Closed earthiverse closed 6 months ago

earthiverse commented 7 months ago

Changes:

FreezePhoenix commented 7 months ago

I feel as though Curse could probably be changed to use the player's range. Only reason I would see for it to be at 200 would be if that was what it previously was.

earthiverse commented 7 months ago

Some more skills need fixing

for(const sN in G.skills) {
    const gSkill = G.skills[sN]
    if(gSkill.range) continue
    if(gSkill.use_range) continue
    if(!gSkill.target) continue
    if(gSkill.global) continue
    console.log(`${sN} might not have range`)
}

mentalburst might not have range curse might not have range charm might not have range tangle might not have range huntersmark might not have range supershot might not have range

thmsndk commented 7 months ago

Some skills has logic in the use_skills method if you do not supply a target 3shot for example uses this to find targets var hostiles=get_nearby_hostiles({range:character.range-2,limit:3}) https://github.com/kaansoral/adventureland/blob/2950ab2c843bfdec4343265c4390a646098fea49/js/functions.js#L836-L850

The range check will never trigger in socket.on("skill") if the skill does not have a range or the use_range property though https://github.com/kaansoral/adventureland/blob/67d76dd2f36a96f9cf8e0c2434edd8fd7e2607dc/node/server.js#L8505

Should player range not just be the default, unless the skills is global / unlimited range? I think I prefer sensible defaults than having to be explicit when making new skills / abilities. If I want the range of a skill to adapt to the players range, I guess I could set use_range to true but it is not obvious that it means player range if I don't specify a range

earthiverse commented 7 months ago

It's probably a good idea to fall back to character.range (or entity range if an entity is using the skill), will do.

earthiverse commented 7 months ago

Now falls back to using player range if unset.

Looking at old code, before refactoring:

mentalburst and supershot just need use_range added for clarity.

I changed curse to 200, since that was its max value before.

We need to figure out a good range for charm, tangle, and huntersmark.