health: 20
fuel: 4
system: []
numberOfJumpsLeft: 10
--
{embed passage: 'GenerateSystem'}
[[Explore Space]]{embed passage: "CheckStatus"}
Current System:
{embed passage: 'DisplaySystem'}
<hr>
[[Hyperjump]]
[[Statistics]] [JavaScript]
// There will always be four (4) planets
let planets = 4;
// Reset global system
let system = engine.state.get('system');
system = [];
// Add 0 (Red) or 1 (Green) planets
for(let i = 0; i < planets; i++) {
// Get a random number from 0 to 2
// 0 = RED
// 1 = GREEN
// 2 = EMPTY
system.push(Math.randomRange(0,3));
}
// Update the new 'system'
engine.state.set('system', system);
[JavaScript]
let health = engine.state.get("health");
let fuel = engine.state.get("fuel");
let numberOfJumpsLeft = engine.state.get("numberOfJumpsLeft");
if(health <= 0) {
// Introduce a micro-delay before transition
setTimeout(() => {
go("Destroyed");
}, 10);
}
if(fuel <= 0) {
// Introduce a micro-delay before transition
setTimeout(() => {
go("Lost in Space");
}, 10);
}
if(numberOfJumpsLeft <= 0) {
// Introduce a micro-delay before transition
setTimeout(() => {
go("Safe");
}, 10);
}
The ship exploded in flight.
Game Over.Without fuel, the ship tumbled and spun in the endless black.
Game OverAfter 10 hyperjumps, the ship left the hazardous area and called for help.
Success!fuel: fuel - 1
numberOfJumpsLeft: numberOfJumpsLeft - 1
--
{embed passage: "CheckStatus"}
{embed passage: "GenerateSystem"}
[[Scan System->Explore Space]]
[if system[0] == 0]
{reveal link: 'RED', passage: 'RED'}
[if system[0] == 1]
{reveal link: 'GREEN', passage: 'GREEN'}
[if system[0] == 2]
<br>
[if system[1] == 0]
{reveal link: 'RED', passage: 'RED'}
[if system[1] == 1]
{reveal link: 'GREEN', passage: 'GREEN'}
[if system[1] == 2]
<br>
[if system[2] == 0]
{reveal link: 'RED', passage: 'RED'}
[if system[2] == 1]
{reveal link: 'GREEN', passage: 'GREEN'}
[if system[2] == 2]
<br>
[if system[3] == 0]
{reveal link: 'RED', passage: 'RED'}
[if system[3] == 1]
{reveal link: 'GREEN', passage: 'GREEN'}
[if system[3] == 2]
<br>
REPORT
[JavaScript]
let percentage = Math.randomRange(0, 11);
let foundHealth;
let foundFuel;
let health = engine.state.get('health');
let fuel = engine.state.get('fuel');
if(percentage >= 6) {
foundHealth = Math.randomRange(1, 6);
foundFuel = Math.randomRange(1, 3);
write(`The hostile environment damaged the ship, but extra fuel was found. (-${foundHealth} to health and +${foundFuel} to fuel.)`);
health -= foundHealth;
fuel += foundFuel;
}
if(percentage >= 3 && percentage < 6) {
foundHealth = Math.randomRange(2, 8);
write(`A hostile ship attacked. (-${foundHealth} to health)`);
health -= foundHealth;
}
if(percentage < 3) {
write("Nothing happened.");
}
engine.state.set('health', health);
engine.state.set('fuel', fuel);
[continued]
{embed passage: "CheckStatus"}REPORT
[JavaScript]
let percentage = Math.randomRange(0, 11);
let foundFuel = 0;
let foundHealth = 0;
let fuel = engine.state.get('fuel');
let health = engine.state.get('health');
if(percentage < 2) {
foundFuel = Math.randomRange(1,3);
write(`Fuel was found in some wreckage. (+${foundFuel} to fuel)`);
fuel += foundFuel;
}
if(percentage > 6) {
foundHealth = Math.randomRange(1,4);
write(`During a brief pause, the ship was able to be repaired. (+${foundHealth} to health)`);
health += foundHealth;
}
if(percentage > 2 && percentage < 6)
{
write(`Nothing happened.`);
}
engine.state.set('health', health);
engine.state.set('fuel', fuel);
[continued]
{embed passage: "CheckStatus"}Health: {health}
Fuel: {fuel}
Number of Jumps Left: {numberOfJumpsLeft}
{reveal link: 'Statistics', passage: 'Statistics'}