Fixed cubic removal array index out of bounds exception.

This commit is contained in:
MobiusDevelopment 2019-06-30 14:27:23 +00:00
parent 4e3f43c102
commit ff0b12f059
12 changed files with 24 additions and 24 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);