Change nether miniboss rewards to drop crafting materials beyond diamonds and add the ability to drop set pieces

This commit is contained in:
AlexTheCoder 2017-03-10 14:59:36 -05:00
parent 48967b4a74
commit 2e04490001
3 changed files with 37 additions and 13 deletions

View File

@ -1,14 +1,8 @@
package mineplex.game.clans.clans.nether.miniboss.bosses;
import java.util.Arrays;
import java.util.Random;
import mineplex.core.common.util.UtilMath;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.amplifiers.AmplifierManager;
import mineplex.game.clans.clans.nether.miniboss.NetherMiniBoss;
import mineplex.game.clans.items.runes.RuneManager.RuneAttribute;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
@ -28,6 +22,13 @@ import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.UtilMath;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.amplifiers.AmplifierManager;
import mineplex.game.clans.clans.nether.miniboss.NetherMiniBoss;
import mineplex.game.clans.items.runes.RuneManager.RuneAttribute;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
/**
* Class for running an individual Archer miniboss
*/
@ -35,7 +36,10 @@ public class ArcherMiniboss extends NetherMiniBoss<Skeleton>
{
private static final int BARBED_LEVEL = 1;
private static final double RUNE_DROP_CHANCE = .02;
private static final int MAX_DIAMOND_DROPS = 5;
private static final int MAX_VALUABLE_DROPS = 5;
private static final Material[] VALUABLE_DROP_TYPES = new Material[] {Material.DIAMOND, Material.GOLD_INGOT, Material.IRON_INGOT, Material.LEATHER};
private static final Material[] SET_DROP_TYPES = (Material[])Arrays.asList(Material.values()).stream().filter(t -> t.name().contains("HELMET") || t.name().contains("CHESTPLATE") || t.name().contains("LEGGINGS") || t.name().contains("BOOTS")).toArray();
private static final double SET_DROP_CHANCE = .02;
public ArcherMiniboss(String displayName, Double maxHealth, Location spawn, EntityType type)
{
@ -63,7 +67,7 @@ public class ArcherMiniboss extends NetherMiniBoss<Skeleton>
@Override
public void customDeath(Location deathLocation)
{
deathLocation.getWorld().dropItemNaturally(deathLocation, new ItemStack(Material.DIAMOND, UtilMath.r(MAX_DIAMOND_DROPS) + 1));
deathLocation.getWorld().dropItemNaturally(deathLocation, new ItemStack(VALUABLE_DROP_TYPES[UtilMath.r(VALUABLE_DROP_TYPES.length)], UtilMath.r(MAX_VALUABLE_DROPS) + 1));
double runeDropChance = RUNE_DROP_CHANCE;
if (ClansManager.getInstance().getAmplifierManager().hasActiveAmplifier())
{
@ -74,6 +78,10 @@ public class ArcherMiniboss extends NetherMiniBoss<Skeleton>
RuneAttribute runeType = RuneAttribute.values()[UtilMath.r(RuneAttribute.values().length)];
deathLocation.getWorld().dropItemNaturally(deathLocation, ClansManager.getInstance().getGearManager().getRuneManager().getRune(runeType));
}
if (new Random().nextDouble() <= SET_DROP_CHANCE)
{
deathLocation.getWorld().dropItemNaturally(deathLocation, new ItemStack(SET_DROP_TYPES[UtilMath.r(SET_DROP_TYPES.length)], 1));
}
}
@EventHandler

View File

@ -1,5 +1,6 @@
package mineplex.game.clans.clans.nether.miniboss.bosses;
import java.util.Arrays;
import java.util.Random;
import mineplex.core.common.util.UtilEnt;
@ -32,8 +33,11 @@ public class GhastMiniboss extends NetherMiniBoss<Ghast>
private static final long FIREBALL_LAUNCH_RATE = 500;
private static final int FIREBALLS_PER_USE = 5;
private static final double RUNE_DROP_CHANCE = .02;
private static final int MAX_DIAMOND_DROPS = 5;
private static final int MAX_VALUABLE_DROPS = 5;
private static final Material[] VALUABLE_DROP_TYPES = new Material[] {Material.DIAMOND, Material.GOLD_INGOT, Material.IRON_INGOT, Material.LEATHER};
private static final double MAX_TARGET_RANGE = 25;
private static final Material[] SET_DROP_TYPES = (Material[])Arrays.asList(Material.values()).stream().filter(t -> t.name().contains("HELMET") || t.name().contains("CHESTPLATE") || t.name().contains("LEGGINGS") || t.name().contains("BOOTS")).toArray();
private static final double SET_DROP_CHANCE = .02;
private long _lastFireballUse;
private int _fireballsRemaining;
@ -72,7 +76,7 @@ public class GhastMiniboss extends NetherMiniBoss<Ghast>
@Override
public void customDeath(Location deathLocation)
{
deathLocation.getWorld().dropItemNaturally(deathLocation, new ItemStack(Material.DIAMOND, UtilMath.r(MAX_DIAMOND_DROPS) + 1));
deathLocation.getWorld().dropItemNaturally(deathLocation, new ItemStack(VALUABLE_DROP_TYPES[UtilMath.r(VALUABLE_DROP_TYPES.length)], UtilMath.r(MAX_VALUABLE_DROPS) + 1));
double runeDropChance = RUNE_DROP_CHANCE;
if (ClansManager.getInstance().getAmplifierManager().hasActiveAmplifier())
{
@ -83,6 +87,10 @@ public class GhastMiniboss extends NetherMiniBoss<Ghast>
RuneAttribute runeType = RuneAttribute.values()[UtilMath.r(RuneAttribute.values().length)];
deathLocation.getWorld().dropItemNaturally(deathLocation, ClansManager.getInstance().getGearManager().getRuneManager().getRune(runeType));
}
if (new Random().nextDouble() <= SET_DROP_CHANCE)
{
deathLocation.getWorld().dropItemNaturally(deathLocation, new ItemStack(SET_DROP_TYPES[UtilMath.r(SET_DROP_TYPES.length)], 1));
}
}
@Override

View File

@ -1,5 +1,6 @@
package mineplex.game.clans.clans.nether.miniboss.bosses;
import java.util.Arrays;
import java.util.Random;
import mineplex.core.common.util.UtilAction;
@ -33,7 +34,10 @@ import org.bukkit.potion.PotionEffectType;
public class WarriorMiniboss extends NetherMiniBoss<Zombie>
{
private static final double RUNE_DROP_CHANCE = .02;
private static final int MAX_DIAMOND_DROPS = 5;
private static final int MAX_VALUABLE_DROPS = 5;
private static final Material[] VALUABLE_DROP_TYPES = new Material[] {Material.DIAMOND, Material.GOLD_INGOT, Material.IRON_INGOT, Material.LEATHER};
private static final Material[] SET_DROP_TYPES = (Material[])Arrays.asList(Material.values()).stream().filter(t -> t.name().contains("HELMET") || t.name().contains("CHESTPLATE") || t.name().contains("LEGGINGS") || t.name().contains("BOOTS")).toArray();
private static final double SET_DROP_CHANCE = .02;
private static final double LEAP_CHANCE = .9;
private static final double LEAP_MIN_DIST = 3;
private static final double LEAP_MAX_DIST = 16;
@ -66,7 +70,7 @@ public class WarriorMiniboss extends NetherMiniBoss<Zombie>
@Override
public void customDeath(Location deathLocation)
{
deathLocation.getWorld().dropItemNaturally(deathLocation, new ItemStack(Material.DIAMOND, UtilMath.r(MAX_DIAMOND_DROPS) + 1));
deathLocation.getWorld().dropItemNaturally(deathLocation, new ItemStack(VALUABLE_DROP_TYPES[UtilMath.r(VALUABLE_DROP_TYPES.length)], UtilMath.r(MAX_VALUABLE_DROPS) + 1));
double runeDropChance = RUNE_DROP_CHANCE;
if (ClansManager.getInstance().getAmplifierManager().hasActiveAmplifier())
{
@ -77,6 +81,10 @@ public class WarriorMiniboss extends NetherMiniBoss<Zombie>
RuneAttribute runeType = RuneAttribute.values()[UtilMath.r(RuneAttribute.values().length)];
deathLocation.getWorld().dropItemNaturally(deathLocation, ClansManager.getInstance().getGearManager().getRuneManager().getRune(runeType));
}
if (new Random().nextDouble() <= SET_DROP_CHANCE)
{
deathLocation.getWorld().dropItemNaturally(deathLocation, new ItemStack(SET_DROP_TYPES[UtilMath.r(SET_DROP_TYPES.length)], 1));
}
}
@Override