Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X2Effects which modify a weapon's base damage type do not visualise correctly #1274

Open
BlackDog86 opened this issue Oct 22, 2023 · 1 comment · May be fixed by #1275
Open

X2Effects which modify a weapon's base damage type do not visualise correctly #1274

BlackDog86 opened this issue Oct 22, 2023 · 1 comment · May be fixed by #1275

Comments

@BlackDog86
Copy link
Contributor

BlackDog86 commented Oct 22, 2023

In X2Action_ApplyWeaponDamageToUnit, the following code runs which is responsible for feeding the damage type to the flyover:

//Set up a damage type
    if (WeaponTemplate != none)
    {
        DamageTypeName = WeaponTemplate.BaseDamage.DamageType;
        if (DamageTypeName == '')
        {
            DamageTypeName = WeaponTemplate.DamageTypeTemplateName;
        }
    }
    else if (TickContext != none || WorldEffectsContext != none)
    {
        for (DmgIndex = 0; DmgIndex < UnitState.DamageResults.Length; ++DmgIndex)
        {
            if (UnitState.DamageResults[DmgIndex].Context == StateChangeContext)
            {
                LookupEffect = UnitState.DamageResults[DmgIndex].SourceEffect.EffectRef;
                SourceEffect = class'X2Effect'.static.GetX2Effect(LookupEffect);
                DamageEffect = SourceEffect;
                if (SourceEffect.DamageTypes.Length > 0)
                    DamageTypeName = SourceEffect.DamageTypes[0];
                m_iDamage = UnitState.DamageResults[DmgIndex].DamageAmount;
                break;
            }
        }
    }
    else
    {
        DamageTypeName = class'X2Item_DefaultDamageTypes'.default.DefaultDamageType;
    }

This code 'prioritises' the weapon's base damage type & if it isn't able to find one, then looks for the damage type of the effect. It would be useful, for the purposes of effects which apply pure fire/poison/psi damage for the effect damage types to be fed into the flyover even when the effect is directly bound to a weapon.

@BlackDog86
Copy link
Contributor Author

BlackDog86 commented Oct 22, 2023

For example something like this still visualises as 'base damage' in the flyover despite the damage type of the applying effect being forced differently:

    WeaponDamageEffect.EffectDamageValue.DamageType = 'Psi';
    WeaponDamageEffect.EffectDamageValue.Damage = 5;
    WeaponDamageEffect.bIgnoreBaseDamage = true;
    WeaponDamageEffect.DamageTypes.Length=0;
    WeaponDamageEffect.DamageTypes.AddItem('Psi');
    Template.AddTargetEffect(WeaponDamageEffect);```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant