Skip to content

Commit

Permalink
Add X2Effect_BonusWeaponDamage to source.
Browse files Browse the repository at this point in the history
  • Loading branch information
ps2guides authored and Iridar committed Oct 29, 2023
1 parent e3ecb23 commit 7b712ed
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//---------------------------------------------------------------------------------------
// FILE: X2Effect_BonusWeaponDamage.uc
// AUTHOR: Joshua Bouscher
// DATE: 17 Jun 2015
// PURPOSE: Add a flat damage amount if the ability's source weapon matches
// the source weapon of this effect.
// Since weapons can define their own damage, this is really for when
// the damage is temporary, or is coming from a specific soldier ability
// and therefore not everyone with the same weapon gets the bonus.
//
//---------------------------------------------------------------------------------------
// Copyright (c) 2016 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------

class X2Effect_BonusWeaponDamage extends X2Effect_Persistent;

var int BonusDmg;

function int GetAttackingDamageModifier(XComGameState_Effect EffectState, XComGameState_Unit Attacker, Damageable TargetDamageable, XComGameState_Ability AbilityState, const out EffectAppliedData AppliedData, const int CurrentDamage, optional XComGameState NewGameState)
{
local X2Effect_ApplyWeaponDamage DamageEffect;

if (!class'XComGameStateContext_Ability'.static.IsHitResultHit(AppliedData.AbilityResultContext.HitResult) || CurrentDamage == 0)
return 0;

// only limit this when actually applying damage (not previewing)
if( NewGameState != none )
{
// only add the bonus damage when the damage effect is applying the weapon's base damage
DamageEffect = X2Effect_ApplyWeaponDamage(class'X2Effect'.static.GetX2Effect(AppliedData.EffectRef));
if( DamageEffect == none || DamageEffect.bIgnoreBaseDamage )
{
return 0;
}
}

if( AbilityState.SourceWeapon == EffectState.ApplyEffectParameters.ItemStateObjectRef )
{
return BonusDmg;
}

return 0;
}

defaultproperties
{
bDisplayInSpecialDamageMessageUI = true
}
3 changes: 3 additions & 0 deletions X2WOTCCommunityHighlander/X2WOTCCommunityHighlander.x2proj
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,9 @@
<Content Include="Src\XComGame\Classes\X2Effect_ApplyWeaponDamage.uc">
<SubType>Content</SubType>
</Content>
<Content Include="Src\XComGame\Classes\X2Effect_BonusWeaponDamage.uc">
<SubType>Content</SubType>
</Content>
<Content Include="Src\XComGame\Classes\X2Effect_Burning.uc">
<SubType>Content</SubType>
</Content>
Expand Down

0 comments on commit 7b712ed

Please sign in to comment.