Fix RewardManager bug, fooling around with animations

This commit is contained in:
Shaun Bennett 2014-09-18 00:41:56 -05:00
parent 9d0b99b7fc
commit 6c4479298d
4 changed files with 32 additions and 16 deletions

View File

@ -5,17 +5,17 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.reward.rewards.CoinReward; import mineplex.core.reward.rewards.CoinReward;
import mineplex.core.reward.rewards.InventoryReward; import mineplex.core.reward.rewards.InventoryReward;
import mineplex.core.reward.rewards.UnknownPackageReward; import mineplex.core.reward.rewards.UnknownPackageReward;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
/** /**
* Created by shaun on 2014-09-04. * Created by shaun on 2014-09-04.
*/ */
@ -44,9 +44,9 @@ public class RewardManager
_doubleGadgetValue = doubleGadgetValue; _doubleGadgetValue = doubleGadgetValue;
addCommon(donationManager, inventoryManager, commonValueMin, commonValueMax); addCommon(donationManager, inventoryManager, commonValueMin, commonValueMax);
addUncommon(donationManager, inventoryManager, commonValueMin, commonValueMax); addUncommon(donationManager, inventoryManager, uncommonValueMin, uncommonValueMax);
addRare(donationManager, inventoryManager, commonValueMin, commonValueMax); addRare(donationManager, inventoryManager, rareValueMin, rareValueMax);
addLegendary(donationManager, inventoryManager, commonValueMin, commonValueMax); addLegendary(donationManager, inventoryManager, legendValueMin, legendValueMax);
} }
public void addCommon(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue) public void addCommon(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
@ -261,12 +261,12 @@ public class RewardManager
double rand = _random.nextDouble(); double rand = _random.nextDouble();
RewardRarity rarity; RewardRarity rarity;
if (isChestOpening ? rand <= 0.01 : rand <= 0.0001) if (isChestOpening ? rand <= 0.91 : rand <= 0.0001)
{ {
// 1% or 0.01% // 1% or 0.01%
rarity = RewardRarity.LEGENDARY; rarity = RewardRarity.LEGENDARY;
} }
else if (isChestOpening ? rand <= 0.05 : rand <= 0.001) else if (isChestOpening ? rand <= 0.95 : rand <= 0.001)
{ {
// 4% or 0.09% // 4% or 0.09%
rarity = RewardRarity.RARE; rarity = RewardRarity.RARE;

View File

@ -9,6 +9,7 @@ import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.treasure.Treasure; import mineplex.core.treasure.Treasure;
/** /**
@ -38,13 +39,27 @@ public class LegendaryAnimation extends Animation
// _chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.WITHER_SPAWN, 10F, 1.2F); // _chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.WITHER_SPAWN, 10F, 1.2F);
_chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F); _chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F);
} }
if (getTicks() == 10) if (getTicks() == 20)
{ {
FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.RED).withFade(Color.BLACK).build(); FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.RED).withFade(Color.BLACK).build();
UtilFirework.playFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), effect); UtilFirework.playFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), effect);
// ((CraftWorld) _chestBlock.getWorld()).getHandle().triggerEffect(1005, _chestBlock.getX(), _chestBlock.getY(), _chestBlock.getZ(), 2257); // ((CraftWorld) _chestBlock.getWorld()).getHandle().triggerEffect(1005, _chestBlock.getX(), _chestBlock.getY(), _chestBlock.getZ(), 2257);
} }
else if (getTicks() < 10) else if (getTicks() < 15)
{
double radius = 2 - (getTicks() / 10D * 2);
int particleAmount = 20 - (getTicks() * 2);
Location _centerLocation = _chestBlock.getLocation().add(0.5, 0.1, 0.5);
for (int i = 0; i < particleAmount; i++)
{
double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius;
double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
Location location = _centerLocation.clone().add(xDiff, 0, zDiff);
UtilParticle.PlayParticle(UtilParticle.ParticleType.CLOUD, location, 0, 0, 0, 0, 1);
}
}
else if (getTicks() < 20)
{ {
double xDif = _random.nextGaussian() * 0.5; double xDif = _random.nextGaussian() * 0.5;
double zDif = _random.nextGaussian() * 0.5; double zDif = _random.nextGaussian() * 0.5;

View File

@ -53,10 +53,11 @@ public class RareAnimation extends Animation
} }
double radius = getTicks() / 20D; double radius = getTicks() / 20D;
for (int i = 0; i < 20; i++) int particleAmount = getTicks() / 2;
for (int i = 0; i < particleAmount; i++)
{ {
double xDiff = Math.sin(i/20D * 2 * Math.PI) * radius; double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius;
double zDiff = Math.cos(i/20D * 2 * Math.PI) * radius; double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
Location location = _centerLocation.clone().add(xDiff, -1.3, zDiff); Location location = _centerLocation.clone().add(xDiff, -1.3, zDiff);
UtilParticle.PlayParticle(UtilParticle.ParticleType.FLAME, location, 0, 0, 0, 0, 1); UtilParticle.PlayParticle(UtilParticle.ParticleType.FLAME, location, 0, 0, 0, 0, 1);

View File

@ -41,7 +41,7 @@ public class UncommonAnimation extends Animation
double zDif = 0;//_random.nextGaussian() * 1; double zDif = 0;//_random.nextGaussian() * 1;
double yDif = 2;//(_random.nextInt(3) * _random.nextDouble()) + 2; double yDif = 2;//(_random.nextInt(3) * _random.nextDouble()) + 2;
FireworkEffect effect = FireworkEffect.builder().withColor(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255))) FireworkEffect effect = FireworkEffect.builder().withColor(Color.RED)
.withFade(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255))) .withFade(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255)))
.with(FireworkEffect.Type.STAR) .with(FireworkEffect.Type.STAR)
.build(); .build();