Browse Source

can block spells

lakebane-ai
FatBoy-DOTC 3 weeks ago
parent
commit
c391272e5b
  1. 124
      src/engine/objects/PlayerCharacter.java

124
src/engine/objects/PlayerCharacter.java

@ -5114,84 +5114,88 @@ public class PlayerCharacter extends AbstractCharacter {
if(!newSystem) if(!newSystem)
return; return;
try {
if (this.updateLock.writeLock().tryLock()) { if (this.updateLock.writeLock().tryLock()) {
try { try {
if (!this.isAlive() && this.isEnteredWorld()) { if (!this.isAlive() && this.isEnteredWorld()) {
if(!this.timestamps.containsKey("DeathTime")){ if (!this.timestamps.containsKey("DeathTime")) {
this.timestamps.put("DeathTime",System.currentTimeMillis()); this.timestamps.put("DeathTime", System.currentTimeMillis());
}else if((System.currentTimeMillis() - this.timestamps.get("DeathTime")) > 600000) } else if ((System.currentTimeMillis() - this.timestamps.get("DeathTime")) > 600000)
forceRespawn(this); forceRespawn(this);
return; return;
} }
this.updateLocation(); this.updateLocation();
if(this.isAlive() && this.isActive && this.enteredWorld) { if (this.isAlive() && this.isActive && this.enteredWorld) {
this.updateMovementState(); this.updateMovementState();
if (this.combatStats == null) { if (this.combatStats == null) {
this.combatStats = new PlayerCombatStats(this); this.combatStats = new PlayerCombatStats(this);
} else { } else {
this.combatStats.update(); this.combatStats.update();
}
this.doRegen();
} }
this.doRegen();
}
if (this.getStamina() < 10) { if (this.getStamina() < 10) {
if (this.getAltitude() > 0 || this.getDesiredAltitude() > 0) { if (this.getAltitude() > 0 || this.getDesiredAltitude() > 0) {
PlayerCharacter.GroundPlayer(this); PlayerCharacter.GroundPlayer(this);
}
} }
}
RealmMap.updateRealm(this);
this.updateBlessingMessage();
this.safeZone = this.isInSafeZone(); RealmMap.updateRealm(this);
if(!this.timestamps.containsKey("nextBoxCheck")) this.updateBlessingMessage();
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
if(!this.isBoxed && this.timestamps.get("nextBoxCheck") < System.currentTimeMillis()) { this.safeZone = this.isInSafeZone();
this.isBoxed = checkIfBoxed(this); if (!this.timestamps.containsKey("nextBoxCheck"))
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000); this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
}
if(this.level < 10 && this.enteredWorld) { if (!this.isBoxed && this.timestamps.get("nextBoxCheck") < System.currentTimeMillis()) {
while (this.level < 10) { this.isBoxed = checkIfBoxed(this);
grantXP(Experience.getBaseExperience(this.level + 1) - this.exp); this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
} }
}
if(this.isBoxed && !this.containsEffect(1672601862)) { if (this.level < 10 && this.enteredWorld) {
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); while (this.level < 10) {
} grantXP(Experience.getBaseExperience(this.level + 1) - this.exp);
}
}
if(this.isFlying()){ if (this.isBoxed && !this.containsEffect(1672601862)) {
if(this.effects.containsKey("MoveBuff")){ PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
GroundPlayer(this);
} }
if(!this.timestamps.containsKey("StunGrounded"))
this.timestamps.put("StunGrounded",System.currentTimeMillis() - 1000L); if (this.isFlying()) {
if(this.bonuses.getBool(ModType.Stunned, SourceType.None) && this.timestamps.get("StunGrounded") < System.currentTimeMillis()){ if (this.effects.containsKey("MoveBuff")) {
boolean isFlyMoving = this.getDesiredAltitude() != this.altitude; GroundPlayer(this);
if(!isFlyMoving && this.bonuses.getBool(ModType.Stunned, SourceType.None)){ }
this.setDesiredAltitude(this.altitude - 10); if (!this.timestamps.containsKey("StunGrounded"))
this.setTakeOffTime(System.currentTimeMillis()); this.timestamps.put("StunGrounded", System.currentTimeMillis() - 1000L);
if (this.bonuses.getBool(ModType.Stunned, SourceType.None) && this.timestamps.get("StunGrounded") < System.currentTimeMillis()) {
ChangeAltitudeMsg msg = new ChangeAltitudeMsg(this.getObjectType().ordinal(), this.getObjectUUID(), false, this.getAltitude(), this.getDesiredAltitude(), this.getAltitude()); boolean isFlyMoving = this.getDesiredAltitude() != this.altitude;
// force a landing if (!isFlyMoving && this.bonuses.getBool(ModType.Stunned, SourceType.None)) {
DispatchMessage.dispatchMsgToInterestArea(this, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); this.setDesiredAltitude(this.altitude - 10);
this.timestamps.put("StunGrounded",System.currentTimeMillis() + 1500L); this.setTakeOffTime(System.currentTimeMillis());
ChatManager.chatSystemInfo(this,"Applying 1 Tier Ground");
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) {
Logger.error(e);
} finally {
this.updateLock.writeLock().unlock();
} }
} catch (Exception e) {
Logger.error(e);
} finally {
this.updateLock.writeLock().unlock();
} }
}catch(Exception e){
Logger.error("UPDATE ISSUE: " + e);
} }
} }
public static void unboxPlayer(PlayerCharacter player){ public static void unboxPlayer(PlayerCharacter player){

Loading…
Cancel
Save