Skip to content

Commit

Permalink
Make Necrotic a flat 5% heal per level (#4983)
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed Apr 27, 2023
1 parent e6bd588 commit 1eaf443
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import slimeknights.tconstruct.library.tools.nbt.NamespacedNBT;
import slimeknights.tconstruct.library.utils.TooltipKey;
import slimeknights.tconstruct.library.utils.Util;
import slimeknights.tconstruct.tools.modifiers.upgrades.general.ReinforcedModifier;

import javax.annotation.Nullable;
import java.util.List;
Expand All @@ -39,7 +38,7 @@ protected void registerHooks(Builder hookBuilder) {
public int afterEntityHit(IToolStackView tool, int level, ToolAttackContext context, float damageDealt) {
if (context.isFullyCharged() && context.isCritical() && damageDealt > 0) {
// heals a percentage of damage dealt, using same rate as reinforced
float percent = ReinforcedModifier.diminishingPercent(level);
float percent = 0.05f * level;
if (percent > 0) {
LivingEntity attacker = context.getAttacker();
attacker.heal(percent * damageDealt);
Expand All @@ -54,7 +53,7 @@ public int afterEntityHit(IToolStackView tool, int level, ToolAttackContext cont
@Override
public boolean onProjectileHitEntity(ModifierNBT modifiers, NamespacedNBT persistentData, ModifierEntry modifier, Projectile projectile, EntityHitResult hit, @Nullable LivingEntity attacker, @Nullable LivingEntity target) {
if (target != null && attacker != null) {
float percent = ReinforcedModifier.diminishingPercent(modifier.getLevel());
float percent = 0.05f * modifier.getLevel();
if (percent > 0) {
if (projectile instanceof AbstractArrow arrow && arrow.isCritArrow()) {
// we don't actually know how much damage will be dealt, so just guess by using the standard formula
Expand All @@ -69,7 +68,7 @@ public boolean onProjectileHitEntity(ModifierNBT modifiers, NamespacedNBT persis

@Override
public void addInformation(IToolStackView tool, int level, @Nullable Player player, List<Component> tooltip, TooltipKey tooltipKey, TooltipFlag tooltipFlag) {
float lifesteal = ReinforcedModifier.diminishingPercent(level);
float lifesteal = 0.05f * level;
if (lifesteal > 0) {
tooltip.add(applyStyle(new TextComponent(Util.PERCENT_FORMAT.format(lifesteal) + " ").append(LIFE_STEAL)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"modifier_id": "tconstruct:necrotic",
"text": [
{
"text": "Critical hits heal a percentage of the damage dealt. Heals 25% at level 1, 45% chance at level 2, 60% at level 3, 70% at level 4, and 75% at level 5. Tool loses 1 extra durability per level."
"text": "Critical hits heal 5% of the damage dealt per level. Tool loses 1 extra durability per level."
}
],
"more_text_space": true,
Expand Down

0 comments on commit 1eaf443

Please sign in to comment.