Fixed summoning Cubic NPE.
This commit is contained in:
		@@ -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();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user