final Hunt act = (Hunt)action;
final Food food = dmodel.getFoodById(act.getFoodTypeId());
// This line gets the agents datamodel
// Just trust me on that one :P
final PublicAgentDataModel am = ((AbstractAgent)sim.getPlayer(actorID)).getDataModel();
if (am.getHuntingTeam() == null)
{
Input result;
if (food.getHuntersRequired() <= 1)
{
result = new HuntResult(actorID, food.getNutrition(),
food.getNutrition(), dmodel.getTime());
}
else
{
result = new HuntResult(actorID, 0, 0, dmodel.getTime());
}
sim.getPlayer(actorID).enqueueInput(result);
}
else
{
if (!storedHuntResults.containsKey(am.getHuntingTeam()))
{
storedHuntResults.put(am.getHuntingTeam(),
new LinkedList<TeamHuntEvent>());
}
storedHuntResults.get(am.getHuntingTeam()).add(new TeamHuntEvent(act,
actorID));
}
logger.log(Level.FINE, "Agent {0} hunted {1}{2}", new Object[]
{
nameOf(actorID),
food.getName(),
am.getHuntingTeam() == null ? " alone." : " with team " + am.getHuntingTeam().hashCode()
});
return null;
}