浏览代码

Added requirements to attacks.

tags/v0.2.8
Fen Dweller 7 年前
父节点
当前提交
c3f1211ff3
共有 3 个文件被更改,包括 22 次插入5 次删除
  1. +17
    -3
      combat.js
  2. +4
    -1
      feast.js
  3. +1
    -1
      vore.js

+ 17
- 3
combat.js 查看文件

@@ -39,6 +39,9 @@ function devourPlayer(attacker) {
conditions: [ conditions: [
function(prefs) { return prefs.player.prey; } function(prefs) { return prefs.player.prey; }
], ],
requirements: [
function(attacker, defender) { return attacker.leering == true; }
],
attackPlayer: function(defender) { attackPlayer: function(defender) {
changeMode("eaten"); changeMode("eaten");
return "The voracious " + attacker.description() + " pins you down and devours you in seconds."; return "The voracious " + attacker.description() + " pins you down and devours you in seconds.";
@@ -46,13 +49,24 @@ function devourPlayer(attacker) {
} }
} }


function leer(attacker) {
return {
name: "Leer",
desc: "Leer at something",
attackPlayer: function(defender) {
attacker.leering = true;
return "The " + attacker.description() + " leers at you.";
},
requirements: [
function(attacker, defender) { return attack.leering != true; }
]
};
}

function poke(attacker) { function poke(attacker) {
return { return {
name: "Poke", name: "Poke",
desc: "Poke a nerd", desc: "Poke a nerd",
attack: function(defender) {
return "You poke the " + defender.description() + " for " + attack(attacker, defender, 1e12) + " damage";
},
attackPlayer: function(defender) { attackPlayer: function(defender) {
return "The " + attacker.description() + " pokes you on the snout for " + attack(attacker, defender, 1e12) + " damage"; return "The " + attacker.description() + " pokes you on the snout for " + attack(attacker, defender, 1e12) + " damage";
} }


+ 4
- 1
feast.js 查看文件

@@ -311,8 +311,11 @@ function attackClicked(index) {
update(["The " + currentFoe.description() + " falls to the ground!"]); update(["The " + currentFoe.description() + " falls to the ground!"]);
startDialog(new FallenFoe(currentFoe)); startDialog(new FallenFoe(currentFoe));
} else { } else {
let attack = pick(currentFoe.attacks.filter(attack => attack.conditions == undefined || attack.conditions.reduce((result, test) => result && test(prefs), true)));
let attacks = currentFoe.attacks.filter(attack => attack.conditions == undefined || attack.conditions.reduce((result, test) => result && test(prefs), true));
attacks = attacks.filter(attack => attack.requirements == undefined || attack.requirements.reduce((result, test) => result && test(currentFoe, player), true));


let attack = pick(attacks);
if (attack == null) { if (attack == null) {
attack = currentFoe.backupAttack; attack = currentFoe.backupAttack;
} }


+ 1
- 1
vore.js 查看文件

@@ -69,7 +69,7 @@ function Fen() {
this.attacks = []; this.attacks = [];


this.attacks.push(new devourPlayer(this)); this.attacks.push(new devourPlayer(this));
this.attacks.push(new leer(this));
this.backupAttack = new poke(this); this.backupAttack = new poke(this);


this.struggles = []; this.struggles = [];


正在加载...
取消
保存