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

Added requirements to attacks.

tags/v0.2.8
Fen Dweller 7 лет назад
Родитель
Сommit
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: [
function(prefs) { return prefs.player.prey; }
],
requirements: [
function(attacker, defender) { return attacker.leering == true; }
],
attackPlayer: function(defender) {
changeMode("eaten");
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) {
return {
name: "Poke",
desc: "Poke a nerd",
attack: function(defender) {
return "You poke the " + defender.description() + " for " + attack(attacker, defender, 1e12) + " damage";
},
attackPlayer: function(defender) {
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!"]);
startDialog(new FallenFoe(currentFoe));
} 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) {
attack = currentFoe.backupAttack;
}


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

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

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

this.struggles = [];


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