Add configurable particle amounts to Smokescreen (#1043)

## Misc. Changes
* Made the particle amount for Smokescreen configurable.
    > * [Trello link](https://trello.com/c/V8UMd6Qj/942-add-config-option-or-something-else-to-low-amount-of-particles-of-smokescreen)
* Cleaned up the smokescreen particle code. Changes give them more dimension.
This commit is contained in:
Numin 2020-02-29 02:01:32 -06:00 committed by GitHub
parent 8217f037ae
commit e4f2f4fc8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 19 deletions

View file

@ -21,6 +21,7 @@ public class Smokescreen extends ChiAbility {
private static final Map<Integer, Smokescreen> SNOWBALLS = new ConcurrentHashMap<>(); private static final Map<Integer, Smokescreen> SNOWBALLS = new ConcurrentHashMap<>();
private static final Map<String, Long> BLINDED_TIMES = new ConcurrentHashMap<>(); private static final Map<String, Long> BLINDED_TIMES = new ConcurrentHashMap<>();
private static final Map<String, Smokescreen> BLINDED_TO_ABILITY = new ConcurrentHashMap<>(); private static final Map<String, Smokescreen> BLINDED_TO_ABILITY = new ConcurrentHashMap<>();
private static int particleAmount;
@Attribute(Attribute.DURATION) @Attribute(Attribute.DURATION)
private int duration; private int duration;
@ -37,6 +38,7 @@ public class Smokescreen extends ChiAbility {
this.cooldown = getConfig().getLong("Abilities.Chi.Smokescreen.Cooldown"); this.cooldown = getConfig().getLong("Abilities.Chi.Smokescreen.Cooldown");
this.duration = getConfig().getInt("Abilities.Chi.Smokescreen.Duration"); this.duration = getConfig().getInt("Abilities.Chi.Smokescreen.Duration");
this.radius = getConfig().getDouble("Abilities.Chi.Smokescreen.Radius"); this.radius = getConfig().getDouble("Abilities.Chi.Smokescreen.Radius");
particleAmount = getConfig().getInt("Abilities.Chi.Smokescreen.ParticleAmount");
this.start(); this.start();
} }
@ -48,29 +50,13 @@ public class Smokescreen extends ChiAbility {
} }
public static void playEffect(final Location loc) { public static void playEffect(final Location loc) {
int z = -2; for (int i = 0; i < 125; i++)
int x = -2; ParticleEffect.SMOKE_NORMAL.display(loc, particleAmount, Math.random() + 0.7, Math.random() + 0.5, Math.random() + 0.7);
final int y = 0;
for (int i = 0; i < 125; i++) {
final Location newLoc = new Location(loc.getWorld(), loc.getX() + x, loc.getY() + y, loc.getZ() + z);
for (int direction = 0; direction < 8; direction++) {
ParticleEffect.SMOKE_NORMAL.display(newLoc, 4, 0.5, 0.5, 0.5);
}
if (z == 2) {
z = -2;
}
if (x == 2) {
x = -2;
z++;
}
x++;
}
} }
public void applyBlindness(final Entity entity) { public void applyBlindness(final Entity entity) {
if (entity instanceof Player) { if (entity instanceof Player) {
if (Commands.invincible.contains(((Player) entity).getName())) { if (Commands.invincible.contains(entity.getName())) {
return; return;
} else if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation())) { } else if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation())) {
return; return;

View file

@ -1516,6 +1516,7 @@ public class ConfigManager {
config.addDefault("Abilities.Chi.Smokescreen.Cooldown", 25000); config.addDefault("Abilities.Chi.Smokescreen.Cooldown", 25000);
config.addDefault("Abilities.Chi.Smokescreen.Radius", 4); config.addDefault("Abilities.Chi.Smokescreen.Radius", 4);
config.addDefault("Abilities.Chi.Smokescreen.Duration", 12); config.addDefault("Abilities.Chi.Smokescreen.Duration", 12);
config.addDefault("Abilities.Chi.Smokescreen.ParticleAmount", 5);
config.addDefault("Abilities.Chi.WarriorStance.Enabled", true); config.addDefault("Abilities.Chi.WarriorStance.Enabled", true);
config.addDefault("Abilities.Chi.WarriorStance.Cooldown", 0); config.addDefault("Abilities.Chi.WarriorStance.Cooldown", 0);