Package ch.fusun.baron.player

Examples of ch.fusun.baron.player.Dynasty


  public Collection<TileChild> getChildren(Tile model) {
    Collection<Unit> units = unitService.getUnits(model);
    Collection<TileChild> children = new ArrayList<TileChild>();
    if (units != null && !units.isEmpty()) {
      Unit unit = units.iterator().next();
      Dynasty dynasty = (Dynasty) propertyService.getOwnership(unit);
      if (unit != null) {
        children.add(new UnitDynastyTileChild(dynasty));
      }
    }
    return children;
View Full Code Here


     * @param allPlayers
     * @return
     */
    protected List<Player> filterOthers(List<Player> allPlayers) {
        List<Player> players = new LinkedList<Player>();
        Dynasty dynasty = playerService.getDynasty(userService.getUser());
        for (Player player : allPlayers) {
            if (!player.isDead() && player.getAge() > MARRIAGE_AGE
                    && !dynasty.equals(playerService.getDynasty(player))
                    && !marriageService.isMarried(player)) {
                players.add(player);
            }
        }
        return players;
View Full Code Here

  /**
   * Tests if the equality function works
   */
  @Test
  public void testEquality() {
    Dynasty dynasty = new Dynasty("Test1", null); //$NON-NLS-1$
    Dynasty dynasty2 = new Dynasty("Test2", null); //$NON-NLS-1$
    Dynasty dynasty3 = new Dynasty("Test1", null); //$NON-NLS-1$

    assertEquals(dynasty, dynasty3);
    assertFalse(dynasty.equals(dynasty2));
    assertFalse(dynasty.equals(null));
    assertFalse(dynasty.equals(new String("Test1"))); //$NON-NLS-1$
View Full Code Here

  /**
   * Tests all accessors
   */
  @Test
  public void testGettersAndSetters() {
    Dynasty dynasty = new Dynasty("TestDynasty", null); //$NON-NLS-1$
    Dynasty dynasty2 = new Dynasty("TestDynasty2", null); //$NON-NLS-1$
    User user = new User("username", "password"); //$NON-NLS-1$ //$NON-NLS-2$
    User user2 = new User("username2", "password2"); //$NON-NLS-1$ //$NON-NLS-2$
    Player player1 = new Player(0, "player1", Gender.MALE); //$NON-NLS-1$
    dynasty.addPlayer(player1);
    Player player2 = new Player(1, "player2", Gender.FEMALE); //$NON-NLS-1$
View Full Code Here

  private boolean calculateAnnectionFrom() {
    boolean newLand = false;
    Object o = propertyService.getOwnership(destination);
    if (o instanceof Dynasty) {
      Dynasty ownership = (Dynasty) o;
      if (!dynasty.equals(ownership)) {
        City city = cityService.getCity(destination);
        if (city != null) {
          Collection<City> citiesOfPlayer = getCitiesForDynasty(ownership);
          for (Tile tile : mapService.getTiles()) {
            if (ownership
                .equals(propertyService.getOwnership(tile))) {
              if (getNearestCityLocation(tile, citiesOfPlayer)
                  .equals(destination)) {
                propertyService.setOwnership(dynasty, tile);
                newLand = true;
View Full Code Here

    if (!text.isDisposed()) {
      text.getDisplay().asyncExec(new Runnable() {

        @Override
        public void run() {
          Dynasty dynasty = playerService.getDynasty(userService
              .getUser());
          if (dynasty != null) {
            text.setText("" //$NON-NLS-1$
                + treasuryService.getMoney(dynasty));
          }
View Full Code Here

        if (!image.isDisposed()) {
            image.getDisplay().asyncExec(new Runnable() {

                @Override
                public void run() {
                    Dynasty dynasty = playerService.getDynasty(userService
                            .getUser());
                    image.setImage(Activator.getImageForCOA(dynasty
                            .getCoatOfArms()));
                }
            });
        }
    }
View Full Code Here

    if (!text.isDisposed()) {
      text.getDisplay().asyncExec(new Runnable() {

        @Override
        public void run() {
          Dynasty dynasty = playerService.getDynasty(userService
              .getUser());
          if (dynasty != null) {
            text.setText(dynasty.getName());
          }
        }
      });
    }
  }
View Full Code Here

  @Override
  public void execute(Object object) {
    if (object instanceof Unit) {
      Unit unit = (Unit) object;
      Tile location = unitService.getLocation(unit);
      Dynasty dynasty = playerService.getDynasty(userService.getUser());
      int width = mapService.getWidth();
      int height = mapService.getHeight();
      clientService.execute(new MoveUnitCommand(dynasty, unit, new Tile(
          (location.getX() + getHorizontalDiff() + width) % width,
          (location.getY() + getVerticalDiff() + height) % height)));
View Full Code Here

  @Override
  public Collection<TileChild> getChildren(Tile tile) {
    City city = cityService.getCity(tile);
    Collection<TileChild> children = new ArrayList<TileChild>();
    Country country = (Country) propertyService.getOwnership(tile);
    Dynasty dynasty = playerService.getDynasty((Player) propertyService
        .getOwnership(country));
    if (city != null) {
      children.add(new CityDynastyTileChild(dynasty));
    }
    return children;
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.