Package civquest.map

Examples of civquest.map.Field


  public void actionPerformed(FunctionActionEvent e) {

    Point position = e.getPosition();
   
    if (position != null) {
      Field field = quadMap.getFieldAtPosition(position);
      Nation activeNation = Game.getGame().getActiveNation();
      if (field != null) {
        if (activeNation != null) {
          ConstructUnit newUnitChange
            = new ConstructUnit(field.getPosition(),
                      activeNation.getID());
          newUnitChange.execute();
        } else {
          Messages.getMessages().info("ConstructTestUnit", "QMapWarn",
                        "When constructing test unit: "
View Full Code Here


  public void execute() {
      notifyBefore();
      Messages messages = Messages.getMessages();
        MapData mapData = Game.getMapData();

        Field field = mapData.getField(location);
        Nation nation = Game.getGame().getNation(ownerNation);

        Iterator<Unit> unitsIt = field.getUnitIterator();
        if (unitsIt.hasNext()) {
            Unit unit = unitsIt.next();
            if (!unit.getOwner().equals(nation)) {
                messages.err("ConstructCity", "You try to build a city " +
                        "on a field where another nation's unit is located.");
                return;
            }
        }
       
        if (field.getCityOnField() != null &&
                !field.getCityOnField().getOwner().equals(nation)) {
            messages.err("ConstructCity", "You try to build a city " +
            "on a field where another nation's city is located.");
            return;
        }
View Full Code Here

  public Musketeer(LoadedData loadedData, LoadingStep step) throws Exception {
    super(loadedData, step);
  }

  public int getSpeed(Coordinate to) {
    Field toField = Game.getMapData().getField(to);
    return (toField.isSea() ? 0 : 500);   
  }
View Full Code Here

  public void execute() {
    notifyBefore();

    MapData mapData = Game.getMapData();
    Field field = mapData.getField(position);
    field.setPopulation(population);

    notifyAfter();
  }
View Full Code Here

  public void execute() {
    notifyBefore();

    MapData mapData = Game.getMapData();
    Field field = mapData.getField(position);

    if (looseControl) {
      cityID = field.getRulingCity().getID();
      mapData.removeFieldFromCity(field, field.getRulingCity());
    } else {
      City city = mapData.getCity(cityID);
      mapData.assignFieldToCity(field, city);
    }
View Full Code Here

      int numberOfShallowFields = 0;
      for(int x = 0;x < mapdata.getArrayWidth();x++)
    for(int y = 0;y < mapdata.getArrayHeight();y++)
        if(mapdata.isArrayCoordOnMap(x,y))
      {
          Field field = mapdata.getField(x,y);
          if(field.isSea())
        {
            double probability = 0;
            int dst = field.getDistanceToCoast();
            int index = dst - 1;
            if(index > configuration.length - 1)
          index = configuration.length - 1;
            if(field.isNormalSea())
          probability = configuration[index][0];
            else
          if(field.isDeepSea())
              probability = configuration[index][1];
          else
              if(field.isSeaMountain())
            probability = configuration[index][2];
              else
            if(field.isSeaVolcano())
                probability = configuration[index][3];
            if((probability >= 1)
               || ((probability > 0) && (randomgen.nextDouble() < probability)))
          {
              field.setHeightLevel(Field.Height.SHALLOW_SEA);
              numberOfShallowFields++;
          }
        }
      }
      return numberOfShallowFields;
View Full Code Here

TOP

Related Classes of civquest.map.Field

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.