From 8a7b37244520aed913a54db898f8e05b39da83e2 Mon Sep 17 00:00:00 2001 From: OmniCypher Date: Wed, 10 Aug 2016 13:53:38 -0700 Subject: [PATCH] Fixes Snow Regen and Adds Ignite option to FireBurst (#534) Ignite determines whether FireBurst creates fire blocks in the world --- .../projectkorra/ability/ElementalAbility.java | 4 ++++ .../projectkorra/configuration/ConfigManager.java | 1 + .../projectkorra/projectkorra/firebending/BlazeArc.java | 2 +- .../projectkorra/projectkorra/firebending/FireBlast.java | 8 ++++++-- .../projectkorra/waterbending/IceSpikeBlast.java | 2 +- .../projectkorra/waterbending/OctopusForm.java | 2 +- .../projectkorra/projectkorra/waterbending/SurgeWall.java | 2 +- .../projectkorra/projectkorra/waterbending/SurgeWave.java | 2 +- .../projectkorra/projectkorra/waterbending/Torrent.java | 2 +- .../projectkorra/projectkorra/waterbending/WaterArms.java | 2 +- .../projectkorra/waterbending/WaterManipulation.java | 2 +- .../projectkorra/waterbending/WaterSpoutWave.java | 2 +- 12 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java b/src/com/projectkorra/projectkorra/ability/ElementalAbility.java index 2a4c48ef..b7a4d4cd 100644 --- a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java +++ b/src/com/projectkorra/projectkorra/ability/ElementalAbility.java @@ -99,6 +99,10 @@ public abstract class ElementalAbility extends CoreAbility { return material == Material.LAVA || material == Material.STATIONARY_LAVA; } + public static boolean isSnow(Block block) { + return block != null ? isSnow(block.getType()) : false; + } + public static boolean isSnow(Material material) { return getConfig().getStringList("Properties.Water.SnowBlocks").contains(material.toString()); } diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index 91ef7e50..fa0d6dcd 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -986,6 +986,7 @@ public class ConfigManager { config.addDefault("Abilities.Fire.FireBurst.Enabled", true); config.addDefault("Abilities.Fire.FireBurst.Damage", 2); + config.addDefault("Abilities.Fire.FireBurst.Ignite", true); config.addDefault("Abilities.Fire.FireBurst.ChargeTime", 3500); config.addDefault("Abilities.Fire.FireBurst.Cooldown", 0); config.addDefault("Abilities.Fire.FireBurst.Range", 14); diff --git a/src/com/projectkorra/projectkorra/firebending/BlazeArc.java b/src/com/projectkorra/projectkorra/firebending/BlazeArc.java index 20aa717c..3f6f32fe 100644 --- a/src/com/projectkorra/projectkorra/firebending/BlazeArc.java +++ b/src/com/projectkorra/projectkorra/firebending/BlazeArc.java @@ -53,7 +53,7 @@ public class BlazeArc extends FireAbility { private void ignite(Block block) { if (block.getType() != Material.FIRE && block.getType() != Material.AIR) { if (canFireGrief()) { - if (isPlant(block)) { + if (isPlant(block) || isSnow(block)) { new PlantRegrowth(player, block); } } else if (block.getType() != Material.FIRE) { diff --git a/src/com/projectkorra/projectkorra/firebending/FireBlast.java b/src/com/projectkorra/projectkorra/firebending/FireBlast.java index b5237e1c..2c165f54 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireBlast.java +++ b/src/com/projectkorra/projectkorra/firebending/FireBlast.java @@ -35,6 +35,7 @@ public class FireBlast extends FireAbility { private boolean showParticles; private boolean dissipate; private boolean isFireBurst = false; + private boolean fireBurstIgnite; private int ticks; private long cooldown; private double speedFactor; @@ -97,6 +98,7 @@ public class FireBlast extends FireAbility { this.isFireBurst = true; this.powerFurnace = true; this.showParticles = true; + this.fireBurstIgnite = getConfig().getBoolean("Abilities.Fire.FireBurst.Ignite"); this.dissipate = getConfig().getBoolean("Abilities.Fire.FireBlast.Dissipate"); this.cooldown = getConfig().getLong("Abilities.Fire.FireBlast.Cooldown"); this.range = getConfig().getDouble("Abilities.Fire.FireBlast.Range"); @@ -141,7 +143,7 @@ public class FireBlast extends FireAbility { && !safeBlocks.contains(block) && !GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) { if (canFireGrief()) { - if (WaterAbility.isPlantbendable(player, block.getType(), false)) { + if (isPlant(block) || isSnow(block)) { new PlantRegrowth(player, block); } block.setType(Material.FIRE); @@ -181,7 +183,9 @@ public class FireBlast extends FireAbility { furnace.setCookTime((short) 800); furnace.update(); } else if (BlazeArc.isIgnitable(player, block.getRelative(BlockFace.UP))) { - ignite(location); + if((isFireBurst && fireBurstIgnite) || !isFireBurst) { + ignite(location); + } } remove(); return; diff --git a/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java b/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java index ef2967f7..c68084e0 100644 --- a/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java +++ b/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java @@ -260,7 +260,7 @@ public class IceSpikeBlast extends IceAbility { settingUp = true; prepared = false; - if (isPlant(sourceBlock)) { + if (isPlant(sourceBlock) || isSnow(sourceBlock)) { new PlantRegrowth(player, sourceBlock); sourceBlock.setType(Material.AIR); } diff --git a/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java b/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java index 2ac97516..22982c11 100644 --- a/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java +++ b/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java @@ -141,7 +141,7 @@ public class OctopusForm extends WaterAbility { private void form() { incrementStep(); - if (isPlant(sourceBlock)) { + if (isPlant(sourceBlock) || isSnow(sourceBlock)) { new PlantRegrowth(player, sourceBlock); sourceBlock.setType(Material.AIR); } else if (!GeneralMethods.isAdjacentToThreeOrMoreSources(sourceBlock)) { diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java index b665f327..1c327eb7 100644 --- a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java +++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java @@ -173,7 +173,7 @@ public class SurgeWall extends WaterAbility { firstDirection = getDirection(sourceBlock.getLocation(), firstDestination); targetDirection = getDirection(firstDestination, targetDestination); - if (isPlant(sourceBlock)) { + if (isPlant(sourceBlock) || isSnow(sourceBlock)) { new PlantRegrowth(player, sourceBlock); } if (!GeneralMethods.isAdjacentToThreeOrMoreSources(sourceBlock)) { diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java index 5e656aac..26090194 100644 --- a/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java @@ -204,7 +204,7 @@ public class SurgeWave extends WaterAbility { targetDirection = getDirection(sourceBlock.getLocation(), targetDestination).normalize(); targetDestination = location.clone().add(targetDirection.clone().multiply(range)); - if (isPlant(sourceBlock)) { + if (isPlant(sourceBlock) || isSnow(sourceBlock)) { new PlantRegrowth(player, sourceBlock); } if (!GeneralMethods.isAdjacentToThreeOrMoreSources(sourceBlock)) { diff --git a/src/com/projectkorra/projectkorra/waterbending/Torrent.java b/src/com/projectkorra/projectkorra/waterbending/Torrent.java index 5fd634d1..fa54a89a 100644 --- a/src/com/projectkorra/projectkorra/waterbending/Torrent.java +++ b/src/com/projectkorra/projectkorra/waterbending/Torrent.java @@ -142,7 +142,7 @@ public class Torrent extends WaterAbility { sourceSelected = false; settingUp = true; - if (isPlant(sourceBlock)) { + if (isPlant(sourceBlock) || isSnow(sourceBlock)) { new PlantRegrowth(player, sourceBlock); sourceBlock.setType(Material.AIR); } else if (!GeneralMethods.isAdjacentToThreeOrMoreSources(sourceBlock)) { diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterArms.java b/src/com/projectkorra/projectkorra/waterbending/WaterArms.java index c75dd815..325438ef 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterArms.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterArms.java @@ -147,7 +147,7 @@ public class WaterArms extends WaterAbility { private boolean prepare() { Block sourceBlock = getWaterSourceBlock(player, sourceGrabRange, canUsePlantSource); if (sourceBlock != null) { - if (isPlant(sourceBlock)) { + if (isPlant(sourceBlock) || isSnow(sourceBlock)) { fullSource = false; } ParticleEffect.LARGE_SMOKE.display(getWaterSourceBlock(player, sourceGrabRange, canUsePlantSource).getLocation().clone().add(0.5, 0.5, 0.5), 0, 0, 0, 0F, 4); diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java b/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java index 262c996f..005cfaf8 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java @@ -152,7 +152,7 @@ public class WaterManipulation extends WaterAbility { targetDestination = GeneralMethods.getPointOnLine(firstDestination, targetDestination, range); targetDirection = GeneralMethods.getDirection(firstDestination, targetDestination).normalize(); - if (isPlant(sourceBlock)) { + if (isPlant(sourceBlock) || isSnow(sourceBlock)) { new PlantRegrowth(player, sourceBlock); sourceBlock.setType(Material.AIR); } else if (!isIce(sourceBlock)) { diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java b/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java index 73330ee1..62612974 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java @@ -174,7 +174,7 @@ public class WaterSpoutWave extends WaterAbility { animation = AnimateState.RISE; location = origin.clone(); - if (isPlant(origin.getBlock())) { + if (isPlant(origin.getBlock()) || isSnow(origin.getBlock())) { new PlantRegrowth(player, origin.getBlock()); origin.getBlock().setType(Material.AIR); }