Browse Source

PVE flag

lakebane
FatBoy-DOTC 4 weeks ago
parent
commit
3e04f36fd7
  1. 26
      src/engine/gameManager/PowersManager.java
  2. 14
      src/engine/powers/ActionsBase.java

26
src/engine/gameManager/PowersManager.java

@ -28,7 +28,6 @@ import engine.net.client.ClientConnection; @@ -28,7 +28,6 @@ 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;
@ -170,25 +169,6 @@ public enum PowersManager { @@ -170,25 +169,6 @@ public enum PowersManager {
if(pc == null)
return;
if(pc.isBoxed){
AbstractWorldObject tar = getTarget(msg);
if(tar != null && tar.getObjectType().equals(GameObjectType.PlayerCharacter) && !tar.equals(pc)) {
RecyclePowerMsg rpm = new RecyclePowerMsg(msg.getPowerUsedID());
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), rpm);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
// Send Fail to cast message
sendPowerMsg(pc, 2, msg);
if (pc.isCasting()) {
pc.update(false);
}
pc.setIsCasting(false);
ChatManager.chatSystemInfo(pc, " You Are PvE Flagged: Cannot Attack Players.");
return;
}
}
if(!pc.isFlying() && powersBaseByToken.get(msg.getPowerUsedID()) != null && powersBaseByToken.get(msg.getPowerUsedID()).isSpell) //cant be sitting if flying
CombatManager.toggleSit(false,origin);
@ -1125,7 +1105,7 @@ public enum PowersManager { @@ -1125,7 +1105,7 @@ public enum PowersManager {
continue;
// If something blocks the action, then stop
if (ab.blocked(target, pb, trains)) {
if (ab.blocked(target, pb, trains, null)) {
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
continue;
@ -1312,7 +1292,7 @@ public enum PowersManager { @@ -1312,7 +1292,7 @@ public enum PowersManager {
continue;
// If something blocks the action, then stop
if (ab.blocked(target, pb, trains))
if (ab.blocked(target, pb, trains, null))
continue;
// TODO handle overwrite stack order here
String stackType = ab.getStackType();
@ -1947,7 +1927,7 @@ public enum PowersManager { @@ -1947,7 +1927,7 @@ public enum PowersManager {
if (trains < ab.getMinTrains() || trains > ab.getMaxTrains())
continue;
// If something blocks the action, then stop
if (ab.blocked(target, pb, trains))
if (ab.blocked(target, pb, trains, null))
// sendPowerMsg(pc, 5, msg);
continue;
// TODO handle overwrite stack order here

14
src/engine/powers/ActionsBase.java

@ -238,8 +238,18 @@ public class ActionsBase { @@ -238,8 +238,18 @@ public class ActionsBase {
}
//Add blocked types here
public boolean blocked(AbstractWorldObject awo, PowersBase pb, int trains) {
public boolean blocked(AbstractWorldObject awo, PowersBase pb, int trains, AbstractCharacter source) {
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter target = (AbstractCharacter) awo;
if(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
PlayerCharacter pc = (PlayerCharacter) source;
if(target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
if(pc.isBoxed && pc.getObjectUUID() != target.getObjectUUID()){
return true;
}
}
}
}
if(pb.isChant)
return false;

Loading…
Cancel
Save