Skip to content

系数、覆盖与 AI 调整

GTPet 的战斗、移动、资源、成长、繁育和工作数值主要位于:

text
plugins/GTCore/modules/GTPet/coefficients.yml
plugins/GTCore/modules/GTPet/overrides.yml

修改后执行:

text
/gtpet reload

系数完整格式

yaml
coefficients:
  combat.damage.base:
    base: 1.0
    formula: "{base} + {pet.level} * 0.04 + {combat.level} * 0.02"
    min: 0.0
    max: 1000000.0
    scale: 4
    rounding: HALF_UP
    invalid-policy: REJECT
字段说明
base基础值;公式中使用 {base} 读取
formula可选公式,可以引用当前宠物、主人、目标和输入变量
min最小结果
max最大结果
scale保留的小数位数
rounding舍入方式,例如 HALF_UPFLOORCEILING
invalid-policy计算失败时的处理方式,通常使用 REJECT

测试一个系数

text
gtpet coefficient combat.damage.base pet.level=1 combat.level=1

按上面的示例公式,预期结果为:

text
1.06

需要查看某类系数时执行:

text
gtpet coefficients ai.owner
gtpet coefficients combat
gtpet coefficients growth

常用移动系数

yaml
coefficients:
  ai.owner.follow-distance:
    base: 3.5
  ai.owner.navigation-speed:
    base: 0.87
    formula: "{base} + {pet.role.move-speed}"
  ai.owner.follow-speed:
    base: 0.0
    formula: "{base} + {pet.role.move-speed}"
    min: 0.0
  ai.owner.fallback-acceleration:
    base: 0.35
  ai.owner.fallback-jump-velocity:
    base: 0.42
  ai.owner.fallback-max-jump-height:
    base: 1.25
  ai.owner.teleport-distance:
    base: 32.0
系数作用
follow-distance超过多少格开始跟随
navigation-speed支持寻路的宠物移动速度
follow-speed无法使用寻路时的移动速度
fallback-acceleration回退移动加速速度
fallback-jump-velocity回退移动跳跃力度
fallback-max-jump-height允许跳向目标的最大高度差
teleport-distance超过多少格返回主人附近

加快所有宠物

yaml
ai.owner.navigation-speed:
  base: 1.10
  formula: "{base} + {pet.role.move-speed}"

保存并执行:

text
/gtpet reload
gtpet coefficient ai.owner.navigation-speed pet.role.move-speed=0.32

只加快一个模板

templates.yml 修改:

yaml
pets:
  starter_wolf:
    attributes:
      move-speed: 0.45

常用战斗系数

先列出本服已加载的战斗系数:

text
gtpet coefficients combat

常见调整:

yaml
coefficients:
  combat.attack.interval-ticks:
    base: 20.0
  combat.basic.energy-cost:
    base: 5.0
  combat.damage.base:
    base: 1.0
  combat.critical.chance:
    base: 0.05
  • combat.attack.interval-ticks: 20 约为每秒一次基础攻击。
  • energy-cost 是每次基础攻击消耗的能量。
  • 使用 damage-calculator: GTPET 时,combat.damage.* 参与内置伤害。
  • 使用 AP 或 CA 时,最终伤害以所选属性插件为准。

常用资源系数

text
gtpet coefficients resource

示例:提高法力恢复速度:

yaml
coefficients:
  resource.mana.regen-per-second:
    base: 4.0

示例:提高技能能量消耗:

yaml
coefficients:
  resource.skill.cost-multiplier:
    base: 1.25

1.25 表示技能消耗变为原来的 125%

配置覆盖规则

overrides.yml 可以在不改基础系数的情况下,为特定世界、模板、品质、姿态、权限或技能设置不同数值。

完整格式:

yaml
overrides:
  - id: nether-combat-damage
    coefficient: combat.damage.base
    scope:
      type: WORLD
      values:
        - world_nether
    priority: 100
    operation: MULTIPLY
    value: 1.15
    conditions:
      - "{pet.level} >= 1"

效果:宠物在 world_nether 中时,combat.damage.base 乘以 1.15

测试:

text
gtpet coefficient combat.damage.base pet.level=1 combat.level=1 scope.WORLD=world_nether

覆盖运算

运算作用
SET直接设置为指定值
ADD加上指定值
SUBTRACT减去指定值
MULTIPLY乘以指定值
DIVIDE除以指定值
POWER幂运算
MIN取较小值
MAX取较大值

常用覆盖示例

指定模板提高移动速度

yaml
overrides:
  - id: player-companion-speed
    coefficient: ai.owner.navigation-speed
    scope:
      type: TEMPLATE
      values:
        - player_companion
    priority: 200
    operation: ADD
    value: 0.20

传说品质提高最大生命

yaml
overrides:
  - id: legendary-health
    coefficient: lifecycle.max-health
    scope:
      type: QUALITY
      values:
        - LEGENDARY
    priority: 200
    operation: MULTIPLY
    value: 1.20

VIP 降低技能消耗

yaml
overrides:
  - id: vip-skill-cost
    coefficient: resource.skill.cost-multiplier
    scope:
      type: OWNER_PERMISSION
      values:
        - gtpet.vip
    priority: 300
    operation: MULTIPLY
    value: 0.80

进攻姿态提高攻击倾向

yaml
overrides:
  - id: aggressive-attack-bias
    coefficient: ai.behavior.attack.bias
    scope:
      type: STANCE
      values:
        - AGGRESSIVE
    priority: 300
    operation: ADD
    value: 25.0

条件

多条 conditions 默认全部满足才生效:

yaml
conditions:
  - "{pet.level} >= 20"
  - "{owner.online} == 1"

任意一条满足即可:

yaml
condition-mode: ANY

全部不满足时才生效:

yaml
condition-mode: NONE

常用作用范围

scope.typevalues 示例
WORLDworld_nether
REGION区域 ID
OWNER_PERMISSIONgtpet.vip
OWNER_GROUPvip
TEMPLATEstarter_wolf
PET_INSTANCE宠物 UUID
GENERATION23
QUALITYRARELEGENDARY
GENE基因 ID
TRAITguardian
TALENT天赋 ID
EQUIPMENT_SLOTweapon
STANCEAGGRESSIVE
SKILLclaw
SKILL_TAG技能标签
TARGET_TYPE目标类型

调整 AI 行为

主要行为:

text
ai.behavior.retreat.bias
ai.behavior.recover-path.bias
ai.behavior.protect-owner.bias
ai.behavior.return-owner.bias
ai.behavior.attack.bias
ai.behavior.search-last-target.bias
ai.behavior.follow-owner.bias
ai.behavior.idle.bias

数值越高,该行为在满足条件时越容易被选择。不要只改一个行为后直接上正式服,先使用诊断命令测试。

text
gtpet ai simulate stance=AGGRESSIVE health=1 mana=1 target=true target-threat=0.5

输出会列出每个行为是否可用、分数和拒绝原因。

测试 PVP 禁止

text
gtpet ai simulate stance=AGGRESSIVE pvp-allowed=false target=true

攻击行为应显示为不可执行,原因显示为 PVP 禁止。

测试低生命撤退

text
gtpet ai simulate stance=DEFENSIVE health=0.1 mana=0.5 target=true

撤退行为的分数应高于普通攻击。

完整验收流程

  1. ai.owner.navigation-speed.base0.87 改为 1.10
  2. 添加 player-companion-speed 模板覆盖。
  3. 执行 /gtpet reload
  4. 使用 gtpet coefficient 分别测试普通输入和 scope.TEMPLATE=player_companion
  5. 召唤普通狼和 PLAYER 宠物,比较移动速度。
  6. 使用 gtpet ai simulate 测试 PASSIVEDEFENSIVEAGGRESSIVE
  7. 确认 PVP 禁止时攻击行为不会被选择。

排错

重载失败

检查提示中的系数 ID、公式、枚举值和 YAML 缩进。常见错误:

  • 引用了不存在的系数。
  • 除数为 0
  • 公式变量拼写错误。
  • min 大于 max
  • scope.typeoperation 拼写错误。

覆盖没有生效

  1. 确认 coefficient ID 与 coefficients.yml 完全一致。
  2. 确认 scope.typevalues 与实际世界、模板或权限一致。
  3. 暂时删除 conditions 再测试。
  4. 使用 gtpet coefficient 传入对应 scope.<类型>=<值>

宠物总是待命

检查:

  • 宠物是否已召唤。
  • 主人是否在线。
  • 姿态是否为 PASSIVEHOLDWORK
  • 是否存在允许攻击的目标。
  • PVP 和区域规则是否允许。
  • 目标是否在感知距离内。

宠物移动仍然很慢

同时检查:

  • ai.owner.navigation-speed.base
  • 模板 attributes.move-speed
  • 是否执行了 /gtpet reload
  • PLAYER 宠物是否收回后重新召唤