Sphereserver / Source-X

Ultima Online server emulator
Apache License 2.0
58 stars 47 forks source link

[Feature Request] SPELLFLAG_ONLYSELF #1171

Closed canerksk closed 2 months ago

canerksk commented 1 year ago

There is a spell flag for SPELLFLAG_TARG_NOSELF, in addition to spells that will only be allowed to be cast on ourselves, another flag like SPELLFLAG_TARG_ONLYSELFcan be added.

Note: When we remove all the spell flags of the spell, the target does not appear in the spell and we can only apply it directly to ourselves, but then the spell effects do not appear.

xwerswoodx commented 1 year ago

Honestly we already have that, if you don't give any targ flag, the spell automatically cast on yourself directly,

eq;

[SPELL 44]
// NOTE: Used primarily to regain mana while fighting or cast helpful spells without incurring attack. Duration should reflect the non-offensive use of this spell
DEFNAME=s_invisibility
NAME=Invisibility
SOUND=snd_spell_invisibility
RUNES=ALX
CAST_TIME=1.8
RESOURCES=i_reag_blood_moss,i_reag_nightshade
RUNE_ITEM=i_rune_invisibility
SCROLL_ITEM=i_scroll_invisibility
FLAGS=spellflag_dir_anim|spellflag_good
EFFECT_ID=0
EFFECT=0
LAYER=layer_spell_invis
DURATION=3*60.0,5*60.0
MANAUSE=20
SKILLREQ=MAGERY 60.0
INTERRUPT=100.0,100.0
ON=@Effect
   FLAGS &= ~statf_hidden

If you cast invisibilty with that flags, you can see it cast on himself directly. You just need to remove targ flags from spells to make it only self-cast.

canerksk commented 1 year ago

This may happen for spells without effect_id, but for spells with effect_id, removing all targeting flags will cause the spell effect to not occur at all. eg; protection spell or reactive armor spell

cbnolok commented 6 months ago

Couldn't this be solved by using effect_id also if there's not a target flag? Edit, to be more clear: i mean, making sphere consider and use effect_id also if there's not a target flag

xwerswoodx commented 6 months ago

Couldn't this be solved by using effect_id also if there's not a target flag? Edit, to be more clear: i mean, making sphere consider and use effect_id also if there's not a target flag

Honestly I haven't deeply checked this, but effect id not trigger when you don't have targ flag, but if you think flag is unnecessary, I could take a look on it more deeply in couple of hours to see why effect id not trigger when player not using target.

xwerswoodx commented 6 months ago

Okay as I tested a bit and take a look for it, seems like SPELLFLAG_FX_TARG flag enough for effect. We don't need spellflag_targ_onlyself, I revert back the update and update the pr.

cbnolok commented 2 months ago

Closing as the feature is already there, as commented.