import { attackTargetType , TaskAttack } from './TaskInstances/task_attack' ; import { buildTargetType , TaskBuild } from './TaskInstances/task_build' ; import { claimTargetType , TaskClaim } from './TaskInstances/task_claim' ; import { dismantleTargetType , TaskDismantle } from './TaskInstances/task_dismantle' ; import { fortifyTargetType , TaskFortify } from './TaskInstances/task_fortify' ; import { getBoostedTargetType , TaskGetBoosted } from './TaskInstances/task_getBoosted' ; import { getRenewedTargetType , TaskGetRenewed } from './TaskInstances/task_getRenewed' ; import { goToTargetType , TaskGoTo } from './TaskInstances/task_goTo' ; import { goToRoomTargetType , TaskGoToRoom } from './TaskInstances/task_goToRoom' ; import { harvestTargetType , TaskHarvest } from './TaskInstances/task_harvest' ; import { healTargetType , TaskHeal } from './TaskInstances/task_heal' ; import { meleeAttackTargetType , TaskMeleeAttack } from './TaskInstances/task_meleeAttack' ; import { pickupTargetType , TaskPickup } from './TaskInstances/task_pickup' ; import { rangedAttackTargetType , TaskRangedAttack } from './TaskInstances/task_rangedAttack' ; import { repairTargetType , TaskRepair } from './TaskInstances/task_repair' ; import { reserveTargetType , TaskReserve } from './TaskInstances/task_reserve' ; import { signControllerTargetType , TaskSignController } from './TaskInstances/task_signController' ; import { TaskTransfer , transferTargetType } from './TaskInstances/task_transfer' ; import { TaskUpgrade , upgradeTargetType } from './TaskInstances/task_upgrade' ; import { TaskWithdraw , withdrawTargetType } from './TaskInstances/task_withdraw' ; import { dropTargetType , TaskDrop } from './TaskInstances/task_drop' ; import { TaskTransferAll , transferAllTargetType } from './TaskInstances/task_transferAll' ; import { TaskWithdrawAll , withdrawAllTargetType } from './TaskInstances/task_withdrawAll' ; export class Tasks { static chain ( tasks , setNextPos = true ) { if ( tasks . length == 0 ) { return null ; } if ( setNextPos ) { for ( let i = 0 ; i < tasks . length - 1 ; i ++ ) { tasks [ i ] . options . nextPos = tasks [ i + 1 ] . targetPos ; } } let task = _ . last ( tasks ) ; tasks = _ . dropRight ( tasks ) ; for ( let i = ( tasks . length - 1 ) ; i >= 0 ; i -- ) { task = task . fork ( tasks [ i ] ) ; } return task ; } static attack ( target , options = { } as TaskOptions ) { return new TaskAttack ( target , options ) ; } static build ( target , options = { } as TaskOptions ) { return new TaskBuild ( target , options ) ; } static claim ( target , options = { } as TaskOptions ) { return new TaskClaim ( target , options ) ; } static dismantle ( target , options = { } as TaskOptions ) { return new TaskDismantle ( target , options ) ; } static drop ( target , resourceType = RESOURCE_ENERGY , amount = undefined , options = { } as TaskOptions ) { return new TaskDrop ( target , resourceType , amount , options ) ; } static fortify ( target , options = { } as TaskOptions ) { return new TaskFortify ( target , options ) ; } static getBoosted ( target , boostType , amount = undefined , options = { } as TaskOptions ) { return new TaskGetBoosted ( target , boostType , amount , options ) ; } static getRenewed ( target , options = { } as TaskOptions ) { return new TaskGetRenewed ( target , options ) ; } static goTo ( target , options = { } as TaskOptions ) { return new TaskGoTo ( target , options ) ; } static goToRoom ( target , options = { } as TaskOptions ) { return new TaskGoToRoom ( target , options ) ; } static harvest ( target , options = { } as TaskOptions ) { return new TaskHarvest ( target , options ) ; } static heal ( target , options = { } as TaskOptions ) { return new TaskHeal ( target , options ) ; } static meleeAttack ( target , options = { } as TaskOptions ) { return new TaskMeleeAttack ( target , options ) ; } static pickup ( target , options = { } as TaskOptions ) { return new TaskPickup ( target , options ) ; } static rangedAttack ( target , options = { } as TaskOptions ) { return new TaskRangedAttack ( target , options ) ; } static repair ( target , options = { } as TaskOptions ) { return new TaskRepair ( target , options ) ; } static reserve ( target , options = { } as TaskOptions ) { return new TaskReserve ( target , options ) ; } static signController ( target , signature , options = { } as TaskOptions ) { return new TaskSignController ( target , signature , options ) ; } static transfer ( target , resourceType = RESOURCE_ENERGY , amount = undefined , options = { } as TaskOptions ) { return new TaskTransfer ( target , resourceType , amount , options ) ; } static transferAll ( target , skipEnergy = false , options = { } as TaskOptions ) { return new TaskTransferAll ( target , skipEnergy , options ) ; } static upgrade ( target , options = { } as TaskOptions ) { return new TaskUpgrade ( target , options ) ; } static withdraw ( target , resourceType = RESOURCE_ENERGY , amount = undefined , options = { } as TaskOptions ) { return new TaskWithdraw ( target , resourceType , amount , options ) ; } static withdrawAll ( target , options = { } as TaskOptions ) { return new TaskWithdrawAll ( target , options ) ; } }