package com.tankalfa;
import com.osnova.*;
import android.graphics.*;

 
public class Hero extends Os{
  
 
 public Sna s;
 public int set=0;
 public Vz v;
 public int ib=0,br; 
    
 
 /////////
 public Hero(Bitmap bi,int fx,int fy,int ae){
        
      super(bi,fx,fy,ae);
        
       hero=true; 
  
   s=new Sna(D.s1,7,7,0); 
   s.hero=true;
   v=new Vz();
   v.bn=10; 
    }   
   ///////Os method//////
 
 @Override
 public void pp1(){
  
  
  v.paint();
  
  
 }
 
 
 /////////////
  public void key(){
         
  if(D.live<=0){D.hx=-300;D.hy=-300;Focus(v.vx,v.vy);}
  if(D.live>=1){Focus(D.hx,D.hy);}
  if(v.an==0 & D.live>=1){v.vx=-400;}
   
  
  if(D.tan==1){sk1=6;D.sks=10;}
  if(D.tan==2){sk1=4;D.sks=15;}
  if(D.tan==3){sk1=2;D.sks=25;}
   
  if(D.baH==1){s.setFrame(0);D.ur=5;}
  if(D.baH==2){s.setFrame(1);D.ur=10;}
  if(D.baH==3){s.setFrame(2);D.ur=15;}
  if(D.baH==4){s.nextFrame(0);D.ur=20;}
  if(D.baH==5){s.nextFrame(0);D.ur=30;}
   
  
   if(Ran.kp.k[0].getK()){st=1;next2Frame(0,1);D.hy-=sk1;}   
 else{
  if(Ran.kp.k[1].getK()){st=2;next2Frame(2,3);D.hy+=sk1;}     
  else{
   if(Ran.kp.k[2].getK()){st=3;next2Frame(4,5);D.hx-=sk1;}   
  else{
   if(Ran.kp.k[3].getK()){st=4;next2Frame(6,7);D.hx+=sk1;}  
    }}}
    v.box(D.hx,D.hy);
    s.Ds(st,D.sks); 
    }  
  
   @Override  
    public void StolkMap(Sprite c,int op){
       
  
    if(collides(c) & op==1){TiDe(c,7,10,7,10);}  
    if(collides(c) & op==2){TiDe(c,7,10,7,10);}  
    if(collides(c) & op==3){Pr(c);}
    if(collides(c) & op==4){TiDe(c,7,7,7,50);}
    if(collides(c) & op==5){TiDe(c,7,7,50,7);}
 }
   
 
  public void StolkNpc(Npc n){
  for(Tn n1:n.n){
    
   if(collides(n1,10,10,10,10)){mBron();n1.mBron();} 
   
    // брать знаки включено
   if(s.collides(n1)){s.vt=s.dal;n1.ib=D.ur; n1.v.collides(this); n1.mBron();}
     
   n1.v.box(n1.x1,n1.y1);
   
  
 }
  
  
 }
 
 
 public void setSna(){
   
  
  if(D.baH==1||D.baH==2||D.baH==3){s.setSna(1);}
  if(D.baH==4){s.setSna(2);}
  if(D.baH==5){s.setSna(3);}
 
 } 
 
 
 public void setTank(){
  
  if(D.tan==1){D.abc(1,this);D.b0();}
  if(D.tan==2){D.abc(3,this);D.b0();}
  if(D.tan==3){D.abc(5,this);D.b0();}
 } 
 
 
 public void setBr(){
  
  if(D.br1==1){D.abc(2,this);D.bron=20;}
  if(D.br1==2){D.abc(4,this);D.bron=50;}
  if(D.br1==3){D.abc(6,this);D.bron=80;}
   
 }
 
 
 
  /// Минус процент Брони
   public void mBron(){ 
      
    if(D.bron<=0){D.live--;v.an=1;ib=0;
    D.x=2;D.y=2018;D.hx=205;D.hy=2304;
    D.baH=1;D.bron=0;D.tan=1; 
    s.setSna(1);D.abc(1,this);}
  
  
    if(D.bron>=1){
      if(ib==D.urv){br++;} 
      if(br>2){D.bron-=ib;br=0;ib=0;}   
      }  
        
   }
 
 
 
 
 
 
 /*
 public void StolkSna(Npc n){
  for(Tn n1:n.n){
    
   if(s.collides(n1)){s.vt=s.dal;n1.live=false;n1.v.an=1;n1.v.collides(this);}
  // n1.v.box(n1.x1,n1.y1); 
   
  }
 
 }
 
 */
 
 
 
 /*
 public void Stolk(Tn[] n){
  
  for(Tn t:n){
       
 
}}*/
 
 /// e c   
    
}
