diff --git a/src/events/001-base/baseEvent.js b/src/events/001-base/baseEvent.js index 8fe3d9f7c03eba76c013c2cfee78153af989845f..822c0b1251aee84aa7b1f72d4bed7f802c4caf9c 100644 --- a/src/events/001-base/baseEvent.js +++ b/src/events/001-base/baseEvent.js @@ -56,6 +56,14 @@ App.Events.BaseEvent = class BaseEvent { return JSON.reviveWrapper(`new App.Events.${this.constructor.name}(${JSON.stringify(this.actors)},${JSON.stringify(this.params)})`); } + /** get the event's (human-readable) name. must not include ":". + * default implementation should generally suffice (though we might want to de-camelcase here or something). + * @returns {string} + */ + get eventName() { + return this.constructor.name; + } + /** build the actual list of actors that will be involved in this event. * default implementation should suffice for child classes with a fixed number of actors; may be overridden for events with variable actor count. * @param {App.Entity.SlaveState} firstActor - if non-null, the first actor should be this slave (fail if she is not qualified) diff --git a/src/events/randomEvent.js b/src/events/randomEvent.js index 84ad32ee14c58289a30d74c1a09dadb81befbbfe..dc12e6eac0b207c47102397d98dd05d700ff5a16 100644 --- a/src/events/randomEvent.js +++ b/src/events/randomEvent.js @@ -39,13 +39,13 @@ App.Events.getNonindividualEvents = function() { /** get a stringified list of possible individual events as fake passage names - TODO: kill me */ App.Events.getIndividualEventsPassageList = function(slave) { const events = App.Events.getIndividualEvents(slave); - return events.map(e => `JSRE ${e.constructor.name}:${JSON.stringify(e.toJSON())}`); + return events.map(e => `JSRE ${e.eventName}:${JSON.stringify(e.toJSON())}`); }; /** get a stringified list of possible individual events as fake passage names - TODO: kill me */ App.Events.getNonindividualEventsPassageList = function() { const events = App.Events.getNonindividualEvents(); - return events.map(e => `JSRE ${e.constructor.name}:${JSON.stringify(e.toJSON())}`); + return events.map(e => `JSRE ${e.eventName}:${JSON.stringify(e.toJSON())}`); }; /** execute a fake event passage from the embedded JSON - TODO: kill me */ diff --git a/src/gui/storyCaption.tw b/src/gui/storyCaption.tw index 1789dc6fdb3bddb9805cd4271774c12c44ae41cd..48970224aa2aaf43cd1db41dc4e673474d8b040d 100644 --- a/src/gui/storyCaption.tw +++ b/src/gui/storyCaption.tw @@ -62,6 +62,9 @@ <<if $ui != "start" && _Pass != "Encyclopedia">> <<if $cheatMode || $debugMode>> <div>_Pass</div> + <<if _Pass == "JS Random Event">> + <div><<= $event.eventName>></div> + <</if>> <</if>> <div> <span id="week">''Week $week''</span>