/*
   Programmer: Kristoffer Larson
   Date: March , 2014
   
   Description: Checks the WayPoint for the PlayerBot
*/

import SimulationFramework.*;
import java.awt.Point;

public class CheckWayPoint {

   PlayerBot aBot;
   SimFrame s;
   String status;

   public CheckWayPoint(PlayerBot aBot, WayPoint aWayPoint, SimFrame s) {
      this.aBot = aBot;
      this.s = s;
      
      if (aWayPoint.getCityValue() > 0) {
         cityWP(aWayPoint);
      } else if (aWayPoint.getGold() > 0) {
         goldWP(aWayPoint);
      } else if ((aWayPoint.getMapX() > 0 || aWayPoint.getMapY() > 0)) {
         mapWP(aWayPoint);
      } else {
         normalWP(aWayPoint);
      }
   
   }//End SpotCheck() Constructor
   
   public void cityWP(WayPoint aWayPoint) {
      status = "City (" + (int)aWayPoint.getWX() + ", " + (int)aWayPoint.getWY() + ") $ " +
               aWayPoint.getCityValue() + ", Player " + aBot.getStrength() + " $ " +
               aBot.getWealth();
      s.statusReport(status);
   }
   
   public void goldWP(WayPoint aWayPoint) {
      status = "Gold (" + (int)aWayPoint.getWX() + ", " + (int)aWayPoint.getWY() + ") $ " +
               aWayPoint.getGold() + ", Player " + aBot.getStrength() + " $ " +
               aBot.getWealth();
      s.statusReport(status);
   }
   
   public void mapWP(WayPoint aWayPoint) {
      status = "Map (" + (int)aWayPoint.getWX() + ", " + (int)aWayPoint.getWY() + 
               ") Treasure (" + aWayPoint.getMapX() + ", " + aWayPoint.getMapY() 
               + ") Player " + aBot.getStrength() + " $ " + aBot.getWealth();
      s.statusReport(status);
   }
   
   public void normalWP(WayPoint aWayPoint) {
      status = "WayPoint (" + (int)aWayPoint.getWX() + ", " + (int)aWayPoint.getWX() +
               "), Player " + aBot.getStrength() + " $ " + aBot.getWealth();
      s.statusReport(status);
   }

}

@@ -216,16 +216,30 @@
 t aBot;%0A
+   Point end;%0A
    SimFr
@@ -307,28 +307,8 @@
 Bot,
- WayPoint aWayPoint,
  Sim
@@ -366,16 +366,120 @@
 ;%0A      
+end = aBot.getDest();%0A   %7D//End SpotCheck() Constructor%0A   %0A   public void checkWP(WayPoint aWayPoint) %7B
 %0A      i
@@ -541,32 +541,39 @@
 Point);%0A      %7D 
+%0A      
 else if (aWayPoi
@@ -624,24 +624,31 @@
 t);%0A      %7D 
+%0A      
 else if ((aW
@@ -735,16 +735,23 @@
       %7D 
+%0A      
 else %7B%0A 
@@ -794,42 +794,9 @@
 %0A   
-%0A   %7D//End SpotCheck() Constructor
+%7D
 %0A   
@@ -796,29 +796,30 @@
   %7D%0A   %0A   p
-ublic
+rivate
  void cityWP
@@ -934,38 +934,32 @@
  $ %22 +%0A         
-      
 aWayPoint.getCit
@@ -1013,38 +1013,32 @@
  $ %22 +%0A         
-      
 aBot.getWealth()
@@ -1061,32 +1061,219 @@
 Report(status);%0A
+      %0A      int c = aWayPoint.getCityValue();%0A      if (aBot.getWealth() %3E c) %7B%0A         aBot.setWealth(aBot.getWealth() - c);%0A         aBot.setStrength(aBot.getStrength() + c);%0A      %7D%0A
    %7D%0A   %0A   publ
@@ -1265,29 +1265,30 @@
   %7D%0A   %0A   p
-ublic
+rivate
  void goldWP
@@ -1411,22 +1411,16 @@
         
-      
 aWayPoin
@@ -1485,22 +1485,16 @@
         
-   
-   
 aBot.get
@@ -1532,39 +1532,234 @@
 status);%0A   
-%7D
+   
 %0A   
-%0A   public
+   if (aBot.getTMap()) %7B%0A         aBot.setTMap(false);%0A         aBot.setDest(end);%0A      %7D%0A%0A      aBot.setWealth(aBot.getWealth() + aWayPoint.getGold());%0A      aWayPoint.makeNormal();%0A   %7D%0A   %0A   private
  void mapWP(
@@ -1872,22 +1872,16 @@
         
-      
 %22) Treas
@@ -1948,22 +1948,16 @@
         
-   
-   
 + %22) Pla
@@ -2048,23 +2048,210 @@
 %0A   
-%7D%0A   %0A   public
+   %0A      if (!aBot.getTMap()) %7B%0A         aBot.setDest(new Point(aWayPoint.getMapX(), aWayPoint.getMapY()));%0A         aBot.setTMap(true);%0A      %7D%0A      %0A      aWayPoint.makeNormal();%0A   %7D%0A   %0A   private
  voi
@@ -2370,22 +2370,16 @@
 tWX() +%0A
-      
         

Update CheckWayPoint.java