Jump to content

Danger Zone tweaking


Amineri

Recommended Posts

Currently the Danger Zone perk has two different effects :

 

1) Increases radius of Rockets (both regular and shredder)

2) Grant radius to suppression ability

 

The two effects are implemented in two different locations, although I think they used the same constant value in EU. Currently Danger Zone adds +192 Unreal units for both effects (which is 2.0 tiles).

 

Since rocket radius is already 336 Unreal units (3.5 tiles) this results in an extremely large radius of 5.5 tiles. Since area scales as the square of radius, the area covered increases by (5.5^2)/(3.5^2) = 2.47 -- almost a +150% increase. This makes Danger Zone with rockets fairly overpowered.

 

Since suppression has no innate radius, Danger Zone creates a radius of effect of 192 = 2 tiles. Comparatively frag grenades have a radius of 240 = 2.5 tiles. Due to the way the tile rounding appears to work a 2 tile radius covers:

O O O X O O O
O O X X X O O
O X X X X X O
O O X X X O O
O O O X O O O

Essentially only the 3x3 block around the target plus 4 additional tiles in the compass direction. This makes the Suppression-related effects of Danger Zone much weaker.

 

-------------------------

 

Suppression radius of Danger Zone is implemented in XGAbilityTree.ApplyAbilityToTarget in the code chunk:

    if(((iType == 17) || iType == 67) && kAbility.m_kUnit.GetCharacter().HasUpgrade(25))
    {
        kSquad = kTarget.GetSquad();
        I = 0;
        J0x234:
        // End:0x3A1 [Loop If]
        if(I < kSquad.GetNumMembers())
        {
            kUnit = kSquad.GetMemberAt(I);
            if(((kUnit != kTarget) && kUnit.IsAliveAndWell()) && VSize(kUnit.Location - kTarget.Location) <= float(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.192))
            {
                ApplyEffectsToTarget(kAbility, kUnit);
            }
            ++ I;
            // [Loop Continue]
            goto J0x234;
        }
    }

The iType == 17 is checking for the Suppression ability (which both LMG Suppression and RifleSuppression perks map to). The iType == 67 refers to a ShotMayhem ability which I think is unused.

 

The code loops through every enemy unit and applies suppression if the distance is less than the defined value of 192. Changing this value will change the effective radius of the Danger Zone + Suppression combo.

 

------------------

 

Rocket radius of Danger Zone is implemented in XGWeapon.GetDamageRadius :

simulated function float GetDamageRadius()
{
    if((m_eType == 7) || m_eType == 19)
    {
        if((m_kOwner != none) && m_kOwner.GetCharacter().HasUpgrade(25))
        {
            return float(m_kTWeapon.iRadius + XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.192);
        }
    }
    return float(m_kTWeapon.iRadius);
    //return ReturnValue;    
}

This function explicitly checks that the current weapon is either a Rocket Launcher (7) or Blaster Launcher (19). It then adds 192 to the weapon radius if the unit has the Danger Zone perk.

 

Changing this value will change the effective radius increase of the Danger Zone perk as applied to rockets.

 

Similar code could be added (checking other weapons such as Frag/Alien grenades) in order to create additional perks (or extend Danger Zone) to affect grenade radius.

 

Smoke radius is defined in a different manner, as is Battlescanner visual radius.

Link to comment
Share on other sites

As a follow up I'm exploring a current working theory as to how Mayhem works with Suppression.

 

My current theory is that it happens via the 'magic' of the mapping from perks to abilities (which happens in native code, hence the 'magic').

 

Theory:

  • The ePerk_FocussedSuppression (21) perk maps to the eAbility_ShotSuppress (17) under normal circumstances
  • However, if the unit has ePerk_Mayhem (91) as well as ePerkFocussedSuppression (21), the eAbility_ShotMayhem (67) is granted instead
  • This alternative mapping may only work if the unit's current weapon has eWP_Heavy

Note that there would be two different checks that prevent this from working with Rifle Suppression : (1) Rifle Suppression is a different perk ePerk_RifleSuppression (49), and (2) Rifles have eWP_Rifle instead of eWP_Heavy. Also pistols could never apply Mayhem since they have eWP_Pistol instead of eWP_Heavy.

 

In XGAbilityTree.BuildAbilities the eAbility_ShotMayhem is configured very similarly to the eAbility_ShotSuppress (and the names provide some support for the theory). Both apply suppression and trigger the constant fire visual effects. ShotMayhem is configured to deal damage and automatically hits however (there is no to-hit roll), while Suppression is configured with the 'no-hit' property.

 

eAbility_ShotMayhem also gets the Danger Zone radius increase in the same code as Suppression.

Link to comment
Share on other sites

Confirmed that in vanilla a Heavy with the Mayhem perk does indeed get a different ability (icon, help text, and effects) that replaces the usual Suppression ability button.

 

On-screen it looks like the Mayhem perk icon, with the suppression 'fist' on the bottom and an explosion on the top. The vanilla help text still reads Suppression, etc, but when I changed the XComGame.int localization file to read:

 

AbilityNames[eAbility_ShotMayhem]=ShotMayhem

HelpMessages[eAbility_ShotMayhem]=Reduce the target's Aim and take a free shot if the target moves.
TargetMessages[eAbility_ShotMayhem]=Mayhemed

 

The mouse-over help text on the icon read ShotMayhem and the pop-up message on the target read Mayhemed instead of Suppression and Suppressed.

 

I still am not sure of all of the triggers for the ability replacement and where the damage value is set, since that's done somewhere in native code. The code path is similar to how medikits heal, which allows for both the -30 aim malus as well as the small damage amount.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...