¶
두날
Unit ¶
~cpp
public class Unit {
protected int unitHp;
protected int unitShield;
protected int attackPoint;
private boolean airAttack;
protected String nowState;
public String name;
public Unit() {
}
public Unit(int hp, int shield, int attack, String state, boolean air) {
this.unitHp = hp;
this.unitShield = shield;
this.attackPoint = attack;
this.nowState = state;
this.airAttack = air;
}
// 되.
/*
* public String changeState(String aState) { this.nowState = aState; return
* nowState; }
*/
public void underattack(int aAttackPoint) {
int totalHp;
totalHp = unitHp + unitShield;
totalHp -= aAttackPoint;
if (totalHp > unitHp) {
unitShield = totalHp - unitHp;
System.out.println("공격 Dragoon Hp Shield");
System.out.print(unitHp);
System.out.print(unitShield);
} else if (totalHp == unitHp) {
unitShield = 0;
System.out.println("공격 Dragoon Hp Shield");
System.out.print(unitHp);
System.out.print(unitShield);
} else {
unitHp = totalHp;
System.out.println("공격 Dragoon Hp Shield");
System.out.print(unitHp);
System.out.print(unitShield);
}
}
public int getAttackPoint() {
return attackPoint;
}
public int getHp() {
return unitHp;
}
public int getShield() {
return unitShield;
}
public static void main(String[] args) {
zealot z = new zealot(100, 100, 10, "attack", false);
dragoon d = new dragoon(150, 150, 20, "stop", true);
System.out.println("공격기 Dragoon Hp Shield");
System.out.println(d.getHp());
System.out.println(d.getShield());
d.underattack(z.getAttackPoint());
}
}
zealot ¶
~cpp
public class zealot extends Unit {
public zealot(int hp, int shield, int attack, String state, boolean air) {
super(hp, shield, attack, state, air);
System.out.println("Zealot 되다.");
}
}
dragoon ¶
~cpp
public class dragoon extends Unit {
public dragoon(int hp, int shield, int attack, String state, boolean air) {
super(hp, shield, attack, state, air);
System.out.println("Dragoon 되다.");
}
}
고부 ^^;
- 깔끔고 보고
, 공격때 드 깎고 hp깍는 , 관고,
래 는 달가 는 기본 모로 놓고( ex) zealot() )
내 동로 (럿나 드라군 hp 드 결되므로) 결면 더 겠? --iruril










