本文整理汇总了Java中net.sf.freecol.common.model.Tile.addLostCityRumour方法的典型用法代码示例。如果您正苦于以下问题:Java Tile.addLostCityRumour方法的具体用法?Java Tile.addLostCityRumour怎么用?Java Tile.addLostCityRumour使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.freecol.common.model.Tile
的用法示例。
在下文中一共展示了Tile.addLostCityRumour方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transform
import net.sf.freecol.common.model.Tile; //导入方法依赖的package包/类
@Override
public void transform(Tile t) {
if (t.isLand()) {
LostCityRumour rumour = t.getLostCityRumour();
if (rumour == null) {
t.addLostCityRumour(new LostCityRumour(t.getGame(), t));
} else {
t.removeLostCityRumour();
}
}
}
示例2: makeLostCityRumours
import net.sf.freecol.common.model.Tile; //导入方法依赖的package包/类
/**
* Make lost city rumours on the given map.
*
* The number of rumours depends on the map size.
*
* @param map The {@code Map} to use.
* @param importMap An optional {@code Map} to import from.
* @param lb A {@code LogBuilder} to log to.
*/
private void makeLostCityRumours(Map map, Map importMap, LogBuilder lb) {
final Game game = map.getGame();
final boolean importRumours = game.getMapGeneratorOptions()
.getBoolean(MapGeneratorOptions.IMPORT_RUMOURS);
if (importMap != null && importRumours) {
// Rumours were read from the import game, no need to do more
return;
}
final int rumourNumber = game.getMapGeneratorOptions()
.getRange(MapGeneratorOptions.RUMOUR_NUMBER);
int number = getApproximateLandCount(game) / rumourNumber;
int counter = 0;
// FIXME: Remove temporary fix:
if (importMap != null) {
number = map.getWidth() * map.getHeight() * 25 / (100 * 35);
}
for (int i = 0; i < number; i++) {
for (int tries = 0; tries < 100; tries++) {
Tile t = map.getRandomLandTile(random);
if (t.isPolar()) continue; // No polar lost cities
if (t.isLand() && !t.hasLostCityRumour()
&& !t.hasSettlement() && t.getUnitCount() == 0) {
LostCityRumour r = new LostCityRumour(t.getGame(), t);
if (r.chooseType(null, random)
== LostCityRumour.RumourType.MOUNDS
&& t.getOwningSettlement() != null) {
r.setType(LostCityRumour.RumourType.MOUNDS);
}
t.addLostCityRumour(r);
counter++;
break;
}
}
}
lb.add("Created ", counter,
" lost city rumours of maximum ", number, ".\n");
}
示例3: testHorsesLost
import net.sf.freecol.common.model.Tile; //导入方法依赖的package包/类
public void testHorsesLost() {
Game game = ServerTestHelper.startServerGame(getTestMap(true));
Map map = game.getMap();
AIMain aiMain = ServerTestHelper.getServer().getAIMain();
// Create players, settlement and unit
ServerPlayer inca = (ServerPlayer)game.getPlayerByNationId("model.nation.inca");
ServerPlayer dutch = (ServerPlayer)game.getPlayerByNationId("model.nation.dutch");
dutch.exploreMap(true);
Tile settlementTile = map.getTile(2, 1);
FreeColTestCase.IndianSettlementBuilder builder
= new FreeColTestCase.IndianSettlementBuilder(game);
builder.player(inca).settlementTile(settlementTile).build();
IndianSettlement is = settlementTile.getIndianSettlement();
Player.makeContact(inca, dutch);
Tile unitTile = map.getTile(2, 2);
Unit scout = new ServerUnit(game, unitTile, dutch,
scoutType, scoutRole);
assertEquals(scoutRole, scout.getRole());
AIUnit aiUnit = aiMain.getAIUnit(scout);
aiUnit.setMission(null);
assertNotNull("The scout should be an AI unit", aiUnit);
assertEquals("Scout should have the scout role", scoutRole,
scout.getRole());
assertTrue("Scout should be able to speak to chief",
scout.hasAbility(Ability.SPEAK_WITH_CHIEF));
assertEquals("The Inca settlement should be a scouting target", null,
ScoutingMission.invalidReason(aiUnit, is));
assertEquals("The Inca settlement should be found as scouting target",
is, ScoutingMission.findTarget(aiUnit, 10, false));
assertEquals("Scouting mission should be assignable to scout", null,
ScoutingMission.invalidReason(aiUnit));
ScoutingMission mission
= new ScoutingMission(aiMain, aiUnit, is);
assertEquals("Scout should have been assigned the Scouting mission",
mission, aiUnit.getMission());
assertEquals(null, mission.invalidReason());
assertTrue("Scouting mission should be valid",
mission.isValid());
assertEquals("Scouting mission target should be the Inca settlement",
is, mission.getTarget());
// Invalidate the mission by losing the horses.
scout.changeRole(spec().getDefaultRole(), 0);
assertFalse("Scout should not have the scout role",
scout.hasAbility(Ability.SPEAK_WITH_CHIEF));
assertNotNull("Scouting mission should be invalid",
aiUnit.getMission().invalidReason());
assertNotNull("Scouting mission should be impossible for this unit",
ScoutingMission.invalidReason(aiUnit));
// Restore the horses.
scout.changeRole(scoutRole, 1);
assertTrue("Scouting mission should be valid again",
aiUnit.getMission().isValid());
// Complete the mission, should be invalid.
is.setScouted(dutch);
assertFalse("Scouting mission should be invalid lacking target",
aiUnit.getMission().isValid());
// Add an LCR. Mission could become valid again.
Tile lcrTile = map.getTile(2, 3);
lcrTile.addLostCityRumour(new LostCityRumour(game, lcrTile));
assertEquals("Scouting mission should be possible for this unit", null,
ScoutingMission.invalidReason(aiUnit));
assertEquals("The LCR tile should be a scouting target",
lcrTile, ScoutingMission.findTarget(aiUnit, 10, false));
}