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

This commit is contained in:
nossr50
2021-04-23 11:13:59 -07:00
parent d67c561fed
commit f983f95961
8 changed files with 57 additions and 44 deletions

View File

@ -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) {

View File

@ -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();

View File

@ -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()) {

View File

@ -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
}

View File

@ -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
*

View File

@ -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