Snake changes

SSM Wolf fixes
This commit is contained in:
Chiss 2013-10-12 16:59:23 +11:00
parent 0b2dcc2617
commit 27fb3b4262
7 changed files with 67 additions and 40 deletions

View File

@ -62,7 +62,7 @@ public class SuperSmash extends SoloGame
new KitSkySquid(manager),
new KitWitherSkeleton(manager),
//new KitWither(manager),
//new KitWolf(manager),
new KitWolf(manager),
},

View File

@ -7,7 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.disguise.disguises.DisguiseWolf;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
@ -30,7 +30,7 @@ public class KitWolf extends SmashKit
new Perk[]
{
new PerkSmashStats(5, 1.6, 0.3, 4.5),
new PerkSmashStats(4, 1.6, 0.3, 4.5),
new PerkDoubleJump("Wolf Jump", 1.0, 1.0, true),
new PerkWolf(),
},
@ -75,7 +75,7 @@ public class KitWolf extends SmashKit
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
//Disguise
DisguisePig disguise = new DisguisePig(player);
DisguiseWolf disguise = new DisguiseWolf(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);

View File

@ -49,6 +49,8 @@ import net.minecraft.server.v1_6_R3.Navigation;
public class Snake extends SoloGame
{
private double _maxSpeed = 60;
private HashMap<Player, ArrayList<Creature>> _tail = new HashMap<Player, ArrayList<Creature>>();
private HashSet<Entity> _food = new HashSet<Entity>();
@ -64,21 +66,23 @@ public class Snake extends SoloGame
new Kit[]
{
new KitSpeed(manager),
new KitOther(manager),
//new KitOther(manager),
new KitInvulnerable(manager),
},
new String[]
{
"Eat slimes to grow longer",
"Red slimes are worth twice as much",
"You die if you hit someones tail",
"Avoid hitting snake tails",
"You get faster as you grow longer",
"Eat slimes to grow faster",
"Last one alive wins!"
});
this.DamageTeamSelf = true;
this.HungerSet = 2;
this.GemMultiplier = 0.5;
}
@EventHandler
@ -112,12 +116,12 @@ public class Snake extends SoloGame
if (!IsLive())
return;
if (event.getType() != UpdateType.FAST)
if (event.getType() != UpdateType.SEC)
return;
for (Player player : GetPlayers(true))
{
Grow(player, 1);
Grow(player, 1, false);
}
}
@ -132,19 +136,13 @@ public class Snake extends SoloGame
for (Player player : GetPlayers(true))
{
double mult = 0.5 + Math.min(0.5, (System.currentTimeMillis() - this.GetStateTime())/250000d);
double mult = 0.5;
if (GetKit(player) instanceof KitSpeed)
mult = mult * 0.9;
if (GetKit(player) instanceof KitOther)
mult = mult * 1.0;
if (GetKit(player) instanceof KitInvulnerable)
mult = mult * 0.8;
if (_tail.containsKey(player))
mult += Math.min(0.8, (double)_tail.get(player).size() / _maxSpeed);
if (_speed.containsKey(player))
mult = mult * 1.6;
mult = mult * 1.7;
Vector vel = player.getLocation().getDirection().setY(0).normalize();
if (!UtilEnt.isGrounded(player)) vel.setY(-0.2);
@ -283,11 +281,9 @@ public class Snake extends SoloGame
{
if (UtilMath.offset(food, player) < 2)
{
int amount = 1;
if (food instanceof MagmaCube)
amount = 2;
int amount = 2;
Grow(player, amount);
Grow(player, amount, true);
foodIterator.remove();
food.remove();
break;
@ -296,7 +292,7 @@ public class Snake extends SoloGame
}
}
public void Grow(Player player, int amount)
public void Grow(Player player, int amount, boolean sound)
{
while (amount > 0)
{
@ -308,10 +304,12 @@ public class Snake extends SoloGame
if (!_tail.get(player).isEmpty())
loc = _tail.get(player).get(_tail.get(player).size() - 1).getLocation();
loc.subtract(loc.getDirection().setY(0));
if (_tail.get(player).size() > 1)
loc.add(UtilAlg.getTrajectory2d(_tail.get(player).get(_tail.get(player).size() - 2), _tail.get(player).get(_tail.get(player).size() - 1)));
else
loc.subtract(player.getLocation().getDirection().setY(0));
//Spawn
this.CreatureAllowOverride = true;
Sheep tail = loc.getWorld().spawn(loc, Sheep.class);
this.CreatureAllowOverride = false;
@ -324,10 +322,13 @@ public class Snake extends SoloGame
_tail.get(player).add(tail);
//Audio
//player.getWorld().playSound(player.getLocation(), Sound.EAT, 2f, 1f);
if (sound)
player.getWorld().playSound(player.getLocation(), Sound.EAT, 2f, 1f);
amount--;
}
player.setExp((float) Math.min(0.9999f, (double)_tail.get(player).size() / _maxSpeed));
}
@EventHandler

View File

@ -17,7 +17,7 @@ public class KitInvulnerable extends Kit
{
public KitInvulnerable(ArcadeManager manager)
{
super(manager, "Super Snake", KitAvailability.Blue,
super(manager, "Super Snake", KitAvailability.Free,
new String[]
{

View File

@ -353,7 +353,7 @@ public class UHC extends TeamGame
event.setCancelled(true);
}
@EventHandler
@EventHandler(priority = EventPriority.LOW)
public void GenerateTeamNames(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)

View File

@ -13,6 +13,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
@ -45,6 +46,8 @@ public class PerkWolf extends Perk
private HashMap<Player, ArrayList<Long>> _repeat = new HashMap<Player, ArrayList<Long>>();
private HashMap<LivingEntity, Long> _tackleStrike = new HashMap<LivingEntity, Long>();
public PerkWolf()
{
super("Wolf Skills", new String[]
@ -293,7 +296,7 @@ public class PerkWolf extends Perk
if (!UtilEnt.isGrounded(player))
continue;
if (!UtilTime.elapsed(_strike.get(player), 1000))
if (!UtilTime.elapsed(_strike.get(player), 1500))
continue;
playerIterator.remove();
@ -314,6 +317,8 @@ public class PerkWolf extends Perk
{
wolf.remove();
wolfIterator.remove();
_tackleStrike.put(damagee, System.currentTimeMillis());
}
}
@ -321,8 +326,6 @@ public class PerkWolf extends Perk
DamageCause.CUSTOM, 7, true, true, false,
damager.getName(), "Wolf Strike");
//Blood
damagee.getWorld().playEffect(damagee.getLocation(), Effect.STEP_SOUND, 55);
//Sound
damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1f);
@ -337,16 +340,29 @@ public class PerkWolf extends Perk
{
if (event.GetReason() != null && event.GetReason().contains("Wolf Strike"))
{
if (_tackle.containsValue(event.GetDamageeEntity()))
if (_tackleStrike.containsKey(event.GetDamageeEntity()) && !UtilTime.elapsed(_tackleStrike.get(event.GetDamageeEntity()), 100))
{
event.AddKnockback(GetName(), 3.0);
//Blood
event.GetDamageeEntity().getWorld().playEffect(event.GetDamageeEntity().getLocation(), Effect.STEP_SOUND, 55);
//Double Sound
event.GetDamageeEntity().getWorld().playSound(event.GetDamageeEntity().getLocation(), Sound.WOLF_BARK, 2f, 1.5f);
}
else
{
event.AddKnockback(GetName(), 1.5);
}
}
}
@EventHandler
@EventHandler(priority = EventPriority.HIGHEST)
public void RepeatDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
@ -360,11 +376,15 @@ public class PerkWolf extends Perk
{
_repeat.put(damager, new ArrayList<Long>());
_repeat.get(damager).add(System.currentTimeMillis());
//Exp
damager.setExp(Math.min(0.9999f, _repeat.get(damager).size()/9f));
return;
}
int count = _repeat.get(damager).size();
Manager.GetGame().Announce("Repeat: " + count);
if (count > 0)
{
event.AddMod(damager.getName(), "Ravage", count, false);
@ -374,6 +394,9 @@ public class PerkWolf extends Perk
}
_repeat.get(damager).add(System.currentTimeMillis());
//Exp
damager.setExp(Math.min(0.9999f, _repeat.get(damager).size()/9f));
}
@EventHandler
@ -397,6 +420,9 @@ public class PerkWolf extends Perk
if (UtilTime.elapsed(time, 3000))
timeIterator.remove();
}
//Exp
player.setExp(Math.min(0.9999f, _repeat.get(player).size()/9f));
}
}
}

View File

@ -67,7 +67,7 @@ public class GameChatManager implements Listener
if (ownsUltra && !rank.Has(Rank.ULTRA))
rankStr = Rank.ULTRA.Color + C.Bold + Rank.ULTRA.Name.toUpperCase() + " ";
if (Manager.GetGame().GetType() == GameType.UHC)
if (Manager.GetGame() != null && Manager.GetGame().GetType() == GameType.UHC)
{
ChatColor col = ChatColor.GREEN;
if (sender.getHealth() <= 12) col = ChatColor.YELLOW;