import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class TowerOne here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class TowerOne extends Towers
{
    
    /**
     * Kreiert eine neues Objekt der Klasse TowerOne
     * 
     */
    
    
    public TowerOne()
    {

        towerShotIntervall = 500;        //Intervall bis ein Schuss abgefeuert wird
        towerDistance      = 150;        // maximale Distanz die ein Tower ein Monster erkennt
        towerLevel         = 1;          // Upgrade Level des Towers
        
        towerMoney         = 150;
        towerShotPower     = 2;
        towerShotSpeed     = 20;
        munitionRadius     = 1;
        

        GreenfootImage[] gM = new GreenfootImage[1];
        gM[0] = TeD_World.B_MUN_1;
        
        aniMun = new Animation( 1 , gM , 100 );
        
        upgradekosten      = 400;
        
        turmhöhe           = 3;
        f                  = 20;
        
        GreenfootImage[] gN = new GreenfootImage[4];
        gN[0] = TeD_World.B_T1_AN_0;
        gN[1] = TeD_World.B_T1_AN_1;
        gN[2] = TeD_World.B_T1_AN_2;
        gN[3] = TeD_World.B_T1_AN_3;
        
        aniNord = new Animation( 4 , gN , (towerShotIntervall*19)/80 ); 
        
        GreenfootImage[] gS = new GreenfootImage[4];
        gS[0] = TeD_World.B_T1_AS_0;
        gS[1] = TeD_World.B_T1_AS_1;
        gS[2] = TeD_World.B_T1_AS_2;
        gS[3] = TeD_World.B_T1_AS_3;
        
        aniSued = new Animation( 4 , gS , (towerShotIntervall*19)/80  );
        
        GreenfootImage[] gW = new GreenfootImage[4];
        gW[0] = TeD_World.B_T1_AW_0;
        gW[1] = TeD_World.B_T1_AW_1;
        gW[2] = TeD_World.B_T1_AW_2;
        gW[3] = TeD_World.B_T1_AW_3;
        
        aniWest = new Animation( 4 , gW , (towerShotIntervall*19)/80  );
        
        GreenfootImage[] gO = new GreenfootImage[4];
        gO[0] = TeD_World.B_T1_AO_0;
        gO[1] = TeD_World.B_T1_AO_1;
        gO[2] = TeD_World.B_T1_AO_2;
        gO[3] = TeD_World.B_T1_AO_3;
        
        aniOst = new Animation( 4 , gO , (towerShotIntervall*19)/80  );
        
    }
    @Override
    public void upgrade()
    {
        if(this.towerLevel == 1)
        {
              towerShotIntervall = 400;        
              towerDistance      = 250;        
              towerLevel         = 2;          
              upgradekosten      = 400;
              towerMoney         = 400;
              towerShotPower     = 7;
              towerShotSpeed     = 20;
              munitionRadius     = 1;

              turmhöhe           = 3;
              f                  = 0;
              Animation hilf1;
              Animation hilf2;
              Animation hilf3;
              Animation hilf4;
              Animation hilf5;
              
              GreenfootImage[] gN = new GreenfootImage[2];
              gN[0] = TeD_World.B_T4_AN_0;
              gN[1] = TeD_World.B_T4_AN_1;
              
              hilf1 = new Animation( 2 , gN , 100 );
              aniNord = hilf1;
        
              GreenfootImage[] gS = new GreenfootImage[2];
              gS[0] = TeD_World.B_T4_AS_0;
              gS[1] = TeD_World.B_T4_AS_1;
             
              hilf2 = new Animation( 2 , gS , 100  );
              aniSued = hilf2;
        
              GreenfootImage[] gW = new GreenfootImage[2];
              gW[0] = TeD_World.B_T4_AW_0;
              gW[1] = TeD_World.B_T4_AW_1;
             
              hilf3 = new Animation( 2 , gW , 100  );
              aniWest = hilf3;
        
              GreenfootImage[] gO = new GreenfootImage[2];
              gO[0] = TeD_World.B_T4_AO_0;
              gO[1] = TeD_World.B_T4_AO_1;
              
              hilf4 = new Animation( 2 , gO , 100  );
              aniOst = hilf4;
              
              GreenfootImage[] gM = new GreenfootImage[1];
              gM[0] = TeD_World.LEER;
        
              hilf5 = new Animation( 1 , gM , 100 );
              aniMun = hilf5;
              
              TeD_World.SPIELEVERWALTUNG.map0.map[(TeD_World.pixToCell(this.getY()+53))-1][(TeD_World.pixToCell(this.getX()))-1] = 40;
              TeD_World.SPIELEVERWALTUNG.druckeKarte(TeD_World.SPIELEVERWALTUNG.map0);
                
        }
        else if(this.towerLevel == 2)
        {
               towerShotIntervall = 300;        
               towerDistance      = 350;        
               towerLevel         = 3;          
               
               towerMoney         = 600;
               towerShotPower     = 15;
               towerShotSpeed     = 20;
               munitionRadius     = 1;
        
               turmhöhe           = 3;
               f                  = 0;
               

               Animation hilf6;
               Animation hilf7;
               Animation hilf8;
               Animation hilf9;
               Animation hilf0;
               
               GreenfootImage[] gN = new GreenfootImage[4];
               
               gN[0] = TeD_World.B_T7_AN_0;
               gN[1] = TeD_World.B_T7_AN_1;
               gN[2] = TeD_World.B_T7_AN_2;
               gN[3] = TeD_World.B_T7_AN_3;
               
               hilf6 = new Animation( 4 , gN , (towerShotIntervall*19)/80  );
               aniNord = hilf6;
               
               GreenfootImage[] gS = new GreenfootImage[4];
               
               gS[0] = TeD_World.B_T7_AS_0;
               gS[1] = TeD_World.B_T7_AS_1;
               gS[2] = TeD_World.B_T7_AS_2;
               gS[3] = TeD_World.B_T7_AS_3;
               
               hilf7 = new Animation( 4 , gS , (towerShotIntervall*19)/80   );
               aniSued = hilf7;
               
               GreenfootImage[] gW = new GreenfootImage[4];
               
               gW[0] = TeD_World.B_T7_AW_0;
               gW[1] = TeD_World.B_T7_AW_1;
               gW[2] = TeD_World.B_T7_AW_2;
               gW[3] = TeD_World.B_T7_AW_3;
               
               hilf8 = new Animation( 4 , gW , (towerShotIntervall*19)/80   );
               aniWest = hilf8;
               
               GreenfootImage[] gO = new GreenfootImage[4];
               
               gO[0] = TeD_World.B_T7_AO_0;
               gO[1] = TeD_World.B_T7_AO_1;
               gO[2] = TeD_World.B_T7_AO_2;
               gO[3] = TeD_World.B_T7_AO_3;
               
               hilf9 = new Animation( 4 , gO , (towerShotIntervall*19)/80   );
               aniOst = hilf9;
               
               GreenfootImage[] gM = new GreenfootImage[1];
               gM[0] = TeD_World.B_MUN_5;
        
               hilf0 = new Animation( 1 , gM , 100 );
               aniMun = hilf0;
               
               TeD_World.SPIELEVERWALTUNG.map0.map[(TeD_World.pixToCell(this.getY()+53))-1][(TeD_World.pixToCell(this.getX()))-1] = 50;
               TeD_World.SPIELEVERWALTUNG.druckeKarte(TeD_World.SPIELEVERWALTUNG.map0);
        }
    }
}
