投掷(ai-throw)

基本信息

属性 值
类名 toast.specialAI.ai.special.EntityAIThrow
实现接口 ISpecialAI
名称 throw
默认权重 1
默认存值 byte 1
互斥位 MOVEMENT + FACING
优先级 0

功能

实体自身附近找一个能充当"炮弹"的同盟生物(同攻击目标、已着地、未骑乘、与目标距离 > 6 格)并把它 mountEntity 到自己身上,随后冲向玩家。每 tick 1/10 概率把它扔出去(沿冲撞方向 + motionY = 0.4)。

阶段

阶段 条件 行为
抓取 riddenByEntity == null 周期 nextInt(20) == 0 时搜寻 throwTarget,靠近到 (width*2)^2 + target.width 距离即 mountEntity
投掷 riddenByEntity != null 每 10 tick 1/10 概率把 riddenByEntity mountEntity(null) 并沿玩家方向施加速度

isInterruptible() = false。

shouldExecute

  • 目标存在
  • 未骑乘
  • 身上已经有骑乘 OR nextInt(20) == 0 且 findThrowTarget 成功

continueExecuting

  • 目标存在
  • 未骑乘
  • throwTarget 还活着 或 身上还有骑乘

失败上限 400 tick(giveUpDelay > 400)强制清空路径。

初始化(initialize)

  • knockbackResistance +1
  • maxHealth +10

resetTask

把身上的骑乘者卸下(mountEntity(null)),清空路径与 throwTarget。

相关条目