Преглед на файлове

chore: added better defaulting for threatMult and added a helper method to reset aggro

tags/v0.12.0
Shaun преди 1 година
родител
ревизия
48ad103e09
променени са 1 файла, в които са добавени 7 реда и са изтрити 3 реда
  1. +7
    -3
      src/server/components/aggro.js

+ 7
- 3
src/server/components/aggro.js Целия файл

@@ -178,7 +178,7 @@ module.exports = {
this.ignoreList.spliceWhere(o => o === obj);
},

tryEngage: function (source, amount, threatMult) {
tryEngage: function (source, amount, threatMult = 1) {
let obj = this.obj;

//Don't aggro yourself, stupid
@@ -204,7 +204,7 @@ module.exports = {
let list = this.list;

amount = (amount || 0);
let threat = (amount / obj.stats.values.hpMax) * (threatMult || 1);
let threat = (amount / obj.stats.values.hpMax) * threatMult;

let exists = list.find(l => l.obj.id === oId);
if (!exists) {
@@ -237,7 +237,7 @@ module.exports = {
return null;
},

die: function () {
reset: function () {
let list = this.list;
let lLen = list.length;

@@ -259,6 +259,10 @@ module.exports = {
this.list = [];
},

die: function () {
this.reset();
},

unAggro: function (obj, amount) {
let list = this.list;
let lLen = list.length;


Зареждане…
Отказ
Запис