/* * AcceptPlayersWeakestThanMeStrategy.java * * Created on May 16, 2004, 1:01 AM */ package simulations.core.strategy.decisionSupportStrategy; import java.util.ArrayList; import simulations.core.Player; /** * This class describes an decision strategy that accept to support to players * that have less points than me * @author tom */ public class AcceptAskingPlayersWeakestThanMeStrategy extends DecisionSupportStrategy { /** Creates a new instance of AcceptPlayersWeakestThanMeStrategy */ public AcceptAskingPlayersWeakestThanMeStrategy() { super(); name="AcceptAskingPlayersWeakestThanMeStrategy"; memoryParam=false; abr="2"; } /** 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 have less 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()>attackingPlayer.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) { } }