Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static function X2AbilityTemplate BscSiphonUpgradeHUD()
- {
- local X2AbilityTemplate Template;
- local X2AbilityCost_Charges ChargeCost;
- local X2AbilityCharges Charges;
- local X2AbilityCooldown Cooldown;
- local X2Effect_Persistent DummyEffect;
- local X2Condition_UnitEffects EffectsCondition;
- `CREATE_X2ABILITY_TEMPLATE(Template, 'BasicSiphonShield');
- //HUD and icon stuff
- Template.Hostility = eHostility_Neutral;
- Template.AbilitySourceName = 'eAbilitySource_Item';
- Template.IconImage = "img:///ShieldUps.HUD.siphon";
- Template.eAbilityIconBehaviorHUD = eAbilityIconBehavior_AlwaysShow;
- Template.ShotHUDPriority = 1900;
- Template.AbilityConfirmSound = "TacticalUI_ActivateAbility";
- Template.AbilityToHitCalc = default.DeadEye;
- Template.AbilityTargetStyle = default.SelfTarget;
- Template.AbilityTriggers.AddItem(default.PlayerInputTrigger);
- Template.AbilityCosts.AddItem(default.FreeActionCost);
- ChargeCost = new class'X2AbilityCost_Charges';
- ChargeCost.NumCharges = 1;
- Template.AbilityCosts.AddItem(ChargeCost);
- Charges = new class'X2AbilityCharges';
- Charges.InitialCharges = default.BSC_SIPH_USES;
- Template.AbilityCharges = Charges;
- Cooldown = new class'X2AbilityCooldown';
- Cooldown.iNumTurns = default.BSC_SIPH_CD;
- Template.AbilityCooldown = Cooldown;
- Template.AbilityShooterConditions.AddItem(default.LivingShooterProperty);
- //BuildPersistentEffect(int _iNumTurns, optional bool _bInfiniteDuration=false, optional bool _bRemoveWhenSourceDies=true, optional bool _bIgnorePlayerCheckOnTick=false, optional GameRuleStateChange _WatchRule=eGameRule_TacticalGameStart )
- DummyEffect = new class'X2Effect_Persistent';
- DummyEffect.EffectName = 'BscSiphonDummyEffect';
- DummyEffect.BuildPersistentEffect(1,,,, eGameRule_PlayerTurnEnd);
- DummyEffect.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.LocLongDescription, Template.IconImage, false,,Template.AbilitySourceName);
- Template.AddTargetEffect(DummyEffect);
- EffectsCondition = new class'X2Condition_UnitEffects';
- EffectsCondition.AddExcludeEffect('BscSiphonDummyEffect', 'AA_MissingRequiredEffect');
- Template.AbilityTargetConditions.AddItem(EffectsCondition);
- Template.AdditionalAbilities.AddItem('BscSiphonUpgradeActual');
- Template.bShowActivation = true;
- Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
- Template.BuildVisualizationFn = TypicalAbility_BuildVisualization;
- return Template;
- }
- static function X2AbilityTemplate BscSiphonUpgradeActual()
- {
- local X2AbilityTemplate Template;
- local X2Effect_PersistentStatChange ShieldedEffect;
- local X2AbilityMultiTarget_Radius MultiTarget;
- local X2AbilityTrigger_EventListener EventListener;
- local X2Condition_UnitProperty FriendCondition;
- local X2Condition_UnitEffects EffectsCondition;
- local X2Effect_RemoveEffects RemoveEffects;
- `CREATE_X2ABILITY_TEMPLATE(Template, 'BscSiphonUpgradeActual');
- Template.Hostility = eHostility_Neutral;
- Template.AbilitySourceName = 'eAbilitySource_Item';
- Template.IconImage = "img:///ShieldUps.HUD.siphon";
- Template.eAbilityIconBehaviorHUD = eAbilityIconBehavior_NeverShow;
- Template.ShotHUDPriority = 1900;
- Template.AbilityToHitCalc = default.DeadEye;
- Template.AbilityTargetStyle = default.SelfTarget;
- Template.AbilityShooterConditions.AddItem(default.LivingShooterProperty);
- EffectsCondition = new class'X2Condition_UnitEffects';
- EffectsCondition.AddRequireEffect('BscSiphonDummyEffect', 'AA_MissingRequiredEffect');
- Template.AbilityShooterConditions.AddItem(EffectsCondition);
- EventListener = new class'X2AbilityTrigger_EventListener';
- EventListener.ListenerData.EventID = 'KillMail';
- EventListener.ListenerData.Deferral = ELD_OnStateSubmitted;
- EventListener.ListenerData.Filter = eFilter_None;
- EventListener.ListenerData.EventFn = SiphonListener;
- EventListener.ListenerData.Priority = 40;
- Template.AbilityTriggers.AddItem(EventListener);
- FriendCondition = new class'X2Condition_UnitProperty';
- FriendCondition.ExcludeDead = true;
- FriendCondition.ExcludeFriendlyToSource = false;
- FriendCondition.ExcludeHostileToSource = true;
- FriendCondition.ExcludeCivilian = true;
- FriendCondition.FailOnNonUnits = true;
- Template.AbilityMultiTargetConditions.AddItem(FriendCondition);
- MultiTarget = new class'X2AbilityMultiTarget_Radius';
- MultiTarget.fTargetRadius = default.BSC_SIPH_RADIUS;
- MultiTarget.bIgnoreBlockingCover = true;
- Template.AbilityMultiTargetStyle = MultiTarget;
- ShieldedEffect = CreateShieldedEffect(Template.LocFriendlyName, Template.GetMyLongDescription(), default.BSC_SIPH_SHIELD);
- Template.AddShooterEffect(ShieldedEffect);
- Template.AddMultiTargetEffect(ShieldedEffect);
- RemoveEffects = new class'X2Effect_RemoveEffects';
- RemoveEffects.EffectNamesToRemove.AddItem('BscSiphonDummyEffect');
- Template.AddTargetEffect(RemoveEffects);
- Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
- Template.BuildVisualizationFn = class'X2Ability_AdventShieldBearer'.static.Shielded_BuildVisualization;
- Template.CinescriptCameraType = "AdvShieldBearer_EnergyShieldArmor";
- Template.SuperConcealmentLoss = class'X2AbilityTemplateManager'.default.SuperConcealmentStandardShotLoss;
- Template.ChosenActivationIncreasePerUse = class'X2AbilityTemplateManager'.default.StandardShotChosenActivationIncreasePerUse;
- Template.LostSpawnIncreasePerUse = class'X2AbilityTemplateManager'.default.MeleeLostSpawnIncreasePerUse;
- return Template;
- }
- //killmail EventManager.TriggerEvent('KillMail', self, Killer, NewGameState);
- static function EventListenerReturn SiphonListener(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackData)
- {
- local XComGameStateContext_Ability AbilityContext;
- local XComGameState_Ability AbilityState;
- local XComGameState_Item SourceWeapon;
- local array<name> AttachedWeaponUpgrades;
- local XComGameState_Unit KilledUnit;
- //local bool correctkiller;
- //local bool correctupgrade;
- AbilityContext = XComGameStateContext_Ability(GameState.GetContext());
- AbilityState = XComGameState_Ability(CallbackData);
- SourceWeapon = XComGameState_Item(`XCOMHISTORY.GetGameStateForObjectID(AbilityContext.InputContext.ItemObject.ObjectID));
- AttachedWeaponUpgrades = SourceWeapon.GetMyWeaponUpgradeTemplateNames();
- KilledUnit = XComGameState_Unit(EventData);
- /*
- correctkiller = (AbilityState.OwnerStateObject.ObjectID == AbilityContext.InputContext.SourceObject.ObjectID);
- `LOG("is the killer the only one: " $ correctkiller);
- correctupgrade = (AttachedWeaponUpgrades.Find('DraktenSiphon_Bsc') != INDEX_NONE);
- `LOG("is the upgrade installed: " $ correctupgrade);
- */
- if (KilledUnit.GetTeam() != eTeam_TheLost) //won't fire on Lost kills
- {
- if (AbilityState.OwnerStateObject == AbilityContext.InputContext.SourceObject) //making sure the ability only fires when the killer kills
- {
- if (AttachedWeaponUpgrades.Find('DraktenSiphon_Bsc') != INDEX_NONE || AttachedWeaponUpgrades.Find('DraktenSiphon_Adv') != INDEX_NONE || AttachedWeaponUpgrades.Find('DraktenSiphon_Sup') != INDEX_NONE) // making sure the correct attachments are installed
- {
- AbilityState.AbilityTriggerAgainstSingleTarget(AbilityContext.InputContext.SourceObject, false); //if all conditions pass, ability fires
- }
- }
- }
- return ELR_NoInterrupt;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement