From 3ed0765fe5b7e6edf7ecec649f4cf0171ea5d3af Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 8 Sep 2024 17:04:25 -0500 Subject: [PATCH] flying while having move buff fix --- src/engine/gameManager/PowersManager.java | 46 +++++++++++++++-------- src/engine/objects/PlayerCharacter.java | 2 +- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 597e6510..9245f433 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -295,22 +295,36 @@ public enum PowersManager { } //check for movement buffs while flying - //if(playerCharacter.isFlying()) { - // for(ActionsBase ab : pb.getActions()){ - // for(AbstractEffectModifier mod1 : ab.getPowerAction().getEffectsBase().getModifiers()){ - // if(mod1.modType.equals(ModType.Speed) && mod1.getPercentMod() > 0){ - // ChatManager.chatSystemInfo(playerCharacter, "You Cannot Fly While Having A MovementBuff"); - // return true; - // } - // } - // for(AbstractEffectModifier mod2 : ab.getPowerAction().getEffectsBase2().getModifiers()){ - // if(mod2.modType.equals(ModType.Speed) && mod2.getPercentMod() > 0){ - // ChatManager.chatSystemInfo(playerCharacter, "You Cannot Fly While Having A MovementBuff"); - // return true; - // } - // } - // } - //} + if(playerCharacter.isFlying()) { + for(ActionsBase ab : pb.getActions()){ + for(AbstractEffectModifier mod1 : ab.getPowerAction().getEffectsBase().getModifiers()){ + if(mod1.modType.equals(ModType.Speed) && mod1.getPercentMod() > 0){ + ChatManager.chatSystemInfo(playerCharacter, "You Cannot Fly While Having A MovementBuff"); + //refund stamina + float amount = playerCharacter.getStamina() + pb.cost; + playerCharacter.setStamina(amount, playerCharacter); + + // Update all surrounding clients. + TargetedActionMsg cmm = new TargetedActionMsg(playerCharacter); + DispatchMessage.dispatchMsgToInterestArea(playerCharacter, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); + return true; + } + } + for(AbstractEffectModifier mod2 : ab.getPowerAction().getEffectsBase2().getModifiers()){ + if(mod2.modType.equals(ModType.Speed) && mod2.getPercentMod() > 0){ + ChatManager.chatSystemInfo(playerCharacter, "You Cannot Fly While Having A MovementBuff"); + //refund stamina + float amount = playerCharacter.getStamina() + pb.cost; + playerCharacter.setStamina(amount, playerCharacter); + + // Update all surrounding clients. + TargetedActionMsg cmm = new TargetedActionMsg(playerCharacter); + DispatchMessage.dispatchMsgToInterestArea(playerCharacter, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); + return true; + } + } + } + } if (playerCharacter.getLastPower() != null) return true; diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 45f5b9fd..f3412d7f 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4895,7 +4895,7 @@ public class PlayerCharacter extends AbstractCharacter { if(this.isFlying()){ if (!AbstractCharacter.CanFly(this)) { GroundPlayer(this); - ChatManager.chatSystemInfo(this, "You Cannot Fly While Having A MovementBuff"); + //ChatManager.chatSystemInfo(this, "You Cannot Fly While Having A MovementBuff"); } }