/** * Gets a message key for a short alarm message associated with the alarm level of this player. * * @param player The other <code>Player</code>. * @return The alarm message key. */ public String getAlarmLevelKey(Player player) { return (!player.hasContacted(owner)) ? "model.indianSettlement.tension.wary" : (!hasContacted(player)) ? "model.indianSettlement.tension.unknown" : getAlarm(player).getNameKey(); }
/** * Get a template for the current most hated nation, depending whether the requestor has contacted * this settlement. * * @param contacted The contact status. * @return A <code>StringTemplate</code> describing the perceived most hated nation. */ public StringTemplate getMostHatedLabel(boolean contacted) { return (contacted) ? ((mostHated == null) ? StringTemplate.key("model.indianSettlement.mostHatedNone") : mostHated.getNationName()) : StringTemplate.key("model.indianSettlement.mostHatedUnknown"); }
/** {@inheritDoc} */ public StringTemplate getAlarmLevelLabel(Player player) { String key = (!player.hasContacted(owner)) ? "model.indianSettlement.tension.wary" : (!hasContacted(player)) ? "model.indianSettlement.tension.unknown" : "model.indianSettlement." + getAlarm(player).getKey(); return StringTemplate.template(key).addStringTemplate("%nation%", getOwner().getNationName()); }
/** * Get a label for one of the wanted goods. * * @param index The index into the wanted goods. * @param player The requesting <code>Player</code>. * @return A suitable <code>StringTemplate</code>. */ public StringTemplate getWantedGoodsLabel(int index, Player player) { StringTemplate ret; if (hasVisited(player) && 0 <= index && index < wantedGoods.length) { if (wantedGoods[index] == null) { ret = StringTemplate.key("model.indianSettlement.wantedGoodsNone"); } else { ret = StringTemplate.label("").add(Messages.nameKey(wantedGoods[index])); String sale = player.getLastSaleString(this, wantedGoods[index]); if (sale != null) ret.addName(" " + sale); } } else { ret = StringTemplate.key("model.indianSettlement.wantedGoodsUnknown"); } return ret; }
/** * Does this settlement have a missionary from the given player? * * @param player The <code>Player</code> to test. * @return True if there is a suitable missionary present. */ public boolean hasMissionary(Player player) { return missionary != null && player != null && player.owns(missionary); }
/** {@inheritDoc} */ public boolean hasContacted(Player player) { return player != null && (player.isIndian() || getContactLevel(player) != ContactLevel.UNCONTACTED); }