Ahli / sc2xml

11 stars 1 forks source link

Widow Mine Targeting Beam Rework (designed by OmniSkeptic) #128

Open Ahli opened 8 months ago

Ahli commented 8 months ago

The balance council's patch indicated that they wanted to implement clearer visuals for Widow Mine's targeting beam.

OmniSkeptic created a wonderful concept in his amazing video.

But I found the implementation to be too hardcoded.

Thus, I created a more dynamic solution using a behavior.

video

test map

Code

    <CAbilEffectTarget id="WidowMineAttack">
        <PrepEffect index="0" value="WidowMineTargetingBeamDummyTintApplyBehavior"/>
        <CancelEffect index="Prep" value="WidowMineTargetingBeamDummyTintRemoveBehavior"/>
    </CAbilEffectTarget>

    <CEffectSet id="WidowMineAttack">
        <EffectArray value="WidowMineTargetingBeamDummyTintRemoveBehavior"/>
    </CEffectSet>
    <CEffectApplyBehavior id="WidowMineTargetingBeamDummyTintApplyBehavior">
        <Behavior value="WidowMineTargeted"/>
    </CEffectApplyBehavior>
    <CEffectRemoveBehavior id="WidowMineTargetingBeamDummyTintRemoveBehavior">
        <BehaviorLink value="WidowMineTargeted"/>
        <Count value="1"/>
    </CEffectRemoveBehavior>

    <CBehaviorBuff id="WidowMineTargeted">
        <InfoFlags index="Hidden" value="1"/>
        <MaxStackCount value="2"/>
    </CBehaviorBuff>

    <CActorSimple id="WidowMineTargetingBeamTargetTint">
        <On Terms="Behavior.WidowMineTargeted.On" Send="Create"/>
        <On Terms="ActorCreation" Target="_Unit" Send="SetTintColor 255,50,50 0.500000 OneShot WidowMineTargetingTarget"/>
        <On Terms="Behavior.WidowMineTargeted.Off" Target="_Unit" Send="ClearTintColor 0.000000 WidowMineTargetingTarget"/>
        <On Terms="Behavior.WidowMineTargeted.Off" Send="Destroy"/>
    </CActorSimple>
    <CActorBeamSimple id="WidowMineTargetingBeam">
        <On index="3" Terms="Effect.WidowMineTargetingBeamDummyTintApplyBehavior.Start; At Caster"/>
        <On Terms="ActorCreation" Send="SetTintColorBlendPair 255,255,255 {221,0,0 1.500000} 1.350000"/>
    </CActorBeamSimple>

    <CModel id="WidowMineTargetingBeam">
        <Model value="Assets\Effects\Terran\TargetingDroneBeam\TargetingDroneBeam.m3"/>
    </CModel>

update:

Ahli commented 8 months ago

Alternative design after OmniSkeptic received feedback to his mod:

=> Bouncing tint on targeted unit (unit blinks red) => circular pretarget model on the unit (the same one appears when you hover with psi storm over enemy units) => remove scaling since it does not work

    <CActorSimple id="WidowMineTargetingBeamTargetTint">
        <On Terms="Behavior.WidowMineTargeted.On" Send="Create"/>
        <On Terms="ActorCreation" Target="_Unit" Send="SetTintColor 255,138,138 0.200000 Bounce WidowMineTargetingTarget"/>
        <On Terms="ActorCreation" Target="_Unit" Send="StatusSet PreTargetingModel 1"/>
        <On Terms="Behavior.WidowMineTargeted.Off" Target="_Unit" Send="ClearTintColor 0.000000 WidowMineTargetingTarget"/>
        <On Terms="Behavior.WidowMineTargeted.Off" Target="_Unit" Send="StatusSet PreTargetingModel 0"/>
        <On Terms="Behavior.WidowMineTargeted.Off" Send="Destroy"/>
    </CActorSimple>
    <CActorBeamSimple id="WidowMineTargetingBeam">
        <On index="3" Terms="Effect.WidowMineTargetingBeamDummyTintApplyBehavior.Start; At Caster"/>
        <On Terms="ActorCreation" Send="SetTintColorBlendPair 255,255,255 {221,0,0 1.500000} 1.350000"/>
    </CActorBeamSimple>
Joshua-Leibold commented 7 months ago

A naive adjustment to the behaviour to fix a bug where the target tint behaviour remains indefinitely on the target unit if the attack is cancelled prior to the shot going off (like the widow mine dying or unburrowing):

<CBehaviorBuff id="WidowMineTargeted">
        <EditorCategories value="AbilityorEffectType:Units,Race:Terran"/>
        <RemoveValidatorArray value="CasterisWidowMineBurrowed"/>
        <RemoveValidatorArray value="CasterIsAlive"/>
        <RemoveValidatorArray value="CasterIsNotGravitonBeamed"/>
        <RemoveValidatorArray value="CasterIsNotStasisWarded"/>
        <RemoveValidatorArray value="CasterIsNotYoinked"/>
        <RemoveValidatorArray value="CasterIsNotNeuralParasited"/>
        <RemoveValidatorArray value="CasterDoesNotHaveScramblerMissileBehavior"/>
        <RemoveValidatorArray value="CasterIsNotNexusStrategicRecalling"/>
        <RemoveValidatorArray value="CasterIsNotMothershipMassRecalling"/>
        <MaxStackCount value="2"/>
        <Duration value="2.5"/> <!-- Emergency fallback case for unforeseen strange scenarios, such as when the widow mine changes ownership mid-shot due to triggers in custom games -->
    </CBehaviorBuff>

Creation of validators necessary to make the above function:

Make sure widow mine is not under the effects of neural parasite:

<CValidatorUnitCompareBehaviorCount id="CasterIsNotNeuralParasited">
        <WhichUnit Value="Caster"/>
        <Behavior value="NeuralParasite"/>
    </CValidatorUnitCompareBehaviorCount>

This recall fix from Issue #135 is necessary (Fix "CasterIsNotMothershipMassRecalling" validator to check for the "MothershipStrategicWarpOut" behaviour rather than "Nexus - Nexus Mass Recall Warpout")

<CValidatorUnitCompareBehaviorCount id="CasterIsNotMothershipMassRecalling">
        <Behavior value="MothershipStrategicWarpOut"/>
    </CValidatorUnitCompareBehaviorCount>
Ahli commented 7 months ago

Good find!

The ability stage's cancel effect seems to only play when the ability is cancelling itself and not when it was forced to be canceled by other means. How unfortunate...