Effect duration over cap is no longer consumed
This commit is contained in:
parent
4a7a1f8a69
commit
f675324134
|
|
@ -40,16 +40,24 @@ public record CollapseEffect(LevelBasedValue amount) implements EnchantmentEntit
|
|||
for (Holder<MobEffect> viableEffect : viableEffects) {
|
||||
if (enemy.hasEffect(viableEffect)) {
|
||||
MobEffectInstance effect = enemy.getEffect(viableEffect);
|
||||
float cap = this.amount.calculate(level);
|
||||
|
||||
// This is not the same way it's calculated in the Wither Skeleton file. This is because the Wither Skeleton version is wither-specific.
|
||||
// Until we figure out the appropriate balance for these effects in a zero-immunity context (and I figure out a better way to simplify the maths), this should be easier to account for.
|
||||
// It's also still reasonably interesting because it creates a choice between Crumble for Wither effect and poison splash potions,
|
||||
// as well as punishing loading too many effects at once due to their local iframes.
|
||||
// AKA: this minimises the odds that players start 1-tapping each other.
|
||||
float damage = (effect.getAmplifier() + 1) * effect.getDuration() + 0.05f;
|
||||
enemy.hurt(enemy.damageSources().magic(), Math.min(damage, this.amount.calculate(level)));
|
||||
float damage = (effect.getAmplifier() + 1) * effect.getDuration() * 0.05f;
|
||||
|
||||
enemy.hurt(enemy.damageSources().magic(), Math.min(damage, cap));
|
||||
enemy.invulnerableTime = 0;
|
||||
enemy.removeEffect(effect.getEffect());
|
||||
|
||||
if(damage>cap){
|
||||
int spentDuration = (int) ( cap * 20 / (effect.getAmplifier()+1) );
|
||||
MobEffectInstance newEffect = new MobEffectInstance(effect.getEffect(), effect.getDuration()-spentDuration, effect.getAmplifier());
|
||||
enemy.addEffect(newEffect, context.owner());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
"enchanted": "attacker",
|
||||
"effect": {
|
||||
"type": "mc_rebalance:collapse",
|
||||
"amount": 20.0
|
||||
"amount": 12.0
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue