Browse Source

stealing from mobs works again

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

14
src/engine/gameManager/PowersManager.java

@ -432,15 +432,20 @@ public enum PowersManager { @@ -432,15 +432,20 @@ public enum PowersManager {
float range = pb.getRange();
// 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
// verify target is valid type
if (!validateTarget(target, playerCharacter, pb))
return true;
}else{
pb.isSpell = false;
}
if (AbstractWorldObject.IsAbstractCharacter(target))
@ -584,7 +589,9 @@ public enum PowersManager { @@ -584,7 +589,9 @@ public enum PowersManager {
}
// update cast (use skill) fail condition
if(pb.token != 429396028) {
playerCharacter.cancelOnCast();
}
// update castSpell (use spell) fail condition if spell
if (pb.isSpell())
@ -874,6 +881,7 @@ public enum PowersManager { @@ -874,6 +881,7 @@ public enum PowersManager {
}
float range = pb.getRange() + speedRange;
if(pb.token != 429396028) {
if (verifyInvalidRange(playerCharacter, mainTarget, range)) {
@ -882,7 +890,7 @@ public enum PowersManager { @@ -882,7 +890,7 @@ public enum PowersManager {
}
// (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 { @@ -78,7 +78,7 @@ public class StealPowerAction extends AbstractPowerAction {
@Override
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;
PlayerCharacter sourcePlayer = (PlayerCharacter) source;
@ -131,8 +131,23 @@ public class StealPowerAction extends AbstractPowerAction { @@ -131,8 +131,23 @@ public class StealPowerAction extends AbstractPowerAction {
//Handle target attacking back if in combat and has no other target
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;
}
ClientConnection origin = sourcePlayer.getClientConnection();

Loading…
Cancel
Save