Procházet zdrojové kódy

Started work on Geta. description() takes a prefix now, so named entities will work better

tags/v0.2.8
Fen Dweller před 7 roky
rodič
revize
f85e400fe0
7 změnil soubory, kde provedl 99 přidání a 45 odebrání
  1. +21
    -21
      combat.js
  2. +41
    -0
      customs.js
  3. +1
    -1
      dialog.js
  4. +1
    -0
      feast.html
  5. +8
    -8
      feast.js
  6. +25
    -14
      vore.js
  7. +2
    -1
      world.js

+ 21
- 21
combat.js Zobrazit soubor

@@ -34,10 +34,10 @@ function punchAttack(attacker) {
name: "Punch",
desc: "Punch a nerd",
attack: function(defender) {
return "You punch the " + defender.description() + " for " + attack(attacker, defender, attacker.str) + " damage";
return "You punch " + defender.description("the") + " for " + attack(attacker, defender, attacker.str) + " damage";
},
attackPlayer: function(defender) {
return "The " + attacker.description() + " punches you for " + attack(attacker, defender, attacker.str) + " damage";
return attacker.description("The") + " punches you for " + attack(attacker, defender, attacker.str) + " damage";
}, requirements: [
function(attacker, defender) { return isNormal(attacker) && isNormal(defender); }
],
@@ -51,10 +51,10 @@ function flankAttack(attacker) {
name: "Flank",
desc: "Be sneaky",
attack: function(defender) {
return "You run around the " + defender.description() + " and attack for " + attack(attacker, defender, attacker.dex) + " damage";
return "You run around " + defender.description("the") + " and attack for " + attack(attacker, defender, attacker.dex) + " damage";
},
attackPlayer: function(defender) {
return "The " + attacker.description() + " runs past you, then turns and hits you for " + attack(attacker, defender, attacker.str) + " damage";
return attacker.description("The") + " runs past you, then turns and hits you for " + attack(attacker, defender, attacker.str) + " damage";
}, requirements: [
function(attacker, defender) { return isNormal(attacker) && isNormal(defender); }
],
@@ -71,18 +71,18 @@ function grapple(attacker) {
let success = statHealthCheck(attacker, defender, "str");
if (success) {
defender.grappled = true;
return "You charge at the " + defender.description() + ", tackling them and knocking them to the ground.";
return "You charge at " + defender.description("the") + ", tackling them and knocking them to the ground.";
} else {
return "You charge at the " + defender.description() + ", but they dodge out of the way!";
return "You charge at " + defender.description("the") + ", but they dodge out of the way!";
}
},
attackPlayer: function(defender) {
let success = Math.random() < 0.5;
if (success) {
defender.grappled = true;
return "The " + attacker.description() + " lunges at you, pinning you to the floor!";
return attacker.description("The") + " lunges at you, pinning you to the floor!";
} else {
return "The " + attacker.description() + " tries to tackle you, but you deftly avoid them.";
return attacker.description("The") + " tries to tackle you, but you deftly avoid them.";
}
},
requirements: [
@@ -103,9 +103,9 @@ function grappleDevour(attacker) {
attacker.stomach.feed(defender);
defender.grappled = false;
changeMode("explore");
return "You open your jaws wide, stuffing the " + defender.description() + "'s head into your gullet and greedily wolfing them down. Delicious.";
return "You open your jaws wide, stuffing " + defender.description("the") + "'s head into your gullet and greedily wolfing them down. Delicious.";
} else {
return "Your jaws open wide, but the " + defender.description() + " manages to avoid becoming " + attacker.species + " chow.";
return "Your jaws open wide, but " + defender.description("the") + " manages to avoid becoming " + attacker.species + " chow.";
}
},
attackPlayer: function(defender) {
@@ -113,9 +113,9 @@ function grappleDevour(attacker) {
if(success) {
defender.grappled = false;
changeMode("eaten");
return "The " + attacker.description() + " forces your head into their sloppy jaws, devouring you despite your frantic struggles. Glp.";
return attacker.description("The") + " forces your head into their sloppy jaws, devouring you despite your frantic struggles. Glp.";
} else {
return "The " + attacker.description() + " tries to swallow you down, but you manage to resist their hunger.";
return attacker.description("The") + " tries to swallow you down, but you manage to resist their hunger.";
}
}, requirements: [
function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); }
@@ -136,9 +136,9 @@ function grappleAnalVore(attacker) {
attacker.butt.feed(defender);
defender.grappled = false;
changeMode("explore");
return "You shove the " + defender.description() + " between your cheeks. Their head slips into your ass with a wet <i>shlk</i>, and the rest of their body follows suit. You moan and gasp, working them deeper and deeper...";
return "You shove " + defender.description("the") + " between your cheeks. Their head slips into your ass with a wet <i>shlk</i>, and the rest of their body follows suit. You moan and gasp, working them deeper and deeper...";
} else {
return "Your grasp and shove the " + defender.description() + ", but they manage to avoid becoming " + attacker.species + " chow.";
return "Your grasp and shove " + defender.description("the") + ", but they manage to avoid becoming " + attacker.species + " chow.";
}
}, requirements: [
function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); }
@@ -155,7 +155,7 @@ function grappleRelease(attacker) {
desc: "Release your opponent",
attack: function(defender) {
defender.grappled = false;
return "You throw the " + defender.description() + " back, dealing " + attack(attacker, defender, attacker.str*1.5) + " damage";
return "You throw " + defender.description("the") + " back, dealing " + attack(attacker, defender, attacker.str*1.5) + " damage";
}, requirements: [
function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); }
],
@@ -171,7 +171,7 @@ function grappledStruggle(attacker) {
let success = statHealthCheck(attacker, defender, "str");
if (success) {
attacker.grappled = false;
return "You struggle and shove the " + defender.description() + " off of you.";
return "You struggle and shove " + defender.description("the") + " off of you.";
} else {
return "You struggle, but to no avail.";
}
@@ -201,7 +201,7 @@ function grappledReverse(attacker) {
if (success) {
attacker.grappled = false;
defender.grappled = true;
return "You surprise the " + defender.description() + " with a burst of strength, flipping them over and pinning them.";
return "You surprise " + defender.description("the") + " with a burst of strength, flipping them over and pinning them.";
} else {
return "You try to throw your opponent off of you, but fail.";
}
@@ -250,7 +250,7 @@ function pass(attacker) {
return "You do nothing.";
},
attackPlayer: function(defender) {
return "The " + attacker.description() + " does nothing.";
return attacker.description("The") + " does nothing.";
},
priority: 0,
};
@@ -280,7 +280,7 @@ function leer(attacker) {
desc: "Leer at something",
attackPlayer: function(defender) {
attacker.leering = true;
return "The " + attacker.description() + " leers at you.";
return attacker.description("The") + " leers at you.";
},
requirements: [
function(attacker, defender) { return attacker.leering != true && attacker.grappled != true; }
@@ -294,7 +294,7 @@ function poke(attacker) {
name: "Poke",
desc: "Poke a nerd",
attackPlayer: function(defender) {
return "The " + attacker.description() + " pokes you on the snout for " + attack(attacker, defender, 1e12) + " damage";
return attacker.description("The") + " pokes you on the snout for " + attack(attacker, defender, 1e12) + " damage";
},
priority: 1,
};
@@ -304,7 +304,7 @@ function digestPlayerStomach(predator,damage=20) {
return {
digest: function(player) {
attack(predator, player, damage);
return "The " + predator.description() + "'s stomach grinds over your body, swiftly digesting you.";
return predator.description("The") + "'s stomach grinds over your body, swiftly digesting you.";
},
priority: 1,
};


+ 41
- 0
customs.js Zobrazit soubor

@@ -0,0 +1,41 @@
/* AEZNON COMMISSION */

function Geta() {
Creature.call(this, "Geta", 5, 15, 10);

this.hasName = true;
this.description = function() { return "Geta" };
}

function GetaObj() {
GameObject.call(this, "Geta");
this.actions.push( {
"name": "Approach Geta",
"action": function() {
startDialog(new GetaDialog());
}
});
}

function GetaDialog() {
DialogNode.call(this);

this.text = "You approach the sandy-furred fox.";

{
let nodeFight = new DialogNode();
this.addChoice("He certainly looks tasty...", nodeFight);

nodeFight.text = "You stalk up to your prey, but he sees you coming. You're going to have to fight!";
nodeFight.hooks.push( function(){
currentFoe = new Geta();
changeMode("combat");
});
}

{
let nodeIgnore = new DialogNode();
this.addChoice("Leave him be", nodeIgnore);
}
}

+ 1
- 1
dialog.js Zobrazit soubor

@@ -21,7 +21,7 @@ function EatDude() {

let nerd = new Anthro();

this.text = "You approach the " + nerd.description();
this.text = "You approach " + nerd.description("the");

let eatHim = new DialogNode();



+ 1
- 0
feast.html Zobrazit soubor

@@ -8,6 +8,7 @@
<script src="combat.js"></script>
<script src="objects.js"></script>
<script src="dialog.js"></script>
<script src="customs.js"></script>
<script src="world.js"></script>
<script src="vore.js"></script>
<script src="feast.js"></script>


+ 8
- 8
feast.js Zobrazit soubor

@@ -23,13 +23,13 @@ let prefs = {

function join(things) {
if (things.length == 1) {
return "a " + things[0].description();
return things[0].description("a");
} else if (things.length == 2) {
return "a " + things[0].description() + " and a " + things[1].description();
return things[0].description("a") + " and " + things[1].description("a");
} else {
let line = "";
line = things.slice(0,-1).reduce((line, prey) => line + "a " + prey.description() + ", ", line);
line += " and a " + things[things.length-1].description();
line = things.slice(0,-1).reduce((line, prey) => line + prey.description("a") + ", ", line);
line += " and " + things[things.length-1].description("a");
return line;
}
}
@@ -375,14 +375,14 @@ function respawn(respawnRoom) {
function startCombat(opponent) {
currentFoe = opponent;
changeMode("combat");
update(["Oh shit it's a " + opponent.description()]);
update(["Oh shit it's " + opponent.description("a")]);
}

function attackClicked(index) {
update([playerAttacks[index].attack(currentFoe)]);

if (currentFoe.health <= 0) {
update(["The " + currentFoe.description() + " falls to the ground!"]);
update([currentFoe.description("The") + " falls to the ground!"]);
startDialog(new FallenFoe(currentFoe));
} else if (mode == "combat") {
let attack = pick(filterPriority(filterValid(currentFoe.attacks, currentFoe, player)), currentFoe, player);
@@ -427,7 +427,7 @@ function struggleClicked(index) {
update([digest.digest(player)]);

if (player.health <= -100) {
update(["You digest in the depths of the " + currentFoe.description()]);
update(["You digest in the depths of " + currentFoe.description("the")]);
respawn(respawnRoom);
}
}
@@ -449,7 +449,7 @@ function dialogClicked(index) {
currentDialog = currentDialog.choices[index].node;
update([currentDialog.text]);
currentDialog.visit();
if (currentDialog.choices.length == 0) {
if (currentDialog.choices.length == 0 && mode == "dialog") {
changeMode("explore");
updateDisplay();
}


+ 25
- 14
vore.js Zobrazit soubor

@@ -13,6 +13,8 @@ function Creature(name = "Creature", str=10, dex=10, con=10) {
this.dex = dex;
this.con = con;

this.hasName = false;

Object.defineProperty(this, "maxHealth", {get: function() { return this.str * 5 + this.con * 10 }});
this.health = this.maxHealth;
Object.defineProperty(this, "maxStamina", {get: function() { return this.dex * 5 + this.con * 10 }});
@@ -80,11 +82,20 @@ function Anthro(name="Anthro") {
}

this.species = pickRandom(["dog","cat","lizard","deer","wolf","fox"]);
this.description = function() {

// todo better lol

this.description = function(prefix="") {
if (this.build == "")
return this.species;
if (prefix == "")
return this.species;
else
return prefix + " " + this.species;
else
return this.build + " " + this.species;
if (prefix == "")
return this.build + " " + this.species;
else
return prefix + " " + this.build + " " + this.species;
};

this.attacks.push(new punchAttack(this));
@@ -215,15 +226,15 @@ class Stomach extends Container {
}

describeDamage(prey) {
return "Your guts gurgle and churn, slowly wearing down the " + prey.description() + " trapped within.";
return "Your guts gurgle and churn, slowly wearing down " + prey.description("the") + " trapped within.";
}

describeKill(prey) {
return "The " + prey.description() + "'s struggles wane as your stomach overpowers them.";
return prey.description("The") + "'s struggles wane as your stomach overpowers them.";
}

describeFinish(prey) {
return "Your churning guts have reduced a " + prey.description() + " to meaty chyme.";
return "Your churning guts have reduced " + prey.description("a") + " to meaty chyme.";
}

fill(amount) {
@@ -253,7 +264,7 @@ class Butt extends Container {

pushed.forEach(function(x) {
this.stomach.feed(x);
lines.push("Your winding guts squeeze the " + x.description() + " into your stomach.");
lines.push("Your winding guts squeeze " + x.description("the") + " into your stomach.");
},this);

this.contents = this.contents.filter(prey => prey.timeInButt < 60 * 30);
@@ -262,11 +273,11 @@ class Butt extends Container {
}

describeDamage(prey) {
return "Your bowels gurgle and squeeze, working to wear down the " + prey.description() + " trapped in those musky confines.";
return "Your bowels gurgle and squeeze, working to wear down " + prey.description("the") + " trapped in those musky confines.";
}

describeKill(prey) {
return "The " + prey.description() + " abruptly stops struggling, overpowered by your winding intestines.";
return prey.description("The") + " abruptly stops struggling, overpowered by your winding intestines.";
}

describeFinish(prey) {
@@ -319,12 +330,12 @@ function plead(predator) {
if (escape) {
return {
"escape": escape,
"lines": ["You plead for the " + predator.description() + " to let you free, and they begrudingly agree, horking you up and leaving you shivering on the ground"]
"lines": ["You plead for " + predator.description("the") + " to let you free, and they begrudingly agree, horking you up and leaving you shivering on the ground"]
};
} else {
return {
"escape": escape,
"lines": ["You plead with the " + predator.description() + " to let you go, but they refuse."]
"lines": ["You plead with " + predator.description("the") + " to let you go, but they refuse."]
};
}
}
@@ -341,12 +352,12 @@ function struggle(predator) {
if (escape) {
return {
"escape": escape,
"lines": ["You struggle and squirm, forcing the " + predator.description() + " to hork you up. They groan and stumble away, exhausted by your efforts."]
"lines": ["You struggle and squirm, forcing " + predator.description("the") + " to hork you up. They groan and stumble away, exhausted by your efforts."]
};
} else {
return {
"escape": escape,
"lines": ["You squirm and writhe within the " + predator.description() + " to no avail."]
"lines": ["You squirm and writhe within " + predator.description("the") + " to no avail."]
};
}
}
@@ -360,7 +371,7 @@ function rub(predator) {
struggle: function(player) {
return {
"escape": false,
"lines": ["You rub the walls of your predator's belly. At least the " + predator.description() + " is getting something out of this."]
"lines": ["You rub the walls of your predator's belly. At least " + predator.description("the") + " is getting something out of this."]
};
}
};


+ 2
- 1
world.js Zobrazit soubor

@@ -169,7 +169,8 @@ let locationsSrc = [
}
],
"objs": [
NatureTrailExercise
NatureTrailExercise,
GetaObj
]
},
{


Načítá se…
Zrušit
Uložit