-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add X2Effect_BonusWeaponDamage to source.
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Effect_BonusWeaponDamage.uc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters