package src.view;

import java.util.Scanner;
import src.controller.AreaEffectItem;

import src.controller.Avatar;
import src.controller.Item;
import src.controller.Terrain;
import src.model.MapMain_Relation;

public class TestingMain {

    public TestingMain() {
        // TODO Auto-generated constructor stub
    }

    /**
     * @param args
     */
    public static void printArray(Viewport view) {
        char[][] in = view.getContents();
        for (int j = 0; j != view.height_; ++j) {
            for (int i = 0; i != view.width_; ++i) {
                {
                    System.out.print(in[i][j]);
                }
            }
            System.out.println();
        }
    }

    public static void oldtest() {
        MapMain_Relation mmr_ = new MapMain_Relation();
        mmr_.bindToNewMapOfSize(Viewport.width_, Viewport.height_); //Can change these later if we so desire. 
        Avatar avatar = new Avatar("avatar", 'x', 0, 0);
        avatar.setMap(mmr_);
        ViewPortTester Tester = new ViewPortTester();
        printArray(Tester);
        System.out.println("Done with viewportTester, ccviewtime!");
        Display _display = new Display(new AvatarCreationView(avatar));
        _display.printView();
    }

    public static void main(String[] args) {
        MapMain_Relation mmr_ = new MapMain_Relation();
        mmr_.bindToNewMapOfSize(Viewport.width_ / 2, Viewport.height_); //Can change these later if we so desire. 
        Avatar avatar = new Avatar("avatar", '☃', 0, 0);
        avatar.setMap(mmr_);
        Item equipable = new Item("☂", '☂', true, true, false);
        mmr_.addItem(equipable, 5, 5); // ▨
        for (int y = 0; y < Viewport.height_; ++y) {
            for (int x = 0; x < Viewport.width_ / 2; ++x) {
                Terrain obstacle = new Terrain("land", '▨', false, false);
                if (y == 4) {
                    if (x == 2) {
                        obstacle.addDecal('☠');
                    } else if (x == 6) {
                        obstacle.addDecal('★');
                    } else if (x == 9) {
                        obstacle.addDecal('✚');
                    }
                }
                mmr_.addTerrain(obstacle, x, y);
            }
        }
            // String name, char representation, boolean is_passable,
        // boolean goes_in_inventory, boolean is_one_shot, Effect effect, int power
        AreaEffectItem inflict_pain = new AreaEffectItem("inflict_pain", '♨', true, false,
                true, AreaEffectItem.Effect.HURT, 10);
        mmr_.addItem(inflict_pain, 8, 3);
        
        AreaEffectItem area_heal = new AreaEffectItem("area_heal", '♥', true, false,
                true, AreaEffectItem.Effect.HURT, 10);
        mmr_.addItem(area_heal, 9, 9);
        
        AreaEffectItem area_kill = new AreaEffectItem("area_kill", '☣', true, false,
                true, AreaEffectItem.Effect.HURT, 10);
        mmr_.addItem(area_kill, 2, 4);
        
        AreaEffectItem area_level = new AreaEffectItem("area_level", '↑', true, false,
                true, AreaEffectItem.Effect.HURT, 10);
        mmr_.addItem(area_level, 7, 1);
        
        Display _display = new Display(avatar.getMyView());
        _display.printView();
        Terrain obstacle = new Terrain("boulder", '■', true, false);
        mmr_.addTerrain(obstacle, 2, 2);
        System.out.println("☠ and ★ and ✚");
        Display.setMessage("test", 3);
        Scanner sc = new Scanner(System.in);
        while (true) {
            char c;
            c = sc.next().charAt(0);
            if (c == '5') {
                return;
            }
            avatar.getInput(c);
            _display.setView(avatar.getMyView());
            _display.printView();

        }

    }

}

@@ -107,16 +107,56 @@
 Avatar;%0A
+import src.controller.AvatarController;%0A
 import s
@@ -2725,35 +2725,36 @@
                 
-tru
+fals
 e, AreaEffectIte
@@ -3479,17 +3479,16 @@
 (%22test%22,
- 
 3);%0A    
@@ -3495,318 +3495,185 @@
     
-Scanner sc
+AvatarController AC
  = new 
-Scanner(System.in);%0A        while (true) %7B%0A            char c;%0A            c = sc.next().charAt(0);%0A            if (c == '5') %7B%0A                return;%0A            %7D%0A            avatar.getInput(c);%0A            _display.setView(avatar.getMyView());%0A            _display.printView();%0A%0A        %7D%0A
+AvatarController(avatar);%0A        try %7B%0A%09%09%09AC.runTheGame();%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09// TODO Auto-generated catch block%0A%09%09%09e.printStackTrace();%0A%09%09%7D
 %0A   

Print stuff changed