congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ChildDeathState
Code IndexAdd Tabnine to your IDE (free)

How to use
ChildDeathState
in
ch.sahits.game.openpatrician.clientserverinterface.model.event

Best Java code snippets using ch.sahits.game.openpatrician.clientserverinterface.model.event.ChildDeathState (Showing top 2 results out of 315)

origin: ch.sahits.game/OpenPatricianDisplay

  @PostConstruct
  private void initializeDialog() {
    String letterDate = modelTranslations.toDisplayString(state.getDate());
    int age = dateService.getAge(state.getChild().getBirthDate());
    addDecoratedText("letter.location.date", "dateLocation", Pos.CENTER_RIGHT, state.getLocation(), letterDate);
    addVerticalSpacer(20);
    addDecoratedText("letter.dairy.entry", "diryEntry");
    addVerticalSpacer(20);
    addDecoratedText("ch.sahits.game.openpatrician.display.dialog.event.ChildDeathDialog.childDeath", "childDeath", state.getChild().getName(), age);
  }
}
origin: ch.sahits.game/OpenPatricianEngine

@VisibleForTesting
void handleChildDeathEvent(boolean catastopheEvent, IPlayer player, boolean childBirth, boolean spouseDeath) {
  if (!catastopheEvent && !spouseDeath && !childBirth) {
    int childDeathLimit = calculateChildDeathLimit(player);
    boolean childDeath = !spouseDeath && childDeathLimit > 0 && rnd.nextInt(childDeathLimit) == 0;
    if (childDeath) {
      List<IChild> nonAdults = filterNonAdultChildren(player);
      IChild child = nonAdults.get(rnd.nextInt(nonAdults.size()));
      ChildDeathState state = ChildDeathState.builder()
          .location(player.getHometown().getName())
          .date(date.getCurrentDate())
          .child(child)
          .build();
      List<IChild> children = player.getChildren();
      children.remove(child);
      eventService.postToHumanPlayer(state, player, "ch.sahits.game.openpatrician.engine.event.EventEngine.message.childDeath.titl");
    }
  }
}
ch.sahits.game.openpatrician.clientserverinterface.model.eventChildDeathState

Most used methods

  • builder
  • getChild
  • getDate
  • getLocation

Popular in Java

  • Updating database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (ScheduledExecutorService)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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