superweapon.py (4587B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\behaviors\trees\drifters\superweapon.py 2 from behaviors.actions.ballparks import FullStopAction, GetBallsInBubbleByOwnerIds, StoreSlimItemAttributeToBlackboard 3 from behaviors.actions.blackboards import BlackboardSetMessageAsNoneAction, BlackboardSetMessageToBooleanValueAction 4 from behaviors.actions.effects import SetDogmaAttributeValue, ResetDogmaAttributeValue, ActivateTargetedEffect 5 from behaviors.blackboards.scopes import ScopeTypes 6 from behaviors.composites import PrioritySelector, Sequence 7 from behaviors.conditions.blackboards import IsBlackboardValueTrue 8 from behaviors.conditions.entities import OwnerIsNpcCondition 9 from behaviors.const.combat import THREAT_TARGET_EVALUATOR 10 from behaviors.decorators.modifiers import Uninterruptible, ForceFailure 11 from behaviors.decorators.repeaters import RepeatWhileFailing 12 from behaviors.actions.combat import ActivateSuperWeaponOnTarget, StopCombatEffectsOnTarget, AddCharacterForPodding 13 from behaviors.monitors.superweapon import WaitForTurboShieldState 14 from brennivin.itertoolsext import Bundle 15 from behaviors.actions.combattargets import FindTarget, AcquireTargetLock 16 from behaviors.trees.combat import COMBAT_TARGETS_SET, COMBAT_EFFECTS 17 from dogma.const import attributeScanResolution, effectWarpScrambleForEntity 18 from inventorycommon.const import categoryShip, categoryEntity 19 from spacecomponents.common.components.turboshield import TURBO_SHIELD_STATE_RESISTIVE, TURBO_SHIELD_STATE_ACTIVE 20 SUPER_WEAPON_TARGET = (ScopeTypes.Item, 'SUPER_WEAPON_TARGET') 21 SUPER_WEAPON_READY = (ScopeTypes.Item, 'SUPER_WEAPON_READY') 22 SUPER_WEAPON_TARGET_OWNER = (ScopeTypes.Item, 'SUPER_WEAPON_TARGET_OWNER') 23 PODDING_TARGET_LIST = (ScopeTypes.EntityGroup, 'PODDING_TARGET_LIST') 24 OVERRIDE_SUPER_WEAPON_RESET = (ScopeTypes.Item, 'OVERRIDE_SUPER_WEAPON_RESET') 25 26 def CreateSuperWeaponBehavior(): 27 return PrioritySelector(Bundle(name='Super Weapon')).AddSubTask(ForceFailure().AddSubTask(PrioritySelector().AddSubTask(IsBlackboardValueTrue(Bundle(name='Should override Weapon Reset?', valueAddress=OVERRIDE_SUPER_WEAPON_RESET))).AddSubTask(Sequence(Bundle(name='Reset Weapon')).AddSubTask(WaitForTurboShieldState(Bundle(turboShieldState=TURBO_SHIELD_STATE_ACTIVE))).AddSubTask(BlackboardSetMessageToBooleanValueAction(Bundle(messageAddress=SUPER_WEAPON_READY, value=False)))))).AddSubTask(Sequence(Bundle(name='Enable Weapon')).AddSubTask(IsBlackboardValueTrue(Bundle(valueAddress=SUPER_WEAPON_READY))).AddSubTask(Uninterruptible().AddSubTask(Sequence(Bundle(name='Destroy someone')).AddSubTask(RepeatWhileFailing(Bundle(maxRepetitions=5)).AddSubTask(Sequence(Bundle(name='Pick target and lock quickly')).AddSubTask(BlackboardSetMessageAsNoneAction(Bundle(messageAddress=SUPER_WEAPON_TARGET))).AddSubTask(FindTarget(Bundle(potentialTargetListAddress=COMBAT_TARGETS_SET, selectedTargetAddress=SUPER_WEAPON_TARGET, includedCategories=[categoryShip, categoryEntity], onlyCheckLocalBubble=True, targetEvaluationFunction=THREAT_TARGET_EVALUATOR, primaryTargetIdAddress=COMBAT_TARGETS_SET))).AddSubTask(SetDogmaAttributeValue(Bundle(attributeId=attributeScanResolution, value=10000.0))).AddSubTask(AcquireTargetLock(Bundle(selectedTargetAddress=SUPER_WEAPON_TARGET))).AddSubTask(ResetDogmaAttributeValue(Bundle(attributeId=attributeScanResolution))))).AddSubTask(ActivateTargetedEffect(Bundle(selectedTargetAddress=SUPER_WEAPON_TARGET, effectId=effectWarpScrambleForEntity, repeats=None, shouldResetBehaviorOnEffectStopped=False))).AddSubTask(StopCombatEffectsOnTarget(Bundle(effectIds=COMBAT_EFFECTS))).AddSubTask(FullStopAction()).AddSubTask(StoreSlimItemAttributeToBlackboard(Bundle(targetAddress=SUPER_WEAPON_TARGET, messageAddress=SUPER_WEAPON_TARGET_OWNER, attributeName='ownerID'))).AddSubTask(ActivateSuperWeaponOnTarget(Bundle(selectedTargetAddress=SUPER_WEAPON_TARGET))).AddSubTask(PrioritySelector().AddSubTask(OwnerIsNpcCondition(Bundle(name='Skipping NPC owners', ownerIdAddress=SUPER_WEAPON_TARGET_OWNER))).AddSubTask(Sequence(Bundle(name='Add owner to pod list')).AddSubTask(AddCharacterForPodding(Bundle(characterAddress=SUPER_WEAPON_TARGET_OWNER, poddingTargetListAddress=PODDING_TARGET_LIST))).AddSubTask(GetBallsInBubbleByOwnerIds(Bundle(objectListAddress=COMBAT_TARGETS_SET, ownerListAddress=PODDING_TARGET_LIST))))).AddSubTask(BlackboardSetMessageToBooleanValueAction(Bundle(messageAddress=SUPER_WEAPON_READY, value=False)))))).AddSubTask(WaitForTurboShieldState(Bundle(turboShieldState=TURBO_SHIELD_STATE_RESISTIVE, messageAddress=SUPER_WEAPON_READY)))