From f96d0caf3c9ac536c47096a6b2b1d87801b482c4 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 9 Jan 2025 18:22:57 -0600 Subject: [PATCH] stun grounds 1 tier per 1.5 seconds of stunned --- src/engine/objects/PlayerCharacter.java | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index b4a2387e..b93bd07c 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4914,15 +4914,22 @@ public class PlayerCharacter extends AbstractCharacter { GroundPlayer(this); //ChatManager.chatSystemInfo(this, "You Cannot Fly While Having A MovementBuff"); } - if(this.getDesiredAltitude() == this.getAltitude() && this.bonuses.getBool(ModType.Stunned, SourceType.None)){ - this.setAltitude(this.getAltitude()); - this.setDesiredAltitude(this.getAltitude() - 10); - this.setTakeOffTime(System.currentTimeMillis()); - - ChangeAltitudeMsg msg = new ChangeAltitudeMsg(this.getObjectType().ordinal(), this.getObjectUUID(), false, this.getAltitude(), this.getDesiredAltitude(), this.getAltitude()); - // force a landing - DispatchMessage.dispatchMsgToInterestArea(this, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); + if(!this.timestamps.containsKey("StunGrounded")) + this.timestamps.put("StunGrounded",System.currentTimeMillis() - 1000L); + if(this.bonuses.getBool(ModType.Stunned, SourceType.None) && this.timestamps.get("StunGrounded") < System.currentTimeMillis()){ + boolean isFlyMoving = this.getDesiredAltitude() != this.altitude; + if(!isFlyMoving && this.bonuses.getBool(ModType.Stunned, SourceType.None)){ + this.setDesiredAltitude(this.altitude - 10); + this.setTakeOffTime(System.currentTimeMillis()); + + ChangeAltitudeMsg msg = new ChangeAltitudeMsg(this.getObjectType().ordinal(), this.getObjectUUID(), false, this.getAltitude(), this.getDesiredAltitude(), this.getAltitude()); + // force a landing + DispatchMessage.dispatchMsgToInterestArea(this, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); + this.timestamps.put("StunGrounded",System.currentTimeMillis() + 1500L); + ChatManager.chatSystemInfo(this,"Applying 1 Tier Ground"); + } } + } } catch (Exception e) {