Browse Source

TargetType declared.

combat-2
MagicBot 1 year ago
parent
commit
fb87dfd91e
  1. 10
      src/engine/net/client/handlers/AttackCmdMsgHandler.java

10
src/engine/net/client/handlers/AttackCmdMsgHandler.java

@ -12,7 +12,6 @@ import engine.objects.AbstractWorldObject;
import engine.objects.Building; import engine.objects.Building;
import engine.objects.Mob; import engine.objects.Mob;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
import org.pmw.tinylog.Logger;
/* /*
* @Author: * @Author:
@ -46,13 +45,16 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
return true; return true;
AbstractWorldObject target; AbstractWorldObject target;
Enum.GameObjectType targetType;
if(msg.getTargetType() == Enum.GameObjectType.Mob.ordinal()){ targetType = Enum.GameObjectType.values()[msg.getTargetType()];
if (msg.getTargetType() == Enum.GameObjectType.Mob.ordinal()) {
target = Mob.getMob(msg.getTargetID()); target = Mob.getMob(msg.getTargetID());
} else if(msg.getTargetType() == Enum.GameObjectType.Building.ordinal()){ } else if (msg.getTargetType() == Enum.GameObjectType.Building.ordinal()) {
target = BuildingManager.getBuilding(msg.getTargetID()); target = BuildingManager.getBuilding(msg.getTargetID());
Building targetBuilding = (Building) target; Building targetBuilding = (Building) target;
if(!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0) { if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0) {
playerCharacter.setCombatTarget(null); playerCharacter.setCombatTarget(null);
return true; return true;
} }

Loading…
Cancel
Save