/*
 * The MIT License
 *
 * Copyright 2015 Joshua.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package net.ae97.notlet.entity;

import net.ae97.notlet.Direction;
import net.ae97.notlet.Location;
import net.ae97.notlet.server.level.Level;

public class Arrow extends Entity {

    private final Direction direction;

    public Arrow(Location loc, int hp, Direction direction) {
        super(loc, hp, 0, "arrow", 0.07, 32);
        this.direction = direction;
    }

    @Override
    public void processTick(Level level) {
        Location old = getLocation();
        Location newLocation = old;
        switch (direction) {
            case LEFT:
                newLocation = new Location(old.getX() - 16, old.getY());
                break;
            case RIGHT:
                newLocation = new Location(old.getX() + 16, old.getY());
                break;
            case UP:
                newLocation = new Location(old.getX() - 16, old.getY());
                break;
            case DOWN:
                newLocation = new Location(old.getX() - 16, old.getY());
                break;
        }
        setLocation(newLocation);
    }

}

@@ -1342,16 +1342,51 @@
 rection;
+%0A    private final int damage = 10;
 %0A%0A    pu
@@ -1413,16 +1413,8 @@
 loc,
- int hp,
  Dir
@@ -1456,10 +1456,9 @@
 oc, 
-hp
+1
 , 0,
@@ -2200,16 +2200,369 @@
 ation);%0A
+        if (!level.isPassable(newLocation)) %7B%0A            level.killEntity(this);%0A        %7D%0A        for (Entity en : level.getEntities()) %7B%0A            if (en == this) %7B%0A                continue;%0A            %7D%0A            if (en.hasCollidedWith(this)) %7B%0A                en.damage(damage);%0A                level.killEntity(this);%0A            %7D%0A        %7D%0A
     %7D%0A%0A%7D

Add arrow damage