-
Notifications
You must be signed in to change notification settings - Fork 69
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
Allow overriding weapon base damage for purposes of flyovers #1275
base: master
Are you sure you want to change the base?
Allow overriding weapon base damage for purposes of flyovers #1275
Conversation
I think the displayed damage type on the flyover for applied damage should match the damage type actually applied to the target. The trick is that an ability can apply damage of several types at the same time, which are gathered from different sources in X2Effect_ApplyWeaponDamage. The This functions a bit differently for X2Effect_ApplyWeaponDamage. Normally it has the I assume the rule of "effect won't be applied if the target is immune to a damage type listed in For example, let's take an X2Effect_ApplyWeaponDamage that is set up to apply weapon damage, attached to a sword, and also its own And even if the target is immune to both, the effect will still be applied, the target just won't take any damage. Unless, of course, either of these damage types is manually added to effect's DamageTypes array. To summarize, an X2Effect_AWD can potentially apply damage of multiple types, and has its own logic for gathering the damage types. Then the question is: which of the damage types should be displayed in flyover? Well let's think about what the flyover can actually display, which is either generic damage or psionic damage. So I think the task boils down to checking whether the effect is applying psionic damage or not. If yes, then display the psionic flyover. If not, then we don't care what other damage types are, the flyover will be the same either way. All that said, to determine whether the effect applies psionic damage or not, we have to repeat the effect's process of gathering the damage type either way. One huge huge caveat is that a custom X2Effect_ApplyWeaponDamage can have completely arbitrary logic for gathering applied damage types, so we can't reliably make a universal solution by copying vanilla logic from X2Effect_AWD. What we can do is check what damage types have actually been applied to the unit. Visualization happens after the effect has already been applied by state code, so we can examine the struct native DamageResult
{
var int DamageAmount, MitigationAmount, ShieldHP, Shred;
var bool bImmuneToAllDamage; // if ALL of the damage being dealt was 0'd out due to immunity, it will be tracked here
var bool bFreeKill; // free kill weapon upgrade forced death of the unit
var name FreeKillAbilityName;
var EffectAppliedData SourceEffect;
var XComGameStateContext Context;
var array<DamageModifierInfo> SpecialDamageFactors;
var array<name> DamageTypes;
}; Of particular interest are Therefore, the task is:
I think this is the optimal solution that covers all bases, but discussion is welcome. |
Seems reasonable to me - I'll try to tackle this over the next few days :) |
cd85a8f
to
8cc3b7b
Compare
09ecbdf
to
d42c4b4
Compare
Fixes #1274