Ahli / sc2xml

11 stars 1 forks source link

Cyclone's Lock On does not clean itself up when target becomes invalid while turret rotates #119

Open Ahli opened 12 months ago

Ahli commented 12 months ago

Cyclone's Lock On ability does not clean itself up properly when the target becomes invalid while the turret is rotating. Invalid means that the max range was exceeded, the target is invulnerable, in stasis, invisible, burrowed, hidden (in Assimilator/Bunker/CC/Medivac/Prism/Overlord/Nydus) or the Cyclone was hit by Interference Matrix, Stasis Ward or was lifted.

This causes Lock On to be in a state where the Cyclone does nothing besides looking at the target (regardless of vision) and the Cyclone will not attack it or another unit.

The Cyclone is freed from this state if the owner orders Cancel or the locked on unit is killed by other units. If it survives

Fix

The issue is that the persistent effect's validator prevents the finish effects to run. The validator needs to be removed, so it will always run the final effect cleaning everything up. Also, the initial effect needs to be pushed into a new effect with the validator that was just removed, so two aspects are still happening: 1. the first missile is launched without delay and 2. the missile is only launched when the target is valid.

    <CEffectSet id="CycloneLockOnCPinitial">
        <ValidatorArray value="LockOnGroundAirPeriodicValidators"/>
        <EditorCategories value="Race:Terran"/>
        <EffectArray value="CycloneWeaponLaunchSet"/>
    </CEffectSet>
    <CEffectCreatePersistent id="LockOnCP">
        <ValidatorArray index="0" removed="1"/>
        <InitialEffect value="CycloneLockOnCPinitial"/>
    </CEffectCreatePersistent>

But this fix is not perfect. => The core issue is that Cyclone's initial design does not validate the target being valid while the turret initially rotates. A perfect fix would stop the turret rotation as well when the target gets out of range, so Recall or Blink's target location is not "revealed" by the direction the turret rotates to. This is something the Cyclone always did because the turret's target setter is not surrounded by a persistent effect which validates the target and releases the turret's lock once the target becomes invalid

TODO create perfect fix in addition to this