Browse Source

stealing from mobs works again

lakebane-strongholds
FatBoy-DOTC 2 months ago
parent
commit
00afe27900
  1. 36
      src/engine/gameManager/PowersManager.java
  2. 19
      src/engine/powers/poweractions/StealPowerAction.java

36
src/engine/gameManager/PowersManager.java

@ -432,15 +432,20 @@ public enum PowersManager {
float range = pb.getRange(); float range = pb.getRange();
// verify target is in range // verify target is in range
if(pb.token != 429396028) {
if (verifyInvalidRange(playerCharacter, target, range))
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
// TODO send message that target is out of range
return true;
// verify target is valid type
if (!validateTarget(target, playerCharacter, pb))
return true;
}else{
pb.isSpell = false;
}
if (verifyInvalidRange(playerCharacter, target, range))
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
// TODO send message that target is out of range
return true;
// verify target is valid type
if (!validateTarget(target, playerCharacter, pb))
return true;
if (AbstractWorldObject.IsAbstractCharacter(target)) if (AbstractWorldObject.IsAbstractCharacter(target))
@ -584,7 +589,9 @@ public enum PowersManager {
} }
// update cast (use skill) fail condition // update cast (use skill) fail condition
playerCharacter.cancelOnCast(); if(pb.token != 429396028) {
playerCharacter.cancelOnCast();
}
// update castSpell (use spell) fail condition if spell // update castSpell (use spell) fail condition if spell
if (pb.isSpell()) if (pb.isSpell())
@ -874,15 +881,16 @@ public enum PowersManager {
} }
float range = pb.getRange() + speedRange; float range = pb.getRange() + speedRange;
if(pb.token != 429396028) {
if (verifyInvalidRange(playerCharacter, mainTarget, range)) { if (verifyInvalidRange(playerCharacter, mainTarget, range)) {
sendPowerMsg(playerCharacter, 8, msg); sendPowerMsg(playerCharacter, 8, msg);
return; return;
}
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
// TODO send message that target is out of range
} }
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
// TODO send message that target is out of range
} }

19
src/engine/powers/poweractions/StealPowerAction.java

@ -78,7 +78,7 @@ public class StealPowerAction extends AbstractPowerAction {
@Override @Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) { protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source == null || awo == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) || !(awo.getObjectType().equals(Enum.GameObjectType.Item))) if (source == null || awo == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return; return;
PlayerCharacter sourcePlayer = (PlayerCharacter) source; PlayerCharacter sourcePlayer = (PlayerCharacter) source;
@ -131,8 +131,23 @@ public class StealPowerAction extends AbstractPowerAction {
//Handle target attacking back if in combat and has no other target //Handle target attacking back if in combat and has no other target
CombatManager.handleRetaliate(ownerAC, sourcePlayer); CombatManager.handleRetaliate(ownerAC, sourcePlayer);
} else } else if (owner.getObjectType().equals(Enum.GameObjectType.Mob)){
Mob ownerMob = (Mob) owner;
if (ownerMob.isSafeMode() || sourcePlayer.inSafeZone())
return;
if (ownerMob.getLoc().distanceSquared(sourcePlayer.getLoc()) > sqr(MBServerStatics.LOOT_RANGE))
return;
//mark thief and target as player aggressive
sourcePlayer.setLastPlayerAttackTime();
//Handle target attacking back if in combat and has no other target
CombatManager.handleRetaliate(ownerAC, sourcePlayer);
}else{
return; return;
}
ClientConnection origin = sourcePlayer.getClientConnection(); ClientConnection origin = sourcePlayer.getClientConnection();

Loading…
Cancel
Save