From 4eff71f288eb53731c9e87ed0ee9863c87b60d55 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 2 Mar 2024 14:54:17 -0600 Subject: [PATCH] combat bug fix --- src/engine/gameManager/CombatManager.java | 10 +++--- src/engine/gameManager/ZergManager.java | 31 ++++++++++++------- src/engine/objects/CharacterItemManager.java | 2 +- .../effectmodifiers/HealthEffectModifier.java | 9 ++++-- .../effectmodifiers/ManaEffectModifier.java | 9 ++++-- .../StaminaEffectModifier.java | 9 ++++-- .../poweractions/TransferStatPowerAction.java | 6 ++-- 7 files changed, 48 insertions(+), 28 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index a860be11..656a6b52 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -811,9 +811,9 @@ public enum CombatManager { damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists); - if(ac.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectType().equals(GameObjectType.PlayerCharacter)){ - damage *= ZergManager.getReducedZergMultiplier((PlayerCharacter)ac,(PlayerCharacter)target); - } + //if(ac.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectType().equals(GameObjectType.PlayerCharacter)){ + // damage *= ZergManager.getReducedZergMultiplier((PlayerCharacter)ac,(PlayerCharacter)target); + //} float d = 0f; errorTrack = 12; @@ -842,7 +842,9 @@ public enum CombatManager { } mobTarget.handleDirectAggro(ac); } - + if(ac.getObjectType().equals(GameObjectType.PlayerCharacter) && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter) && tarAc.equals(ac) == false){ + damage *= ZergManager.getReducedZergMultiplier(ac,tarAc); + } if (tarAc.getHealth() > 0) d = tarAc.modifyHealth(-damage, ac, false); subTrack = 5; diff --git a/src/engine/gameManager/ZergManager.java b/src/engine/gameManager/ZergManager.java index ab78e733..04e545fd 100644 --- a/src/engine/gameManager/ZergManager.java +++ b/src/engine/gameManager/ZergManager.java @@ -1,9 +1,7 @@ package engine.gameManager; -import engine.objects.Bane; -import engine.objects.Guild; -import engine.objects.Mine; -import engine.objects.PlayerCharacter; +import engine.Enum; +import engine.objects.*; public class ZergManager { public static float getMultiplier5Man(int count, PlayerCharacter pc){ @@ -232,7 +230,13 @@ public class ZergManager { return multiplier; } - public static float getReducedZergMultiplier(PlayerCharacter source, PlayerCharacter target){ + public static float getReducedZergMultiplier(AbstractCharacter sourceABS, AbstractCharacter targetABS){ + if(sourceABS.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) == false || targetABS.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) == false) + return 1.0f; + + PlayerCharacter source = (PlayerCharacter) sourceABS; + PlayerCharacter target = (PlayerCharacter) targetABS; + if(source.ZergMultiplier == 0.0f) { if(Mine.getMine(source.mineAppliedID) != null && Mine.getMine(source.mineAppliedID)._playerMemory.contains(source.getObjectUUID()) == false ){ source.ZergMultiplier = 1.0f; @@ -246,19 +250,24 @@ public class ZergManager { if(source.ZergMultiplier == target.ZergMultiplier){ return 1.0f; } + float returnMultiplier = 1.0f; if(source.ZergMultiplier > 0 && target.ZergMultiplier > 0){ if(source.ZergMultiplier > target.ZergMultiplier) { - return 1 + (target.ZergMultiplier - source.ZergMultiplier); + returnMultiplier = 1 + (target.ZergMultiplier - source.ZergMultiplier); } else{ - return 1.0f; + returnMultiplier = 1.0f; } }else if(source.ZergMultiplier < 0 && target.ZergMultiplier > 0){ - return source.ZergMultiplier; + returnMultiplier = source.ZergMultiplier; } else if(source.ZergMultiplier < 0 && target.ZergMultiplier < 0){ - return source.ZergMultiplier; + returnMultiplier = source.ZergMultiplier; } else if(source.ZergMultiplier > 0 && target.ZergMultiplier < 0){ - return source.ZergMultiplier; + returnMultiplier = source.ZergMultiplier; + } + if(returnMultiplier == 0.0f) + return 1.0f; + else{ + return returnMultiplier; } - return 1.0f; } } diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 44238433..5035ae41 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -1211,7 +1211,7 @@ public class CharacterItemManager { //i.clearEffects(); for (String name : i.getEffects().keySet()) { Effect eff = i.getEffects().get(name); - if (eff.getDuration() < 2000) + if (!eff.isStatic()) i.endEffect(name); } } diff --git a/src/engine/powers/effectmodifiers/HealthEffectModifier.java b/src/engine/powers/effectmodifiers/HealthEffectModifier.java index 9d44d581..6d5a9bf7 100644 --- a/src/engine/powers/effectmodifiers/HealthEffectModifier.java +++ b/src/engine/powers/effectmodifiers/HealthEffectModifier.java @@ -177,9 +177,9 @@ public class HealthEffectModifier extends AbstractEffectModifier { if (!ac.isAlive()) return; - if(ac.getObjectType().equals(GameObjectType.PlayerCharacter) && ac.combatTarget.getObjectType().equals(GameObjectType.PlayerCharacter)){ - modAmount *= ZergManager.getReducedZergMultiplier((PlayerCharacter)ac,(PlayerCharacter)ac.combatTarget); - } + //if(ac.getObjectType().equals(GameObjectType.PlayerCharacter) && ac.combatTarget.getObjectType().equals(GameObjectType.PlayerCharacter)){ + // modAmount *= ZergManager.getReducedZergMultiplier((PlayerCharacter)ac,(PlayerCharacter)ac.combatTarget); + //} int powerID = 0, effectID = 0; String powerName = ""; @@ -318,6 +318,9 @@ public class HealthEffectModifier extends AbstractEffectModifier { AbstractCharacter ac = (AbstractCharacter) awo; if (ac.isSit()) damage *= 2.5f; // increase damage if sitting + if(ac.getObjectType().equals(GameObjectType.PlayerCharacter) && source.equals(ac) == false && ZergManager.getReducedZergMultiplier(source,ac) != 0.0f){ + damage *= ZergManager.getReducedZergMultiplier(source,ac); + } } return damage; diff --git a/src/engine/powers/effectmodifiers/ManaEffectModifier.java b/src/engine/powers/effectmodifiers/ManaEffectModifier.java index 9eb424ac..9f539b56 100644 --- a/src/engine/powers/effectmodifiers/ManaEffectModifier.java +++ b/src/engine/powers/effectmodifiers/ManaEffectModifier.java @@ -158,9 +158,9 @@ public class ManaEffectModifier extends AbstractEffectModifier { skipImmune = true; } } - if(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && ac.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ - modAmount *= ZergManager.getReducedZergMultiplier((PlayerCharacter)ac,(PlayerCharacter)ac.combatTarget); - } + //if(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && ac.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ + // modAmount *= ZergManager.getReducedZergMultiplier((PlayerCharacter)ac,(PlayerCharacter)ac.combatTarget); + //} PlayerBonuses bonus = ac.getBonuses(); if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) { ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID); @@ -207,6 +207,9 @@ public class ManaEffectModifier extends AbstractEffectModifier { AbstractCharacter ac = (AbstractCharacter) awo; if (ac.isSit()) damage *= 2.5f; // increase damage if sitting + if(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && source.equals(ac) == false && ZergManager.getReducedZergMultiplier(source,ac) != 0.0f){ + damage *= ZergManager.getReducedZergMultiplier(source,ac); + } } return damage; diff --git a/src/engine/powers/effectmodifiers/StaminaEffectModifier.java b/src/engine/powers/effectmodifiers/StaminaEffectModifier.java index 3e97248d..91e64bcf 100644 --- a/src/engine/powers/effectmodifiers/StaminaEffectModifier.java +++ b/src/engine/powers/effectmodifiers/StaminaEffectModifier.java @@ -154,9 +154,9 @@ public class StaminaEffectModifier extends AbstractEffectModifier { skipImmune = true; } } - if(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && ac.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ - modAmount *= ZergManager.getReducedZergMultiplier((PlayerCharacter)ac,(PlayerCharacter)ac.combatTarget); - } + //if(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && ac.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ + // modAmount *= ZergManager.getReducedZergMultiplier((PlayerCharacter)ac,(PlayerCharacter)ac.combatTarget); + //} PlayerBonuses bonus = ac.getBonuses(); if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) { ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID); @@ -205,6 +205,9 @@ public class StaminaEffectModifier extends AbstractEffectModifier { AbstractCharacter ac = (AbstractCharacter) awo; if (ac.isSit()) damage *= 2.5f; // increase damage if sitting + if(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && source.equals(ac) == false && ZergManager.getReducedZergMultiplier(source,ac) != 0.0f){ + damage *= ZergManager.getReducedZergMultiplier(source,ac); + } } return damage; diff --git a/src/engine/powers/poweractions/TransferStatPowerAction.java b/src/engine/powers/poweractions/TransferStatPowerAction.java index a4225fd6..11987421 100644 --- a/src/engine/powers/poweractions/TransferStatPowerAction.java +++ b/src/engine/powers/poweractions/TransferStatPowerAction.java @@ -214,9 +214,9 @@ public class TransferStatPowerAction extends AbstractPowerAction { // put it back between min and max damage += min; - if(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && source.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ - damage *= ZergManager.getReducedZergMultiplier((PlayerCharacter)source,(PlayerCharacter)source.combatTarget); - } + //if(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && source.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ + // damage *= ZergManager.getReducedZergMultiplier((PlayerCharacter)source,(PlayerCharacter)source.combatTarget); + //} } // Apply any power effect modifiers (such as stances)