Small fixes for win room

This commit is contained in:
LCastr0 2017-01-20 22:12:01 -02:00
parent 34bf89187d
commit 023ed5ed4a
4 changed files with 79 additions and 20 deletions

View File

@ -170,6 +170,11 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Gingerbread Chests");
}
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -17)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Love Chests");
}
//Rank Unlocks
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10)

View File

@ -117,7 +117,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Power Play Club");
}
//Rank Unlocks
else if (pet.getPrice() == -10)
{

View File

@ -22,7 +22,7 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
public UnlockCosmeticsCommand(GadgetManager plugin)
{
super(plugin, Rank.JNR_DEV, "unlockCosmetics");
super(plugin, Rank.SNR_MODERATOR, "unlockCosmetics");
_plugin = plugin;
}

View File

@ -1,7 +1,12 @@
package mineplex.core.gadget.gadgets.wineffect;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.util.Vector;
@ -9,6 +14,10 @@ import mineplex.core.common.animation.AnimationPoint;
import mineplex.core.common.animation.AnimatorEntity;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.gadget.GadgetManager;
@ -20,14 +29,24 @@ public class WinEffectLoveIsABattlefield extends WinEffectGadget
{
private DisguisePlayer _npc;
private int _ticks = 0;
private List<ArmorStand> _nonTeamArmorStands = new ArrayList<>();
public WinEffectLoveIsABattlefield(GadgetManager manager)
{
super(manager, "Love is a Battlefield", UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE),
0, Material.GLASS, (byte)0, true);
-17, Material.GLASS, (byte) 0, true);
_schematicName = "WinRoomLove";
}
@Override
public void teleport()
{
Location loc = getBaseLocation().add(getBaseLocation().getDirection().normalize().multiply(17)).add(0, 3, 0);
loc.setDirection(getBaseLocation().clone().subtract(loc).toVector());
super.teleport(loc);
}
@Override
public void play()
{
@ -35,16 +54,18 @@ public class WinEffectLoveIsABattlefield extends WinEffectGadget
AnimatorEntity animator = new AnimatorEntity(Manager.getPlugin(), _npc.getEntity().getBukkitEntity());
animator.addPoint(new AnimationPoint( 20, new Vector(0,0,0), new Vector(-1, 0.5, 0)));
animator.addPoint(new AnimationPoint( 40, new Vector(0,0,0), new Vector( 0, 0.5,-1)));
animator.addPoint(new AnimationPoint( 60, new Vector(0,0,0), new Vector( 1, 0.5, 0)));
animator.addPoint(new AnimationPoint( 80, new Vector(0,0,0), new Vector( 0, 0.5, 1)));
animator.addPoint(new AnimationPoint(20, new Vector(0,0,0), new Vector(-1, 0.5, 0)));
animator.addPoint(new AnimationPoint(40, new Vector(0,0,0), new Vector( 0, 0.5,-1)));
animator.addPoint(new AnimationPoint(60, new Vector(0,0,0), new Vector( 1, 0.5, 0)));
animator.addPoint(new AnimationPoint(80, new Vector(0,0,0), new Vector( 0, 0.5, 1)));
animator.setRepeat(true);
Location loc = _npc.getEntity().getBukkitEntity().getLocation();
loc.setDirection(new Vector(0, 0.5, 1));
animator.start(loc);
spawnNonTeam();
}
@EventHandler
@ -53,6 +74,13 @@ public class WinEffectLoveIsABattlefield extends WinEffectGadget
if(!isRunning()) return;
if (event.getType() == UpdateType.TICK)
{
_ticks++;
if (_ticks == 70)
knockPlayers();
}
if(event.getType() == UpdateType.FASTER)
{
_npc.sendHit();
@ -60,20 +88,18 @@ public class WinEffectLoveIsABattlefield extends WinEffectGadget
if(event.getType() != UpdateType.FAST) return;
spawnFirework(event.getTick());
Location loc = getBaseLocation();
// Location loc = getBaseLocation();
//
// for(int i = 0; i < 3; i++)
// {
// double r = 3;
// double rad = (((Math.PI*2)/3.0)*i) + ((event.getTick()%240) * Math.PI/120.0);
// double x = Math.sin(rad) * r;
// double z = Math.cos(rad) * r;
//
// Location l = loc.clone().add(x, 0, z);
// UtilFirework.launchFirework(l, Type.BALL, Color.fromRGB(UtilMath.r(255*255*255)), false, true, new Vector(0, 0.01, 0), 1);
// }
for(int i = 0; i < 3; i++)
{
double r = 3;
double rad = (((Math.PI*2)/3.0)*i) + ((event.getTick()%240) * Math.PI/120.0);
double x = Math.sin(rad) * r;
double z = Math.cos(rad) * r;
Location l = loc.clone().add(x, 0, z);
UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, l, 0.75f, 0.75f, 0.75f, 0.5f, 5, UtilParticle.ViewDist.NORMAL);
}
}
@Override
@ -83,4 +109,32 @@ public class WinEffectLoveIsABattlefield extends WinEffectGadget
_npc = null;
}
private void knockPlayers()
{
for (ArmorStand armorStand : _nonTeamArmorStands)
{
double mult = 5;
UtilAction.velocity(armorStand, UtilAlg.getTrajectory(armorStand.getLocation(),
armorStand.getLocation()), 2 * mult, false, 0, 1 + 1 * mult, 10, true);
}
}
private void spawnNonTeam()
{
int i = 0;
List<Location> circle = UtilShapes.getPointsInCircle(getBaseLocation(), _nonTeam.size(), 2.5);
for (Player player : _nonTeam)
{
Location loc = circle.get(i);
DisguisePlayer disguisePlayer = getNPC(player, loc);
ArmorStand armorStand = (ArmorStand) disguisePlayer.getEntity().getBukkitEntity();
Vector direction = _player.getEyeLocation().toVector().subtract(armorStand.getEyeLocation().toVector());
Location teleport = armorStand.getLocation().setDirection(direction);
armorStand.teleport(teleport);
armorStand.setGravity(true);
_nonTeamArmorStands.add(armorStand);
i++;
}
}
}