Skip to content

Commit

Permalink
Tweak protection modifiers
Browse files Browse the repository at this point in the history
Protection is now 5% per level, but is capped at one level per piece
Conditional protection is now 10% per level
Goal is buffing armor to be closer to vanilla without making it too strong once you have dragon heads
  • Loading branch information
KnightMiner committed Feb 2, 2023
1 parent b8d6a15 commit d8253ee
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
"result": {
"name": "tconstruct:protection",
"level": 1
}
},
"max_level": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ private void addModifierRecipes(Consumer<FinishedRecipe> consumer) {
.addInput(TinkerModifiers.cobaltReinforcement, 4)
.setSlots(SlotType.ABILITY, 1)
.setTools(TinkerTags.Items.ARMOR)
.setMaxLevel(1)
.saveSalvage(consumer, prefix(TinkerModifiers.protection, abilitySalvage))
.save(consumer, prefix(TinkerModifiers.protection, abilityFolder));
ModifierRecipeBuilder.modifier(ModifierIds.knockbackResistance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public class ProtectionModifier extends IncrementalModifier {
@Override
public float getProtectionModifier(IToolStackView tool, int level, EquipmentContext context, EquipmentSlot slotType, DamageSource source, float modifierValue) {
if (!source.isBypassMagic() && !source.isBypassInvul()) {
modifierValue += getEffectiveLevel(tool, level);
modifierValue += getEffectiveLevel(tool, level) * 1.25f;
}
return modifierValue;
}

@Override
public void addInformation(IToolStackView tool, int level, @Nullable Player player, List<Component> tooltip, TooltipKey tooltipKey, TooltipFlag tooltipFlag) {
if (tool.hasTag(TinkerTags.Items.ARMOR)) {
tooltip.add(applyStyle(new TextComponent(Util.PERCENT_BOOST_FORMAT.format(getEffectiveLevel(tool, level) / 25f))
tooltip.add(applyStyle(new TextComponent(Util.PERCENT_BOOST_FORMAT.format(getEffectiveLevel(tool, level) * 1.25f / 25f))
.append(" ")
.append(new TranslatableComponent(getTranslationKey() + ".resistance"))));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ public BlastProtectionModifier() {
@Override
public float getProtectionModifier(IToolStackView tool, int level, EquipmentContext context, EquipmentSlot slotType, DamageSource source, float modifierValue) {
if (!source.isBypassMagic() && !source.isBypassInvul() && source.isExplosion()) {
modifierValue += getScaledLevel(tool, level) * 2;
modifierValue += getScaledLevel(tool, level) * 2.5f;
}
return modifierValue;
}

@Override
public void addInformation(IToolStackView tool, int level, @Nullable Player player, List<Component> tooltip, TooltipKey tooltipKey, TooltipFlag tooltipFlag) {
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2f, tooltip);
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2.5f, tooltip);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static boolean isAirborne(LivingEntity living) {
@Override
public float getProtectionModifier(IToolStackView tool, int level, EquipmentContext context, EquipmentSlot slotType, DamageSource source, float modifierValue) {
if (!source.isBypassMagic() && !source.isBypassInvul() && isAirborne(context.getEntity())) {
modifierValue += getScaledLevel(tool, level) * 2.5;
modifierValue += getScaledLevel(tool, level) * 2.5f;
}
return modifierValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ public FireProtectionModifier() {
@Override
public float getProtectionModifier(IToolStackView tool, int level, EquipmentContext context, EquipmentSlot slotType, DamageSource source, float modifierValue) {
if (!source.isBypassMagic() && !source.isBypassInvul() && source.isFire()) {
modifierValue += getScaledLevel(tool, level) * 2;
modifierValue += getScaledLevel(tool, level) * 2.5f;
}
return modifierValue;
}

@Override
public void addInformation(IToolStackView tool, int level, @Nullable Player player, List<Component> tooltip, TooltipKey tooltipKey, TooltipFlag tooltipFlag) {
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2f, tooltip);
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2.5f, tooltip);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public MagicProtectionModifier() {
@Override
public float getProtectionModifier(IToolStackView tool, int level, EquipmentContext context, EquipmentSlot slotType, DamageSource source, float modifierValue) {
if (!source.isBypassMagic() && !source.isBypassInvul() && source.isMagic()) {
modifierValue += getScaledLevel(tool, level) * 2;
modifierValue += getScaledLevel(tool, level) * 2.5f;
}
return modifierValue;
}

@Override
public void addInformation(IToolStackView tool, int level, @Nullable Player player, List<Component> tooltip, TooltipKey tooltipKey, TooltipFlag tooltipFlag) {
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2f, tooltip);
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2.5f, tooltip);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ protected void reset(ModifierMaxLevel data, EquipmentChangeContext context) {
@Override
public float getProtectionModifier(IToolStackView tool, int level, EquipmentContext context, EquipmentSlot slotType, DamageSource source, float modifierValue) {
if (doesApply(source)) {
modifierValue += getScaledLevel(tool, level) * 2;
modifierValue += getScaledLevel(tool, level) * 2.5;
}
return modifierValue;
}

@Override
public void addInformation(IToolStackView tool, int level, @Nullable Player player, List<Component> tooltip, TooltipKey tooltipKey, TooltipFlag tooltipFlag) {
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2.0f, tooltip);
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2.5f, tooltip);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ protected ModifierMaxLevel createData() {
@Override
public float getProtectionModifier(IToolStackView tool, int level, EquipmentContext context, EquipmentSlot slotType, DamageSource source, float modifierValue) {
if (!source.isBypassMagic() && !source.isBypassInvul() && source.isProjectile()) {
modifierValue += getScaledLevel(tool, level) * 2;
modifierValue += getScaledLevel(tool, level) * 2.5f;
}
return modifierValue;
}

@Override
public void addInformation(IToolStackView tool, int level, @Nullable Player player, List<Component> tooltip, TooltipKey tooltipKey, TooltipFlag tooltipFlag) {
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2f, tooltip);
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2.5f, tooltip);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ protected ModifierMaxLevel createData() {
@Override
public float getProtectionModifier(IToolStackView tool, int level, EquipmentContext context, EquipmentSlot slotType, DamageSource source, float modifierValue) {
if (context.getEntity().isCrouching() && !source.isBypassMagic() && !source.isBypassInvul()) {
modifierValue += getScaledLevel(tool, level) * 2;
modifierValue += getScaledLevel(tool, level) * 2.5f;
}
return modifierValue;
}

@Override
public void addInformation(IToolStackView tool, int level, @Nullable Player player, List<Component> tooltip, TooltipKey tooltipKey, TooltipFlag tooltipFlag) {
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2f, tooltip);
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2.5f, tooltip);
}

private static void onAttack(LivingHurtEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public float getProtectionModifier(IToolStackView tool, int level, EquipmentCont
LivingEntity entity = context.getEntity();
// helmet/chest boost if eyes in water, legs/boots boost if feet in water
if ((slotType == EquipmentSlot.HEAD || slotType == EquipmentSlot.CHEST) ? entity.wasEyeInWater : entity.isInWater()) {
modifierValue += getScaledLevel(tool, level) * 2;
modifierValue += getScaledLevel(tool, level) * 2.5f;
}
}
return modifierValue;
}

@Override
public void addInformation(IToolStackView tool, int level, @Nullable Player player, List<Component> tooltip, TooltipKey tooltipKey, TooltipFlag tooltipFlag) {
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2f, tooltip);
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 2.5f, tooltip);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"modifier_id": "tconstruct:protection",
"text": [
{
"text": "Grants +6% resistance against all damage for the first level, and +4% at consecutive levels. Caps at 80% across the whole set, including other types of protection."
"text": "Grants +5% resistance against all damage per piece with this modifier. Caps at 80% across the whole set, including other types of protection."
}
],
"more_text_space": true,
"effects": [
"Maximum of 1 level",
"Requires 1 ability slot per level"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"modifier_id": "tconstruct:blast_protection",
"text": [
{
"text": "Grants +8% resistance against explosion damage, such as from creepers or TNT. Caps at 80% across the whole set, or 10 levels."
"text": "Grants +10% resistance against explosion damage, such as from creepers or TNT. Caps at 80% across the whole set, or 10 levels."
},
{
"text": "Reduces the knockback from explosions by 15% per level of the highest level piece.", "paragraph": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"modifier_id": "tconstruct:fire_protection",
"text": [
{
"text": "Grants +8% resistance against fire damage, such as from lava or blazes. Caps at 80% across the whole set, or 10 levels."
"text": "Grants +10% resistance against fire damage, such as from lava or blazes. Caps at 80% across the whole set, or 10 levels."
},
{
"text": "Reduces the duration of fire by 15% per level of the highest level piece.", "paragraph": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"modifier_id": "tconstruct:magic_protection",
"text": [
{
"text": "Grants +8% resistance against magic damage, such as from poison or thorns. Caps at 80% across the whole set, or 10 levels."
"text": "Grants +10% resistance against magic damage, such as from poison or thorns. Caps at 80% across the whole set, or 10 levels."
},
{
"text": "Reduces the duration of negative potions by 5% per level of the highest level piece.", "paragraph": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"modifier_id": "tconstruct:melee_protection",
"text": [
{
"text": "Grants +8% resistance against melee damage, such as from zombies and swords. Caps at 80% across the whole set, or 10 levels."
"text": "Grants +10% resistance against melee damage, such as from zombies and swords. Caps at 80% across the whole set, or 10 levels."
},
{
"text": "Grants +3% attack speed per level of the highest level piece.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"modifier_id": "tconstruct:projectile_protection",
"text": [
{
"text": "Grants +8% resistance against projectile damage, such as arrows from skeletons. Caps at 80% across the whole set, or 10 levels."
"text": "Grants +10% resistance against projectile damage, such as arrows from skeletons. Caps at 80% across the whole set, or 10 levels."
},
{
"text": "Reduces visibility to all mobs by 5% per level of the highest level piece.", "paragraph": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"modifier_id": "tconstruct:shulking",
"text": [
{
"text": "Grants +8% resistance while sneaking. Caps at 80% across the whole set, or 10 levels."
"text": "Grants +10% resistance while sneaking. Caps at 80% across the whole set, or 10 levels."
},
{
"text": "Decreases attack damage while sneaking by 10% per level of the highest level piece.", "paragraph": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"modifier_id": "tconstruct:turtle_shell",
"text": [
{
"text": "Grants +8% resistance when underwater. Caps at 80% across the whole set, or 10 levels."
"text": "Grants +10% resistance when underwater. Caps at 80% across the whole set, or 10 levels."
},
{
"text": "Increases swim speed by 5% per level.", "paragraph": true
Expand Down

0 comments on commit d8253ee

Please sign in to comment.