Package ch.sahits.game.openpatrician.model.city

Examples of ch.sahits.game.openpatrician.model.city.ICity


      final BufferedImage bale = loader.getImage("bale_icon");
      final BufferedImage coin = loader.getImage("coin_icon");
     
      // Sub title
      y += positions.titleHeigth;
      ICity cityModel = city.getCity();
      y += (int)Math.rint(positions.titleHeigth*2/3);
     
      // Table header
      y += positions.lineHeight; // more space to the title
      y += positions.lineHeight;
View Full Code Here


      final BufferedImage barrel = loader.getImage("barrel_icon");
      final BufferedImage bale = loader.getImage("bale_icon");
     
      // Sub title
      y += positions.titleHeigth;
      ICity cityModel = city.getCity();
      y += (int)Math.rint(positions.titleHeigth*2/3);
     
      // Table header
      y += positions.lineHeight; // more space to the title
      y += positions.lineHeight;
View Full Code Here

      y += positions.lineHeight;
      y += positions.lineHeight;
      y += positions.lineHeight;
      y += positions.titleHeigth;
      y += positions.lineHeight;
      ICity cityModel = city.getCity();
      y += (int)Math.rint(positions.titleHeigth*2/3);
     
      // Table header
      y += positions.lineHeight; // more space to the title
      y += positions.lineHeight;
View Full Code Here

      // Dialog title
      int y = getBounds().y+getInset().top+10+(int)Math.rint(positions.titleHeigth*2/3);
      // Sub title
      y += positions.titleHeigth;
      y += 5*positions.lineHeight;
      ICity cityModel = city.getCity();
      y += (int)Math.rint(positions.titleHeigth*2/3);
     
     
      ITradingOffice office = city.getPlayer().findTradingOffice(cityModel);
      IStorage storage = office.getStorage();
View Full Code Here

     
      // Birth
      DateObject now = new DateObject(Date.getInstance(0).getCurrentDate()); // TODO ugly
      y = drawRow(g2d, y, firstColumn, "Born");
      sb = new StringBuilder();
      ICity birthPlace = data.getBirthPlace();
      sb.append("on ").append(data.getBirthDate().toDisplayString()).append(" in ").append(birthPlace.getName()).append(", ");
      sb.append("Age ").append(data.getAge(now));
      y = drawRow(g2d, y, firstColumn, sb.toString());

      y += positions.lineHeight;

      y = drawRow(g2d, y, firstColumn, "Hometown");
      y = drawRow(g2d, y, firstColumn, player.getHometown().getName());
     
      y += positions.lineHeight;
      sb = new StringBuilder();
      sb.append("Social status in this town: ").append(city.getCity().getSocialRank());
      y = drawRow(g2d, y, firstColumn, sb.toString());
     
      IReputation rep = city.getCity().getReputation(player);
      int repDiff = rep.getReputationDifference();
      sb = new StringBuilder();
      if (repDiff<0){
        // reputation has sunk
        if (repDiff<=-10 && repDiff>-25){
          sb.append("Your reputation has sunken.");
        } else if (repDiff>-10){
          sb.append("Your reputation has sunken slightly");
        } else {
          sb.append("Your reputation has dropped");
        }
      } else if (repDiff>0){
        // reputation has risen
        if (repDiff>=10 && repDiff<25){
          sb.append("Your reputation has risen");
        } else if (repDiff<10){
          sb.append("Your reputation has risen slightly");
        } else {
          sb.append("Your reputation has risen massivly");
        }
      } else {
        sb.append("Your reputation in this city is unchanged");
      }
      y = drawRow(g2d, y, firstColumn, sb.toString());
     
      if (rank!=ESocialRank.ALDERMAN && rank!=ESocialRank.MAYOR){
        // draw string what is needed
        ESocialRank nextRank = rank.getNextRank();
        boolean needFortune = false;
        if (player.getCompany().getCompanyValue()<nextRank.getCompanyValue()){
          needFortune=true;
        }
        boolean needReputation=false;
        if (city.getCity().getReputation(player).getPopularity()<nextRank.getSocialReputation()){
          needReputation=true;
        }
        sb = new StringBuilder();
        if (needFortune && needReputation){
          sb.append("You need more fortune and respect in ").append(city.getCity().getName()).append(" to");
          y = drawRow(g2d, y, firstColumn, sb.toString());
          sb = new StringBuilder();
          sb.append("advanve to the next social rank");
          y = drawRow(g2d, y, firstColumn, sb.toString());
        } else if (needFortune){
          sb.append("You need more fortune in ").append(city.getCity().getName()).append(" to");
          y = drawRow(g2d, y, firstColumn, sb.toString());
          sb = new StringBuilder();
          sb.append("advanve to the next social rank");
          y = drawRow(g2d, y, firstColumn, sb.toString());
        } else if (needReputation){
          sb.append("You need more respect in ").append(city.getCity().getName()).append(" to");
          y = drawRow(g2d, y, firstColumn, sb.toString());
          sb = new StringBuilder();
          sb.append("advanve to the next social rank");
          y = drawRow(g2d, y, firstColumn, sb.toString());
        } else {
          y += positions.lineHeight;
          y += positions.lineHeight;
        }
      } else {
        y += positions.lineHeight;
        y += positions.lineHeight;
      }
     
      // Draw underworld string
      ICareer careerLevel = player.getCareerLevel();
      String s;
      if (careerLevel instanceof IMilitantCareer){
        if (((EMilitantCareer)careerLevel)!=EMilitantCareer.BOISTEROUS &&
          ((EMilitantCareer)careerLevel)!=EMilitantCareer.BOLD ){
          s = "The underworld fears you";
        } else {
          s = "The underworld avoids you";
        }
      } else {
        s = "The underworld avoids you";
      }
      y = drawRow(g2d, y, firstColumn, s);
      y += positions.lineHeight;
     
      if (player.getSpouseData()!=null){
        ISpouseData spouse = player.getSpouseData();
        // Name
        if (spouse.isMale()){
          s = "Name of husband"; // TODO externalize
        } else {
          s = "Name of wife";
        }
        y = drawRow(g2d, y, firstColumn, s);
        sb = new StringBuilder();
        sb.append(spouse.getName()).append(" ").append(spouse.getLastName());
        sb.append(", Age ").append(spouse.getAge(now));
        y = drawRow(g2d, y, firstColumn, sb.toString());
       
        y += positions.lineHeight;
       
        // Birth
        y = drawRow(g2d, y, firstColumn, "Born");
        sb = new StringBuilder();
        sb.append("on ").append(data.getBirthDate().toDisplayString()).append(" in ").append(birthPlace.getName());
        y = drawRow(g2d, y, firstColumn, sb.toString());

        y += positions.lineHeight;

        y = drawRow(g2d, y, firstColumn, "Children");
View Full Code Here

     
      // Sub title
      y += positions.titleHeigth;
      int leftBorderX = getBounds().x+getInset().left;
      int x = leftBorderX + 20;
      ICity cityModel = city.getCity();
      IShip ship = city.getActiveShip();
      ITradingOffice office = city.getPlayer().findTradingOffice(cityModel);
      y += (int)Math.rint(positions.titleHeigth*2/3);
     
      synchronized (type) { // Avoid change of the type during rendering of one screen
View Full Code Here

      int y = getBounds().y+getInset().top+10+(int)Math.rint(positions.titleHeigth*2/3);
      final BufferedImage coin = loader.getImage("coin_icon");
     
      // Sub title
      y += positions.titleHeigth;
      ICity cityModel = city.getCity();
      y += (int)Math.rint(positions.titleHeigth*2/3);
     
      // Table header
      y += positions.lineHeight; // more space to the title
      y += positions.lineHeight;
View Full Code Here

   * Initialize the full notice with the trade notice
   * @throws IOException
   * @throws FontFormatException
   */
  private void createTradeNotice(ICityPlayerProxy proxy) throws FontFormatException, IOException {
    ICity city = proxy.getCity();
    ITradingOffice office = proxy.getPlayer().findTradingOffice(city);
    IShip ship = proxy.getActiveShip();
    boolean city2ShipFlag = proxy.getActiveShip()!=null; // if true this is active
    boolean hasTradingOffice = office!=null;
    boolean hasWeapons = (city2ShipFlag&&hasTradingOffice&&office.hasWeapons()&&ship.getUpgradeSpaceReduction()>0&&ship.hasWeapons());
View Full Code Here

            EGameSpeed gameSpeed = EGameSpeed.values()[speed.getSelectedIndex()];
            int startyear = Integer.parseInt(startYear.getSelected());
            IGame game = GameFactory.createGame(gameMap, obj, diff, gameSpeed, startyear);

           
            ICity homeCity = CityFactory.createCityByName(ECityName.values()[homeTownIndex]);
            IPlayer player = GameFactory.createPlayer(name.getValue(), lastName.getValue(), homeCity, male.isSelected() && !female.isSelected(),difficulity.getStartingCapital());
            RandomNameLoader shipLoader = new RandomNameLoader("shipnames.properties");
            IShip ship = ShipFactory.createCrayer(shipLoader.getRandomName(), EShipUpgrade.LEVEL1,3000); // TODO check the value
            player.addShip(ship);
View Full Code Here

  }
 
  public boolean isNextRankAchievable(){
    ESocialRank rank = player.getRank();
    ICity homeTown = player.getCompany().getHomeTown();
    if (rank==ESocialRank.PATRICIAN || rank==ESocialRank.MAYOR || rank==ESocialRank.ALDERMAN){
      return false;
    }
    long compValue = player.getCompany().getCompanyValue();
    ESocialRank nextRank = rank.getNextRank();
    IReputation rep = homeTown.getReputation(player);
    int popularity = rep.getPopularity();
    if (compValue>=nextRank.getCompanyValue() && popularity>=nextRank.getSocialReputation()){
      if (nextRank==ESocialRank.COUNCILMAN){
        // TODO check for guild membership
        return false;
View Full Code Here

TOP

Related Classes of ch.sahits.game.openpatrician.model.city.ICity

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.