From 56f3dfce925decd855403324e9721107b2bf2905 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 29 Aug 2024 20:36:22 -0500 Subject: [PATCH] no movement buffs while flying, cannot fly if you have a movement buff applied --- src/engine/gameManager/PowersManager.java | 12 ++++++++++++ src/engine/objects/AbstractCharacter.java | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 297dbb10..d31d04f8 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -8,6 +8,7 @@ package engine.gameManager; +import com.sun.corba.se.spi.orbutil.fsm.ActionBase; import engine.Enum.*; import engine.InterestManagement.HeightMap; import engine.InterestManagement.WorldGrid; @@ -27,6 +28,7 @@ import engine.net.client.ClientConnection; import engine.net.client.msg.*; import engine.objects.*; import engine.powers.*; +import engine.powers.effectmodifiers.AbstractEffectModifier; import engine.powers.poweractions.AbstractPowerAction; import engine.powers.poweractions.TrackPowerAction; import engine.server.MBServerStatics; @@ -276,6 +278,7 @@ public enum PowersManager { // get power PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID()); + if (pb == null) { ChatManager.chatSayInfo(playerCharacter, "This power is not implemented yet."); @@ -287,6 +290,15 @@ public enum PowersManager { // return false; } + //check for movement buffs while flying + if(playerCharacter.isFlying()) { + for (ActionsBase ab : pb.getActions()) { + if (ab.stackType.equalsIgnoreCase("MoveBuff")) { + PlayerCharacter.GroundPlayer(playerCharacter); + } + } + } + if (playerCharacter.getLastPower() != null) return true; diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 21a5f3b4..2a481423 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -31,6 +31,7 @@ import engine.net.ByteBufferWriter; import engine.net.DispatchMessage; import engine.net.client.msg.UpdateStateMsg; import engine.powers.EffectsBase; +import engine.powers.effectmodifiers.AbstractEffectModifier; import engine.server.MBServerStatics; import org.pmw.tinylog.Logger; @@ -499,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)){ + canFly = false; + } + } + } + return canFly; }