Toughness
基本信息
| 属性 | 值 |
|---|---|
| 注册名 | nutrition:toughness(Potion.setPotionName → potion.nutrition:toughness) |
| 效果类型 | 增益(good Potion,PotionCustom(id, false, icon)) |
| 修饰属性 | SharedMonsterAttributes.maxHealth(UUID d80b5ec3-8cf9-4b74-bc0d-6f3ef7b48b2e)+ knockbackResistance(UUID f42431e4-8efc-44d2-8249-fea2a2cb418e) |
| 图标资源 | assets/nutrition/textures/potions/toughness.png |
| 应用时长 | 619 ticks(约 30.95 秒),由 EffectsManager.reapplyEffects 每 110 ticks 续期 |
功能
玩家 5 个 Nutrient 同时处于极高水平(90-100)时获得的双重 buff:每 amplifier 等级同时增加 4 HP(2 红心)和 2 点 knockbackResistance。是 mod 的"超级营养"奖励。
实现
public class PotionToughness extends PotionCustom {
PotionToughness(int id, ResourceLocation icon) {
super(id, false, icon);
}
@Override
public double func_111183_a(int amplifier, AttributeModifier modifier) {
// Multiply health
if (modifier.getID().equals(ModPotions.TOUGHNESS_HEALTH)) {
return (amplifier + 1) * 4D; // 4 = two hearts
}
// Multiply armor toughness
if (modifier.getID().equals(ModPotions.TOUGHNESS_KNOCKBACK)) {
return (amplifier + 1) * 2D;
}
return 0D;
}
}
数值公式
maxHealth 增加 = (amplifier + 1) × 4 HP
knockbackResistance 增加 = (amplifier + 1) × 2
| amplifier | HP 增加 | 红心增加 | knockbackResistance |
|---|---|---|---|
| 0 | 4 | 2 | 2 |
| 1 | 8 | 4 | 4 |
| 2 | 12 | 6 | 6 |
| 4 | 20 | 10 | 10 |
触发条件
EffectsList 中显式注册:
EFFECTS.add(
Effect.builder("toughness", ModPotions.toughness)
.nutrientRange(90, 100)
.detectionType(EnumDetectionType.CUMULATIVE)
.build());
nutrientRange(90, 100):Nutrient 值在 [90, 100] 区间才计入CUMULATIVE:每命中一个 Nutrient 在该区间,amplifier 增加(cumulativeModifier默认 1)
也就是说只有当所有 5 个 Nutrient(dairy/fruit/grain/protein/vegetable)都 ≥ 90 时才会触发,且每多一个 Nutrient 维持在 ≥ 90,Toughness 等级就 +1,最高等于 Nutrient 数量(5)。
相关条目
- Nourished - 类似的 HP buff Potion
- Malnourished - 对应的减益 Potion
- 效果阈值检测类型 -
CUMULATIVE检测算法详解