/*
 * The MIT License
 *
 * Copyright 2016 MrMcX.
 *
 * 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 dungeon;

import util.Dice;

/**
 * Stores information about enemies
 * @author MrMcX
 */
public class Enemy{
    private String enemy;
    
    /**
     * Constructs a new random enemy in a given type of room
     * @param type type of environment
     */
    public Enemy(Dungeon.Type type){
        enemy = "";
        if(Dungeon.Natural(type)){
            switch(Dice.Roll(20, 1)){
                case 1: 
                    enemy = "Höhlendrache";
                    break;
                case 2: 
                case 3:
                case 4:
                case 5: 
                    enemy = "verirrter Goblin";
                    break;
                case 6:
                case 7: 
                    enemy = "Gruftassel";
                    break;
                case 8: 
                    enemy = "Glutling";
                    break;
                case 9:
                case 10: 
                    enemy = "Höhlenspinne";
                    break;
                case 11: 
                    enemy = Dice.Roll(20, 5) + " Fledermäuse";
                    break;
                case 12: 
                    enemy = "Höhlenoger";
                    break;
                case 13:
                case 14:
                case 15:
                case 16: 
                    enemy = Dice.Roll(6, 1)*Dice.Roll(20, 1) + " Ratten";
                    break;
                case 17: 
                    enemy = "Riesenamöbe";
                    break;
                case 18: 
                    enemy = Dice.Roll(6, 1) + " Skelette";
                    break;
                case 19: 
                    enemy = "Geistererscheinung eines hier verstorbenen Abenteurers";
                    break;
                case 20: 
                    enemy = Dice.Roll(6, 1) + " Wühlschrate";   
                    break;
            }
        } else {
            switch(Dice.Roll(20, 1)){
                case 1:
                case 2:
                case 3: 
                    enemy = Dice.Roll(6, 1) + " Einwohner des Systems";
                    break;
                case 4: 
                    enemy = Dice.Roll(6, 1) + " Gruftasseln";
                    break;
                case 5:
                case 6: 
                    enemy = "Riesenamöbe";
                    break;
                case 7: 
                    enemy = "Höhlenhaustiere";
                    break;
                case 8:
                case 9: 
                    enemy = Dice.Roll(6, 1) + " Gefangene";
                    break;
                case 10: 
                    enemy = "Mumie";
                    break;
                case 11:
                case 12:
                case 13: 
                    enemy = Dice.Roll(6, 2) + " Einwohner des Systems";
                    break;
                case 14:
                case 15:
                case 16: 
                    enemy = Dice.Roll(6,1) + " Ratten";
                    break;
                case 17:
                case 18: 
                    enemy = Dice.Roll(6, 1) + " Skelette";
                    break;
                case 19: 
                    enemy = "‚Endgegner‘ der Anlage";
                    break;
                case 20: 
                    enemy = Dice.Roll(6, 1) + " gut ausgebildete Wachen der Einwohner";
                    break;
            }
        }
    }
    
    @Override
    public String toString(){
        return enemy;
    }
}
