Advertisement
Iridar51

Untitled

Jul 29th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. class X2Effect_DP_AmmoCost extends X2Effect;
  2.  
  3. var int iAmmo;
  4.  
  5. //this is a roundabout way of adding an ammuniton cost to some of the abilities, since the normal way doesn't work for whatever reason
  6. simulated protected function OnEffectAdded(const out EffectAppliedData ApplyEffectParameters, XComGameState_BaseObject kNewTargetState, XComGameState NewGameState, XComGameState_Effect NewEffectState)
  7. {
  8. local XComGameState_Unit TargetUnit;
  9. local XComGameState_Item WeaponState, NewWeaponState;
  10.  
  11. TargetUnit = XComGameState_Unit(kNewTargetState);
  12. if (TargetUnit != none)
  13. {
  14. WeaponState = TargetUnit.GetItemInSlot(eInvSlot_PrimaryWeapon, NewGameState);
  15. if (WeaponState != none && WeaponState.Ammo > 0)
  16. {
  17. NewWeaponState = XComGameState_Item(NewGameState.ModifyStateObject(WeaponState.Class, WeaponState.ObjectID));
  18. NewWeaponState.Ammo = WeaponState.Ammo - iAmmo;
  19. }
  20. }
  21. }
  22.  
  23. defaultproperties
  24. {
  25. iAmmo = 1
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement