forked from MagicBane/Server
PvE flagged system
This commit is contained in:
@@ -101,6 +101,10 @@ public enum CombatManager {
|
||||
|
||||
public static void AttackTarget(PlayerCharacter playerCharacter, AbstractWorldObject target) {
|
||||
|
||||
if(playerCharacter != null && playerCharacter.isBoxed)
|
||||
if(target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
return;
|
||||
|
||||
boolean swingOffhand = false;
|
||||
|
||||
//check my weapon can I do an offhand attack
|
||||
|
||||
@@ -173,8 +173,7 @@ public enum PowersManager {
|
||||
if(!pc.isFlying() && powersBaseByToken.get(msg.getPowerUsedID()) != null && powersBaseByToken.get(msg.getPowerUsedID()).isSpell) //cant be sitting if flying
|
||||
CombatManager.toggleSit(false,origin);
|
||||
|
||||
if(pc.isMoving())
|
||||
pc.stopMovement(pc.getMovementLoc());
|
||||
|
||||
if(msg.getPowerUsedID() != 421084024 && origin.getPlayerCharacter().getPromotionClassID() != 2513) {
|
||||
if (!origin.getPlayerCharacter().getPowers().containsKey(msg.getPowerUsedID())) {
|
||||
Logger.error(origin.getPlayerCharacter().getFirstName() + " attempted to cast a power they do not have");
|
||||
@@ -1094,7 +1093,7 @@ public enum PowersManager {
|
||||
continue;
|
||||
// If something blocks the action, then stop
|
||||
|
||||
if (ab.blocked(target, pb, trains)) {
|
||||
if (ab.blocked(target, pb, trains,playerCharacter)) {
|
||||
|
||||
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
|
||||
continue;
|
||||
@@ -1281,7 +1280,7 @@ public enum PowersManager {
|
||||
continue;
|
||||
// If something blocks the action, then stop
|
||||
|
||||
if (ab.blocked(target, pb, trains))
|
||||
if (ab.blocked(target, pb, trains,caster))
|
||||
continue;
|
||||
// TODO handle overwrite stack order here
|
||||
String stackType = ab.getStackType();
|
||||
@@ -1900,7 +1899,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,ac))
|
||||
// sendPowerMsg(pc, 5, msg);
|
||||
continue;
|
||||
// TODO handle overwrite stack order here
|
||||
|
||||
@@ -5145,9 +5145,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
@Override
|
||||
public void update(Boolean newSystem) {
|
||||
|
||||
if(!newSystem)
|
||||
this.updateLocation();
|
||||
|
||||
this.updateLocation();
|
||||
this.updateMovementState();
|
||||
|
||||
if(!newSystem)
|
||||
@@ -5198,8 +5196,11 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isBoxed && !this.containsEffect(1672601862)) {
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
if (this.isBoxed && !this.containsEffect(-654906771)) {
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, -935138707, 40, false);
|
||||
}else if(!this.isBoxed && this.containsEffect(-654906771)){
|
||||
this.effects.remove("PvE-Flagged");
|
||||
this.effects.remove("1258");
|
||||
}
|
||||
}
|
||||
if (this.isFlying()) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
package engine.powers;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.ModType;
|
||||
import engine.Enum.SourceType;
|
||||
import engine.Enum.StackType;
|
||||
@@ -237,32 +238,72 @@ 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(!pb.getName().contains("Summon")) {
|
||||
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;
|
||||
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
|
||||
AbstractCharacter ac = (AbstractCharacter) awo;
|
||||
if(ac.effects.containsKey(this.stackType)) {
|
||||
Boolean sameRank = false;
|
||||
Effect eff = ac.effects.get(this.stackType);
|
||||
String currentEffect = eff.getEffectsBase().getIDString();
|
||||
String newEffect = this.effectID;
|
||||
if (currentEffect.equals(newEffect) && !this.stackType.equals("Stun"))
|
||||
return false;
|
||||
if (eff != null) {
|
||||
for (ActionsBase action : eff.getPower().getActions()) {
|
||||
if (this.stackType.equals(action.stackType) && this.stackOrder == action.stackOrder) {
|
||||
if (this.stackType.equals("NoStun")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (sameRank) {
|
||||
if (this.greaterThan && trains <= eff.getTrains())
|
||||
return true;
|
||||
if (this.greaterThanEqual && trains < eff.getTrains())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PlayerBonuses bonus = ac.getBonuses();
|
||||
if (bonus == null)
|
||||
return false;
|
||||
|
||||
//TODO make this more efficient then testing strings
|
||||
if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.Stun))
|
||||
return true; //Currently stun immune. Skip stun
|
||||
else if (this.stackType.equals("Snare") && bonus.getBool(ModType.ImmuneTo, SourceType.Snare))
|
||||
return true; //Currently snare immune. Skip snare
|
||||
else if (this.stackType.equals("Blindness") && bonus.getBool(ModType.ImmuneTo, SourceType.Blind))
|
||||
return true; //Currently blind immune. Skip blind
|
||||
else if (this.stackType.equals("PowerInhibitor") && bonus.getBool(ModType.ImmuneTo, SourceType.Powerblock))
|
||||
return true; //Currently power block immune. Skip power block
|
||||
else if (this.stackType.equals("Root") && bonus.getBool(ModType.ImmuneTo, SourceType.Root))
|
||||
SourceType sourceType = null;
|
||||
try {
|
||||
sourceType = SourceType.GetSourceType(this.stackType);
|
||||
}catch(Exception ignored){
|
||||
}
|
||||
if(sourceType != null && (bonus.getBool(ModType.ImmuneTo,sourceType) || bonus.getBool(ModType.NoMod,sourceType)))
|
||||
return true;
|
||||
// else if (pb.isHeal() && (bonus.getByte("immuneTo.Heal")) >= trains)
|
||||
// return true; //Currently shadowmantled. Skip heals
|
||||
else if (this.stackType.equals("Flight") && bonus.getBool(ModType.NoMod, SourceType.Fly))
|
||||
if(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter)ac;
|
||||
if(this.stackType.equals("Blindness") && pc.getRace().getName().contains("Shade"))
|
||||
return true;
|
||||
if(this.stackType.equals("Stun") && pc.getRace().getName().contains("Minotaur"))
|
||||
return true;
|
||||
}
|
||||
if(this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo,SourceType.Stun))
|
||||
return true;
|
||||
else if (this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None))
|
||||
if(pb.vampDrain() && bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN))
|
||||
return true;
|
||||
if (this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None))
|
||||
return true;
|
||||
if (this.stackType.equals("PowerInhibitor") && bonus.getBool(ModType.ImmuneTo, SourceType.Powerblock))
|
||||
return true;
|
||||
else
|
||||
return pb.vampDrain() && bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user