package test.cocos.airplain;

/**
 * 英雄，属性有：多把枪用于远程攻击；增加超级攻击的方法；可以获得各种补给等；
 */
public class RoleHero extends Role {
	public RoleHero() {
		super(RoleTeam.RoleTeamHero, 100, 100, 100);
	}

	private Gun mGunSingleInfinite;
	private Gun mGunDouble;
	private Gun mGunSupper;

	private Gun mGunCurrent;

	private final int MAX_HP = 100;

	public void switchGunSingleInflite() {
		mGunCurrent = mGunSingleInfinite;
	}

	public void switchGunDouble() {
		mGunCurrent = mGunDouble;
	}

	// 引爆全屏
	public void attackSupper() {
		mGunCurrent = mGunSupper;
	}

	@Override
	public void fire(Role target) {
		// TODO Auto-generated method stub
		int x = 10;
		int y = 10;
		if (!mGunCurrent.fire(DirectorVice.getInstance().getGamLayer(), x, y)) {
			switchGunSingleInflite();
			mGunCurrent.fire(DirectorVice.getInstance().getGamLayer(), x, y);
		}
	}

	@Override
	public void fireSuper(Role target) {
		mGunSupper.fire(DirectorVice.getInstance().getGamLayer(), 0, 0);
	}

	@Override
	public void attack(Role target) {
		target.gotDamaged(mForce);
	}

	@Override
	public void gotDamaged(int damage) {
		mHP -= damage;
		if (mHP <= 0) {
			// die
		}
	}

	@Override
	public void gotBlood(int blood) {
		mHP += blood;
		if (MAX_HP < mHP) {
			mHP = MAX_HP;
		}
	}

	@Override
	public void gotGunDouble(Gun gun) {
		mGunDouble = gun;
	}

	@Override
	public void gotGunSupper(Gun gun) {
		mGunSupper = gun;
	}

}

@@ -475,79 +475,8 @@
 %09%7D%0A%0A
-%09// %E5%BC%95%E7%88%86%E5%85%A8%E5%B1%8F%0A%09public void attackSupper() %7B%0A%09%09mGunCurrent = mGunSupper;%0A%09%7D%0A%0A
 %09@Ov

refactor code