Added support for enchanting shields properly
This commit is contained in:
@@ -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'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user