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.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}

View File

@ -90,9 +90,10 @@ public class SummonCubic extends AbstractEffect
{
// If maximum amount is reached, random cubic is removed.
// Players with no mastery can have only one cubic.
final double allowedCubicCount = effected.getActingPlayer().getStat().getValue(Stats.MAX_CUBIC, 0);
final int currentCubicCount = player.getCubics().size();
final double allowedCubicCount = player.getStat().getValue(Stats.MAX_CUBIC, 1);
// Extra cubics are removed, one by one, randomly.
final int currentCubicCount = player.getCubics().size();
if (currentCubicCount >= allowedCubicCount)
{
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.
player.addCubic(new CubicInstance(effected.getActingPlayer(), effector.getActingPlayer(), template));
player.addCubic(new CubicInstance(player, effector.getActingPlayer(), template));
player.sendPacket(new ExUserInfoCubic(player));
player.broadcastCharInfo();
}