diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java index 3aef54b154..f94560452c 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java @@ -16,9 +16,9 @@ */ package handlers.effecthandlers; -import java.util.Collections; -import java.util.HashSet; +import java.util.Arrays; import java.util.Set; +import java.util.stream.Collectors; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; @@ -37,19 +37,7 @@ public final class BlockAbnormalSlot extends AbstractEffect public BlockAbnormalSlot(StatsSet params) { - final String blockAbnormalSlots = params.getString("slot", null); - if ((blockAbnormalSlots != null) && !blockAbnormalSlots.isEmpty()) - { - _blockAbnormalSlots = new HashSet<>(); - for (String slot : blockAbnormalSlots.split(";")) - { - _blockAbnormalSlots.add(AbnormalType.getAbnormalType(slot)); - } - } - else - { - _blockAbnormalSlots = Collections. emptySet(); - } + _blockAbnormalSlots = Arrays.stream(params.getString("dispel").split(";")).map(slot -> Enum.valueOf(AbnormalType.class, slot)).collect(Collectors.toSet()); } @Override diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java index 834c09acb7..d39741de67 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java @@ -16,9 +16,8 @@ */ package handlers.effecthandlers; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.HashSet; +import java.util.Set; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.model.StatsSet; @@ -35,26 +34,17 @@ import com.l2jmobius.gameserver.model.skills.Skill; */ public final class DispelBySlotProbability extends AbstractEffect { - private final String _dispel; - private final Map _dispelAbnormals; + private final Set _dispelAbnormals; private final int _rate; public DispelBySlotProbability(StatsSet params) { - _dispel = params.getString("dispel"); + final String[] dispelEffects = params.getString("dispel").split(";"); _rate = params.getInt("rate", 100); - if ((_dispel != null) && !_dispel.isEmpty()) + _dispelAbnormals = new HashSet<>(dispelEffects.length); + for (String slot : dispelEffects) { - _dispelAbnormals = new HashMap<>(); - for (String ngtStack : _dispel.split(";")) - { - String[] ngt = ngtStack.split(","); - _dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), Short.MAX_VALUE); - } - } - else - { - _dispelAbnormals = Collections. emptyMap(); + _dispelAbnormals.add(Enum.valueOf(AbnormalType.class, slot)); } } @@ -73,31 +63,12 @@ public final class DispelBySlotProbability extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (_dispelAbnormals.isEmpty()) + if (effected == null) { return; } - // Dispel transformations (buff and by GM) - if ((Rnd.get(100) < _rate)) - { - final Short transformToDispel = _dispelAbnormals.get(AbnormalType.TRANSFORM); - if ((transformToDispel != null) && ((transformToDispel == effected.getTransformationId()) || (transformToDispel < 0))) - { - effected.stopTransformation(true); - } - } - - effected.getEffectList().stopEffects(info -> - { - // We have already dealt with transformation from above. - if (info.isAbnormalType(AbnormalType.TRANSFORM)) - { - return false; - } - - final Short abnormalLevel = (Rnd.get(100) < _rate) ? _dispelAbnormals.get(info.getSkill().getAbnormalType()) : null; - return (abnormalLevel != null) && ((abnormalLevel < 0) || (abnormalLevel >= info.getSkill().getAbnormalLvl())); - }, true, true); + // The effectlist should already check if it has buff with this abnormal type or not. + effected.getEffectList().stopEffects(info -> !info.getSkill().isIrreplacableBuff() && (Rnd.get(100) < _rate) && _dispelAbnormals.contains(info.getSkill().getAbnormalType()), true, true); } } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/11800-11899.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/11800-11899.xml index d534f680cf..61e1447f50 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/11800-11899.xml +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/11800-11899.xml @@ -943,7 +943,7 @@ SINGLE - IMPROVE_VAMPIRIC_HASTE,-1;ATTACK_TIME_DOWN,-1;VAMPIRIC_ATTACK,-1;CASTING_TIME_DOWN,-1 + IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN @@ -1043,7 +1043,7 @@ 50 - DANCE_OF_ALIGNMENT,-1;ARMOR_UNHOLY,-1;DANCE_OF_LIGHT,-1;SONG_OF_INVOCATION,-1;RESIST_BLEEDING,-1;RESIST_SHOCK,-1 + DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK @@ -1088,7 +1088,7 @@ 50 - DANCE_OF_PROTECTION,-1;RESIST_DEBUFF_DISPEL,-1 + DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL @@ -1220,7 +1220,7 @@ SINGLE - MULTI_BUFF,-1;COUNTER_CRITICAL,-1 + MULTI_BUFF;COUNTER_CRITICAL MULTI_BUFF;COUNTER_CRITICAL diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java index 3aef54b154..f94560452c 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java @@ -16,9 +16,9 @@ */ package handlers.effecthandlers; -import java.util.Collections; -import java.util.HashSet; +import java.util.Arrays; import java.util.Set; +import java.util.stream.Collectors; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; @@ -37,19 +37,7 @@ public final class BlockAbnormalSlot extends AbstractEffect public BlockAbnormalSlot(StatsSet params) { - final String blockAbnormalSlots = params.getString("slot", null); - if ((blockAbnormalSlots != null) && !blockAbnormalSlots.isEmpty()) - { - _blockAbnormalSlots = new HashSet<>(); - for (String slot : blockAbnormalSlots.split(";")) - { - _blockAbnormalSlots.add(AbnormalType.getAbnormalType(slot)); - } - } - else - { - _blockAbnormalSlots = Collections. emptySet(); - } + _blockAbnormalSlots = Arrays.stream(params.getString("dispel").split(";")).map(slot -> Enum.valueOf(AbnormalType.class, slot)).collect(Collectors.toSet()); } @Override diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java index 834c09acb7..d39741de67 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java @@ -16,9 +16,8 @@ */ package handlers.effecthandlers; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.HashSet; +import java.util.Set; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.model.StatsSet; @@ -35,26 +34,17 @@ import com.l2jmobius.gameserver.model.skills.Skill; */ public final class DispelBySlotProbability extends AbstractEffect { - private final String _dispel; - private final Map _dispelAbnormals; + private final Set _dispelAbnormals; private final int _rate; public DispelBySlotProbability(StatsSet params) { - _dispel = params.getString("dispel"); + final String[] dispelEffects = params.getString("dispel").split(";"); _rate = params.getInt("rate", 100); - if ((_dispel != null) && !_dispel.isEmpty()) + _dispelAbnormals = new HashSet<>(dispelEffects.length); + for (String slot : dispelEffects) { - _dispelAbnormals = new HashMap<>(); - for (String ngtStack : _dispel.split(";")) - { - String[] ngt = ngtStack.split(","); - _dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), Short.MAX_VALUE); - } - } - else - { - _dispelAbnormals = Collections. emptyMap(); + _dispelAbnormals.add(Enum.valueOf(AbnormalType.class, slot)); } } @@ -73,31 +63,12 @@ public final class DispelBySlotProbability extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (_dispelAbnormals.isEmpty()) + if (effected == null) { return; } - // Dispel transformations (buff and by GM) - if ((Rnd.get(100) < _rate)) - { - final Short transformToDispel = _dispelAbnormals.get(AbnormalType.TRANSFORM); - if ((transformToDispel != null) && ((transformToDispel == effected.getTransformationId()) || (transformToDispel < 0))) - { - effected.stopTransformation(true); - } - } - - effected.getEffectList().stopEffects(info -> - { - // We have already dealt with transformation from above. - if (info.isAbnormalType(AbnormalType.TRANSFORM)) - { - return false; - } - - final Short abnormalLevel = (Rnd.get(100) < _rate) ? _dispelAbnormals.get(info.getSkill().getAbnormalType()) : null; - return (abnormalLevel != null) && ((abnormalLevel < 0) || (abnormalLevel >= info.getSkill().getAbnormalLvl())); - }, true, true); + // The effectlist should already check if it has buff with this abnormal type or not. + effected.getEffectList().stopEffects(info -> !info.getSkill().isIrreplacableBuff() && (Rnd.get(100) < _rate) && _dispelAbnormals.contains(info.getSkill().getAbnormalType()), true, true); } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/11800-11899.xml b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/11800-11899.xml index 9e8f3ba105..d18cd67189 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/11800-11899.xml +++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/11800-11899.xml @@ -943,7 +943,7 @@ SINGLE - IMPROVE_VAMPIRIC_HASTE,-1;ATTACK_TIME_DOWN,-1;VAMPIRIC_ATTACK,-1;CASTING_TIME_DOWN,-1 + IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN @@ -1043,7 +1043,7 @@ 50 - DANCE_OF_ALIGNMENT,-1;ARMOR_UNHOLY,-1;DANCE_OF_LIGHT,-1;SONG_OF_INVOCATION,-1;RESIST_BLEEDING,-1;RESIST_SHOCK,-1 + DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK @@ -1088,7 +1088,7 @@ 50 - DANCE_OF_PROTECTION,-1;RESIST_DEBUFF_DISPEL,-1 + DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL @@ -1220,7 +1220,7 @@ SINGLE - MULTI_BUFF,-1;COUNTER_CRITICAL,-1 + MULTI_BUFF;COUNTER_CRITICAL MULTI_BUFF;COUNTER_CRITICAL diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java index 3aef54b154..f94560452c 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java @@ -16,9 +16,9 @@ */ package handlers.effecthandlers; -import java.util.Collections; -import java.util.HashSet; +import java.util.Arrays; import java.util.Set; +import java.util.stream.Collectors; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; @@ -37,19 +37,7 @@ public final class BlockAbnormalSlot extends AbstractEffect public BlockAbnormalSlot(StatsSet params) { - final String blockAbnormalSlots = params.getString("slot", null); - if ((blockAbnormalSlots != null) && !blockAbnormalSlots.isEmpty()) - { - _blockAbnormalSlots = new HashSet<>(); - for (String slot : blockAbnormalSlots.split(";")) - { - _blockAbnormalSlots.add(AbnormalType.getAbnormalType(slot)); - } - } - else - { - _blockAbnormalSlots = Collections. emptySet(); - } + _blockAbnormalSlots = Arrays.stream(params.getString("dispel").split(";")).map(slot -> Enum.valueOf(AbnormalType.class, slot)).collect(Collectors.toSet()); } @Override diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java index 834c09acb7..d39741de67 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java @@ -16,9 +16,8 @@ */ package handlers.effecthandlers; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.HashSet; +import java.util.Set; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.model.StatsSet; @@ -35,26 +34,17 @@ import com.l2jmobius.gameserver.model.skills.Skill; */ public final class DispelBySlotProbability extends AbstractEffect { - private final String _dispel; - private final Map _dispelAbnormals; + private final Set _dispelAbnormals; private final int _rate; public DispelBySlotProbability(StatsSet params) { - _dispel = params.getString("dispel"); + final String[] dispelEffects = params.getString("dispel").split(";"); _rate = params.getInt("rate", 100); - if ((_dispel != null) && !_dispel.isEmpty()) + _dispelAbnormals = new HashSet<>(dispelEffects.length); + for (String slot : dispelEffects) { - _dispelAbnormals = new HashMap<>(); - for (String ngtStack : _dispel.split(";")) - { - String[] ngt = ngtStack.split(","); - _dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), Short.MAX_VALUE); - } - } - else - { - _dispelAbnormals = Collections. emptyMap(); + _dispelAbnormals.add(Enum.valueOf(AbnormalType.class, slot)); } } @@ -73,31 +63,12 @@ public final class DispelBySlotProbability extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (_dispelAbnormals.isEmpty()) + if (effected == null) { return; } - // Dispel transformations (buff and by GM) - if ((Rnd.get(100) < _rate)) - { - final Short transformToDispel = _dispelAbnormals.get(AbnormalType.TRANSFORM); - if ((transformToDispel != null) && ((transformToDispel == effected.getTransformationId()) || (transformToDispel < 0))) - { - effected.stopTransformation(true); - } - } - - effected.getEffectList().stopEffects(info -> - { - // We have already dealt with transformation from above. - if (info.isAbnormalType(AbnormalType.TRANSFORM)) - { - return false; - } - - final Short abnormalLevel = (Rnd.get(100) < _rate) ? _dispelAbnormals.get(info.getSkill().getAbnormalType()) : null; - return (abnormalLevel != null) && ((abnormalLevel < 0) || (abnormalLevel >= info.getSkill().getAbnormalLvl())); - }, true, true); + // The effectlist should already check if it has buff with this abnormal type or not. + effected.getEffectList().stopEffects(info -> !info.getSkill().isIrreplacableBuff() && (Rnd.get(100) < _rate) && _dispelAbnormals.contains(info.getSkill().getAbnormalType()), true, true); } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/11800-11899.xml b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/11800-11899.xml index b9057d7463..1c30eebadb 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/11800-11899.xml +++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/11800-11899.xml @@ -943,7 +943,7 @@ SINGLE - IMPROVE_VAMPIRIC_HASTE,-1;ATTACK_TIME_DOWN,-1;VAMPIRIC_ATTACK,-1;CASTING_TIME_DOWN,-1 + IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN @@ -1043,7 +1043,7 @@ 50 - DANCE_OF_ALIGNMENT,-1;ARMOR_UNHOLY,-1;DANCE_OF_LIGHT,-1;SONG_OF_INVOCATION,-1;RESIST_BLEEDING,-1;RESIST_SHOCK,-1 + DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK @@ -1088,7 +1088,7 @@ 50 - DANCE_OF_PROTECTION,-1;RESIST_DEBUFF_DISPEL,-1 + DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL @@ -1220,7 +1220,7 @@ SINGLE - MULTI_BUFF,-1;COUNTER_CRITICAL,-1 + MULTI_BUFF;COUNTER_CRITICAL MULTI_BUFF;COUNTER_CRITICAL diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java index 3aef54b154..f94560452c 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java @@ -16,9 +16,9 @@ */ package handlers.effecthandlers; -import java.util.Collections; -import java.util.HashSet; +import java.util.Arrays; import java.util.Set; +import java.util.stream.Collectors; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; @@ -37,19 +37,7 @@ public final class BlockAbnormalSlot extends AbstractEffect public BlockAbnormalSlot(StatsSet params) { - final String blockAbnormalSlots = params.getString("slot", null); - if ((blockAbnormalSlots != null) && !blockAbnormalSlots.isEmpty()) - { - _blockAbnormalSlots = new HashSet<>(); - for (String slot : blockAbnormalSlots.split(";")) - { - _blockAbnormalSlots.add(AbnormalType.getAbnormalType(slot)); - } - } - else - { - _blockAbnormalSlots = Collections. emptySet(); - } + _blockAbnormalSlots = Arrays.stream(params.getString("dispel").split(";")).map(slot -> Enum.valueOf(AbnormalType.class, slot)).collect(Collectors.toSet()); } @Override diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java index 834c09acb7..d39741de67 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java @@ -16,9 +16,8 @@ */ package handlers.effecthandlers; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.HashSet; +import java.util.Set; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.model.StatsSet; @@ -35,26 +34,17 @@ import com.l2jmobius.gameserver.model.skills.Skill; */ public final class DispelBySlotProbability extends AbstractEffect { - private final String _dispel; - private final Map _dispelAbnormals; + private final Set _dispelAbnormals; private final int _rate; public DispelBySlotProbability(StatsSet params) { - _dispel = params.getString("dispel"); + final String[] dispelEffects = params.getString("dispel").split(";"); _rate = params.getInt("rate", 100); - if ((_dispel != null) && !_dispel.isEmpty()) + _dispelAbnormals = new HashSet<>(dispelEffects.length); + for (String slot : dispelEffects) { - _dispelAbnormals = new HashMap<>(); - for (String ngtStack : _dispel.split(";")) - { - String[] ngt = ngtStack.split(","); - _dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), Short.MAX_VALUE); - } - } - else - { - _dispelAbnormals = Collections. emptyMap(); + _dispelAbnormals.add(Enum.valueOf(AbnormalType.class, slot)); } } @@ -73,31 +63,12 @@ public final class DispelBySlotProbability extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (_dispelAbnormals.isEmpty()) + if (effected == null) { return; } - // Dispel transformations (buff and by GM) - if ((Rnd.get(100) < _rate)) - { - final Short transformToDispel = _dispelAbnormals.get(AbnormalType.TRANSFORM); - if ((transformToDispel != null) && ((transformToDispel == effected.getTransformationId()) || (transformToDispel < 0))) - { - effected.stopTransformation(true); - } - } - - effected.getEffectList().stopEffects(info -> - { - // We have already dealt with transformation from above. - if (info.isAbnormalType(AbnormalType.TRANSFORM)) - { - return false; - } - - final Short abnormalLevel = (Rnd.get(100) < _rate) ? _dispelAbnormals.get(info.getSkill().getAbnormalType()) : null; - return (abnormalLevel != null) && ((abnormalLevel < 0) || (abnormalLevel >= info.getSkill().getAbnormalLvl())); - }, true, true); + // The effectlist should already check if it has buff with this abnormal type or not. + effected.getEffectList().stopEffects(info -> !info.getSkill().isIrreplacableBuff() && (Rnd.get(100) < _rate) && _dispelAbnormals.contains(info.getSkill().getAbnormalType()), true, true); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/11800-11899.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/11800-11899.xml index ada4dd7fd2..d27d593c59 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/11800-11899.xml +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/11800-11899.xml @@ -923,7 +923,7 @@ SINGLE - IMPROVE_VAMPIRIC_HASTE,-1;ATTACK_TIME_DOWN,-1;VAMPIRIC_ATTACK,-1;CASTING_TIME_DOWN,-1 + IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN @@ -1023,7 +1023,7 @@ 50 - DANCE_OF_ALIGNMENT,-1;ARMOR_UNHOLY,-1;DANCE_OF_LIGHT,-1;SONG_OF_INVOCATION,-1;RESIST_BLEEDING,-1;RESIST_SHOCK,-1 + DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK @@ -1068,7 +1068,7 @@ 50 - DANCE_OF_PROTECTION,-1;RESIST_DEBUFF_DISPEL,-1 + DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL @@ -1200,7 +1200,7 @@ SINGLE - MULTI_BUFF,-1;COUNTER_CRITICAL,-1 + MULTI_BUFF;COUNTER_CRITICAL MULTI_BUFF;COUNTER_CRITICAL diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java index 3aef54b154..f94560452c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/BlockAbnormalSlot.java @@ -16,9 +16,9 @@ */ package handlers.effecthandlers; -import java.util.Collections; -import java.util.HashSet; +import java.util.Arrays; import java.util.Set; +import java.util.stream.Collectors; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; @@ -37,19 +37,7 @@ public final class BlockAbnormalSlot extends AbstractEffect public BlockAbnormalSlot(StatsSet params) { - final String blockAbnormalSlots = params.getString("slot", null); - if ((blockAbnormalSlots != null) && !blockAbnormalSlots.isEmpty()) - { - _blockAbnormalSlots = new HashSet<>(); - for (String slot : blockAbnormalSlots.split(";")) - { - _blockAbnormalSlots.add(AbnormalType.getAbnormalType(slot)); - } - } - else - { - _blockAbnormalSlots = Collections. emptySet(); - } + _blockAbnormalSlots = Arrays.stream(params.getString("dispel").split(";")).map(slot -> Enum.valueOf(AbnormalType.class, slot)).collect(Collectors.toSet()); } @Override diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java index 834c09acb7..d39741de67 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java @@ -16,9 +16,8 @@ */ package handlers.effecthandlers; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.HashSet; +import java.util.Set; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.model.StatsSet; @@ -35,26 +34,17 @@ import com.l2jmobius.gameserver.model.skills.Skill; */ public final class DispelBySlotProbability extends AbstractEffect { - private final String _dispel; - private final Map _dispelAbnormals; + private final Set _dispelAbnormals; private final int _rate; public DispelBySlotProbability(StatsSet params) { - _dispel = params.getString("dispel"); + final String[] dispelEffects = params.getString("dispel").split(";"); _rate = params.getInt("rate", 100); - if ((_dispel != null) && !_dispel.isEmpty()) + _dispelAbnormals = new HashSet<>(dispelEffects.length); + for (String slot : dispelEffects) { - _dispelAbnormals = new HashMap<>(); - for (String ngtStack : _dispel.split(";")) - { - String[] ngt = ngtStack.split(","); - _dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), Short.MAX_VALUE); - } - } - else - { - _dispelAbnormals = Collections. emptyMap(); + _dispelAbnormals.add(Enum.valueOf(AbnormalType.class, slot)); } } @@ -73,31 +63,12 @@ public final class DispelBySlotProbability extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (_dispelAbnormals.isEmpty()) + if (effected == null) { return; } - // Dispel transformations (buff and by GM) - if ((Rnd.get(100) < _rate)) - { - final Short transformToDispel = _dispelAbnormals.get(AbnormalType.TRANSFORM); - if ((transformToDispel != null) && ((transformToDispel == effected.getTransformationId()) || (transformToDispel < 0))) - { - effected.stopTransformation(true); - } - } - - effected.getEffectList().stopEffects(info -> - { - // We have already dealt with transformation from above. - if (info.isAbnormalType(AbnormalType.TRANSFORM)) - { - return false; - } - - final Short abnormalLevel = (Rnd.get(100) < _rate) ? _dispelAbnormals.get(info.getSkill().getAbnormalType()) : null; - return (abnormalLevel != null) && ((abnormalLevel < 0) || (abnormalLevel >= info.getSkill().getAbnormalLvl())); - }, true, true); + // The effectlist should already check if it has buff with this abnormal type or not. + effected.getEffectList().stopEffects(info -> !info.getSkill().isIrreplacableBuff() && (Rnd.get(100) < _rate) && _dispelAbnormals.contains(info.getSkill().getAbnormalType()), true, true); } }