I want to make an ability that constantly restores another ship's antimatter reserves while draining the ship's own. Obviously once the ship's own runs out, the ability will cease. However, every time it runs, the buff lasts for a fraction of a second on the target, while the drain seemingly keeps going on the ship with the ability. Help?
Ability file:
TXT
entityType "Ability"
buffInstantActionType "ApplyTargettedBuffToSelf"
instantActionTriggerType "AlwaysPerform"
buffType "BuffPowerRestoreCaster"
targetFilter
numOwnerships 1
ownership "Friendly"
numObjects 2
object "Frigate"
object "CapitalShip"
numConstraints 2
constraint "HasAntiMatterShortage"
constraint "NotSelf"
range
Level:0 2000.000000
Level:1 0.000000
Level:2 0.000000
effectInfo
effectAttachInfo
attachType "Invalid"
smallEffectName ""
largeEffectName ""
soundID "EFFECT_TRANSFERANTIMATTER"
needsToFaceTarget FALSE
canCollideWithTarget TRUE
moveThruTarget FALSE
isUltimateAbility FALSE
maxNumLevels 1
levelSourceType "FixedLevel0"
aiUseTime "Anytime"
aiUseTargetCondition "IsDifferentRoleType"
isAutoCastAvailable TRUE
isAutoCastOnByDefault TRUE
pickRandomPlanetToExploreForAutoCastTarget FALSE
ignoreNonCombatShipsForAutoCastTarget TRUE
onlyAutoCastWhenDamageTakenExceedsPerc 0.000000
useCostType "AntiMatter"
antiMatterCost
Level:0 0.000000
Level:1 0.000000
Level:2 0.000000
cooldownTime
Level:0 0.000000
Level:1 0.000000
Level:2 0.000000
researchPrerequisites
NumResearchPrerequisites 0
nameStringID "IDS_ABILITY_POWERRESTORE_NAME"
descStringID "IDS_ABILITY_POWERRESTORE_DESCRIPTION"
hudIcon "HUDICON_ABILITY_TRANSFERANTIMATTER"
smallHudIcon "HUDICON_ABILITY_TRANSFERANTIMATTER"
infoCardIcon ""
Caster file:
TXT
entityType "Buff"
onReapplyDuplicateType "ReplaceWithNewBuff"
buffExclusivityForAIType "ExclusiveForAllPlayers"
isInterruptable TRUE
isChannelling FALSE
numInstantActions 2
instantAction
buffInstantActionType "PlayPersistantAttachedEffect"
instantActionTriggerType "OnDelay"
delayTime 0.000000
effectInfo
effectAttachInfo
attachType "Ability"
abilityIndex 0
smallEffectName "Buff_TransferAntiMatterChanneling"
largeEffectName "Buff_TransferAntiMatterChanneling"
soundID "EFFECT_TRANSFERANTIMATTER"
instantAction
buffInstantActionType "ApplyBuffToTargetNoFilterNoRange"
instantActionTriggerType "OnDelay"
delayTime 0.000000
buffType "BuffPowerRestoreTarget"
numPeriodicActions 0
numOverTimeActions 1
overTimeAction
buffOverTimeActionType "DrainAntiMatter"
drainAntiMatterRate
Level:0 5.000000
Level:1 0.000000
Level:2 0.000000
numEntityModifiers 0
numEntityBoolModifiers 0
numFinishConditions 1
finishCondition
finishConditionType "AntiMatterDepleted"
Target file:
TXT
entityType "Buff"
onReapplyDuplicateType "ReplaceWithNewBuff"
buffExclusivityForAIType "ExclusiveForAllPlayers"
isInterruptable FALSE
isChannelling FALSE
numInstantActions 1
instantAction
buffInstantActionType "PlayPersistantAttachedEffect"
instantActionTriggerType "OnDelay"
delayTime 0.000000
effectInfo
effectAttachInfo
attachType "Above"
smallEffectName "Buff_TransferAntiMatterTarget"
largeEffectName "Buff_TransferAntiMatterTarget"
soundID ""
numPeriodicActions 0
numOverTimeActions 1
overTimeAction
buffOverTimeActionType "RestoreAntiMatter"
antiMatterRestoreRate
Level:0 3.000000
Level:1 0.000000
Level:2 0.000000
numEntityModifiers 0
numEntityBoolModifiers 0
numFinishConditions 2
finishCondition
finishConditionType "FirstSpawnerNoLongerHasBuff"
buffTypeToQuery "BuffPowerRestoreCaster"
finishCondition
finishConditionType "OutOfRange"
edit: well I tweaked a few things and now it works, I'm not quite sure how I did it, though 
edit 2: looks like it was the OutOfRange condition. is this a bug with the buff system? OutOfRange seems to always return true, whether on caster or target, in range or not. is there a better way to do this to keep the caster in range?