Fixing several issues related to Bleed/Rupture

Rupture now keeps track of who applied the damage and attributes it correctly in events
Rupture's bleed timer task no longer caps at the low value of 10 ticks internally
Ruptures bleed check code has had some minor refactoring
This commit is contained in:
nossr50 2019-01-23 15:22:16 -08:00
parent e5e86246f3
commit 3e5c4bc617
5 changed files with 19 additions and 19 deletions

View File

@ -35,9 +35,10 @@ Version 2.1.0
+ (Events) Starting an XP event will now use the title API (toggle this in advanced.yml) + (Events) Starting an XP event will now use the title API (toggle this in advanced.yml)
+ (Sound) Volume and Pitch of sounds can now be configured in the new sounds.yml file + (Sound) Volume and Pitch of sounds can now be configured in the new sounds.yml file
+ (MySQL) Added support for SSL for MySQL/MariaDB (On by default) + (MySQL) Added support for SSL for MySQL/MariaDB (On by default)
! (Skills) Taming's Gore now uses Bleed Rank 1 for its DoT ! (Skills) Taming's Gore now uses Rupture Rank 1 for its DoT
! (Skills) Sword's Rupture now ticks four times as fast
! (Skills) Sword's Bleed has been renamed to Rupture ! (Skills) Sword's Bleed has been renamed to Rupture
! (Skills) Sword's Rupture now ticks four times as fast
= (Skills) Fixed a bug where Rupture would apply an incorrect amount of bleed ticks
! (Skills) Sword's Rupture now reaches its max proc chance at level 20 (200 in Retro) ! (Skills) Sword's Rupture now reaches its max proc chance at level 20 (200 in Retro)
! (Skills) Sword's Rupture now has a max chance to proc of 33% instead of 70% ! (Skills) Sword's Rupture now has a max chance to proc of 33% instead of 70%
! (Skills) Sword's Rupture now deals 50% more damage at above Rank 3 and can last much longer! The base damage for Bleed has been increased as well (update your advanced.yml admins) ! (Skills) Sword's Rupture now deals 50% more damage at above Rank 3 and can last much longer! The base damage for Bleed has been increased as well (update your advanced.yml admins)

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.swords.Swords;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@ -43,7 +42,7 @@ public class SwordsCommand extends SkillCommand {
// SWORDS_RUPTURE // SWORDS_RUPTURE
if (canBleed) { if (canBleed) {
bleedLength = UserManager.getPlayer(player).getSwordsManager().getBleedTicks(); bleedLength = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
String[] bleedStrings = calculateAbilityDisplayValues(skillValue, SubSkillType.SWORDS_RUPTURE, isLucky); String[] bleedStrings = calculateAbilityDisplayValues(skillValue, SubSkillType.SWORDS_RUPTURE, isLucky);
bleedChance = bleedStrings[0]; bleedChance = bleedStrings[0];
@ -69,7 +68,7 @@ public class SwordsCommand extends SkillCommand {
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>(); List<String> messages = new ArrayList<String>();
int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getBleedTicks(); int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
double ruptureDamagePlayers = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamagePlayer() * 1.5D : AdvancedConfig.getInstance().getRuptureDamagePlayer(); double ruptureDamagePlayers = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamagePlayer() * 1.5D : AdvancedConfig.getInstance().getRuptureDamagePlayer();
double ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamageMobs() * 1.5D : AdvancedConfig.getInstance().getRuptureDamageMobs(); double ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamageMobs() * 1.5D : AdvancedConfig.getInstance().getRuptureDamageMobs();

View File

@ -511,7 +511,7 @@ public class mcMMO extends JavaPlugin {
// Cleanup the backups folder // Cleanup the backups folder
new CleanBackupsTask().runTaskAsynchronously(mcMMO.p); new CleanBackupsTask().runTaskAsynchronously(mcMMO.p);
// Bleed timer (Runs every two seconds) // Bleed timer (Runs every 0.5 seconds)
new BleedTimerTask().runTaskTimer(this, 1 * Misc.TICK_CONVERSION_FACTOR, 1 * (Misc.TICK_CONVERSION_FACTOR / 2)); new BleedTimerTask().runTaskTimer(this, 1 * Misc.TICK_CONVERSION_FACTOR, 1 * (Misc.TICK_CONVERSION_FACTOR / 2));
// Old & Powerless User remover // Old & Powerless User remover

View File

@ -17,9 +17,10 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
public class BleedTimerTask extends BukkitRunnable { public class BleedTimerTask extends BukkitRunnable {
private final static int MAX_BLEED_TICKS = 10; private final static int MAX_BLEED_TICKS = 100; //The cap has been raised :)
private static Map<LivingEntity, Integer> bleedList = new HashMap<LivingEntity, Integer>(); private static Map<LivingEntity, Integer> bleedList = new HashMap<LivingEntity, Integer>();
private static Map<LivingEntity, Integer> bleedDamage = new HashMap<LivingEntity, Integer>(); private static Map<LivingEntity, Integer> bleedDamage = new HashMap<LivingEntity, Integer>();
private static Map<LivingEntity, LivingEntity> attackerMap = new HashMap<>();
@Override @Override
public void run() { public void run() {
@ -73,7 +74,8 @@ public class BleedTimerTask extends BukkitRunnable {
bleedIterator.remove(); bleedIterator.remove();
} }
CombatUtils.dealNoInvulnerabilityTickDamage(entity, damage, null);
CombatUtils.dealNoInvulnerabilityTickDamage(entity, damage, attackerMap.get(entity));
ParticleEffectUtils.playBleedEffect(entity); ParticleEffectUtils.playBleedEffect(entity);
} }
} }
@ -86,9 +88,10 @@ public class BleedTimerTask extends BukkitRunnable {
*/ */
public static void bleedOut(LivingEntity entity) { public static void bleedOut(LivingEntity entity) {
if (bleedList.containsKey(entity)) { if (bleedList.containsKey(entity)) {
CombatUtils.dealNoInvulnerabilityTickDamage(entity, bleedList.get(entity) * 2, null); CombatUtils.dealNoInvulnerabilityTickDamage(entity, bleedList.get(entity) * 2, attackerMap.get(entity));
bleedList.remove(entity); bleedList.remove(entity);
bleedDamage.remove(entity); bleedDamage.remove(entity);
attackerMap.remove(entity);
} }
} }
@ -101,6 +104,7 @@ public class BleedTimerTask extends BukkitRunnable {
if (bleedList.containsKey(entity)) { if (bleedList.containsKey(entity)) {
bleedList.remove(entity); bleedList.remove(entity);
bleedDamage.remove(entity); bleedDamage.remove(entity);
attackerMap.remove(entity);
} }
} }
@ -110,20 +114,21 @@ public class BleedTimerTask extends BukkitRunnable {
* @param entity LivingEntity to add * @param entity LivingEntity to add
* @param ticks Number of bleeding ticks * @param ticks Number of bleeding ticks
*/ */
public static void add(LivingEntity entity, int ticks, int bleedRank) { public static void add(LivingEntity entity, LivingEntity attacker, int ticks, int bleedRank) {
int newTicks = ticks; int newTicks = ticks;
if (bleedList.containsKey(entity)) { if (bleedList.containsKey(entity)) {
newTicks += bleedList.get(entity); newTicks += bleedList.get(entity);
bleedList.put(entity, Math.min(newTicks, MAX_BLEED_TICKS)); bleedList.put(entity, Math.min(MAX_BLEED_TICKS, newTicks));
//Override the current bleed rank only if this one is higher //Override the current bleed rank only if this one is higher
if(bleedDamage.get(entity) < bleedRank) if(bleedDamage.get(entity) < bleedRank)
bleedDamage.put(entity, bleedRank); bleedDamage.put(entity, bleedRank);
} }
else { else {
bleedList.put(entity, Math.min(newTicks, MAX_BLEED_TICKS)); bleedList.put(entity, Math.min(MAX_BLEED_TICKS, newTicks));
bleedDamage.put(entity, bleedRank); bleedDamage.put(entity, bleedRank);
attackerMap.put(entity, attacker);
} }
} }

View File

@ -61,12 +61,7 @@ public class SwordsManager extends SkillManager {
} }
} }
if (getSkillLevel() >= AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.SWORDS_RUPTURE)) { BleedTimerTask.add(target, getRuptureBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE));
BleedTimerTask.add(target, getBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE));
}
else {
BleedTimerTask.add(target, getBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE));
}
if (mcMMOPlayer.useChatNotifications()) { if (mcMMOPlayer.useChatNotifications()) {
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding"); NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding");
@ -74,7 +69,7 @@ public class SwordsManager extends SkillManager {
} }
} }
public int getBleedTicks() public int getRuptureBleedTicks()
{ {
int bleedTicks = 2 * RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE); int bleedTicks = 2 * RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE);