瀏覽代碼

Add some random events during digestion

geta
Fen Dweller 5 年之前
父節點
當前提交
6925f83ac1
共有 1 個檔案被更改,包括 99 行新增28 行删除
  1. +99
    -28
      stories/geta-unaware.js

+ 99
- 28
stories/geta-unaware.js 查看文件

@@ -17,6 +17,23 @@

return true;
}

function randomBodyPart(state) {
const choices = Object.entries(state.player.limbs).filter(([name, status]) => {
return status;
}).map(([name, status]) => name);

return choices[Math.floor(Math.random() * choices.length)];
}

const limbs = {
head: "head",
leftArm: "left arm",
rightArm: "right arm",
leftLeg: "left leg",
rightLeg: "right leg"
};

stories.push({
"id": "geta-unaware",
"name": "Geta's Breakfast",
@@ -53,6 +70,13 @@
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;

state.player.limbs = {};
state.player.limbs.head = true;
state.player.limbs.leftArm = true;
state.player.limbs.rightArm = true;
state.player.limbs.leftLeg = true;
state.player.limbs.rightLef = true;

startTimer({
id: "clock",
func: state => {
@@ -468,18 +492,18 @@
state.geta.swallowsLeft = 3 + Math.floor(Math.random() * 3);

startTimer({
id: "maw-random-movement",
func: state => {
changeStat("mawPos", Math.random()/50 - 0.01, state);
return true;
},
delay: 100,
loop: true,
classes: [
"maw-struggle"
]
id: "maw-random-movement",
func: state => {
changeStat("mawPos", Math.random() / 50 - 0.01, state);
return true;
},
delay: 100,
loop: true,
classes: [
"maw-struggle"
]
}, state);
startTimer({
id: "maw-struggle",
func: state => {
@@ -505,7 +529,7 @@

if (Math.random() > state.geta.slurps / 3) {
choice = "slurp";
} else if (state.geta.chews - Math.floor(Math.random()*3) < state.geta.slurps) {
} else if (state.geta.chews - Math.floor(Math.random() * 3) < state.geta.slurps) {
choice = "chew";
} else {
choice = "swallow";
@@ -571,19 +595,19 @@
]
},
{
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: [
]
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": {
@@ -682,10 +706,57 @@
playLoop("loop/stomach.ogg");
stopClassTimers("maw-struggle", state);

state.geta.acidStrength = 1;

startTimer({
id: "digest-random",
func: state => {
const choices = [
() => {
const crushed = randomBodyPart(state);
const name = limbs[crushed];

if (name == "head") {
print(["A powerful fold of muscle grips your head, crushing it like a grape and killing you instantly."]);
changeStat("health", -100, state);
return false;
} else {
print(["Geta's stomach grips your " + name + " and crushes it with a horrific CRACK"]);
changeStat("health", -40, state);
return true;
}
},
() => {
print(["Geta squeezes in on his gut with both hands, sloshing you around in the sickly stew of cereal, milk, and enzymatic slime."]);
changeStat("health", -10, state);
return true;
},
() => {
print(["Your organic prison snarls and churns, soaking you in fresh acids and hastening your wretched demise."]);
state.geta.acidStretngth += 1;
return true;
},
() => {
print(["\"You were barely worth eating,\" murmurs the fox. \"So small. So weak.\""]);
return true;
}
];

return choices[Math.floor(Math.random() * choices.length)]();

},
delay: 5000,
loop: true,
classes: [
"digestion"
]
}, state);

startTimer({
id: "digest",
func: state => {
changeStat("health", -0.3, state);
changeStat("health", -0.3 * state.geta.acidStrength, state);

if (getStat("health", state) <= 0) {
print(["You're digested before too long."]);
@@ -699,7 +770,7 @@
delay: 100,
loop: true,
classes: [
"digestion"
]
}, state);

@@ -746,7 +817,7 @@

},
"enter": (room, state) => {
stopClassTimers("digestion", state);
},
"exit": (room, state) => {



Loading…
取消
儲存