diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt index fa7d66bdc..19e80c062 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt @@ -314,7 +314,7 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang AndroidResearchType.Builder(modLocation(MNames.FALL_DAMPENERS + "_3")) .withExperience(35) .withDescription(0 .. 1) - .withDescription(AndroidResearchDescriptions.FALL_DAMPENERS.Instance(2)) + .withDescription(AndroidResearchDescriptions.FALL_DAMPENERS.Instance(3)) .withIcon(ResearchIcons.ICON_FEATHER_FALLING) .addFeatureLevel(AndroidFeatures.FALL_DAMPENERS) .addPrerequisite(FALL_DAMPENERS_2) @@ -376,8 +376,8 @@ fun addResearchData(serializer: Consumer, lang: MatteryLang serializer.accept(JUMP_BOOST_2) with(lang) { - misc("fall_dampeners.description", "Reduces fall damage by %s%%") { - russian("Уменьшает урон от падения на %s%%") + misc("fall_dampeners.description", "Reduces fall damage by %s%% and increases fall damage flat resist by %s half a hearts") { + russian("Уменьшает урон от падения на %s%% и повышает сопротивление урону от падения на %s полусердец") } add(limbList[0], "Limb Overclocking %s") { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDescription.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDescription.kt index 7e5d420e6..402c46eac 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDescription.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDescription.kt @@ -36,7 +36,11 @@ object AndroidResearchDescriptions { } val FALL_DAMPENERS: AndroidResearchDescription.Leveled by registrar.register("fall_dampeners") { - AndroidResearchDescription.Leveled { _, _, level -> TranslatableComponent("otm.fall_dampeners.description", TextComponent("%.1f".format((AndroidConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL * level).toFloat().coerceAtLeast(0f).coerceAtMost(1f) * 100f)).withStyle(ChatFormatting.YELLOW)) } + AndroidResearchDescription.Leveled { _, list, level -> + list.add(TranslatableComponent("otm.fall_dampeners.description", + TextComponent("%.1f".format((AndroidConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_P * level).toFloat().coerceIn(0f, 1f) * 100f)).withStyle(ChatFormatting.YELLOW), + TextComponent("%.1f".format((AndroidConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_F * level).toFloat())).withStyle(ChatFormatting.YELLOW), + )) } } val ITEM_MAGNET: AndroidResearchDescription.Singleton by registrar.register("item_magnet") { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt index dbf0004d8..c0db601b9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt @@ -19,14 +19,16 @@ import ru.dbotthepony.mc.otm.triggers.FallDampenersSaveTrigger class FallDampenersFeature(capability: MatteryPlayerCapability) : AndroidFeature(AndroidFeatures.FALL_DAMPENERS, capability) { override fun onHurt(event: LivingHurtEvent) { if (event.source.isFall) { - val reduction = (AndroidConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL * (level + 1)).toFloat() + val reduction = (AndroidConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_P * (level + 1)).toFloat().coerceIn(0f, 1f) + val flat = (AndroidConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_F * (level + 1)).toFloat().coerceIn(0f, Float.MAX_VALUE) val old = event.amount - if (reduction >= 1f) { + if (reduction >= 1f || event.amount <= flat) { event.isCanceled = true event.amount = 0f } else { + event.amount -= flat event.amount *= (1f - reduction) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/AndroidConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/AndroidConfig.kt index 55cfb0e5c..9614c5948 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/AndroidConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/AndroidConfig.kt @@ -54,7 +54,16 @@ object AndroidConfig : AbstractConfig("androids") { val ANDROID_ENERGY_PER_HUNGER_POINT by builder.defineDecimal("energyPerHunger", Decimal(2000), Decimal.ZERO) val ANDROID_MAX_ENERGY by builder.comment("Internal battery of every android has this much storage").defineDecimal("capacity", Decimal(80_000), Decimal.ZERO) val NIGHT_VISION_POWER_DRAW by builder.defineDecimal("nightVisionPowerDraw", Decimal(8), Decimal.ZERO) - val FALL_DAMAGE_REDUCTION_PER_LEVEL: Double by builder.comment("In percent. Level of feature is multiplied by this").defineInRange("fallDamageReductionPerDampenerLevel", 0.25, 0.01, 1.0) + + val FALL_DAMAGE_REDUCTION_PER_LEVEL_P: Double by builder + .comment("In percent. Level of feature is multiplied by this") + .comment("First, fall damage is reduced by flat resistance, then reduced by percentage resistance (this)") + .defineInRange("FALL_DAMAGE_REDUCTION_PER_LEVEL_P", 0.2, 0.01, 1.0) + + val FALL_DAMAGE_REDUCTION_PER_LEVEL_F: Double by builder + .comment("In flat half of hearts. Level of feature is multiplied by this") + .comment("First, fall damage is reduced by flat resistance (this), then reduced by percentage resistance") + .defineInRange("FALL_DAMAGE_REDUCTION_PER_LEVEL_F", 1.5, 0.0, Float.MAX_VALUE.toDouble()) object EnderTeleporter { init {