系数、覆盖与 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_UP、FLOOR、CEILING |
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.05combat.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.251.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.20VIP 降低技能消耗
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.type | values 示例 |
|---|---|
WORLD | world_nether |
REGION | 区域 ID |
OWNER_PERMISSION | gtpet.vip |
OWNER_GROUP | vip |
TEMPLATE | starter_wolf |
PET_INSTANCE | 宠物 UUID |
GENERATION | 2、3 |
QUALITY | RARE、LEGENDARY |
GENE | 基因 ID |
TRAIT | guardian |
TALENT | 天赋 ID |
EQUIPMENT_SLOT | weapon |
STANCE | AGGRESSIVE |
SKILL | claw |
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撤退行为的分数应高于普通攻击。
完整验收流程
- 将
ai.owner.navigation-speed.base从0.87改为1.10。 - 添加
player-companion-speed模板覆盖。 - 执行
/gtpet reload。 - 使用
gtpet coefficient分别测试普通输入和scope.TEMPLATE=player_companion。 - 召唤普通狼和 PLAYER 宠物,比较移动速度。
- 使用
gtpet ai simulate测试PASSIVE、DEFENSIVE和AGGRESSIVE。 - 确认 PVP 禁止时攻击行为不会被选择。
排错
重载失败
检查提示中的系数 ID、公式、枚举值和 YAML 缩进。常见错误:
- 引用了不存在的系数。
- 除数为
0。 - 公式变量拼写错误。
min大于max。scope.type或operation拼写错误。
覆盖没有生效
- 确认
coefficientID 与coefficients.yml完全一致。 - 确认
scope.type和values与实际世界、模板或权限一致。 - 暂时删除
conditions再测试。 - 使用
gtpet coefficient传入对应scope.<类型>=<值>。
宠物总是待命
检查:
- 宠物是否已召唤。
- 主人是否在线。
- 姿态是否为
PASSIVE、HOLD或WORK。 - 是否存在允许攻击的目标。
- PVP 和区域规则是否允许。
- 目标是否在感知距离内。
宠物移动仍然很慢
同时检查:
ai.owner.navigation-speed.base- 模板
attributes.move-speed - 是否执行了
/gtpet reload - PLAYER 宠物是否收回后重新召唤
