/* * AcceptAttackedPlayersStrongestThanMeStrategy.java * * Created on May 16, 2004, 1:15 AM */ package simulations.core.strategy.decisionSupportStrategy; import simulations.core.Player; import java.util.ArrayList; /** * This class describes a decision support strategy that accept to help attacks * on players that have more points than me. * @author tom */ public class AcceptAttackedPlayersStrongestThanMeStrategy extends DecisionSupportStrategy { /** Creates a new instance of AcceptAttackedPlayersStrongestThanMeStrategy */ public AcceptAttackedPlayersStrongestThanMeStrategy() { super(); name="AcceptAttackedPlayersStrongestThanMeStrategy"; memoryParam=false; abr="3"; } /** return the description of this attack strategy * @return return the description of this attack strategy **/ public String getDescription() { return "Decision support : I accept to help\n"+ "players that attack players that have \n"+ "more points than me\n"; } /** return true if the player will support the attack. * @return return true if the player will support the attack. * @param player The owner of the strategy * @param attackingPlayer The attacking player * @param attackedPlayer The attacked player * @param playerList The list of remaining players */ public boolean supportAttack(simulations.core.Player player, simulations.core.Player attackingPlayer, simulations.core.Player attackedPlayer, java.util.ArrayList playerList) { if (player.equals(attackedPlayer)) { return false; } if (player.getHitPoints()>attackedPlayer.getHitPoints()) { if (negative) { return false; } else { return true; } } if (negative) { return true; } else { return false; } } /** * This method is called by the judge after the decision of players to attack and to ask supports * to inform the strategy * @param player The owner of the strategy * @param attacksList The list of attacks **/ public void updateAttacksInfos(Player player, ArrayList attacksList) { } /** This method is called by the judge to inform players of the last turn * @param turn The turn * @param player The owner of the strategy * @param remainingPlayers The list of the remaining players */ public void updateLastTurn(simulations.core.history.Turn turn, simulations.core.Player player, java.util.ArrayList remainingPlayers) { } }