Package ch.fusun.baron.player

Examples of ch.fusun.baron.player.Dynasty


        if (marriageService.isMarried(player)) {
          if (Math.random() < CHILDREN_PROBABILITY) {
            Player husband = marriageService.getSpouse(player);
            if (husband.getAge() >= AGE_FOR_CHILDREN
                && !husband.isDead()) {
              Dynasty dynasty = playerService.getDynasty(husband);
              Gender gender = Gender.random();
              Player child = playerService
                  .generateNewPlayer(gender);
              child.setFather(husband);
              child.setMother(player);
              child.setAge(0);
              playerService.addPlayerToDynasty(dynasty, child);
              messagingService
                  .addMessage(
                      null,
                      "A new child was born for " + husband.getName() //$NON-NLS-1$
                          + " and " + player.getName() + ": " //$NON-NLS-1$ //$NON-NLS-2$
                          + child.getName() + " of " //$NON-NLS-1$
                          + dynasty.getName() + "."); //$NON-NLS-1$
            }
          }
        }
      }
    }
View Full Code Here


  }

  @Override
  public void execute() {
    for (User user : userService.getUsers()) {
      Dynasty dynasty = playerService.getDynasty(user);
      for (Unit unit : unitService.getAllUnits()) {
        if (dynasty.equals(propertyService.getOwnership(unit))) {
          treasuryService.removeMoney(dynasty,
              unit.getNumberOfUnits());
        }
      }
    }
View Full Code Here

  }

  @Override
  public void initialize() {
    for (User user : userService.getUsers()) {
      Dynasty dynasty = playerService.getDynasty(user);
      treasuryService.setMoney(dynasty, 1000);
    }
    messagingService.addMessage(null,
        Messages.TreasuryPlayerInitializer_TreasuryInitialized);
  }
View Full Code Here

    messagingService.addMessage(null,
        Messages.PlayerInitializer_PlayersInitialized);
  }

  private void createDynastyForUser(User user) {
    Dynasty dynasty = new Dynasty(
        userDynastyMap.get(user) == null ? user.getName()
            : userDynastyMap.get(user), userCOADynastyMap.get(user));
    Country country = countryService
        .createCountry(userDynastyMap.get(user));
    Player man = playerService.generateNewPlayer(Gender.MALE);
    man.setAge(INITIAL_AGE_MAN);
    Player woman = playerService.generateNewPlayer(Gender.FEMALE);
    woman.setAge(INITIAL_AGE_WOMAN);
    dynasty.addPlayer(man);
    dynasty.addPlayer(woman);
    marriageService.marry(man, woman);
    playerService.setDynastyForUser(dynasty, user);
    propertyService.setOwnership(man, country);
  }
View Full Code Here

TOP

Related Classes of ch.fusun.baron.player.Dynasty

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.