diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java index bcb52d924b..2be750a918 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java @@ -90,14 +90,12 @@ public class SummonCubic extends AbstractEffect { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. - final int allowedCubicCount = (int) effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 1); + final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++) + if (currentCubicCount >= allowedCubicCount) { - final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; - final CubicInstance removedCubic = player.getCubicById(removedCubicId); - removedCubic.deactivate(); + player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); } }