Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added magicbane damage scaling factor #621

Open
wants to merge 1 commit into
base: 1.18.x-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/main/java/reliquary/items/MagicbaneItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import reliquary.Reliquary;
import reliquary.reference.Settings;
import reliquary.util.LanguageHelper;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -91,9 +92,14 @@ public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlo

ListTag enchants = stack.getEnchantmentTags();
int attackDamage = 4;
int enchantBonus = 0;
for (int enchant = 0; enchant < enchants.size(); enchant++) {
attackDamage += enchants.getCompound(enchant).getShort("lvl");
enchantBonus += enchants.getCompound(enchant).getShort("lvl");
}
double damageExponent = Settings.COMMON.items.magicBane.damageExponent.get();
enchantBonus = (int) Math.round(Math.pow(enchantBonus, damageExponent));
attackDamage += enchantBonus;

return ImmutableMultimap.of(
Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Weapon modifier", attackDamage, AttributeModifier.Operation.ADDITION),
Attributes.ATTACK_SPEED, SPEED_ATTRIBUTE
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/reliquary/reference/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ public static class ItemSettings {
infernalTear = new InfernalTearSettings(builder);
krakenShell = new KrakenShellSettings(builder);
lanternOfParanoia = new LanternOfParanoiaSettings(builder);
magicBane = new MagicbaneSettings(builder);
midasTouchstone = new MidasTouchstoneSettings(builder);
mobCharm = new MobCharmSettings(builder);
mobCharmFragment = new MobCharmFragmentSettings(builder);
Expand Down Expand Up @@ -815,6 +816,22 @@ public static class LanternOfParanoiaSettings {
}
}

public final MagicbaneSettings magicBane;

public static class MagicbaneSettings {
public final DoubleValue damageExponent;

MagicbaneSettings(ForgeConfigSpec.Builder builder) {
builder.comment("Magicbane settings").push("magicbane");

damageExponent = builder
.comment("Magicbane bonus damage scaling exponent, based on total level of enchants. 1 = linear scaling, 2 = quadratic, 0.5 = square root, etc.")
.defineInRange("magicbaneDamageScaling", 1f, 0, 3);

builder.pop();
}
}

public final MidasTouchstoneSettings midasTouchstone;

public static class MidasTouchstoneSettings {
Expand Down