From 9b555c025905e29059968b7ce860099bfe0d824f Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 1 Mar 2024 19:15:27 -0600 Subject: [PATCH] Zerg multiplier reduction method --- src/engine/gameManager/CombatManager.java | 4 ++-- src/engine/gameManager/ZergManager.java | 24 ++++++++++++++++--- src/engine/objects/Mine.java | 18 +++++++------- .../effectmodifiers/HealthEffectModifier.java | 5 ++-- .../effectmodifiers/ManaEffectModifier.java | 5 ++-- .../StaminaEffectModifier.java | 5 ++-- .../poweractions/TransferStatPowerAction.java | 5 +++- 7 files changed, 45 insertions(+), 21 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index bfe7a1dc..a860be11 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -811,8 +811,8 @@ public enum CombatManager { damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists); - if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){ - damage *= ((PlayerCharacter)ac).ZergMultiplier; + if(ac.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectType().equals(GameObjectType.PlayerCharacter)){ + damage *= ZergManager.getReducedZergMultiplier((PlayerCharacter)ac,(PlayerCharacter)target); } float d = 0f; diff --git a/src/engine/gameManager/ZergManager.java b/src/engine/gameManager/ZergManager.java index 46952e18..7f35b5f6 100644 --- a/src/engine/gameManager/ZergManager.java +++ b/src/engine/gameManager/ZergManager.java @@ -41,7 +41,6 @@ public class ZergManager { else return multiplier; } - public static float getMultiplier10Man(int count, PlayerCharacter pc){ float multiplier = 1.0f; if(count <=4) @@ -99,7 +98,6 @@ public class ZergManager { else return multiplier; } - public static float getMultiplier20Man(int count, PlayerCharacter pc){ float multiplier = 1.0f; if(count < 10){ @@ -177,7 +175,6 @@ public class ZergManager { else return multiplier; } - public static int getBaneCapSize(Guild defender){ int treesInNation = defender.getNation().getSubGuildList().size() + 1; int capSize; @@ -233,4 +230,25 @@ public class ZergManager { else return multiplier; } + + public static float getReducedZergMultiplier(PlayerCharacter source, PlayerCharacter target){ + if(source.ZergMultiplier == 0.0f) + source.ZergMultiplier = 1.0f; + if(target.ZergMultiplier == 0.0f) + target.ZergMultiplier = 1.0f; + if(source.ZergMultiplier > 0 && target.ZergMultiplier > 0){ + if(source.ZergMultiplier > target.ZergMultiplier) { + return 1 + (target.ZergMultiplier - source.ZergMultiplier); + } else{ + return 1.0f; + } + }else if(source.ZergMultiplier < 0 && target.ZergMultiplier > 0){ + return source.ZergMultiplier; + } else if(source.ZergMultiplier < 0 && target.ZergMultiplier < 0){ + return source.ZergMultiplier; + } else if(source.ZergMultiplier > 0 && target.ZergMultiplier < 0){ + return source.ZergMultiplier; + } + return 1.0f; + } } diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index 20f02100..f6d33056 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -107,16 +107,16 @@ public class Mine extends AbstractGameObject { this.production = Resource.valueOf(rs.getString("mine_resource")); this.lastClaimer = null; - int capRoll = ThreadLocalRandom.current().nextInt(0,101); - if(capRoll >= 0 && capRoll <= 33){ + //int capRoll = ThreadLocalRandom.current().nextInt(0,101); + //if(capRoll >= 0 && capRoll <= 33){ this.capSize = 5; - } - if(capRoll >= 34 && capRoll <= 66){ - this.capSize = 10; - } - if(capRoll >= 67 && capRoll <= 100){ - this.capSize = 20; - } + //} + //if(capRoll >= 34 && capRoll <= 66){ + // this.capSize = 10; + //} + //if(capRoll >= 67 && capRoll <= 100){ + // this.capSize = 20; + //} Building mineTower = BuildingManager.getBuilding(this.buildingID); mineTower.setMaxHitPoints(5000 * this.capSize); mineTower.setCurrentHitPoints((float)5000 * this.capSize); diff --git a/src/engine/powers/effectmodifiers/HealthEffectModifier.java b/src/engine/powers/effectmodifiers/HealthEffectModifier.java index efedabec..9d44d581 100644 --- a/src/engine/powers/effectmodifiers/HealthEffectModifier.java +++ b/src/engine/powers/effectmodifiers/HealthEffectModifier.java @@ -14,6 +14,7 @@ import engine.Enum.GameObjectType; import engine.Enum.ModType; import engine.Enum.SourceType; import engine.gameManager.ChatManager; +import engine.gameManager.ZergManager; import engine.jobs.AbstractEffectJob; import engine.jobs.DamageOverTimeJob; import engine.net.AbstractNetMsg; @@ -176,8 +177,8 @@ public class HealthEffectModifier extends AbstractEffectModifier { if (!ac.isAlive()) return; - if(source.getObjectType().equals(GameObjectType.PlayerCharacter)){ - modAmount *= ((PlayerCharacter)source).ZergMultiplier; + 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; diff --git a/src/engine/powers/effectmodifiers/ManaEffectModifier.java b/src/engine/powers/effectmodifiers/ManaEffectModifier.java index 10686659..9eb424ac 100644 --- a/src/engine/powers/effectmodifiers/ManaEffectModifier.java +++ b/src/engine/powers/effectmodifiers/ManaEffectModifier.java @@ -14,6 +14,7 @@ import engine.Enum.DamageType; import engine.Enum.ModType; import engine.Enum.SourceType; import engine.gameManager.ChatManager; +import engine.gameManager.ZergManager; import engine.jobs.AbstractEffectJob; import engine.jobs.DamageOverTimeJob; import engine.net.DispatchMessage; @@ -157,8 +158,8 @@ public class ManaEffectModifier extends AbstractEffectModifier { skipImmune = true; } } - if(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ - modAmount *= ((PlayerCharacter)source).ZergMultiplier; + 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) { diff --git a/src/engine/powers/effectmodifiers/StaminaEffectModifier.java b/src/engine/powers/effectmodifiers/StaminaEffectModifier.java index e7a89ce6..3e97248d 100644 --- a/src/engine/powers/effectmodifiers/StaminaEffectModifier.java +++ b/src/engine/powers/effectmodifiers/StaminaEffectModifier.java @@ -14,6 +14,7 @@ import engine.Enum.DamageType; import engine.Enum.ModType; import engine.Enum.SourceType; import engine.gameManager.ChatManager; +import engine.gameManager.ZergManager; import engine.jobs.AbstractEffectJob; import engine.jobs.DamageOverTimeJob; import engine.net.DispatchMessage; @@ -153,8 +154,8 @@ public class StaminaEffectModifier extends AbstractEffectModifier { skipImmune = true; } } - if(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ - modAmount *= ((PlayerCharacter)source).ZergMultiplier; + 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) { diff --git a/src/engine/powers/poweractions/TransferStatPowerAction.java b/src/engine/powers/poweractions/TransferStatPowerAction.java index f2673706..a4225fd6 100644 --- a/src/engine/powers/poweractions/TransferStatPowerAction.java +++ b/src/engine/powers/poweractions/TransferStatPowerAction.java @@ -14,6 +14,7 @@ import engine.Enum.DamageType; import engine.Enum.ModType; import engine.Enum.SourceType; import engine.gameManager.ChatManager; +import engine.gameManager.ZergManager; import engine.math.Vector3fImmutable; import engine.net.AbstractNetMsg; import engine.net.DispatchMessage; @@ -213,7 +214,9 @@ public class TransferStatPowerAction extends AbstractPowerAction { // put it back between min and max damage += min; - damage *= ((PlayerCharacter) source).ZergMultiplier; + 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)