ToolLeveling 配置

主配置 config/iguanatweakstconstruct.cfg 的 ToolLeveling 分类,对应 工具等级系统 与 随机奖励修饰符。

分类注释:Leveling Module: Setup the leveling system how you like it

经验需求

配置键 类型 默认 范围 含义
xpRequiredToolsPercentage int 100 1~999 工具升级所需经验百分比(越高越难升)
xpRequiredWeaponsPercentage int 100 1~999 武器升级所需经验百分比
xpPerLevelMultiplier float 1.15 1.0~9.99 升级经验的指数系数(每级指数增长)
onlyHeadsChangeXPRequirement boolean true — 只用头部部件材料决定经验需求;设为 false 时手柄/配件也计入
allowFakePlayerLeveling boolean true — 允许假玩家(自动化设备)积累工具等级

onlyHeadsChangeXPRequirement 的注释说明它只在你用覆盖模块手动指定某些材料升级更快时才有意义(见 覆盖模块)。默认几何平均只统计 HEAD 类型部件。

xpPerBoostLevelMultiplier 虽然写在这个方法里,但它落在 ToolLeveling 分类(源码中 CATEGORY_Leveling),属于 PickLeveling 配置 的语义范畴。

Tooltip

配置键 类型 默认 含义
showTooltipXP boolean true 悬停工具时显示当前经验
detailedXpTooltip boolean true 经验提示同时显示具体数值,而非只有百分比
showMinimalTooltipXP boolean false 在等级后追加简洁的 XP%

三者可组合:showTooltipXP=false 时后两项无效。

升级行为

配置键 类型 默认 范围 含义
maxToolLevel int 6 1~99 工具等级上限(isMaxLevel 判定用)
toolLeveling boolean true — 是否启用工具等级系统(总开关)
ExtraModifiers int 0 0~9 新造工具自带的修饰符槽数量
ModifiersAtLevels int[] {2, 4, 6} — ExtraModifiers 开启时,在这些等级额外白送槽位
RandomBonuses boolean true — 每次升级给随机奖励修饰符
BonusesAtLevels int[] {2, 3, 4, 5, 6} — 在这些等级触发随机奖励
UsefulBonuses boolean true — 剔除对当前工具类别没用的修饰符(剑给丝触、镐给断头这类)
CompletelyRandomBonuses boolean false — 所有修饰符等概率,且强制禁用「有用」过滤

ExtraModifiers 与新工具

LevelingEventHandler.onCraftTool 在制造工具时执行:

toolTag.setInteger("Modifiers", Math.max(toolTag.getInteger("Modifiers")
        - (3 - Config.toolLevelingExtraModifiers), 0));

即新工具默认被扣 3 个修饰符槽,ExtraModifiers 每加 1 就少扣 1 个。这保证了首次升级时至少有空槽可用。

两个随机奖励开关的交互

RandomBonuses 的注释说明了降级行为:

Gives a random bonus every level, if false and levelling is on modifiers are given at levels 2 and 4 (requires 'toolLeveling=true')

即设为 false 时,不再随机发放,而是在固定的 2 级和 4 级各发一个修饰符。

RandomBonuses 分类(逐个禁用)

RandomBonuses 分类是循环生成的 18 个布尔开关:

for (RandomBonuses.Modifier mod : RandomBonuses.Modifier.values()) {
    Property allowed = configfile.get(CATEGORY_Bonuses, String.format("allow%s", mod.toString()), true);
    if (!allowed.getBoolean()) deactivatedModifiers.add(mod);
}

分类注释:Leveling Module: Allows to completely deactivate specific modifiers on levelup.

因此键名为 allow<修饰符键>,全部 18 个默认 true:

allowRedstone        allowLuckLooting     allowAutosmelt    allowSilkTouch
allowDiamond         allowEmerald         allowRepair       allowReinforced
allowAttack          allowFiery           allowSmite        allowBaneOfArthropods
allowBeheading       allowLifeSteal       allowKnockback    allowJagged
allowStonebound      allowCritical

源码注释说明了为什么用 configfile.get(Property) 而不是 getBoolean(key, cat, default, comment):// we use this way of obtaining the values because it doesn't create the empty lines and comments otherwise this blows up the config. a lot.

被置 false 的修饰符会被加入 Config.deactivatedModifiers,在 随机奖励 的权重计算中权重直接归零(不消耗一次抽奖机会)。

完整权重矩阵见 随机奖励修饰符。