rebalance all stats

This commit is contained in:
2026-03-29 14:25:23 +02:00
parent 2ce0182cb2
commit f28557f851
7 changed files with 79 additions and 132 deletions
@@ -1,5 +1,6 @@
package net.fretux.ascend.compat;
import net.fretux.ascend.player.StatEffects;
import io.redspace.ironsspellbooks.api.registry.AttributeRegistry;
import net.fretux.ascend.player.PlayerStatsProvider;
import net.minecraft.world.entity.ai.attributes.Attribute;
@@ -77,11 +78,9 @@ public class IronsSpellbooksCompat {
(Attribute) AttributeRegistry.MAX_MANA.get(),
INT_MAX_MANA_UUID,
"Ascend INT max mana",
intelligence * 3.0d
StatEffects.getIntelligenceManaBonus(intelligence)
);
double regenPerPoint = 0.004d;
double regenMax = 0.40d;
double regenBonus = Math.min(intelligence * regenPerPoint, regenMax);
double regenBonus = StatEffects.getIntelligenceAnvilCostReduction(intelligence);
applyMultiplyBaseModifier(
player,
(Attribute) AttributeRegistry.MANA_REGEN.get(),
@@ -101,9 +100,7 @@ public class IronsSpellbooksCompat {
if (willpower <= 0) {
return;
}
double perPoint = 0.0025d;
double max = 0.25d;
double reduction = Math.min(willpower * perPoint, max);
double reduction = StatEffects.getWillpowerCastTimeReduction(willpower);
Attribute attr = (Attribute) AttributeRegistry.CAST_TIME_REDUCTION.get();
if (attr == null) {
return;
@@ -135,7 +132,7 @@ public class IronsSpellbooksCompat {
return;
}
double manaPerPoint = 1.5d;
double bonusMana = charisma * manaPerPoint;
double bonusMana = Math.min(charisma * manaPerPoint, 150.0d);
applyAddModifier(
player,
(Attribute) AttributeRegistry.MAX_MANA.get(),
@@ -143,9 +140,7 @@ public class IronsSpellbooksCompat {
"Ascend CHA max mana",
bonusMana
);
double supportPerPoint = 0.003d;
double supportMax = 0.30d;
double supportBonus = Math.min(charisma * supportPerPoint, supportMax);
double supportBonus = StatEffects.getCharismaAllyDamageBonus(charisma);
Attribute supportAttr = (Attribute) AttributeRegistry.HOLY_SPELL_POWER.get();
if (supportAttr != null && supportBonus > 0.0d) {
applyMultiplyBaseModifier(
@@ -156,10 +151,8 @@ public class IronsSpellbooksCompat {
supportBonus
);
}
double minionHpPerPoint = 0.004d;
double minionDmgPerPoint = 0.003d;
double minionHpBonus = Math.min(charisma * minionHpPerPoint, 0.40d);
double minionDmgBonus = Math.min(charisma * minionDmgPerPoint, 0.30d);
double minionHpBonus = Math.min(StatEffects.getCharismaAllyHealthBonus(charisma) * 1.25d, 0.25d);
double minionDmgBonus = Math.min(StatEffects.getCharismaAllyDamageBonus(charisma) * 1.25d, 0.25d);
Attribute summonHpAttr = null;
Attribute summonDmgAttr = (Attribute) AttributeRegistry.SUMMON_DAMAGE.get();
if (summonHpAttr != null && minionHpBonus > 0.0d) {
@@ -203,9 +196,7 @@ public class IronsSpellbooksCompat {
clearMagicScaling(player);
return;
}
double spPerPoint = 0.0075d;
double spMax = 0.75d;
double spBonus = Math.min(magicScaling * spPerPoint, spMax);
double spBonus = Math.min(StatEffects.getMagicScalingMultiplier(magicScaling) - 1.0d, 0.35d);
applyMultiplyBaseModifier(
player,
(Attribute) AttributeRegistry.SPELL_POWER.get(),
@@ -213,9 +204,7 @@ public class IronsSpellbooksCompat {
"Ascend Magic Scaling spell power",
spBonus
);
double cdrPerPoint = 0.0015d;
double cdrMax = 0.15d;
double cdrBonus = Math.min(magicScaling * cdrPerPoint, cdrMax);
double cdrBonus = Math.min((StatEffects.getMagicScalingMultiplier(magicScaling) - 1.0d) * 0.4d, 0.14d);
applyMultiplyBaseModifier(
player,
(Attribute) AttributeRegistry.COOLDOWN_REDUCTION.get(),
@@ -300,7 +300,7 @@ public class ActivityEvents {
player.getCapability(PlayerStatsProvider.PLAYER_STATS).ifPresent(stats -> {
int agility = stats.getAttributeLevel("agility");
if (agility <= 0) return;
double evadeChance = Math.min(agility * 0.0005d, 0.05d);
double evadeChance = StatEffects.getAgilityEvasionChance(agility);
if (player.getRandom().nextDouble() < evadeChance) {
float original = event.getAmount();
event.setAmount(original * 0.1f);
@@ -2,6 +2,7 @@ package net.fretux.ascend.event;
import net.fretux.ascend.AscendMod;
import net.fretux.ascend.player.PlayerStatsProvider;
import net.fretux.ascend.player.StatEffects;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.event.TickEvent;
@@ -21,9 +22,7 @@ public class FortitudeDefenseEvents {
player.getCapability(PlayerStatsProvider.PLAYER_STATS).ifPresent(stats -> {
int fortitude = stats.getAttributeLevel("fortitude");
if (fortitude <= 0) return;
double perPoint = 0.004d;
double max = 0.5d;
double chance = Math.min(fortitude * perPoint, max);
double chance = StatEffects.getFortitudeEffectGuardChance(fortitude);
if (chance > 0 && player.getRandom().nextDouble() < chance) {
event.setResult(Event.Result.DENY);
}
@@ -38,9 +37,7 @@ public class FortitudeDefenseEvents {
int fortitude = stats.getAttributeLevel("fortitude");
if (fortitude <= 0) return;
if (player.tickCount % 40 != 0) return;
double perPoint = 0.003d;
double max = 0.4d;
double chance = Math.min(fortitude * perPoint, max);
double chance = StatEffects.getFortitudeCleanseChance(fortitude);
if (chance <= 0) return;
if (player.getRandom().nextDouble() >= chance) return;
player.getActiveEffects().stream()
@@ -2,6 +2,7 @@ package net.fretux.ascend.event;
import net.fretux.ascend.AscendMod;
import net.fretux.ascend.player.PlayerStatsProvider;
import net.fretux.ascend.player.StatEffects;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.event.enchanting.EnchantmentLevelSetEvent;
@@ -32,9 +33,7 @@ public class IntelligenceEnchantmentEvents {
if (intelligence <= 0) return;
int original = event.getOriginalLevel();
if (original <= 0) return;
double perPoint = 0.005d;
double max = 0.40d;
double reduction = Math.min(intelligence * perPoint, max);
double reduction = StatEffects.getIntelligenceAnvilCostReduction(intelligence);
int newLevel = (int) Math.max(1, Math.floor(original * (1.0d - reduction)));
event.setEnchantLevel(newLevel);
});
@@ -2,6 +2,7 @@ package net.fretux.ascend.event;
import net.fretux.ascend.AscendMod;
import net.fretux.ascend.player.PlayerStatsProvider;
import net.fretux.ascend.player.StatEffects;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.player.Player;
@@ -24,9 +25,7 @@ public class IntelligencePotionEvents {
int intel = stats.getAttributeLevel("intelligence");
if (intel <= 0) return;
int baseDuration = inst.getDuration();
double durPerPoint = 0.005d;
double durMax = 0.5d;
double durBonus = Math.min(intel * durPerPoint, durMax);
double durBonus = StatEffects.getIntelligenceAnvilCostReduction(intel);
int newDuration = (int) (baseDuration * (1.0d + durBonus));
if (newDuration <= baseDuration) return;
player.removeEffect(inst.getEffect());
@@ -1,25 +1,20 @@
package net.fretux.ascend.event;
import net.fretux.ascend.AscendMod;
import net.fretux.ascend.config.AscendConfig;
import net.fretux.ascend.player.PlayerStatsProvider;
import net.fretux.ascend.player.StatEffects;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.FireworkRocketEntity;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.entity.projectile.ThrownTrident;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber(modid = AscendMod.MODID)
public class WeaponMagicScalingEvents {
private static double getScaling() {
return AscendConfig.COMMON.attributeScalingMultiplier.get();
}
@SubscribeEvent
public static void onLivingHurt(LivingHurtEvent event) {
if (!(event.getSource().getEntity() instanceof Player player)) return;
@@ -31,33 +26,12 @@ public class WeaponMagicScalingEvents {
if (isMagicDamage(event.getSource())) {
int magicScaling = stats.getAttributeLevel("magic_scaling");
if (magicScaling > 0) {
double perPoint = 0.005d;
double maxBonus = 0.40d;
double bonusMult = 1.0d + Math.min(magicScaling * perPoint * getScaling(), maxBonus);
double bonusMult = StatEffects.getMagicScalingMultiplier(magicScaling);
modified = (float) (modified * bonusMult);
}
} else if (isRangedDamage(event.getSource())) {
double rangedMultiplier = getRangedScalingMultiplier(stats, event.getSource());
modified = (float) (modified * rangedMultiplier);
} else {
double attackSpeed = 4.0d;
if (player.getAttribute(Attributes.ATTACK_SPEED) != null) {
attackSpeed = player.getAttribute(Attributes.ATTACK_SPEED).getValue();
}
String key =
(attackSpeed >= 1.8d) ? "light_scaling" :
(attackSpeed >= 1.2d) ? "medium_scaling" :
"heavy_scaling";
int level = stats.getAttributeLevel(key);
if (level > 0) {
double perPoint =
key.equals("light_scaling") ? 0.003d :
key.equals("medium_scaling") ? 0.004d :
0.005d;
double maxBonus = 0.40d;
double bonusMult = 1.0d + Math.min(level * perPoint * getScaling(), maxBonus);
modified = (float) (modified * bonusMult);
}
}
if (modified != base) {
@@ -91,17 +65,13 @@ public class WeaponMagicScalingEvents {
double bonus = 1.0d;
int agility = stats.getAttributeLevel("agility");
if (agility > 0) {
double perPoint = 0.004d;
double maxBonus = 0.35d;
bonus *= 1.0d + Math.min(agility * perPoint * getScaling(), maxBonus);
bonus *= StatEffects.getAgilityRangedDamageMultiplier(agility);
}
if (source.getDirectEntity() instanceof ThrownTrident) {
int strength = stats.getAttributeLevel("strength");
if (strength > 0) {
double perPoint = 0.003d;
double maxBonus = 0.25d;
bonus *= 1.0d + Math.min(strength * perPoint * getScaling(), maxBonus);
bonus *= StatEffects.getStrengthTridentDamageMultiplier(strength);
}
}
@@ -36,19 +36,13 @@ public final class StatEffects {
return AscendConfig.COMMON.attributeScalingMultiplier.get();
}
private static double mediumScalingPercent(int x) {
if (x <= 0) return 0.0d;
return Math.pow(3.5d * x, 0.61d);
private static double scaledRatio(int level, double perPoint, double max) {
if (level <= 0) return 0.0d;
return Math.min(level * perPoint * getScaling(), max);
}
private static double lightScalingPercent(int x) {
if (x <= 0) return 0.0d;
return Math.pow(4.0d * x, 0.55d);
}
private static double heavyScalingPercent(int x) {
if (x <= 0) return 0.0d;
return (0.4d * x) + (5.0d * Math.sin(0.065d * x));
private static double scalingMultiplier(int level, double perPoint, double maxBonus) {
return 1.0d + scaledRatio(level, perPoint, maxBonus);
}
public static void applyAll(Player player) {
@@ -68,7 +62,7 @@ public final class StatEffects {
if (atk != null) {
atk.removeModifier(STRENGTH_DAMAGE_UUID);
if (strengthLevel > 0) {
double dmgBonus = (mediumScalingPercent(strengthLevel) * 0.1d) * getScaling();
double dmgBonus = Math.min(strengthLevel * 0.06d * getScaling(), 6.0d);
atk.addTransientModifier(new AttributeModifier(
STRENGTH_DAMAGE_UUID,
"Ascend Strength damage bonus",
@@ -82,7 +76,7 @@ public final class StatEffects {
if (kb != null) {
kb.removeModifier(STRENGTH_KNOCKBACK_UUID);
if (strengthLevel > 0) {
double kbBonus = (mediumScalingPercent(strengthLevel) * 0.015d) * getScaling();
double kbBonus = scaledRatio(strengthLevel, 0.002d, 0.2d);
kb.addTransientModifier(new AttributeModifier(
STRENGTH_KNOCKBACK_UUID,
"Ascend Strength knockback bonus",
@@ -98,7 +92,7 @@ public final class StatEffects {
if (move != null) {
move.removeModifier(AGILITY_SPEED_UUID);
if (agilityLevel > 0) {
double bonus = agilityLevel * 0.0005d * getScaling();
double bonus = scaledRatio(agilityLevel, 0.0008d, 0.08d);
move.addTransientModifier(new AttributeModifier(
AGILITY_SPEED_UUID,
"Ascend Agility speed bonus",
@@ -114,7 +108,7 @@ public final class StatEffects {
if (hp != null) {
hp.removeModifier(FORTITUDE_HEALTH_UUID);
if (fortitudeLevel > 0) {
double healthBonus = fortitudeLevel * 0.25d * getScaling();
double healthBonus = Math.min(fortitudeLevel * 0.18d * getScaling(), 18.0d);
hp.addTransientModifier(new AttributeModifier(
FORTITUDE_HEALTH_UUID,
"Ascend Fortitude health bonus",
@@ -127,7 +121,7 @@ public final class StatEffects {
if (kbRes != null) {
kbRes.removeModifier(FORTITUDE_KB_RESIST_UUID);
if (fortitudeLevel > 0) {
double res = Math.min(0.006d * fortitudeLevel * getScaling(), 0.60d);
double res = scaledRatio(fortitudeLevel, 0.003d, 0.3d);
kbRes.addTransientModifier(new AttributeModifier(
FORTITUDE_KB_RESIST_UUID,
"Ascend Fortitude knockback resist",
@@ -140,22 +134,26 @@ public final class StatEffects {
public static float getWillpowerSanityMultiplier(int willpowerLevel) {
if (willpowerLevel <= 0) return 1.0f;
double reduction = Math.min(willpowerLevel * 0.005d * getScaling(), 0.5d);
double reduction = scaledRatio(willpowerLevel, 0.0035d, 0.35d);
return (float) (1.0d - reduction);
}
public static float getWillpowerTempoMultiplier(int willpowerLevel) {
if (willpowerLevel <= 0) return 1.0f;
double bonus = Math.min(willpowerLevel * 0.004d * getScaling(), 0.4d);
double bonus = scaledRatio(willpowerLevel, 0.003d, 0.3d);
return (float) (1.0d + bonus);
}
public static float getWillpowerHealthRegen(int willpowerLevel) {
if (willpowerLevel <= 0) return 0.0f;
double bonus = Math.min(willpowerLevel * 0.01d * getScaling(), 2.0d);
double bonus = scaledRatio(willpowerLevel, 0.0125d, 1.25d);
return (float) bonus;
}
public static double getWillpowerCastTimeReduction(int willpowerLevel) {
return scaledRatio(willpowerLevel, 0.002d, 0.2d);
}
public static float getPlayerSanityMultiplier(Player player) {
return player.getCapability(PlayerStatsProvider.PLAYER_STATS)
.map(stats -> getWillpowerSanityMultiplier(stats.getAttributeLevel("willpower")))
@@ -169,52 +167,56 @@ public final class StatEffects {
}
public static int getIntelligenceManaBonus(int intelligenceLevel) {
return Math.max(0, intelligenceLevel);
return (int) Math.floor(Math.min(intelligenceLevel * 2.0d * getScaling(), 200.0d));
}
public static double getIntelligenceAnvilCostReduction(int intelligenceLevel) {
if (intelligenceLevel <= 0) return 0.0d;
double perPoint = 0.005d;
double max = 0.40d;
return Math.min(intelligenceLevel * perPoint * getScaling(), max);
return scaledRatio(intelligenceLevel, 0.003d, 0.3d);
}
public static int getIntelligenceKnowledgeGain(int intelligenceLevel, int baseGain) {
if (baseGain <= 0) return baseGain;
if (intelligenceLevel <= 0) return baseGain;
double perPoint = 0.005d;
double max = 0.50d;
double bonus = Math.min(intelligenceLevel * perPoint * getScaling(), max);
double bonus = scaledRatio(intelligenceLevel, 0.003d, 0.3d);
int extra = (int) Math.floor(baseGain * bonus);
return baseGain + Math.max(0, extra);
}
public static double getCharismaTradeDiscount(int charismaLevel) {
if (charismaLevel <= 0) return 0.0d;
double perPoint = 0.01d;
double max = 0.30d;
return Math.min(charismaLevel * perPoint * getScaling(), max);
return scaledRatio(charismaLevel, 0.003d, 0.3d);
}
public static int getCharismaVillagerReputationBonus(int charismaLevel) {
if (charismaLevel <= 0) return 0;
double perPoint = 0.1d;
double max = 10.0d;
return (int) Math.floor(Math.min(charismaLevel * perPoint * getScaling(), max));
return (int) Math.floor(Math.min(charismaLevel * 0.08d * getScaling(), 8.0d));
}
public static double getCharismaAllyHealthBonus(int charismaLevel) {
if (charismaLevel <= 0) return 0.0d;
double perPoint = 0.0025d;
double max = 0.25d;
return Math.min(charismaLevel * perPoint * getScaling(), max);
return scaledRatio(charismaLevel, 0.002d, 0.2d);
}
public static double getCharismaAllyDamageBonus(int charismaLevel) {
if (charismaLevel <= 0) return 0.0d;
double perPoint = 0.0020d;
double max = 0.20d;
return Math.min(charismaLevel * perPoint * getScaling(), max);
return scaledRatio(charismaLevel, 0.002d, 0.2d);
}
public static double getFortitudeEffectGuardChance(int fortitudeLevel) {
return scaledRatio(fortitudeLevel, 0.0025d, 0.25d);
}
public static double getFortitudeCleanseChance(int fortitudeLevel) {
return scaledRatio(fortitudeLevel, 0.002d, 0.2d);
}
public static double getAgilityEvasionChance(int agilityLevel) {
return scaledRatio(agilityLevel, 0.0015d, 0.15d);
}
public static double getAgilityRangedDamageMultiplier(int agilityLevel) {
return 1.0d + Math.min((getLightWeaponScalingMultiplier(agilityLevel) - 1.0d) * 0.7d, 0.25d);
}
public static double getStrengthTridentDamageMultiplier(int strengthLevel) {
return 1.0d + Math.min((getWeaponScalingMultiplier(strengthLevel) - 1.0d) * 0.6d, 0.2d);
}
public static void applyCharismaAllyBuff(LivingEntity entity, int charismaLevel) {
@@ -265,27 +267,18 @@ public final class StatEffects {
}
public static double getWeaponScalingMultiplier(int scalingLevel) {
if (scalingLevel <= 0) return 1.0d;
double percent = mediumScalingPercent(scalingLevel);
return 1.0d + (percent / 100.0d);
return scalingMultiplier(scalingLevel, 0.0035d, 0.35d);
}
public static double getLightWeaponScalingMultiplier(int scalingLevel) {
if (scalingLevel <= 0) return 1.0d;
double percent = lightScalingPercent(scalingLevel);
return 1.0d + (percent / 100.0d);
return scalingMultiplier(scalingLevel, 0.0035d, 0.35d);
}
public static double getHeavyWeaponScalingMultiplier(int scalingLevel) {
if (scalingLevel <= 0) return 1.0d;
double percent = heavyScalingPercent(scalingLevel);
return 1.0d + (percent / 100.0d);
return scalingMultiplier(scalingLevel, 0.0035d, 0.35d);
}
public static double getMagicScalingMultiplier(int scalingLevel) {
if (scalingLevel <= 0) return 1.0d;
double perPoint = 0.0075d;
double maxBonus = 0.75d;
return 1.0d + Math.min(scalingLevel * perPoint, maxBonus);
return scalingMultiplier(scalingLevel, 0.0035d, 0.35d);
}
}