From 02d524663aef73f34de754b813405ceb0a461090 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 13 Jun 2024 20:14:43 -0500 Subject: [PATCH] fixed a lore issue in powers manager --- src/engine/gameManager/PowersManager.java | 21 +++++++++++++++++++-- src/engine/powers/PowersBase.java | 4 ++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index a10a14fa..59901a99 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -176,12 +176,29 @@ public enum PowersManager { PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID()); PlayerCharacter caster = origin.getPlayerCharacter(); PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID()); - if (pb != null && pb.isHarmful == false) { + if (pb != null && pb.enforceLore()) { //if (caster.guild.equals(Guild.getErrantGuild())) // return; - if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false && target.getObjectType().equals(GameObjectType.Building) == false) + if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false && target.getObjectType().equals(GameObjectType.Building) == false) { + RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID()); + Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg); + DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY); + + // Send Fail to cast message + PlayerCharacter pc = SessionManager + .getPlayerCharacter(origin); + + if (pc != null) { + sendPowerMsg(pc, 2, msg); + if (pc.isCasting()) { + pc.update(); + } + + pc.setIsCasting(false); + } return; + } } } diff --git a/src/engine/powers/PowersBase.java b/src/engine/powers/PowersBase.java index efd5af71..902c6d14 100644 --- a/src/engine/powers/PowersBase.java +++ b/src/engine/powers/PowersBase.java @@ -633,4 +633,8 @@ public class PowersBase { return description; } + public boolean enforceLore(){ + return this.powerCategory.equals(PowerCategoryType.SUMMON) || this.powerCategory.equals(PowerCategoryType.HEAL)|| this.powerCategory.equals(PowerCategoryType.BUFF); + } + }