Creeper converted to Google Sheets

This commit is contained in:
Sam 2017-04-23 16:08:45 +01:00
parent 02ffec8618
commit 9d48a5f1a5
8 changed files with 153 additions and 88 deletions

View File

@ -7,6 +7,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import mineplex.core.MiniPlugin;
import mineplex.core.blockrestore.BlockRestore;
@ -38,10 +39,11 @@ import org.bukkit.util.Vector;
public class Explosion extends MiniPlugin
{
private boolean _regenerateGround = false;
private boolean _regenerateGround;
private long _regenerateTime;
private boolean _temporaryDebris = true;
private boolean _enableDebris = false;
private boolean _tntSpread = true;
private boolean _tntSpread;
private boolean _liquidDamage = true;
private HashSet<FallingBlock> _explosionBlocks = new HashSet<FallingBlock>();
@ -52,6 +54,8 @@ public class Explosion extends MiniPlugin
super("Block Restore", plugin);
_blockRestore = blockRestore;
resetConfiguration();
}
@EventHandler
@ -134,7 +138,7 @@ public class Explosion extends MiniPlugin
else
{
int heightDiff = cur.getLocation().getBlockY() - event.getEntity().getLocation().getBlockY();
_blockRestore.add(cur, 0, (byte) 0, (long) (20000 + (heightDiff * 3000) + Math.random() * 2900));
_blockRestore.add(cur, 0, (byte) 0, (long) (_regenerateTime + (heightDiff * 3000) + Math.random() * 2900));
}
}
@ -276,6 +280,11 @@ public class Explosion extends MiniPlugin
_regenerateGround = regenerate;
}
public void setRegenerateTime(long time)
{
_regenerateTime = time;
}
public void SetDebris(boolean value)
{
_enableDebris = value;
@ -296,6 +305,13 @@ public class Explosion extends MiniPlugin
_temporaryDebris = value;
}
public void resetConfiguration()
{
_regenerateGround = false;
_regenerateTime = TimeUnit.SECONDS.toMillis(20);
_tntSpread = true;
}
public HashSet<FallingBlock> GetExplosionBlocks()
{
return _explosionBlocks;
@ -326,7 +342,14 @@ public class Explosion extends MiniPlugin
if (removeBlock)
{
cur.setType(Material.AIR);
if (_regenerateGround)
{
_blockRestore.add(cur, 0, (byte) 0, (long) (_regenerateTime + (cur.getLocation().getBlockY() * 3000) + (Math.random() * 1500)));
}
else
{
cur.setType(Material.AIR);
}
}
}
@ -356,12 +379,16 @@ public class Explosion extends MiniPlugin
_explosionBlocks.add(fall);
}
}
}
}, 1);
}
private void addToRegenerate(Block block)
{
}
public void setEnabled(boolean var)
{
if (var)

View File

@ -90,6 +90,9 @@ public abstract class SuperSmash extends Game
HideTeamSheep = true;
ReplaceTeamsWithKits = true;
manager.GetExplosion().SetRegenerate(true);
manager.GetExplosion().setRegenerateTime(TimeUnit.SECONDS.toMillis(30));
new CompassModule()
.setGiveCompassToAlive(true)
.register(this);

View File

@ -25,8 +25,8 @@ import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitCreeper extends SmashKit
{
private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.65, 0.4, 3.5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkSmashStats(),
new PerkDoubleJump("Double Jump"),
new PerkCreeperElectricity(),
new PerkCreeperSulphurBomb(),
new PerkCreeperExplode(),

View File

@ -25,10 +25,10 @@ import nautilus.game.arcade.kit.Perk;
public class PerkCreeperElectricity extends Perk
{
private static final int DURATION = 2000;
private static final int SHOCK = 1;
private static final int DAMAGE = 4;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
private int _duration;
private int _shock;
private int _damage;
private float _knockbackMagnitude;
private Map<UUID, Long> _active = new HashMap<>();
@ -37,6 +37,15 @@ public class PerkCreeperElectricity extends Perk
super("Lightning Shield", new String[] { "When hit by a non-melee attack, you gain " + C.cGreen + "Lightning Shield" });
}
@Override
public void setupValues()
{
_duration = getPerkTime("Duration");
_shock = getPerkInt("Shock");
_damage = getPerkInt("Damage");
_knockbackMagnitude = getPerkFloat("Knockback Magnitude");
}
@EventHandler
public void Shield(CustomDamageEvent event)
{
@ -103,7 +112,7 @@ public class PerkCreeperElectricity extends Perk
continue;
}
if (UtilTime.elapsed(_active.get(key), DURATION))
if (UtilTime.elapsed(_active.get(key), _duration))
{
shieldIterator.remove();
@ -152,12 +161,12 @@ public class PerkCreeperElectricity extends Perk
// Elec
damagee.getWorld().strikeLightningEffect(damagee.getLocation());
Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), SHOCK, false, false);
Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), _shock, false, false);
SetPowered(damagee, false);
// Damage Event
Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null, DamageCause.LIGHTNING, DAMAGE, true, true, false, damagee.getName(), GetName());
Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null, DamageCause.LIGHTNING, _damage, true, true, false, damagee.getName(), GetName());
}
public DisguiseCreeper GetDisguise(Player player)
@ -211,6 +220,6 @@ public class PerkCreeperElectricity extends Perk
return;
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
event.AddKnockback(GetName(), _knockbackMagnitude);
}
}

View File

@ -1,11 +1,18 @@
package nautilus.game.arcade.game.games.smash.perks.creeper;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -16,48 +23,43 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
import java.util.*;
public class PerkCreeperExplode extends SmashPerk
{
private static final int COOLDOWN = 8000;
private static final int WARMUP = 1500;
private static final int RADIUS_NORMAL = 8;
private static final int RADIUS_SMASH = 24;
private static final int DAMAGE_NORMAL = 20;
private static final int DAMAGE_SMASH = 30;
private static final int SPAWN_REMOVAL_RADIUS = 14;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
private int _cooldown;
private int _warmup;
private int _radiusNormal;
private int _radiusSmash;
private int _damageNormal;
private int _damageSmash;
private int _spawnRemovalRadius;
private float _knockbackMagnitude;
private int _blockDestroyRadius;
private int _blockRegeneration;
private Map<UUID, Long> _active = new HashMap<>();
private Map<Location, Long> _removedSpawns = new HashMap<>();
public PerkCreeperExplode()
{
super("Explode", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap" });
super("Explode", new String[]{C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap"});
}
@Override
public void setupValues()
{
_cooldown = getPerkTime("Cooldown");
_warmup = getPerkInt("Warmup (ms)");
_radiusNormal = getPerkInt("Radius Normal");
_radiusSmash = getPerkInt("Radius Smash");
_damageNormal = getPerkInt("Damage Normal");
_damageSmash = getPerkInt("Damage Smash");
_spawnRemovalRadius = (int) Math.pow(getPerkInt("Spawn Removal Radius"), 2);
_knockbackMagnitude = getPerkFloat("Knockback Magnitude");
_blockDestroyRadius = getPerkInt("Block Destroy Radius");
_blockRegeneration = getPerkTime("Block Regeneration Time");
}
@EventHandler
@ -95,7 +97,7 @@ public class PerkCreeperExplode extends SmashPerk
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
{
return;
}
@ -138,14 +140,14 @@ public class PerkCreeperExplode extends SmashPerk
IncreaseSize(player);
player.setExp(Math.min(0.999f, elapsed / (float) WARMUP));
player.setExp(Math.min(0.999f, elapsed / (float) _warmup));
// Not Detonated
if (!UtilTime.elapsed(_active.get(key), WARMUP))
if (!UtilTime.elapsed(_active.get(key), _warmup))
{
continue;
}
player.setExp(0);
chargeIterator.remove();
@ -172,29 +174,23 @@ public class PerkCreeperExplode extends SmashPerk
}
// Blocks
Collection<Block> blocks = UtilBlock.getInRadius(player.getLocation(), 12).keySet();
Iterator<Block> iter = blocks.iterator();
Collection<Block> blocks = UtilBlock.getInRadius(player.getLocation(), _blockDestroyRadius).keySet();
while (iter.hasNext())
{
Block b = iter.next();
blocks.removeIf(b -> b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA || b.getType() == Material.BEDROCK);
if (b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA || b.getType() == Material.BEDROCK)
{
iter.remove();
}
}
Manager.GetExplosion().BlockExplosion(blocks, player.getLocation(), false);
// Remove Spawns
Iterator<Location> spawnIterator = Manager.GetGame().GetTeam(player).GetSpawns().iterator();
while (spawnIterator.hasNext())
{
Location spawn = spawnIterator.next();
Iterator<Location> iterator = Manager.GetGame().GetTeam(player).GetSpawns().iterator();
if (UtilMath.offset(player.getLocation(), spawn) < SPAWN_REMOVAL_RADIUS)
while (iterator.hasNext())
{
Location spawn = iterator.next();
if (UtilMath.offsetSquared(player.getLocation(), spawn) < _spawnRemovalRadius)
{
spawnIterator.remove();
_removedSpawns.put(spawn, System.currentTimeMillis());
iterator.remove();
}
}
@ -209,8 +205,8 @@ public class PerkCreeperExplode extends SmashPerk
}
}
double maxRange = isSuperActive(player) ? RADIUS_SMASH : RADIUS_NORMAL;
double damage = isSuperActive(player) ? DAMAGE_SMASH : DAMAGE_NORMAL;
double maxRange = isSuperActive(player) ? _radiusSmash : _radiusNormal;
double damage = isSuperActive(player) ? _damageSmash : _damageNormal;
// Damage
for (LivingEntity ent : UtilEnt.getInRadius(player.getLocation(), maxRange).keySet())
@ -245,7 +241,7 @@ public class PerkCreeperExplode extends SmashPerk
}
}
}
public void activate(Player player)
{
_active.put(player.getUniqueId(), System.currentTimeMillis());
@ -316,7 +312,7 @@ public class PerkCreeperExplode extends SmashPerk
return;
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
event.AddKnockback(GetName(), _knockbackMagnitude);
}
@EventHandler
@ -338,4 +334,27 @@ public class PerkCreeperExplode extends SmashPerk
DecreaseSize(player);
}
@EventHandler
public void addDestroyedSpawns(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
{
return;
}
GameTeam team = Manager.GetGame().GetTeamList().get(0);
Iterator<Location> iterator = _removedSpawns.keySet().iterator();
while (iterator.hasNext())
{
Location spawn = iterator.next();
if (UtilTime.elapsed(_removedSpawns.get(spawn), _blockRegeneration))
{
team.GetSpawns().add(spawn);
iterator.remove();
}
}
}
}

View File

@ -35,15 +35,23 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown
{
private static final int COOLDOWN = 3000;
private static final float DAMAGE = 6.5F;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
private int _cooldown;
private float _damage;
private float _knockbackMagnitude;
public PerkCreeperSulphurBomb()
{
super("Sulphur Bomb", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Sulphur Bomb" });
}
@Override
public void setupValues()
{
_cooldown = getPerkTime("Cooldown");
_damage = getPerkFloat("Damage");
_knockbackMagnitude = getPerkFloat("Knockback Magnitude");
}
@EventHandler
public void ShootWeb(PlayerInteractEvent event)
{
@ -79,7 +87,7 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
{
return;
}
@ -112,7 +120,7 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown
}
// Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE, true, true, false, UtilEnt.getName(data.getThrower()), GetName());
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, _damage, true, true, false, UtilEnt.getName(data.getThrower()), GetName());
}
@Override
@ -142,6 +150,6 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown
return;
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
event.AddKnockback(GetName(), _knockbackMagnitude);
}
}

View File

@ -11,7 +11,7 @@ public class SmashCreeper extends SmashUltimate
public SmashCreeper()
{
super("Atomic Blast", new String[] {}, Sound.CREEPER_HISS, 1600);
super("Atomic Blast", new String[] {}, Sound.CREEPER_HISS, 0);
}
@Override

View File

@ -158,8 +158,7 @@ public class GameCreationManager implements Listener
Manager.GetDamage().DisableDamageChanges = false;
Manager.GetCreature().SetDisableCustomDrops(false);
Manager.GetDamage().SetEnabled(true);
Manager.GetExplosion().SetRegenerate(false);
Manager.GetExplosion().SetTNTSpread(true);
Manager.GetExplosion().resetConfiguration();
// Manager.GetAntiStack().SetEnabled(true);
Manager.getCosmeticManager().setHideParticles(false);
Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.CustomWeaponName);