投掷玩家(ai-throw-player)
基本信息
| 属性 | 值 |
|---|---|
| 类名 | toast.specialAI.ai.special.EntityAIThrowPlayer |
| 实现接口 | ISpecialAI |
| 名称 | throw_player |
| 默认权重 | 1 |
| 默认存值 | byte 1 |
| 互斥位 | MOVEMENT + FACING |
| 优先级 | 0 |
功能
把玩家抓起来扔向附近最密集的同盟生物群(同攻击目标中 4×1×4 范围内生物数最多者)。抓住后靠近目标同盟,每 10 tick 1/10 概率投掷(玩家客户端同步发送 S12PacketEntityVelocity)。
阶段
| 阶段 | 行为 |
|---|---|
| 抓取 | 实体未携带骑乘 → 走向玩家,靠近到 (width*2)^2 + player.width 时 player.mountEntity(theEntity) |
| 投掷 | 每 10 tick 1/10 概率:把玩家 mountEntity(null),给玩家施加 (target_dir + entity.motion * 0.2) + motionY = 0.4,并向玩家发速度包 |
shouldExecute
- 攻击倒计时归零
- 攻击目标存在、在地面
- 未骑乘
nextInt(20) == 0且findThrowTarget()成功
continueExecuting
- 目标存在
- 未骑乘
throwTarget仍存活
isInterruptible() = false。失败上限 400 tick。
findThrowTarget
筛选攻击同一玩家、且与玩家距离 > 3 格(distanceSqToEntity > 9)的同盟;选取其周围 4×1×4 范围内实体数最多者作为投掷落点。
初始化(initialize)
- 头盔位(4)装备
Helmet of Strength红染色(0xff0000)皮头盔,EffectHelper.addModifier给attackDamage +1.0(op 0) knockbackResistance+1movementSpeed× +0.3(op 1 乘性)
resetTask
同 ai-throw:卸下身上骑乘、清路径、清 throwTarget。