Explorar el Código

Remove explosion from rupture, and rupture bug fixes and other tweaks

nossr50 hace 4 años
padre
commit
f983f95961

+ 7 - 0
Changelog.txt

@@ -1,11 +1,18 @@
 Version 2.1.196
+    Removed the explosion from Rupture
+    Adjusted Rupture to play its particle effect less often
     Fixed a bug where Rupture never applied to additional targets during Serrated Strikes
+    Fixed a bug where players without Rupture permission could use Rupture during Serrated Strikes
     Fixed a possible null error for our SelfListener
+    Added locale string 'Swords.Combat.Rupture.Note.Update.One'
+    Updated locale string 'Guides.Swords.Section.1'
     Crossbows can now be fished up with enchantments
     (API) Added McMMOEntityDamageByRuptureEvent (thanks qixils)
 
     NOTES:
+    Rupture will be in a state of change for a while as I receive feedback (give me feedback in Discord!)
     Crossbows is not in the default fishing loot list, you'd have to add it yourself.
+    For Devs: McMMOEntityDamageByRuptureEvent extends EntityDamageByEntityEvent and uses CUSTOM type damage
 
 Version 2.1.195
     Fixed a null connection error which affected some SQL users

+ 2 - 2
src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java

@@ -91,9 +91,9 @@ public class SwordsCommand extends SkillCommand {
                     ruptureLengthSecondsAgainstMobs));
 
             messages.add(LocaleLoader.getString("Swords.SubSkill.Rupture.Stat.TickDamage", rupturePureTickDamageAgainstPlayers, rupturePureTickDamageAgainstMobs));
-            messages.add(LocaleLoader.getString("Swords.SubSkill.Rupture.Stat.ExplosionDamage", ruptureExplosionDamageAgainstPlayers, ruptureExplosionDamageAgainstMobs));
+//            messages.add(LocaleLoader.getString("Swords.SubSkill.Rupture.Stat.ExplosionDamage", ruptureExplosionDamageAgainstPlayers, ruptureExplosionDamageAgainstMobs));
 
-            messages.add(LocaleLoader.getString("Swords.Combat.Rupture.Note"));
+            messages.add(LocaleLoader.getString("Swords.Combat.Rupture.Note.Update.One"));
         }
 
         if (canSerratedStrike) {

+ 3 - 3
src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java

@@ -1141,9 +1141,9 @@ public class McMMOPlayer implements Identified {
             RuptureTaskMeta ruptureTaskMeta = (RuptureTaskMeta) getPlayer().getMetadata(mcMMO.RUPTURE_META_KEY).get(0);
 
             //Punish a logout
-            ruptureTaskMeta.getRuptureTimerTask().explode();
-            ruptureTaskMeta.getRuptureTimerTask().explode();
-            ruptureTaskMeta.getRuptureTimerTask().explode();
+            ruptureTaskMeta.getRuptureTimerTask().endRupture();
+            ruptureTaskMeta.getRuptureTimerTask().endRupture();
+            ruptureTaskMeta.getRuptureTimerTask().endRupture();
         }
 
         cleanup();

+ 14 - 13
src/main/java/com/gmail/nossr50/listeners/PlayerListener.java

@@ -832,23 +832,24 @@ public class PlayerListener implements Listener {
                     ChimaeraWing.activationCheck(player);
                 }
 
-                /* GREEN THUMB CHECK */
                 HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
 
-                if (heldItem.getType() == Material.BONE_MEAL) {
-                    switch (blockState.getType()) {
-                        case BEETROOTS:
-                        case CARROT:
-                        case COCOA:
-                        case WHEAT:
-                        case NETHER_WART_BLOCK:
-                        case POTATO:
-                            mcMMO.getPlaceStore().setFalse(blockState);
-                    }
-                }
-
                 FakePlayerAnimationEvent fakeSwing = new FakePlayerAnimationEvent(event.getPlayer()); //PlayerAnimationEvent compat
                 if(!event.isCancelled() || event.useInteractedBlock() != Event.Result.DENY) {
+                    //TODO: Is this code to set false from bone meal even needed? I'll have to double check later.
+                    if (heldItem.getType() == Material.BONE_MEAL) {
+                        switch (blockState.getType()) {
+                            case BEETROOTS:
+                            case CARROT:
+                            case COCOA:
+                            case WHEAT:
+                            case NETHER_WART_BLOCK:
+                            case POTATO:
+                                mcMMO.getPlaceStore().setFalse(blockState);
+                                break;
+                        }
+                    }
+
                     if (herbalismManager.canGreenThumbBlock(blockState)) {
                         //call event for Green Thumb Block
                         if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, block).isCancelled()) {

+ 25 - 17
src/main/java/com/gmail/nossr50/runnables/skills/RuptureTask.java

@@ -7,13 +7,13 @@ import com.gmail.nossr50.util.skills.ParticleEffectUtils;
 import com.google.common.base.Objects;
 import org.bukkit.entity.LivingEntity;
 import org.bukkit.entity.Player;
-import org.bukkit.metadata.FixedMetadataValue;
 import org.bukkit.scheduler.BukkitRunnable;
 import org.jetbrains.annotations.NotNull;
 
 public class RuptureTask extends BukkitRunnable {
 
     public static final int DAMAGE_TICK_INTERVAL = 10;
+    public static final int ANIMATION_TICK_INTERVAL = 2;
 
     private final @NotNull McMMOPlayer ruptureSource;
     private final @NotNull LivingEntity targetEntity;
@@ -21,8 +21,9 @@ public class RuptureTask extends BukkitRunnable {
 
     private int ruptureTick;
     private int damageTickTracker;
-    private final double pureTickDamage; //TODO: Make configurable
-    private final double explosionDamage; //TODO: Make configurable
+    private int animationTick;
+    private final double pureTickDamage;
+    private final double explosionDamage;
 
     public RuptureTask(@NotNull McMMOPlayer ruptureSource, @NotNull LivingEntity targetEntity, double pureTickDamage, double explosionDamage) {
         this.ruptureSource = ruptureSource;
@@ -31,6 +32,7 @@ public class RuptureTask extends BukkitRunnable {
 
         this.ruptureTick = 0;
         this.damageTickTracker = 0;
+        this.animationTick = ANIMATION_TICK_INTERVAL; //Play an animation right away
         this.pureTickDamage = pureTickDamage;
         this.explosionDamage = explosionDamage;
     }
@@ -61,14 +63,20 @@ public class RuptureTask extends BukkitRunnable {
                         if (event.isCancelled() || damage <= 0 || healthBeforeRuptureIsApplied - damage <= 0)
                             return;
 
-                        ParticleEffectUtils.playBleedEffect(targetEntity); //Animate
+                        if(animationTick >= ANIMATION_TICK_INTERVAL) {
+                            ParticleEffectUtils.playBleedEffect(targetEntity); //Animate
+                            animationTick = 0;
+                        } else {
+                            animationTick++;
+                        }
+
                         double damagedHealth = healthBeforeRuptureIsApplied - damage;
 
                         targetEntity.setHealth(damagedHealth); //Hurt entity without the unwanted side effects of damage()}
                     }
                 }
             } else {
-                explode();
+                endRupture();
             }
         } else {
             targetEntity.removeMetadata(mcMMO.RUPTURE_META_KEY, mcMMO.p);
@@ -81,18 +89,18 @@ public class RuptureTask extends BukkitRunnable {
         ruptureTick = 0;
     }
 
-    public void explode() {
-        targetEntity.setMetadata(mcMMO.EXPLOSION_FROM_RUPTURE, new FixedMetadataValue(mcMMO.p, "null"));
-
-        ParticleEffectUtils.playGreaterImpactEffect(targetEntity); //Animate
-
-        if(ruptureSource.getPlayer() != null && ruptureSource.getPlayer().isValid()) {
-            targetEntity.damage(getExplosionDamage(), ruptureSource.getPlayer());
-        } else {
-            targetEntity.damage(getExplosionDamage(), null);
-        }
-
-        targetEntity.removeMetadata(mcMMO.RUPTURE_META_KEY, mcMMO.p);
+    public void endRupture() {
+//        targetEntity.setMetadata(mcMMO.EXPLOSION_FROM_RUPTURE, new FixedMetadataValue(mcMMO.p, "null"));
+//
+//        ParticleEffectUtils.playGreaterImpactEffect(targetEntity); //Animate
+//
+//        if(ruptureSource.getPlayer() != null && ruptureSource.getPlayer().isValid()) {
+//            targetEntity.damage(getExplosionDamage(), ruptureSource.getPlayer());
+//        } else {
+//            targetEntity.damage(getExplosionDamage(), null);
+//        }
+//
+//        targetEntity.removeMetadata(mcMMO.RUPTURE_META_KEY, mcMMO.p);
 
         this.cancel(); //Task no longer needed
     }

+ 3 - 4
src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java

@@ -63,6 +63,9 @@ public class SwordsManager extends SkillManager {
      * @param target The defending entity
      */
     public void processRupture(@NotNull LivingEntity target) {
+        if(!canUseRupture())
+            return;
+
         if(target.hasMetadata(mcMMO.RUPTURE_META_KEY)) {
             RuptureTaskMeta ruptureTaskMeta = (RuptureTaskMeta) target.getMetadata(mcMMO.RUPTURE_META_KEY).get(0);
 
@@ -134,10 +137,6 @@ public class SwordsManager extends SkillManager {
             return 1;
     }
 
-    public int getRuptureBleedTicks(boolean isTargetPlayer) {
-        return mcMMO.p.getAdvancedConfig().getRuptureDurationSeconds(isTargetPlayer) / RuptureTask.DAMAGE_TICK_INTERVAL;
-    }
-
     /**
      * Handle the effects of the Counter Attack ability
      *

+ 1 - 3
src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java

@@ -93,9 +93,7 @@ public final class CombatUtils {
         }
 
         if(target.getHealth() - event.getFinalDamage() > 0) {
-            if (swordsManager.canUseRupture()) {
-                swordsManager.processRupture(target);
-            }
+            swordsManager.processRupture(target);
         }
 
         //Add Stab Damage

+ 2 - 2
src/main/resources/locale/locale_en_US.properties

@@ -406,7 +406,7 @@ Anvil.Unbreakable=This item is unbreakable!
 #SWORDS
 Swords.Ability.Lower=&7You lower your sword.
 Swords.Ability.Ready=&3You &6ready&3 your Sword.
-Swords.Combat.Rupture.Note=&7(Rupture Note): Periodic damage is non-lethal occuring twice a second and bypasses armor, explosion damage is lethal and does not bypass armor/resistances
+Swords.Combat.Rupture.Note.Update.One=&7(Rupture Note): Periodic damage is non-lethal occurring twice a second and bypasses armor
 Swords.Combat.Bleeding.Started=&4 You're bleeding!
 Swords.Combat.Bleeding.Stopped=&7The bleeding has &astopped&7!
 Swords.Combat.Bleeding=&a**ENEMY BLEEDING**
@@ -944,7 +944,7 @@ Guides.Salvage.Section.4=&3How does Arcane Salvage work?\n&eThis ability allows
 Guides.Smelting.Section.0=Coming soon...
 ##Swords
 Guides.Swords.Section.0=&3About Swords:\n&eThis skill awards combat bonuses to anyone fighting with a\n&esword.\n\n&3XP GAIN:\n&eXP is gained based on the amount of damage dealt to mobs or \n&eother players when wielding a sword.
-Guides.Swords.Section.1=&3How does Serrated Strikes work?\n&eSerrated Strikes is an active ability, you can activate it by\n&eright-clicking with a sword. This ability allows you to deal \n&ean AoE (Area of Effect) hit. This AoE will do a bonus 25%\n&edamage and will inflict a bleed effect that lasts for 5 ticks.
+Guides.Swords.Section.1=&3How does Serrated Strikes work?\n&eSerrated Strikes is an active ability, you can activate it by\n&eright-clicking with a sword. This ability allows you to deal \n&ean AoE (Area of Effect) hit. This AoE will do a bonus 25%\n&edamage and may apply Rupture
 Guides.Swords.Section.2=&3How does Counter Attack work?\n&eCounter Attack is an active ability. When blocking and taking\n&ehits from mobs, you will have a chance to reflect 50% of \n&ethe damage that was taken.
 Guides.Swords.Section.3=&3How does Rupture work?\n&eRupture causes enemies to take damage every two seconds. The \n&etarget will bleed until the effect wears off, or death, \n&ewhichever comes first.\n&eThe duration of the bleed is increased by your sword skill.
 ##Taming