Fixed stacking same type buffs.
Adapted from: L2jUnity free files.
This commit is contained in:
@@ -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.<AbnormalType> emptySet();
|
||||
}
|
||||
_blockAbnormalSlots = Arrays.stream(params.getString("dispel").split(";")).map(slot -> Enum.valueOf(AbnormalType.class, slot)).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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<AbnormalType, Short> _dispelAbnormals;
|
||||
private final Set<AbnormalType> _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.<AbnormalType, Short> 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);
|
||||
}
|
||||
}
|
||||
|
@@ -943,7 +943,7 @@
|
||||
<affectScope>SINGLE</affectScope>
|
||||
<effects>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE,-1;ATTACK_TIME_DOWN,-1;VAMPIRIC_ATTACK,-1;CASTING_TIME_DOWN,-1</dispel>
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN</dispel>
|
||||
@@ -1043,7 +1043,7 @@
|
||||
<POISON>50</POISON>
|
||||
</effect>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>DANCE_OF_ALIGNMENT,-1;ARMOR_UNHOLY,-1;DANCE_OF_LIGHT,-1;SONG_OF_INVOCATION,-1;RESIST_BLEEDING,-1;RESIST_SHOCK,-1</dispel>
|
||||
<dispel>DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK</slot>
|
||||
@@ -1088,7 +1088,7 @@
|
||||
<SLEEP>50</SLEEP>
|
||||
</effect>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>DANCE_OF_PROTECTION,-1;RESIST_DEBUFF_DISPEL,-1</dispel>
|
||||
<dispel>DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL</slot>
|
||||
@@ -1220,7 +1220,7 @@
|
||||
<affectScope>SINGLE</affectScope>
|
||||
<effects>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>MULTI_BUFF,-1;COUNTER_CRITICAL,-1</dispel>
|
||||
<dispel>MULTI_BUFF;COUNTER_CRITICAL</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>MULTI_BUFF;COUNTER_CRITICAL</slot>
|
||||
|
@@ -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.<AbnormalType> emptySet();
|
||||
}
|
||||
_blockAbnormalSlots = Arrays.stream(params.getString("dispel").split(";")).map(slot -> Enum.valueOf(AbnormalType.class, slot)).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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<AbnormalType, Short> _dispelAbnormals;
|
||||
private final Set<AbnormalType> _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.<AbnormalType, Short> 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);
|
||||
}
|
||||
}
|
||||
|
@@ -943,7 +943,7 @@
|
||||
<affectScope>SINGLE</affectScope>
|
||||
<effects>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE,-1;ATTACK_TIME_DOWN,-1;VAMPIRIC_ATTACK,-1;CASTING_TIME_DOWN,-1</dispel>
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN</dispel>
|
||||
@@ -1043,7 +1043,7 @@
|
||||
<POISON>50</POISON>
|
||||
</effect>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>DANCE_OF_ALIGNMENT,-1;ARMOR_UNHOLY,-1;DANCE_OF_LIGHT,-1;SONG_OF_INVOCATION,-1;RESIST_BLEEDING,-1;RESIST_SHOCK,-1</dispel>
|
||||
<dispel>DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK</slot>
|
||||
@@ -1088,7 +1088,7 @@
|
||||
<SLEEP>50</SLEEP>
|
||||
</effect>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>DANCE_OF_PROTECTION,-1;RESIST_DEBUFF_DISPEL,-1</dispel>
|
||||
<dispel>DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL</slot>
|
||||
@@ -1220,7 +1220,7 @@
|
||||
<affectScope>SINGLE</affectScope>
|
||||
<effects>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>MULTI_BUFF,-1;COUNTER_CRITICAL,-1</dispel>
|
||||
<dispel>MULTI_BUFF;COUNTER_CRITICAL</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>MULTI_BUFF;COUNTER_CRITICAL</slot>
|
||||
|
@@ -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.<AbnormalType> emptySet();
|
||||
}
|
||||
_blockAbnormalSlots = Arrays.stream(params.getString("dispel").split(";")).map(slot -> Enum.valueOf(AbnormalType.class, slot)).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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<AbnormalType, Short> _dispelAbnormals;
|
||||
private final Set<AbnormalType> _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.<AbnormalType, Short> 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);
|
||||
}
|
||||
}
|
||||
|
@@ -943,7 +943,7 @@
|
||||
<affectScope>SINGLE</affectScope>
|
||||
<effects>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE,-1;ATTACK_TIME_DOWN,-1;VAMPIRIC_ATTACK,-1;CASTING_TIME_DOWN,-1</dispel>
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN</dispel>
|
||||
@@ -1043,7 +1043,7 @@
|
||||
<POISON>50</POISON>
|
||||
</effect>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>DANCE_OF_ALIGNMENT,-1;ARMOR_UNHOLY,-1;DANCE_OF_LIGHT,-1;SONG_OF_INVOCATION,-1;RESIST_BLEEDING,-1;RESIST_SHOCK,-1</dispel>
|
||||
<dispel>DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK</slot>
|
||||
@@ -1088,7 +1088,7 @@
|
||||
<SLEEP>50</SLEEP>
|
||||
</effect>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>DANCE_OF_PROTECTION,-1;RESIST_DEBUFF_DISPEL,-1</dispel>
|
||||
<dispel>DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL</slot>
|
||||
@@ -1220,7 +1220,7 @@
|
||||
<affectScope>SINGLE</affectScope>
|
||||
<effects>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>MULTI_BUFF,-1;COUNTER_CRITICAL,-1</dispel>
|
||||
<dispel>MULTI_BUFF;COUNTER_CRITICAL</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>MULTI_BUFF;COUNTER_CRITICAL</slot>
|
||||
|
@@ -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.<AbnormalType> emptySet();
|
||||
}
|
||||
_blockAbnormalSlots = Arrays.stream(params.getString("dispel").split(";")).map(slot -> Enum.valueOf(AbnormalType.class, slot)).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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<AbnormalType, Short> _dispelAbnormals;
|
||||
private final Set<AbnormalType> _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.<AbnormalType, Short> 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);
|
||||
}
|
||||
}
|
||||
|
@@ -923,7 +923,7 @@
|
||||
<affectScope>SINGLE</affectScope>
|
||||
<effects>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE,-1;ATTACK_TIME_DOWN,-1;VAMPIRIC_ATTACK,-1;CASTING_TIME_DOWN,-1</dispel>
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<dispel>IMPROVE_VAMPIRIC_HASTE;ATTACK_TIME_DOWN;VAMPIRIC_ATTACK;CASTING_TIME_DOWN</dispel>
|
||||
@@ -1023,7 +1023,7 @@
|
||||
<POISON>50</POISON>
|
||||
</effect>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>DANCE_OF_ALIGNMENT,-1;ARMOR_UNHOLY,-1;DANCE_OF_LIGHT,-1;SONG_OF_INVOCATION,-1;RESIST_BLEEDING,-1;RESIST_SHOCK,-1</dispel>
|
||||
<dispel>DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>DANCE_OF_ALIGNMENT;ARMOR_UNHOLY;DANCE_OF_LIGHT;SONG_OF_INVOCATION;RESIST_BLEEDING;RESIST_SHOCK</slot>
|
||||
@@ -1068,7 +1068,7 @@
|
||||
<SLEEP>50</SLEEP>
|
||||
</effect>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>DANCE_OF_PROTECTION,-1;RESIST_DEBUFF_DISPEL,-1</dispel>
|
||||
<dispel>DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>DANCE_OF_PROTECTION;RESIST_DEBUFF_DISPEL</slot>
|
||||
@@ -1200,7 +1200,7 @@
|
||||
<affectScope>SINGLE</affectScope>
|
||||
<effects>
|
||||
<effect name="DispelBySlotProbability">
|
||||
<dispel>MULTI_BUFF,-1;COUNTER_CRITICAL,-1</dispel>
|
||||
<dispel>MULTI_BUFF;COUNTER_CRITICAL</dispel>
|
||||
</effect>
|
||||
<effect name="BlockAbnormalSlot">
|
||||
<slot>MULTI_BUFF;COUNTER_CRITICAL</slot>
|
||||
|
@@ -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.<AbnormalType> emptySet();
|
||||
}
|
||||
_blockAbnormalSlots = Arrays.stream(params.getString("dispel").split(";")).map(slot -> Enum.valueOf(AbnormalType.class, slot)).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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<AbnormalType, Short> _dispelAbnormals;
|
||||
private final Set<AbnormalType> _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.<AbnormalType, Short> 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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user