package com.mirror.ts;
public class Player {
int atk;
int def;
int blood;
public Player(int c){
this.blood = c;
this.atk = (int)(100*(Math.random()));
this.def = (int)(30*(Math.random())); }
public void Show(Player a ,Player b){
if(a.blood < 0){
a.blood = 0;
}else if(b.blood < 0){
b.blood = 0;
}
System.out.println("成员a的血量,攻击,防守为:"+ a.blood + ","+ a.atk + "," +a.def);
System.out.println("成员b的血量,攻击,防守为:"+ b.blood + ","+ b.atk + "," +b.def);
}
public void Attack(Player a,Player b){
if(a.atk > b.def){
b.blood -= a.atk - b.def;
} else{
a.blood += a.atk - b.def;
}
}
}
public class Player {
int atk;
int def;
int blood;
public Player(int c){
this.blood = c;
this.atk = (int)(100*(Math.random()));
this.def = (int)(30*(Math.random())); }
public void Show(Player a ,Player b){
if(a.blood < 0){
a.blood = 0;
}else if(b.blood < 0){
b.blood = 0;
}
System.out.println("成员a的血量,攻击,防守为:"+ a.blood + ","+ a.atk + "," +a.def);
System.out.println("成员b的血量,攻击,防守为:"+ b.blood + ","+ b.atk + "," +b.def);
}
public void Attack(Player a,Player b){
if(a.atk > b.def){
b.blood -= a.atk - b.def;
} else{
a.blood += a.atk - b.def;
}
}
}










