Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class X2Effect_TacticalReloadDamage extends X2Effect_Persistent config (TacticalReloadNew2);
- var localized string FriendlyName;
- var float fDamageMultiplier;
- var config int BONUS_DAMAGE_DEFAULT;
- var config int BONUS_AIM_DEFAULT;
- var config int BONUS_CRIT_DEFAULT;
- var config int BONUS_DAMAGE_CV;
- var config int BONUS_DAMAGE_MG;
- var config int BONUS_DAMAGE_BM;
- var config int BONUS_AIM_CV;
- var config int BONUS_AIM_MG;
- var config int BONUS_AIM_BM;
- var config int BONUS_CRIT_CV;
- var config int BONUS_CRIT_MG;
- var config int BONUS_CRIT_BM;
- 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 XComGameState_Item ItemState;
- //local X2AbilityTemplate AbilityTemplate;
- local XComGameState_Player Player;
- ItemState = AbilityState.GetSourceWeapon();
- //AbilityTemplate = AbilityState.GetMyTemplate();
- // Check that Ability that activated GetAttackingDamageModifier comes from the same weapon as the ability that applied this effect.
- if (ItemState != none && ItemState.ObjectID == AppliedData.ItemStateObjectRef.ObjectID)
- {
- // If this effect is used not just for damage preview, but for actual damage calculation, then remove it, so that damage increase is applied only once.
- if (NewGameState != none)
- {
- Player = XComGameState_Player(`XCOMHISTORY.GetGameStateForObjectID(EffectState.ApplyEffectParameters.PlayerStateObjectRef.ObjectID));
- if (Player != none)
- {
- `XEVENTMGR.TriggerEvent('TacticalReloadExpended', Player, Attacker, NewGameState);
- }
- }
- return CurrentDamage * fDamageMultiplier;
- /*
- if (ItemState != none && AbilityState.GetMyTemplateName() == 'TacticalReload') // Change to work with all weapons later
- {
- if (ItemState != none && ItemState.GetWeaponTech() == 'conventional')
- {
- return default.BONUS_DAMAGE_CV;
- }
- else if (ItemState != none && ItemState.GetWeaponTech() == 'magnetic')
- {
- return default.BONUS_DAMAGE_MG;
- }
- else if (ItemState != none && ItemState.GetWeaponTech() == 'beam')
- {
- return default.BONUS_DAMAGE_BM;
- }
- else if (ItemState != none)
- {
- return default.BONUS_DAMAGE_DEFAULT;
- }
- }
- */
- }
- else return 0;
- }
- function bool IsEffectCurrentlyRelevant(XComGameState_Effect EffectGameState, XComGameState_Unit TargetUnit)
- {
- return EffectGameState.iTurnsRemaining > 0;
- }
- static function EventListenerReturn OnPlayerTurnTickedWrapper(Object EventData, Object EventSource, XComGameState GameState, Name Event, Object CallbackData)
- {
- local XComGameState_Effect EffectGameState;
- local XComGameState_Unit TargetUnit;
- EffectGameState = XComGameState_Effect(CallbackData);
- TargetUnit = XComGameState_Unit(EventSource);
- // If this event was triggered by a unit this effect was applied to
- if (EffectGameState != none && TargetUnit != none && EffectGameState.ApplyEffectParameters.TargetStateObjectRef.ObjectID == TargetUnit.ObjectID)
- {
- // Then "tick" the effect. Since the effect has 1 turn duration, that's effectively the same as removing it.
- // Straight up removing the effect doesn't work, because that for some reason doesn't handle removing perk content PFX
- return EffectGameState.OnPlayerTurnTicked(EventData, EventSource, GameState, Event, CallbackData);
- }
- return ELR_NoInterrupt;
- }
- static function PowerUpVisualization(XComGameState VisualizeGameState, out VisualizationActionMetadata ActionMetadata, const name EffectApplyResult)
- {
- //local X2Action_PlayAnimation PlayAnimation;
- local X2Action_PlayEffect EffectAction;
- if (EffectApplyResult != 'AA_Success') return;
- //PlayAnimation = X2Action_PlayAnimation(class'X2Action_PlayAnimation'.static.AddToVisualizationTree(ActionMetadata, VisualizeGameState.GetContext(), false, ActionMetadata.LastActionAdded));
- //PlayAnimation.Params.AnimName = 'HL_PowerUp';
- EffectAction = X2Action_PlayEffect(class'X2Action_PlayEffect'.static.AddToVisualizationTree(ActionMetadata, VisualizeGameState.GetContext(), false, ActionMetadata.LastActionAdded));
- EffectAction.EffectName = "TacticalReload_Persistent_Effect_Name";
- EffectAction.AttachToUnit = true;
- //EffectAction.AttachToSocketsArrayName = 'BoneSocketActor';
- EffectAction.AttachToSocketName = 'R_Hand';
- }
- function GetToHitModifiers(XComGameState_Effect EffectState, XComGameState_Unit Attacker, XComGameState_Unit Target, XComGameState_Ability AbilityState, class<X2AbilityToHitCalc> ToHitType, bool bMelee, bool bFlanking, bool bIndirectFire, out array<ShotModifierInfo> ShotModifiers)
- {
- local ShotModifierInfo ModInfo;
- local XComGameState_Item SourceWeapon;
- SourceWeapon = AbilityState.GetSourceWeapon();
- if (SourceWeapon != none && AbilityState.GetMyTemplateName() == 'TacticalReload') // Change to work with all weapons later
- {
- if (SourceWeapon != none && SourceWeapon.GetWeaponTech() == 'conventional')
- {
- ModInfo.ModType = eHit_Crit;
- ModInfo.Reason = FriendlyName;
- ModInfo.Value = default.BONUS_CRIT_CV;
- ShotModifiers.AddItem(ModInfo);
- ModInfo.ModType = eHit_Success;
- ModInfo.Reason = FriendlyName;
- ModInfo.Value = default.BONUS_AIM_CV;
- ShotModifiers.AddItem(ModInfo);
- }
- else if (SourceWeapon != none && SourceWeapon.GetWeaponTech() == 'magnetic')
- {
- ModInfo.ModType = eHit_Crit;
- ModInfo.Reason = FriendlyName;
- ModInfo.Value = default.BONUS_CRIT_MG;
- ShotModifiers.AddItem(ModInfo);
- ModInfo.ModType = eHit_Success;
- ModInfo.Reason = FriendlyName;
- ModInfo.Value = default.BONUS_AIM_MG;
- ShotModifiers.AddItem(ModInfo);
- }
- else if (SourceWeapon != none && SourceWeapon.GetWeaponTech() == 'beam')
- {
- ModInfo.ModType = eHit_Crit;
- ModInfo.Reason = FriendlyName;
- ModInfo.Value = default.BONUS_CRIT_BM;
- ShotModifiers.AddItem(ModInfo);
- ModInfo.ModType = eHit_Success;
- ModInfo.Reason = FriendlyName;
- ModInfo.Value = default.BONUS_AIM_BM;
- ShotModifiers.AddItem(ModInfo);
- }
- else if (SourceWeapon != none)
- {
- ModInfo.ModType = eHit_Crit;
- ModInfo.Reason = FriendlyName;
- ModInfo.Value = default.BONUS_CRIT_DEFAULT;
- ShotModifiers.AddItem(ModInfo);
- ModInfo.ModType = eHit_Success;
- ModInfo.Reason = FriendlyName;
- ModInfo.Value = default.BONUS_AIM_DEFAULT;
- ShotModifiers.AddItem(ModInfo);
- }
- }
- }
- defaultproperties
- {
- bDisplayInSpecialDamageMessageUI = true
- //EffectName = "TacticalReloadEffect"
- //VisualizationFn = PowerUpVisualization
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement