Snowman converted to Google Sheets

This commit is contained in:
Sam 2017-04-23 18:54:29 +01:00
parent 9e6ab9a696
commit c8d891ef31
6 changed files with 81 additions and 41 deletions

View File

@ -26,16 +26,6 @@ import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitSnowman extends SmashKit
{
private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.4, 0.3, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkDamageSnow(1, 0.4),
new PerkArcticAura(),
new PerkBlizzard(),
new PerkIcePath(),
new SmashSnowman()
};
private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BALL);
private static final ItemStack[] PLAYER_ITEMS = {
@ -80,7 +70,15 @@ public class KitSnowman extends SmashKit
public KitSnowman(ArcadeManager manager)
{
super(manager, "Snowman", KitAvailability.Gem, 5000, PERKS, EntityType.SNOWMAN, IN_HAND, DisguiseSnowman.class);
super(manager, "Snowman", KitAvailability.Gem, 5000, new Perk[] {
new PerkSmashStats(),
new PerkDoubleJump("Double Jump"),
new PerkDamageSnow(),
new PerkArcticAura(),
new PerkBlizzard(),
new PerkIcePath(),
new SmashSnowman() },
EntityType.SNOWMAN, IN_HAND, DisguiseSnowman.class);
}
@Override

View File

@ -15,14 +15,21 @@ import nautilus.game.arcade.kit.Perk;
public class PerkArcticAura extends Perk
{
private static final int DURATION = 2000;
private static final int RANGE = 5;
private int _duration;
private int _range;
public PerkArcticAura()
{
super("Arctic Aura", new String[] { "You freeze things around you, slowing enemies." });
}
@Override
public void setupValues()
{
_duration = getPerkTime("Duration");
_range = getPerkInt("Range");
}
@EventHandler
public void SnowAura(UpdateEvent event)
{
@ -43,13 +50,13 @@ public class PerkArcticAura extends Perk
continue;
}
double range = RANGE * player.getExp();
double range = _range * player.getExp();
Map<Block, Double> blocks = UtilBlock.getInRadius(player.getLocation(), range);
for (Block block : blocks.keySet())
{
Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (int) (DURATION * (1 + blocks.get(block))), 250, 0);
Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (int) (_duration * (1 + blocks.get(block))), 250, 0);
}
}
}

View File

@ -28,8 +28,8 @@ import nautilus.game.arcade.kit.perks.data.IcePathData;
public class PerkIcePath extends Perk
{
private static final int COOLDOWN = 12000;
private static final int MELT_TIME = 6000;
private int _cooldown;
private int _meltTime;
private Set<IcePathData> _data = new HashSet<>();
@ -38,6 +38,13 @@ public class PerkIcePath extends Perk
super("Ice Path", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Ice Path" });
}
@Override
public void setupValues()
{
_cooldown = getPerkTime("Cooldown");
_meltTime = getPerkTime("Melt Time");
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
@ -68,7 +75,7 @@ public class PerkIcePath extends Perk
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
{
return;
}
@ -105,7 +112,7 @@ public class PerkIcePath extends Perk
else
{
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79);
Manager.GetBlockRestore().add(block, 79, (byte) 0, MELT_TIME);
Manager.GetBlockRestore().add(block, 79, (byte) 0, _meltTime);
}
}
}

View File

@ -40,19 +40,29 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
public class SmashSnowman extends SmashUltimate
{
private static final int DURATION = 20000;
private static final int TURRET_HEALTH = 40;
private static final int RATE = 250;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
private static final int COOLDOWN = 1000;
private int _duration;
private int _turretHealth;
private int _rate;
private float _knockbackMagnitude;
private Map<Projectile, Player> _snowball = new HashMap<>();
private Map<Snowman, Player> _turret = new HashMap<>();
public SmashSnowman()
{
super("Snow Turret", new String[] {}, Sound.STEP_SNOW, DURATION);
super("Snow Turret", new String[] {}, Sound.STEP_SNOW, 0);
}
@Override
public void setupValues()
{
_duration = getPerkTime("Duration");
_turretHealth = getPerkInt("Turret Health");
_rate = getPerkInt("Rate");
_knockbackMagnitude = getPerkFloat("Knockback Magnitude");
}
@Override
@ -72,8 +82,8 @@ public class SmashSnowman extends SmashUltimate
UtilEnt.vegetate(ent);
UtilEnt.ghost(ent, true, false);
ent.setMaxHealth(TURRET_HEALTH);
ent.setHealth(TURRET_HEALTH);
ent.setMaxHealth(_turretHealth);
ent.setHealth(_turretHealth);
UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false);
@ -122,7 +132,7 @@ public class SmashSnowman extends SmashUltimate
{
Snowman snowman = turretIter.next();
if(snowman.getTicksLived() >= (DURATION/50.0))
if(snowman.getTicksLived() >= (_duration /50.0))
{
UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers());
snowman.remove();
@ -131,7 +141,7 @@ public class SmashSnowman extends SmashUltimate
}
else
{
double amount = 1 - snowman.getTicksLived() / (DURATION/50.0);
double amount = 1 - snowman.getTicksLived() / (_duration /50.0);
snowman.setCustomName(UtilText.getProgress(C.cGreen, amount, C.cRed, false));
snowman.setCustomNameVisible(true);
}
@ -205,13 +215,7 @@ public class SmashSnowman extends SmashUltimate
UtilAction.velocity(damagee, proj.getVelocity().multiply(0.3).add(new Vector(0, 0.3, 0)));
// Damage Event
if (!(damagee instanceof LivingEntity))
{
return;
}
if (!Recharge.Instance.use((Player) damagee, GetName() + " Hit", RATE, false, false))
if (!Recharge.Instance.use((Player) damagee, GetName() + " Hit", _rate, false, false))
{
return;
}
@ -242,7 +246,7 @@ public class SmashSnowman extends SmashUltimate
return;
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
event.AddKnockback(GetName(), _knockbackMagnitude);
}
@Override

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.kit.perks;
import java.util.Map;
import java.util.WeakHashMap;
import org.bukkit.Sound;
@ -26,7 +27,11 @@ import nautilus.game.arcade.kit.Perk;
public class PerkBlizzard extends Perk
{
private WeakHashMap<Projectile, Player> _snowball = new WeakHashMap<Projectile, Player>();
private float _energyTick;
private float _energyPerBall;
private Map<Projectile, Player> _snowball = new WeakHashMap<>();
public PerkBlizzard()
{
@ -36,6 +41,13 @@ public class PerkBlizzard extends Perk
});
}
@Override
public void setupValues()
{
_energyTick = getPerkFloat("Energy Per Tick");
_energyPerBall = getPerkFloat("Energy Per Ball");
}
@EventHandler
public void EnergyUpdate(UpdateEvent event)
{
@ -50,7 +62,7 @@ public class PerkBlizzard extends Perk
if (player.isBlocking())
continue;
player.setExp((float) Math.min(0.999, player.getExp()+(1f/60f)));
player.setExp((float) Math.min(0.999, player.getExp()+ _energyTick));
}
}
@ -72,7 +84,7 @@ public class PerkBlizzard extends Perk
if (player.getExp() < 0.1)
continue;
player.setExp((float) Math.max(0, player.getExp()-(1f/9f)));
player.setExp(Math.max(0, player.getExp() - _energyPerBall));
for (int i=0 ; i<4 ; i++)
{

View File

@ -12,7 +12,12 @@ public class PerkDamageSnow extends Perk
{
private int _damage;
private double _knockback;
public PerkDamageSnow()
{
this(0, 0);
}
public PerkDamageSnow(int damage, double knockback)
{
super("Snow Attack", new String[]
@ -23,7 +28,14 @@ public class PerkDamageSnow extends Perk
_damage = damage;
_knockback = knockback;
}
@Override
public void setupValues()
{
_damage = getPerkInt("Damage");
_knockback = getPerkDouble("Knockback");
}
@EventHandler(priority = EventPriority.HIGH)
public void Knockback(CustomDamageEvent event)
{