/** 指揮官 */

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;

public class Commander extends Soldier implements Horse {

	Army army;	// この指揮官が指揮する軍隊。

	public Commander(int x, int y, Board tacticsField, Direction direction, int Nationality) {
		super(x,y, tacticsField, direction, Nationality);
	}
	public Commander(int x, int y, Board tacticsField, Direction direction, int Nationality, Unit target, boolean auto) {
		super(x,y, tacticsField, direction, Nationality, target, auto);
	}

	public void init() {
		maxHP = 100;
		hp = 100;
		offensivePower = 1;
		defensivePower = 5;

		presentSpeed = 0;
		maxSpeed = 4;
		acceleration = 2;

		attackSpeed = 4;

		movementPower = 0;
		attackSpeedPower = 0;
	}

	public Army getArmy() { return army; }
	public void setArmy( Army army ) { this.army = army; }

	public void show(Graphics g, int x, int y, Component view) {
		uge.show(g, x,y, this, view);
	}

	/** ボードから自分自身を削除する。 */
	public void remove() {

		// 戦場の時間を停止させる。
		board.setSpeed(0);

		// ボードの二次元配列から自分自身を削除する。
		if (this == board.getUnit(x,y))
			board.removeUnit(x,y);

		// ボードのRunnableUnitListから自分自身を削除する。
		board.getRunnableUnitList().remove( this );

		// 自身の指揮する軍隊ユニットを消滅させる。
		army.defeated();

	}

}

