Tabnine Logo
EPlayerType
Code IndexAdd Tabnine to your IDE (free)

How to use
EPlayerType
in
jsettlers.common.ai

Best Java code snippets using jsettlers.common.ai.EPlayerType (Showing top 7 results out of 315)

origin: jsettlers/settlers-remake

  @Override
  public String toString() {
    return Labels.getString("player-type-" + playerType.name());
  }
}
origin: jsettlers/settlers-remake

public ConfigurableGeneral(AiStatistics aiStatistics, Player player, MovableGrid movableGrid, ITaskScheduler taskScheduler, EPlayerType playerType) {
  this.aiStatistics = aiStatistics;
  this.player = player;
  this.taskScheduler = taskScheduler;
  this.movableGrid = movableGrid;
  this.attackerCountFactor = ATTACKER_COUNT_FACTOR_BY_PLAYER_TYPE[playerType.ordinal()];
}
origin: jsettlers/settlers-remake

  public static PlayerSetting[] createDefaultSettings(byte playerId, byte maxPlayers) {
    PlayerSetting[] playerSettings = new PlayerSetting[maxPlayers];

    byte offsetToSkipHuman = 0;
    for (byte i = 0; i < playerSettings.length; i++) {
      if (i == playerId) {
        playerSettings[playerId] = new PlayerSetting(i);
      } else {
        EPlayerType aiType;

        aiType = EPlayerType.getTypeByIndex(i + offsetToSkipHuman);
        if (aiType == EPlayerType.HUMAN) {
          offsetToSkipHuman++;
          aiType = EPlayerType.getTypeByIndex(i + offsetToSkipHuman);
        }
        playerSettings[i] = new PlayerSetting(true, aiType, ECivilisation.ROMAN, i);
      }
    }
    System.out.println("created player settings: " + Arrays.toString(playerSettings));

    return playerSettings;
  }
}
origin: jsettlers/settlers-remake

public static PlayerSetting readFromStream(DataInputStream dis) throws IOException {
  dis.readShort(); // read version
  boolean available = dis.readBoolean();
  if (available) {
    byte readTeamId = dis.readByte();
    Byte teamId = readTeamId == -1 ? null : readTeamId;
    String civilizationName = dis.readUTF();
    ECivilisation civilisation = civilizationName.isEmpty() ? null : ECivilisation.valueOf(civilizationName);
    String playerTypeName = dis.readUTF();
    EPlayerType playerType = playerTypeName.isEmpty() ? null : EPlayerType.valueOf(playerTypeName);
    return new PlayerSetting(true, playerType, civilisation, teamId);
  } else {
    return new PlayerSetting();
  }
}
origin: jsettlers/settlers-remake

public AiExecutor(PlayerSetting[] playerSettings, MainGrid mainGrid, ITaskScheduler taskScheduler) {
  aiStatistics = new AiStatistics(mainGrid);
  aiStatistics.updateStatistics();
  this.whatToDoAis = new ArrayList<>();
  WhatToDoAiFactory aiFactory = new WhatToDoAiFactory();
  for (byte playerId = 0; playerId < playerSettings.length; playerId++) {
    PlayerSetting playerSetting = playerSettings[playerId];
    if (playerSetting.isAvailable() && playerSetting.getPlayerType().isAi()) {
      whatToDoAis.add(aiFactory.buildWhatToDoAi(
          playerSettings[playerId].getPlayerType(),
          playerSettings[playerId].getCivilisation(),
          aiStatistics,
          mainGrid.getPartitionsGrid().getPlayer(playerId),
          mainGrid,
          mainGrid.getMovableGrid(),
          taskScheduler));
    }
  }
}
origin: jsettlers/settlers-remake

public void writeTo(DataOutputStream dos) throws IOException {
  dos.writeShort(INITIAL_VERSION);
  dos.writeBoolean(available);
  if (available) {
    dos.writeByte(teamId == null ? -1 : teamId);
    dos.writeUTF(civilisation == null ? "" : civilisation.name());
    dos.writeUTF(playerType == null ? "" : playerType.name());
  }
}
origin: jsettlers/settlers-remake

private void updateAiPlayerName() {
  if (typeComboBox.getSelectedItem() == null || civilisationComboBox.getSelectedItem() == null) {
    return;
  }
  if (EPlayerType.HUMAN != getPlayerType()) {
    ECivilisation civilisation = getCivilisation();
    if (civilisation != null) {
      setPlayerName(Labels.getString("player-name-" + getCivilisation().name() + "-" + ((PlayerTypeUiWrapper) typeComboBox.getSelectedItem()).getPlayerType().name()));
    } else {
      setPlayerName(Labels.getString("player-name-random"));
    }
    setReady(true);
  } else {
    setReady(false);
  }
}
jsettlers.common.aiEPlayerType

Most used methods

  • name
  • getTypeByIndex
  • isAi
  • ordinal
  • valueOf

Popular in Java

  • Reading from database using SQL prepared statement
  • runOnUiThread (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • onRequestPermissionsResult (Fragment)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Join (org.hibernate.mapping)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now