Compare commits

..

2 Commits

Author SHA1 Message Date
gamer147
12fdde6ca4 Updated gradle 2025-11-04 12:37:30 -05:00
gamer147
732ee9a953 Added support for enchanting shields properly 2025-11-04 12:37:16 -05:00
3 changed files with 85 additions and 62 deletions

View File

@@ -1,17 +1,17 @@
apply plugin: 'java' apply plugin: 'java'
group "mod.sin" group "mod.sin"
version "4.1" version "4.2"
repositories { repositories {
mavenCentral() mavenCentral()
mavenLocal() mavenLocal()
maven { url "https://dl.bdew.net/agorepo/" }
maven { url 'https://jitpack.io' } maven { url 'https://jitpack.io' }
maven { url "http://gotti.no-ip.org/maven/repository" }
} }
dependencies { dependencies {
compile 'org.gotti.wurmunlimited:server-modlauncher:0.40' compile 'com.github.ago1024:WurmServerModLauncher:v0.46'
compile 'com.github.Sindusk:sindusklibrary:v2.1' compile 'com.github.Sindusk:sindusklibrary:v2.1'
} }

View File

@@ -1,6 +1,6 @@
#Wed Jul 02 15:54:47 CDT 2014 #Tue Nov 04 09:53:21 EST 2025
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip

View File

@@ -2,6 +2,8 @@ package mod.sin.armoury;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.wurmonline.server.spells.EnchantUtil;
import com.wurmonline.server.spells.Spell;
import mod.sin.lib.Util; import mod.sin.lib.Util;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager; import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
@@ -35,19 +37,19 @@ public class ShieldsTweaks {
boolean playSound = false; boolean playSound = false;
if (shield.getBonusForSpellEffect(Enchants.BUFF_ROTTING_TOUCH) > 0f) { if (shield.getBonusForSpellEffect(Enchants.BUFF_ROTTING_TOUCH) > 0f) {
double damage = shield.getBonusForSpellEffect(Enchants.BUFF_ROTTING_TOUCH) * 31d; double damage = shield.getBonusForSpellEffect(Enchants.BUFF_ROTTING_TOUCH) * 31d;
attacker.addWoundOfType(defender, Wound.TYPE_INFECTION, 0, true, 1.0f, true, damage); attacker.addWoundOfType(defender, Wound.TYPE_INFECTION, 0, true, 1.0f, true, damage, 0, 0, false, true);
playSound = true; playSound = true;
} else if (shield.getBonusForSpellEffect(Enchants.BUFF_FLAMING_AURA) > 0f) { } else if (shield.getBonusForSpellEffect(Enchants.BUFF_FLAMING_AURA) > 0f) {
double damage = shield.getBonusForSpellEffect(Enchants.BUFF_FLAMING_AURA) * 27d; double damage = shield.getBonusForSpellEffect(Enchants.BUFF_FLAMING_AURA) * 27d;
attacker.addWoundOfType(defender, Wound.TYPE_BURN, 0, true, 1.0f, true, damage); attacker.addWoundOfType(defender, Wound.TYPE_BURN, 0, true, 1.0f, true, damage, 0, 0, false, true);
playSound = true; playSound = true;
} else if (shield.getBonusForSpellEffect(Enchants.BUFF_FROSTBRAND) > 0f) { } else if (shield.getBonusForSpellEffect(Enchants.BUFF_FROSTBRAND) > 0f) {
double damage = shield.getBonusForSpellEffect(Enchants.BUFF_FROSTBRAND) * 28d; double damage = shield.getBonusForSpellEffect(Enchants.BUFF_FROSTBRAND) * 28d;
attacker.addWoundOfType(defender, Wound.TYPE_COLD, 0, true, 1.0f, true, damage); attacker.addWoundOfType(defender, Wound.TYPE_COLD, 0, true, 1.0f, true, damage, 0, 0, false, true);
playSound = true; playSound = true;
} else if (shield.getBonusForSpellEffect(Enchants.BUFF_VENOM) > 0f) { } else if (shield.getBonusForSpellEffect(Enchants.BUFF_VENOM) > 0f) {
double damage = shield.getBonusForSpellEffect(Enchants.BUFF_VENOM) * 30d; double damage = shield.getBonusForSpellEffect(Enchants.BUFF_VENOM) * 30d;
attacker.addWoundOfType(defender, Wound.TYPE_POISON, 0, true, 1.0f, true, damage); attacker.addWoundOfType(defender, Wound.TYPE_POISON, 0, true, 1.0f, true, damage, 0, 0, false, true);
playSound = true; playSound = true;
} }
if (playSound) { if (playSound) {
@@ -56,6 +58,18 @@ public class ShieldsTweaks {
} }
} }
public static boolean shieldIsValidItemType(Spell spell, Creature performer, Item target) {
if (spell.isTargetArmour() && target.isShield()) {
return true;
}
if (spell.isTargetWeapon() && target.isShield()) {
return true;
}
return false;
}
public static void preInit() { public static void preInit() {
try { try {
ClassPool classPool = HookManager.getInstance().getClassPool(); ClassPool classPool = HookManager.getInstance().getClassPool();
@@ -75,6 +89,15 @@ public class ShieldsTweaks {
} }
} }
});*/ });*/
CtClass ctSpell = classPool.get("com.wurmonline.server.spells.Spell");
String shieldSpellCheck = ShieldsTweaks.class.getName() + ".shieldIsValidItemType(this, performer, target)";
String spellCheckReplace = "if (" + shieldSpellCheck + ") {" +
"return true;" +
"}";
Util.setReason("Enable enchanting shields with damage enchants.");
Util.insertBeforeDeclared(thisClass, ctSpell, "isValidItemType", spellCheckReplace);
} }
if (ArmouryModMain.enableShieldSpeedEnchants) { if (ArmouryModMain.enableShieldSpeedEnchants) {
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler"); CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");