Przeglądaj źródła

Dialog can now have requirements. Geta can be stomped and crushed

tags/v0.2.8
Fen Dweller 7 lat temu
rodzic
commit
9c94a8af96
5 zmienionych plików z 37 dodań i 2 usunięć
  1. +18
    -0
      combat.js
  2. +1
    -1
      customs.js
  3. +11
    -0
      dialog.js
  4. +6
    -1
      feast.js
  5. +1
    -0
      vore.js

+ 18
- 0
combat.js Wyświetl plik

@@ -267,6 +267,24 @@ function shrunkSwallow(attacker) {
};
}

function shrunkStomp(attacker) {
return {
name: "Stomp",
desc: "Stomp on your shrunken prey",
attack: function(defender) {
let success = statCheck(attacker, defender, "dex") || statCheck(attacker, defender, "dex") || defender.stamina == 0;
defender.stamina = 0;
defender.health = Math.max(0, defender.health - 50);
return "Your paw comes crashing down on " + defender.description("the") + ", burying them under your heavy toes and pinning them down hard.";
},
requirements: [
function(attacker, defender) {
return isNormal(attacker) && defender.flags.grappled != true && defender.flags.shrunk == true;
}
]
};
}

function flee(attacker) {
return {
name: "Flee",


+ 1
- 1
customs.js Wyświetl plik

@@ -139,7 +139,7 @@ function getaStomp(attacker) {
if (success) {
defender.health = Math.max(-100, defender.health - 50 - Math.round(Math.random() * 25));
defender.stamina = 0;
return attacker.description() + "'s paws comes crashing down on your little body, smashing you into the dirt.";
return attacker.description() + "'s paw comes crashing down on your little body, smashing you into the dirt.";
} else {
return "You dive away as " + attacker.description() + "'s paw slams down, narrowly missing your little body.";
}


+ 11
- 0
dialog.js Wyświetl plik

@@ -4,6 +4,8 @@ function DialogNode() {
this.text = "Foo bar baz.";
this.hooks = [];

this.requirements = [];

this.visit = function() {
for (let i=0; i<this.hooks.length; i++)
this.hooks[i]();
@@ -80,6 +82,15 @@ function FallenFoe(foe) {
this.addChoice("Spare",nodeSpare);
nodeSpare.text = "You decide to leave your foe uneaten.";
}

{
let nodeCrush = new DialogNode();
this.addChoice("Crush",nodeCrush);
nodeCrush.text = "You slam your paw down hard, crushing " + foe.description("the") + " like a bug";
nodeCrush.requirements.push( function(attacker, defender) {
return defender.flags.shrunk == true;
});
}
}

function NatureExercise() {


+ 6
- 1
feast.js Wyświetl plik

@@ -163,11 +163,16 @@ function updateDialog() {
}

for (let i = 0; i < currentDialog.choices.length; i++) {
let activated = currentDialog.choices[i].node.requirements == undefined || currentDialog.choices[i].node.requirements.reduce((result, test) => result && test(player, currentFoe), true);
let li = document.createElement("li");
let button = document.createElement("button");
button.classList.add("dialog-button");
button.innerHTML = currentDialog.choices[i].text;
button.addEventListener("click", function() { dialogClicked(i); });
if (!activated) {
button.classList.add("disabled-button");
button.disabled = true;
}
li.appendChild(button);
list.appendChild(li);
}
@@ -416,7 +421,7 @@ function struggleClicked(index) {
if (result.escape) {
changeMode("explore");
} else {
let digest = pick(filterValid(currentFoe.digests, FurrentFoe, player), currentFoe, player);
let digest = pick(filterValid(currentFoe.digests, currentFoe, player), currentFoe, player);

if (digest == null) {
digest = currentFoe.backupDigest;


+ 1
- 0
vore.js Wyświetl plik

@@ -65,6 +65,7 @@ function Player(name = "Player") {

this.attacks.push(new shrunkGrapple(this));
this.attacks.push(new shrunkSwallow(this));
this.attacks.push(new shrunkStomp(this));

this.attacks.push(new flee(this));



Ładowanie…
Anuluj
Zapisz