fix thrown tridents not getting XP or subskill benefits

This commit is contained in:
nossr50 2024-03-31 08:44:06 -07:00
parent 86a5d14a9b
commit cf49fc7599
3 changed files with 49 additions and 5 deletions

View File

@ -1,3 +1,6 @@
Version 2.2.002
Fixed bug where thrown tridents did not grant XP or benefit from subskills
Version 2.2.001 Version 2.2.001
Fixed Crossbow's Powered shot showing the text for the wrong skill from the locale when using /crossbows command Fixed Crossbow's Powered shot showing the text for the wrong skill from the locale when using /crossbows command

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId> <groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId> <artifactId>mcMMO</artifactId>
<version>2.2.001</version> <version>2.2.002-SNAPSHOT</version>
<name>mcMMO</name> <name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url> <url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm> <scm>

View File

@ -111,7 +111,7 @@ public final class CombatUtils {
} }
} }
} }
private static void processTridentCombat(@NotNull LivingEntity target, @NotNull Player player, @NotNull EntityDamageByEntityEvent event) { private static void processTridentCombatMelee(@NotNull LivingEntity target, @NotNull Player player, @NotNull EntityDamageByEntityEvent event) {
if (event.getCause() == DamageCause.THORNS) { if (event.getCause() == DamageCause.THORNS) {
return; return;
} }
@ -127,10 +127,40 @@ public final class CombatUtils {
TridentsManager tridentsManager = mcMMOPlayer.getTridentsManager(); TridentsManager tridentsManager = mcMMOPlayer.getTridentsManager();
if (tridentsManager.canActivateAbility()) { // if (tridentsManager.canActivateAbility()) {
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.TRIDENTS); // mcMMOPlayer.checkAbilityActivation(PrimarySkillType.TRIDENTS);
// }
if (SkillUtils.canUseSubskill(player, SubSkillType.TRIDENTS_IMPALE)) {
boostedDamage += (tridentsManager.impaleDamageBonus() * mcMMOPlayer.getAttackStrength());
} }
if(canUseLimitBreak(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
}
event.setDamage(boostedDamage);
processCombatXP(mcMMOPlayer, target, PrimarySkillType.TRIDENTS);
printFinalDamageDebug(player, event, mcMMOPlayer);
}
private static void processTridentCombatRanged(@NotNull Trident trident, @NotNull LivingEntity target, @NotNull Player player, @NotNull EntityDamageByEntityEvent event) {
if (event.getCause() == DamageCause.THORNS) {
return;
}
double boostedDamage = event.getDamage();
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Make sure the profiles been loaded
if(mcMMOPlayer == null) {
return;
}
TridentsManager tridentsManager = mcMMOPlayer.getTridentsManager();
if (SkillUtils.canUseSubskill(player, SubSkillType.TRIDENTS_IMPALE)) { if (SkillUtils.canUseSubskill(player, SubSkillType.TRIDENTS_IMPALE)) {
boostedDamage += (tridentsManager.impaleDamageBonus() * mcMMOPlayer.getAttackStrength()); boostedDamage += (tridentsManager.impaleDamageBonus() * mcMMOPlayer.getAttackStrength());
} }
@ -465,7 +495,7 @@ public final class CombatUtils {
} }
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.TRIDENTS)) { if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.TRIDENTS)) {
processTridentCombat(target, player, event); processTridentCombatMelee(target, player, event);
} }
} }
} }
@ -481,6 +511,17 @@ public final class CombatUtils {
} }
} }
} }
else if (painSource instanceof Trident trident) {
ProjectileSource projectileSource = trident.getShooter();
if (projectileSource instanceof Player player) {
if (!Misc.isNPCEntityExcludingVillagers(player)) {
if(mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.TRIDENTS, target)) {
processTridentCombatRanged(trident, target, player, event);
}
}
}
}
else if (painSource instanceof Arrow arrow) { else if (painSource instanceof Arrow arrow) {
ProjectileSource projectileSource = arrow.getShooter(); ProjectileSource projectileSource = arrow.getShooter();
boolean isCrossbow = arrow.isShotFromCrossbow(); boolean isCrossbow = arrow.isShotFromCrossbow();