package gamecontrollers.rules.tileplacementrules;

/**
 * Created by jorgep on 4/15/14.
 */
public class LandTypeRestrictionsRule {

}

@@ -44,16 +44,200 @@
 rules;%0A%0A
+import models.board.TileComponentContent;%0Aimport models.board.TilePlacementVisitor;%0Aimport gamecontrollers.Message;%0Aimport gamecontrollers.commandcreator.TilePlacementCommandCreator;%0A%0A
 /**%0A * C
@@ -269,16 +269,17 @@
 14.%0A */%0A
+%0A
 public c
@@ -312,9 +312,1931 @@
 ule 
-%7B%0A
+extends TilePlacementRule %7B%0A%09/* This boolean array is used to determine the validity of Tile Placements as well%0A%09 * as how many action points it should cost to move from one TileComponent to another.%0A%09 * By convention:%0A%09 * %0A%09 * Village = 0%0A%09 * Rice = 1%0A%09 * Palace = 2%0A%09 * Irrigation = 3%0A%09 * %0A%09 * The position of the row represents the TileComponent that is being placed %0A%09 * on underneath (in the case of TilePlacement), or the first TileComponent in the case%0A%09 * of Developer movement. %0A%09 * %0A%09 * The position of the column represents the TileComponent that is being placed on top %0A%09 * (in the case of TilePlacement), or the second TileComponent in the case of Developer movement */%0A%09%0A%09public final boolean%5B%5D%5B%5D validityChecker = %7B%7Btrue, true, true, false%7D,%0A                      %09%09%09%09%09%09%09%09%09%09%09%09%7Btrue, true, false, false%7D,%0A                      %09%09%09%09%09%09%09%09%09%09%09%09%7Bfalse, false, true, false%7D,%0A                      %09%09%09%09%09%09%09%09%09%09   %09%7Bfalse, false, false, false%7D%7D;%0A                      %09%0A%09private TilePlacementCommandCreator tpc;%0A%09private Message message;%0A%09%0A%09public LandTypeRestrictionsRule(TilePlacementCommandCreator tpc) %7B%0A%09  this.tpc = tpc;%0A%09%7D%0A%09%0A%09@Override%0A%09public void update() %7B%0A%09%09TilePlacementVisitor tpvUnder = new TilePlacementVisitor();%0A%09%09TilePlacementVisitor tpvTop = new TilePlacementVisitor();%0A%09%09%0A%09%09TileComponentContent under = tpc.getCurrentSpace().getTile().getTileComponentContent();%0A%09%09TileComponentContent top = tpc.getCurrentTile().getTileComponentContent();%0A%09%09%0A%09%09under.accept(tpvUnder);%0A%09%09top.accept(tpvUnder);%0A%0A%09%09setValidity(validityChecker%5BtpvUnder.getValue()%5D%5BtpvTop.getValue()%5D);%0A%09%09%0A%09%09TileComponentContent%5B%5D tileComponentArray = %7Bunder, top%7D;%0A%09%09%0A%09%09if (!this.getValidity()) %7B%0A%09%09%09message = new Message(%22Not allowed to place a %25s on a &s%22, tileComponentArray, true);%0A%09%09%7D%0A%09%09%0A%09%09else %7B%0A%09%09%09message = new Message(%22Tile placed successfully%22, false);%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09public Message getErrorMessage() %7B%0A%09%09return message;%0A%09%7D
 %0A%7D%0A

Update LandTypeRestrictionsRule.java