Players with no mastery can only have one cubic.

This commit is contained in:
MobiusDevelopment
2019-11-03 19:34:00 +00:00
parent 61b68da1ff
commit 8a8aeffdb3
15 changed files with 60 additions and 45 deletions

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }

View File

@@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{ {
// If maximum amount is reached, random cubic is removed. // If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic. // Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0); final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
final int currentCubicCount = player.getCubics().size();
// Extra cubics are removed, one by one, randomly. // Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount) if (currentCubicCount >= allowedCubicCount)
{ {
player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate(); player.getCubics().values().stream().skip((int) (currentCubicCount * Rnd.nextDouble())).findAny().get().deactivate();
@@ -107,7 +108,7 @@ public class SummonCubic extends AbstractEffect
} }
// Adding a new cubic. // Adding a new cubic.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template)); player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player)); player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo(); player.broadcastCharInfo();
} }