@ -49,20 +49,21 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
@@ -49,20 +49,21 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
targetType = Enum . GameObjectType . values ( ) [ msg . getTargetType ( ) ] ;
if ( msg . getTargetType ( ) = = Enum . GameObjectType . Mob . ordinal ( ) ) {
switch ( targetType ) {
case Mob :
target = Mob . getMob ( msg . getTargetID ( ) ) ;
} else if ( msg . getTargetType ( ) = = Enum . GameObjectType . Building . ordinal ( ) ) {
break ;
case PlayerCharacter :
target = PlayerCharacter . getPlayerCharacter ( msg . getTargetID ( ) ) ;
break ;
case Building :
target = BuildingManager . getBuilding ( msg . getTargetID ( ) ) ;
Building targetBuilding = ( Building ) target ;
if ( ! targetBuilding . isVulnerable ( ) | | targetBuilding . getRank ( ) < 0 ) {
playerCharacter . setCombatTarget ( null ) ;
return true ;
}
} else if ( msg . getTargetType ( ) = = Enum . GameObjectType . PlayerCharacter . ordinal ( ) ) {
target = PlayerCharacter . getPlayerCharacter ( msg . getTargetID ( ) ) ;
} else {
playerCharacter . setCombatTarget ( null ) ;
return true ; //cannot attack other things
if ( ! targetBuilding . isVulnerable ( ) | | targetBuilding . getRank ( ) < 0 )
return true ; // cannot attack destroyed building or protected building
break ;
default :
return true ; //cannot attack anything other than the 3 above
}
if ( target = = null ) {