Ahli / sc2xml

11 stars 1 forks source link

Steady Targeting is still cast-able even though un-executable while Damage-Over-Time abilities are active #109

Open Joshua-Leibold opened 1 year ago

Joshua-Leibold commented 1 year ago

Ghost's ability Steady Targeting is cancelled whenever damage is dealt to the channeling ghost. This means that ghosts affected by Damage-Over-Time spells will never be able to get their Steady Targeting off. However, ghosts are still able to cast Steady Targeting which can lead to undesirable behaviour.

As a general rule abilities can not be cast unless the ability's effects can affect the target. For instance, Transfuse (ability) which is a heal ability can not be cast on units that cannot be the recipients of the healing (effect). (aka units at full health)

Under the effects of DOT Ghosts will cast Steady Targeting, creating a snipe line across the battlefield that will inevitably be destroyed half a second later without doing anything but contributing to visual clutter and registering no tangible effect on either player

It can result in strange behaviour with Smart Cast. If the player selects their ghosts and orders a Steady Targeting, if the ghost affected by fungal is closest to enemy units, Smart Cast will select the fungaled ghost to the be the one to cast the impossible-to-get-off ability, requiring the player to use RapidFire hotkeys in order to "override" the initial ghost's orders so that the second-closest, un-fungaled ghost will be selected by Smart Cast to issue a possible Steady Targeting order. Psi Storm has the same issues

BEFORE: https://i.gyazo.com/eb26a7866373c4b451deae18e053b0c4.mp4

AFTER: https://i.gyazo.com/c6ab9661a462ab68b2d524f3af3822ed.mp4 https://i.gyazo.com/58f7ebf134376fd0f78190a79829823b.mp4

Joshua-Leibold commented 1 year ago

XML Changes for the fix:

Creation of validator to verify the caster is not within PsiStorm radius:

<CValidatorUnitCompareBehaviorCount id="CasterNotInPsiStorm">
        <WhichUnit Value="Caster"/>
        <Behavior value="PsiStorm"/>
    </CValidatorUnitCompareBehaviorCount>

Adding validators to the initial set effect of Channel Snipe

<CEffectSet id="ChannelSnipeInitialSet">
        <ValidatorArray value="CasterNotFungalGrowthed"/>
        <ValidatorArray value="CasterNotInPsiStorm"/>
    </CEffectSet>
Ahli commented 9 months ago

I would use a nicer error on the validator like this one:

    <CValidatorUnitCompareBehaviorCount id="CasterNotInPsiStorm">
        <WhichUnit Value="Caster"/>
        <Behavior value="PsiStorm"/>
        <ResultFailed value="CantAttackWeaponsDisabled"/>
    </CValidatorUnitCompareBehaviorCount>

Having a requirement would be even cooler (so the button is grayed out while unusable), but that would require localization work...