Home /Modules/gameplay/HelpIndexMove.sleela

HelpIndexMove.sleela

lib/gameplay/HelpIndexMove.sleela · 102 line(s) · sleela

<< lib/gameplay/HelpIndexMove.sleela
   SLeeLa Standard Library Definition.
   Definition: Move (a) — create a help index or a friend. It generally plays as
     an 80% roll, then a 20% roll. On the first (80%) roll you build the index
     and bank solid experience; on the rarer second (20%) roll you also pull the
     BETTER player's index and your boss's deeper understanding. Each reward is a
     subevent resolved on its own percentage, live-play, so no two turns feel
     identical even on the same seed stream.
   
   A concrete GameMove: override resolve() to roll and fill a MoveOutcome.
   Family: gameplay. >>
#sleela 2.5
material;
class HelpIndexMove extends GameMove {
  < ---- 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 = 10321;
  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; }

  void setUp() {
    load();
    declare("Create Help Index / Friend", CHOICE_HELP_INDEX);
  }

  MoveOutcome resolve(Player p) {
    MoveOutcome out = new MoveOutcome();
    out.begin("Create Help Index / Friend");
    if (dice == null || p == null) {
      out.say("No roller or player; nothing indexed.");
      return out;
    }

    < The primary 80% roll: build the help index / make the friend. >
    boolean built = dice.rollUnder(80);
    if (!built) {
      out.say("The index wouldn't come together this turn.");
      < you learn a little even from a dud >
      out.addXp(1);
      return out;
    }
    out.succeed();
    < more experience per turn, as desired >
    out.addXp(5);

    < The rarer 20% roll unlocks the premium rewards, each a live subevent. >
    boolean premium = dice.rollUnder(20);
    if (premium) {
      < Subevent 1: the better player's index (65% within the premium branch). >
      if (dice.rollUnder(65)) {
        out.addXp(4);
        out.addFile(1);
      }
      < Subevent 2: your boss's deeper understanding (55% within premium). >
      if (dice.rollUnder(55)) {
        p.raiseBossUnderstanding(10);
        out.addTact(1);
      }
      out.say("Index built AND the premium 20% landed: better index + boss rapport.");
    } else {
      out.say("Index built on the 80% roll; the premium 20% did not land.");
    }
    return out;
  }
}