Home /Modules/gameplay/DetailedReport.sleela

DetailedReport.sleela

lib/gameplay/DetailedReport.sleela · 114 line(s) · sleela

<< lib/gameplay/DetailedReport.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines DetailedReport, the document the Boss hands a Player on a
     LOSING "ask for help" roll — the consolation prize that is often the better
     prize. Where ExpectedFuture only shows the schedule, a DetailedReport comes
     with some Game-Engineering moves ALREADY decided, so the player gets a plan
     instead of a prophecy. The player pays for it based on their own quality.
   
   DetailedReport is a NATURAL / LOADABLE MODULE sharing the common module
   contract (load / loaded / moduleName / describe). It holds an ordered list of
   pre-decided engineering moves and the price that was charged for it.
   
   Family: gameplay. >>
#sleela 2.5
material;
< Unified SLeeLa SDK front-end object. >
class DetailedReport {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10309;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-07";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }

  static final String MODULE = "DetailedReport";
  static final int MAX_MOVES = 16;

  int loadedFlag;
  String title;
  < Game-Engineering moves the boss already chose >
  String[] decidedMoves;
  int moveCount;
  < what the player paid, by their quality >
  int pricePaidCents;
  < whether the player could pay at all >
  boolean affordable;

  < --- loadable-module contract ------------------------------------------ >
  void load() {
    loadedFlag = 1;
    title = "Boss's Detailed Report";
    decidedMoves = new String[MAX_MOVES];
    moveCount = 0;
    pricePaidCents = 0;
    affordable = false;
  }
  boolean loaded() { return loadedFlag == 1; }
  String moduleName() { return MODULE; }

  void name(String t) { if (t != null) { title = t; } }
  void setPrice(int cents, boolean couldPay) {
    pricePaidCents = cents;
    affordable = couldPay;
  }

  < Record one pre-decided Game-Engineering move. >
  void decide(String move) {
    if (move == null || moveCount >= MAX_MOVES) { return; }
    decidedMoves[moveCount] = move;
    moveCount = moveCount + 1;
  }

  String moveAt(int i) {
    if (i < 0 || i >= moveCount) { return null; }
    return decidedMoves[i];
  }

  int moves() { return moveCount; }
  boolean paid() { return affordable; }
  int price() { return pricePaidCents; }

  String yn(boolean v) { if (v) { return "yes"; } return "no"; }

  String describe() {
    return MODULE + " '" + title + "' decidedMoves=" + moveCount
         + " price=" + pricePaidCents + " paid=" + yn(affordable);
  }
}