mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Fixed DoubleDrops for Mining, MANY nerfs to Rupture (PVP balance tweaks coming soon)
This commit is contained in:
parent
b68bbad766
commit
aa25ba6338
@ -9,6 +9,17 @@ Key:
|
||||
|
||||
Version 2.1.23
|
||||
Fixed a bug with Double Drops for Mining
|
||||
Fixed a bug where killing entities with Rupture would not properly credit you as the killer
|
||||
Fixed a bug where Serrated Strikes was applying Rupture twice
|
||||
Players will now be ejected from Minecarts if they cast their fishing rod (anti-afk)
|
||||
Rupture's strength is now related to your equipped Sword
|
||||
Rupture will no longer be applied if the target is blocking, this doesn't prevent existing bleed damage from occurring though.
|
||||
Wolf's Rupture has strength equivalent to a Stone Sword
|
||||
Only Diamond swords will have bonus rupture damage at Rank 4
|
||||
Rupture damage is cut in half for weapons below Diamond in quality, if the weapon is wooden, the damage is cut in half again.
|
||||
Swords below Diamond quality will have their tick duration drastically reduced
|
||||
Rupture is not lethal if the sword is Stone or Wooden
|
||||
Rupture damage is reduced by 25% on players if they are wearing Full Armor (can be any type)
|
||||
Note: You'll need to add these entries to your config.yml manually, or wait for the upcoming config update where this will be fixed for you automatically.
|
||||
NOTE: Here's what your Double_Drop entries in Config.yml for Mining should look like
|
||||
https://paste.gg/p/anonymous/dcd06f1215844311b4f2225f200090d1
|
||||
|
@ -25,6 +25,8 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.Block;
|
||||
@ -193,6 +195,16 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
double damage = event.getFinalDamage();
|
||||
Entity defender = event.getEntity();
|
||||
Entity attacker = event.getDamager();
|
||||
|
||||
if(defender.getMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY).size() > 0)
|
||||
{
|
||||
defender.removeMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY, plugin);
|
||||
return;
|
||||
}
|
||||
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
@ -211,10 +223,6 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
double damage = event.getFinalDamage();
|
||||
Entity defender = event.getEntity();
|
||||
Entity attacker = event.getDamager();
|
||||
|
||||
if(attacker instanceof Player)
|
||||
{
|
||||
Player player = (Player) attacker;
|
||||
@ -263,8 +271,6 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (Misc.isNPCEntity(attacker)) {
|
||||
return;
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
/* Metadata Values */
|
||||
public static final String FISH_HOOK_REF_METAKEY = "mcMMO: Fish Hook Tracker";
|
||||
public static final String CUSTOM_DAMAGE_METAKEY = "mcMMO: Custom Damage";
|
||||
public final static String entityMetadataKey = "mcMMO: Spawned Entity";
|
||||
public final static String blockMetadataKey = "mcMMO: Piston Tracking";
|
||||
public final static String furnaceMetadataKey = "mcMMO: Tracked Furnace";
|
||||
|
@ -5,14 +5,16 @@ import org.bukkit.entity.LivingEntity;
|
||||
public class BleedContainer {
|
||||
public int bleedTicks;
|
||||
public int bleedRank;
|
||||
public int toolTier;
|
||||
public LivingEntity target;
|
||||
public LivingEntity damageSource;
|
||||
|
||||
public BleedContainer(LivingEntity target, int bleedTicks, int bleedRank, LivingEntity damageSource)
|
||||
public BleedContainer(LivingEntity target, int bleedTicks, int bleedRank, int toolTier, LivingEntity damageSource)
|
||||
{
|
||||
this.target = target;
|
||||
this.bleedTicks = bleedTicks;
|
||||
this.bleedRank = bleedRank;
|
||||
this.toolTier = toolTier;
|
||||
this.damageSource = damageSource;
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,11 @@ import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -28,21 +31,32 @@ public class BleedTimerTask extends BukkitRunnable {
|
||||
while (bleedIterator.hasNext()) {
|
||||
Entry<LivingEntity, BleedContainer> containerEntry = bleedIterator.next();
|
||||
LivingEntity target = containerEntry.getKey();
|
||||
int toolTier = containerEntry.getValue().toolTier;
|
||||
|
||||
int bleedTicks = containerEntry.getValue().bleedTicks;
|
||||
// String debugMessage = "";
|
||||
// debugMessage += ChatColor.GOLD + "Target ["+target.getName()+"]: " + ChatColor.RESET;
|
||||
|
||||
// debugMessage+="RemainingTicks=["+containerEntry.getValue().bleedTicks+"], ";
|
||||
|
||||
if (containerEntry.getValue().bleedTicks <= 0 || !target.isValid()) {
|
||||
if(target instanceof Player)
|
||||
{
|
||||
NotificationManager.sendPlayerInformation((Player) target, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Stopped");
|
||||
}
|
||||
|
||||
bleedIterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
int armorCount = 0;
|
||||
|
||||
double damage;
|
||||
|
||||
if (target instanceof Player) {
|
||||
damage = AdvancedConfig.getInstance().getRuptureDamagePlayer();
|
||||
|
||||
//Above Bleed Rank 3 deals 50% more damage
|
||||
if (containerEntry.getValue().bleedRank >= 3)
|
||||
if (containerEntry.getValue().toolTier >= 4 && containerEntry.getValue().bleedRank >= 3)
|
||||
damage = damage * 1.5;
|
||||
|
||||
Player player = (Player) target;
|
||||
@ -51,28 +65,77 @@ public class BleedTimerTask extends BukkitRunnable {
|
||||
continue;
|
||||
}
|
||||
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Stopped");
|
||||
//Count Armor
|
||||
for(ItemStack armorPiece : ((Player) target).getInventory().getArmorContents())
|
||||
{
|
||||
if(armorPiece != null)
|
||||
armorCount++;
|
||||
}
|
||||
|
||||
} else {
|
||||
damage = AdvancedConfig.getInstance().getRuptureDamageMobs();
|
||||
|
||||
// debugMessage+="BaseDMG=["+damage+"], ";
|
||||
|
||||
//Above Bleed Rank 3 deals 50% more damage
|
||||
if (containerEntry.getValue().bleedRank >= 3)
|
||||
{
|
||||
damage = damage * 1.5;
|
||||
}
|
||||
|
||||
// debugMessage+="Rank4Bonus=["+String.valueOf(containerEntry.getValue().bleedRank >= 3)+"], ";
|
||||
|
||||
|
||||
MobHealthbarUtils.handleMobHealthbars(target, damage, mcMMO.p); //Update health bars
|
||||
}
|
||||
|
||||
CombatUtils.dealNoInvulnerabilityTickDamage(target, damage, containerEntry.getValue().damageSource);
|
||||
// debugMessage+="FullArmor=["+String.valueOf(armorCount > 3)+"], ";
|
||||
|
||||
if(armorCount > 3)
|
||||
{
|
||||
damage = damage * .75;
|
||||
}
|
||||
|
||||
// debugMessage+="AfterRankAndArmorChecks["+damage+"], ";
|
||||
|
||||
//Weapons below Diamond get damage cut in half
|
||||
if(toolTier < 4)
|
||||
damage = damage / 2;
|
||||
|
||||
// debugMessage+="AfterDiamondCheck=["+String.valueOf(damage)+"], ";
|
||||
|
||||
//Wood weapons get damage cut in half again
|
||||
if(toolTier < 2)
|
||||
damage = damage / 2;
|
||||
|
||||
// debugMessage+="AfterWoodenCheck=["+String.valueOf(damage)+"], ";
|
||||
|
||||
double victimHealth = target.getHealth();
|
||||
|
||||
// debugMessage+="TargetHealthBeforeDMG=["+String.valueOf(target.getHealth())+"], ";
|
||||
|
||||
CombatUtils.dealNoInvulnerabilityTickDamageRupture(target, damage, containerEntry.getValue().damageSource, toolTier);
|
||||
|
||||
double victimHealthAftermath = target.getHealth();
|
||||
|
||||
// debugMessage+="TargetHealthAfterDMG=["+String.valueOf(target.getHealth())+"], ";
|
||||
|
||||
if(victimHealthAftermath <= 0 || victimHealth != victimHealthAftermath)
|
||||
{
|
||||
//Play Bleed Sound
|
||||
SoundManager.worldSendSound(target.getWorld(), target.getLocation(), SoundType.BLEED);
|
||||
|
||||
ParticleEffectUtils.playBleedEffect(target);
|
||||
}
|
||||
|
||||
//Lower Bleed Ticks
|
||||
BleedContainer loweredBleedContainer = copyContainer(containerEntry.getValue());
|
||||
loweredBleedContainer.bleedTicks -= 1;
|
||||
|
||||
// debugMessage+="RemainingTicks=["+loweredBleedContainer.bleedTicks+"]";
|
||||
containerEntry.setValue(loweredBleedContainer);
|
||||
|
||||
// Bukkit.broadcastMessage(debugMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,8 +145,9 @@ public class BleedTimerTask extends BukkitRunnable {
|
||||
LivingEntity source = container.damageSource;
|
||||
int bleedTicks = container.bleedTicks;
|
||||
int bleedRank = container.bleedRank;
|
||||
int toolTier = container.toolTier;
|
||||
|
||||
BleedContainer newContainer = new BleedContainer(target, bleedTicks, bleedRank, source);
|
||||
BleedContainer newContainer = new BleedContainer(target, bleedTicks, bleedRank, toolTier, source);
|
||||
return newContainer;
|
||||
}
|
||||
|
||||
@ -108,8 +172,11 @@ public class BleedTimerTask extends BukkitRunnable {
|
||||
* @param entity LivingEntity to add
|
||||
* @param ticks Number of bleeding ticks
|
||||
*/
|
||||
public static void add(LivingEntity entity, LivingEntity attacker, int ticks, int bleedRank) {
|
||||
BleedContainer newBleedContainer = new BleedContainer(entity, ticks, bleedRank, attacker);
|
||||
public static void add(LivingEntity entity, LivingEntity attacker, int ticks, int bleedRank, int toolTier) {
|
||||
if(toolTier < 4)
|
||||
ticks = Math.max(1, (ticks / 3));
|
||||
|
||||
BleedContainer newBleedContainer = new BleedContainer(entity, ticks, bleedRank, toolTier, attacker);
|
||||
bleedList.put(entity, newBleedContainer);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
@ -8,6 +8,7 @@ import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@ -19,6 +20,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -60,13 +62,17 @@ public class SwordsManager extends SkillManager {
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
//Don't start or add to a bleed if they are blocking
|
||||
if(defender.isBlocking())
|
||||
return;
|
||||
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
if(!BleedTimerTask.isBleeding(defender))
|
||||
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Started");
|
||||
}
|
||||
}
|
||||
|
||||
BleedTimerTask.add(target, getPlayer(), getRuptureBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE));
|
||||
BleedTimerTask.add(target, getPlayer(), getRuptureBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE), getToolTier(getPlayer().getInventory().getItemInMainHand()));
|
||||
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding");
|
||||
@ -74,6 +80,18 @@ public class SwordsManager extends SkillManager {
|
||||
}
|
||||
}
|
||||
|
||||
public int getToolTier(ItemStack itemStack)
|
||||
{
|
||||
if(ItemUtils.isDiamondTool(itemStack))
|
||||
return 4;
|
||||
else if(ItemUtils.isIronTool(itemStack) || ItemUtils.isGoldTool(itemStack))
|
||||
return 3;
|
||||
else if(ItemUtils.isStoneTool(itemStack))
|
||||
return 2;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getRuptureBleedTicks()
|
||||
{
|
||||
int bleedTicks = 2 * RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE);
|
||||
@ -110,6 +128,5 @@ public class SwordsManager extends SkillManager {
|
||||
*/
|
||||
public void serratedStrikes(LivingEntity target, double damage, Map<DamageModifier, Double> modifiers) {
|
||||
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Swords.serratedStrikesModifier, modifiers, skill);
|
||||
BleedTimerTask.add(target, getPlayer(), getRuptureBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE));
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class TamingManager extends SkillManager {
|
||||
return 0;
|
||||
}
|
||||
|
||||
BleedTimerTask.add(target, getPlayer(), Taming.goreBleedTicks, 1);
|
||||
BleedTimerTask.add(target, getPlayer(), Taming.goreBleedTicks, 1, 2);
|
||||
|
||||
if (target instanceof Player) {
|
||||
NotificationManager.sendPlayerInformation((Player)target, NotificationType.SUBSKILL_MESSAGE, "Combat.StruckByGore");
|
||||
|
@ -32,6 +32,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
@ -394,9 +395,47 @@ public final class CombatUtils {
|
||||
double incDmg = callFakeDamageEvent(attacker, target, DamageCause.CUSTOM, damage);
|
||||
|
||||
double newHealth = Math.max(0, target.getHealth() - incDmg);
|
||||
|
||||
if(newHealth == 0)
|
||||
{
|
||||
target.damage(9999, attacker);
|
||||
}
|
||||
else
|
||||
target.setHealth(newHealth);
|
||||
}
|
||||
|
||||
public static void dealNoInvulnerabilityTickDamageRupture(LivingEntity target, double damage, Entity attacker, int toolTier) {
|
||||
if (target.isDead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int noDamageTicks = target.getNoDamageTicks();
|
||||
|
||||
double incDmg = callFakeDamageEvent(attacker, target, DamageCause.CUSTOM, damage);
|
||||
|
||||
double newHealth = Math.max(0, target.getHealth() - incDmg);
|
||||
|
||||
//Don't kill things with a stone or wooden weapon
|
||||
if(toolTier < 3 && newHealth == 0)
|
||||
return;
|
||||
|
||||
target.setMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY, mcMMO.metadataValue);
|
||||
|
||||
if(newHealth == 0)
|
||||
{
|
||||
target.damage(99999, attacker);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector beforeRuptureVec = new Vector(target.getVelocity().getX(), target.getVelocity().getY(), target.getVelocity().getZ()); ;
|
||||
target.damage(damage, attacker);
|
||||
|
||||
target.setNoDamageTicks(noDamageTicks);
|
||||
target.setVelocity(beforeRuptureVec);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply Area-of-Effect ability actions.
|
||||
*
|
||||
@ -427,7 +466,7 @@ public final class CombatUtils {
|
||||
NotificationManager.sendPlayerInformation((Player)entity, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.SS.Struck");
|
||||
}
|
||||
|
||||
BleedTimerTask.add(livingEntity, attacker, UserManager.getPlayer(attacker).getSwordsManager().getRuptureBleedTicks(), RankUtils.getRank(attacker, SubSkillType.SWORDS_RUPTURE));
|
||||
UserManager.getPlayer(attacker).getSwordsManager().ruptureCheck(target);
|
||||
break;
|
||||
|
||||
case AXES:
|
||||
|
Loading…
Reference in New Issue
Block a user