From 5be9033c406a657a496faf290e7ce79d21e32b2f Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 30 Aug 2024 19:27:19 -0500 Subject: [PATCH] no move buff while flying --- src/engine/gameManager/PowersManager.java | 13 ++++++++++--- src/engine/objects/AbstractCharacter.java | 8 ++++++++ src/engine/objects/PlayerCharacter.java | 7 ++----- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 33ed6b82..9b568d2f 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -292,9 +292,16 @@ public enum PowersManager { //check for movement buffs while flying if(playerCharacter.isFlying()) { - for (ActionsBase ab : pb.getActions()) { - if (ab.stackType.equalsIgnoreCase("MoveBuff")) { - return true; + for(ActionsBase ab : pb.getActions()){ + for(AbstractEffectModifier mod1 : ab.getPowerAction().getEffectsBase().getModifiers()){ + if(mod1.modType.equals(ModType.Speed) && mod1.getPercentMod() > 0){ + return false; + } + } + for(AbstractEffectModifier mod2 : ab.getPowerAction().getEffectsBase2().getModifiers()){ + if(mod2.modType.equals(ModType.Speed) && mod2.getPercentMod() > 0){ + return false; + } } } } diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 6d2fb35f..f69c5d6d 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -500,6 +500,14 @@ public abstract class AbstractCharacter extends AbstractWorldObject { if (bonus != null && !bonus.getBool(ModType.NoMod, SourceType.Fly) && bonus.getBool(ModType.Fly, SourceType.None) && flyer.isAlive()) canFly = true; + + for(Effect eff : flyer.effects.values()){ + for(AbstractEffectModifier mod : eff.getEffectModifiers()){ + if(mod.modType.equals(ModType.Speed) && mod.getPercentMod() > 0){ + return false; + } + } + } if(bonus != null && bonus.getFloat(ModType.Speed,SourceType.BUFF) > 0){ return false; } diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 145f2449..03abf536 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4828,11 +4828,8 @@ public class PlayerCharacter extends AbstractCharacter { } if(this.isFlying()){ - if(this.getBonuses() != null){ - float speedMod = this.getBonuses().getFloatPercentPositive(ModType.Speed,SourceType.None); - if(speedMod > 0) { - GroundPlayer(this); - } + if (!AbstractCharacter.CanFly(this)) { + GroundPlayer(this); } }