Преглед изворни кода

Add a basic struggle minigame in Geta's maw

You have to struggle forward to avoid being swallowed, but also can't go too far forward,
or else you'll be chewed.
geta
Fen Dweller пре 6 година
родитељ
комит
78002bc6ac
1 измењених фајлова са 78 додато и 23 уклоњено
  1. +78
    -23
      stories/geta-unaware.js

+ 78
- 23
stories/geta-unaware.js Прегледај датотеку

@@ -28,7 +28,7 @@
"intro": {
"start": "pepper-grinder",
"setup": state => {
state.info.awareness = {
id: "awareness",
name: "Geta's Awareness",
@@ -45,8 +45,11 @@
}
}

state.geta = {};

state.player.stats.health = { name: "Health", type: "meter", value: 100, min: 0, max: 100, color: "rgb(255,55,55)" };
state.player.stats.suspicion = { name: "Suspicion", type: "meter", value: 0, min: 0, max: 100, color: "rgb(100,100,100)" };
state.player.stats.mawPos = { "name": "Struggle", "type": "meter", "value": 0.5, "min": 0, "max": 1, "color": "rgb(0,255,0)", hidden: true }
state.info.time.value = 60 * 60 * 7 + 60 * 17;

startTimer({
@@ -456,45 +459,94 @@
},
"enter": (room, state) => {
stopClassTimers("free", state);
startTimer({
id: "swallow",
func: state => {
print(["It's too late to escape. You're swallowed down."]);
stopTimer("maw-tease", state);
goToRoom("throat", state);
return true;
},
delay: Math.random() * 5000 + 6000,
loop: false,
classes: [

]
}, state);
state.player.stats.mawPos.hidden = false;

startTimer({
id: "maw-tease",
id: "maw-struggle",
func: state => {
printRandom([
["Your captor teases you with a sharp, sloppy swallow, barely holding you back from plunging down that slick gullet."],
["You're sloshed to and fro, battered against the fox's gums by his undulating tongue."],
["Slobber drenches your body as you're smothered beneath Geta's hot tongue."]
]);
return Math.random() * 2000 + 3000;
const choice = Math.random();

if (getStat("mawPos", state) <= 0) {
print(["Swallowed!"]);
goToRoom("throat", state);
return false;
} else if (getStat("mawPos", state) >= 1) {
print(["Chewed!"]);
changeStat("health", -90, state);
goToRoom("stomach", state);
return false;
}

if (choice < 0.3) {
if (getStat("mawPos", state) < 0.3) {
print(["Swallowed!"]);
goToRoom("throat", state);
return false;
} else {
print(["Swallows"]);
changeStat("mawPos", -0.25, state);
return Math.random() * 1500 + 2500;
}

} else if (choice < 0.7) {
changeStat("mawPos", -0.1, state);
print(["Slurps"]);
return Math.random() * 1000 + 1500;
} else {
if (getStat("mawPos", state) > 0.7) {
print(["Chewed!"]);
changeStat("health", -90, state);
goToRoom("stomach", state);
return false;
} else {
print(["Chews"]);
return Math.random() * 500 + 1000;
}

}
},
delay: 3000,
delay: 0,
loop: true,
classes: [

]
}, state);


},
"exit": (room, state) => {

},
"actions": [
{
name: "Struggle",
desc: "Pull yourself away from the fox's throat! Just don't go too far forward...",
execute: (room, state) => {
print(["You drag yourself forward"]);
changeStat("mawPos", Math.random() * 0.1 + 0.15, state);
},
show: [

],
conditions: [

]
},
{
name: "Slip Back",
desc: "Slide back towards Geta's gullet",
execute: (room, state) => {
print(["You let yourself slip back"]);
changeStat("mawPos", -Math.random() / 5 - 0.2, state);
},
show: [
],
conditions: [
]
},
],
"exits": {

@@ -516,6 +568,9 @@

},
"enter": (room, state) => {

state.player.stats.mawPos.hidden = true;

startTimer({
id: "throat-swallow",
func: state => {


Loading…
Откажи
Сачувај