Fixed cubic removal array index out of bounds exception.
This commit is contained in:
parent
4e3f43c102
commit
ff0b12f059
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
@ -91,9 +91,9 @@ public final 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 int currentCubicCount = player.getCubics().size() + 1;
|
||||
final int currentCubicCount = player.getCubics().size();
|
||||
// Extra cubics are removed, one by one, randomly.
|
||||
for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)
|
||||
for (int i = 0; i <= ((currentCubicCount + 1) - allowedCubicCount); i++)
|
||||
{
|
||||
final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)];
|
||||
final CubicInstance removedCubic = player.getCubicById(removedCubicId);
|
||||
|
Loading…
Reference in New Issue
Block a user