Просмотр исходного кода

Fixed broken conditions. Worked on walf

tags/v0.2.8
Fen Dweller 7 лет назад
Родитель
Сommit
cded99a5cf
3 измененных файлов: 55 добавлений и 8 удалений
  1. +1
    -1
      feast.js
  2. +49
    -7
      forest.js
  3. +5
    -0
      vore.js

+ 1
- 1
feast.js Просмотреть файл

@@ -313,7 +313,7 @@ function updateActions() {
actions = []; actions = [];
currentRoom.objects.forEach(function (object) { currentRoom.objects.forEach(function (object) {
object.actions.forEach(function (action) { object.actions.forEach(function (action) {
if (action.conditions == undefined || action.conditions.reduce((result, cond) => result && cond(player.prefs), true))
if (action.conditions == undefined || action.conditions.reduce((result, cond) => result && cond(player), true))
actions.push(action); actions.push(action);
}); });
}); });


+ 49
- 7
forest.js Просмотреть файл

@@ -38,16 +38,15 @@ function Wolf() {


this.hasName = false; this.hasName = false;


this.description = function() { return "wolf"; };
this.description = function(prefix) { return prefix + " wolf"; };


this.attacks = []; this.attacks = [];


this.attacks.push(wolfBite(this)); this.attacks.push(wolfBite(this));

//this.attacks.push(wolfSwallow(this));
this.attacks.push(wolfHowl(this));


this.attacks.push(wolfTackle(this)); this.attacks.push(wolfTackle(this));
//this.attacks.push(wolfTackleBite(this));
this.attacks.push(wolfTackleBite(this));
this.attacks.push(wolfTackleSwallow(this)); this.attacks.push(wolfTackleSwallow(this));


this.attacks.push(wolfDigest(this)); this.attacks.push(wolfDigest(this));
@@ -57,15 +56,15 @@ function Wolf() {
this.flags.stage = "combat"; this.flags.stage = "combat";


this.startCombat = function(player) { this.startCombat = function(player) {
return ["Oh no a feral wolf"];
return ["A snapping twig grabs your attention. You turn and find yourself facing a large, mangy wolf. The cur stands at least half your height at the shoulder, and it looks <i>hungry.</i>"];
}; };


this.finishCombat = function() { this.finishCombat = function() {
return ["Oops eaten"];
return ["The wolf knocks you to the ground. You bash your head on a rock and black out."];
}; };


this.status = function(player) { this.status = function(player) {
return ["It's a wolf"];
return [];
}; };
} }


@@ -88,6 +87,26 @@ function wolfBite(attacker) {
}; };
} }


function wolfHowl(attacker) {
return {
attackPlayer: function(defender){
attacker.statBuffs.push(new StatBuff("str", 1.25));
return ["The wolf backs up and lets out a long, wailing howl.",newline,"It seems emboldened."];
},
requirements: [
function(attacker, defender) {
return attacker.flags.stage == "combat";
},
function(attacker, defender) {
return !attacker.flags.grappled && !defender.flags.grappled;
}
],
priority: 1,
weight: function(attacker, defender) { return 0.25; }
};
}


function wolfTackle(attacker) { function wolfTackle(attacker) {
return { return {
attackPlayer: function(defender){ attackPlayer: function(defender){
@@ -107,6 +126,29 @@ function wolfTackle(attacker) {
}; };
} }


function wolfTackleBite(attacker) {
return {
attackPlayer: function(defender){
let damage = attack(attacker, defender, attacker.str * 1.5);
return pickRandom([
["Pain shoots through your arm as the wolf bites it for " + damage + " damage!"],
["You struggle against the wolf as it bites your shoulder for " + damage + " damage."],
["The wolf's claws dig into your legs for " + damage + " damage."]
]);
},
requirements: [
function(attacker, defender) {
return attacker.flags.stage == "combat";
},
function(attacker, defender) {
return !attacker.flags.grappled && defender.flags.grappled;
}
],
priority: 1,
weight: function(attacker, defender) { return 1 + defender.health/defender.maxHealth; }
};
}

function wolfTackleSwallow(attacker) { function wolfTackleSwallow(attacker) {
return { return {
attackPlayer: function(defender){ attackPlayer: function(defender){


+ 5
- 0
vore.js Просмотреть файл

@@ -1,5 +1,10 @@
"use strict"; "use strict";


function StatBuff(type, amount) {
this.stat = type;
this.amount = amount;
}

function Creature(name = "Creature", str = 10, dex = 10, con = 10) { function Creature(name = "Creature", str = 10, dex = 10, con = 10) {
this.name = name; this.name = name;




Загрузка…
Отмена
Сохранить