142 lines
3.3 KiB
JavaScript
142 lines
3.3 KiB
JavaScript
var __extends =
|
|
(this && this.__extends) ||
|
|
(function () {
|
|
var extendStatics = function (d, b) {
|
|
extendStatics =
|
|
Object.setPrototypeOf ||
|
|
({ __proto__: [] } instanceof Array &&
|
|
function (d, b) {
|
|
d.__proto__ = b;
|
|
}) ||
|
|
function (d, b) {
|
|
for (var p in b)
|
|
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
};
|
|
return extendStatics(d, b);
|
|
};
|
|
return function (d, b) {
|
|
if (typeof b !== "function" && b !== null)
|
|
throw new TypeError(
|
|
"Class extends value " + String(b) + " is not a constructor or null"
|
|
);
|
|
extendStatics(d, b);
|
|
function __() {
|
|
this.constructor = d;
|
|
}
|
|
d.prototype =
|
|
b === null
|
|
? Object.create(b)
|
|
: ((__.prototype = b.prototype), new __());
|
|
};
|
|
})();
|
|
var Game_Enemy2 = /** @class */ (function (_super) {
|
|
__extends(Game_Enemy2, _super);
|
|
function Game_Enemy2(enemyId, x, y, level) {
|
|
var _this = _super.call(this, enemyId, x, y) || this;
|
|
_this._level = level;
|
|
p("level:" + _this._level);
|
|
_this.calcMhp();
|
|
_this.calcAtk();
|
|
_this.calcDef();
|
|
_this.recoverAll();
|
|
return _this;
|
|
}
|
|
Game_Enemy2.prototype.calcMhp = function () {
|
|
var n = this.param(0);
|
|
this._mhp = Math.round(n * this.levelHpRate());
|
|
};
|
|
Game_Enemy2.prototype.calcAtk = function () {
|
|
var n = this.param(2);
|
|
this._atk = Math.round(n * this.levelAtkRate());
|
|
};
|
|
Game_Enemy2.prototype.calcDef = function () {
|
|
var n = this.param(3);
|
|
this._def = 0;
|
|
};
|
|
Object.defineProperty(Game_Enemy2.prototype, "mhp", {
|
|
get: function () {
|
|
return this._mhp;
|
|
},
|
|
enumerable: false,
|
|
configurable: true,
|
|
});
|
|
Game_Enemy2.prototype.levelHpRate = function () {
|
|
var rate = 1 + (this._level - 1) / 2;
|
|
return rate;
|
|
};
|
|
Game_Enemy2.prototype.levelAtkRate = function () {
|
|
var rate = 1 + (this._level - 1) / 3;
|
|
return rate;
|
|
};
|
|
Game_Enemy2.prototype.hpValue = function (n) {
|
|
switch (n) {
|
|
case 1:
|
|
return 10;
|
|
case 2:
|
|
return 12;
|
|
case 3:
|
|
return 14;
|
|
case 4:
|
|
return 17;
|
|
case 5:
|
|
return 20;
|
|
case 6:
|
|
return 25;
|
|
case 7:
|
|
return 30;
|
|
case 8:
|
|
return 36;
|
|
case 9:
|
|
return 43;
|
|
case 10:
|
|
return 50;
|
|
}
|
|
console.error("不正なHPです " + n);
|
|
return n;
|
|
};
|
|
Game_Enemy2.prototype.atkValue = function (n) {
|
|
switch (n) {
|
|
case 1:
|
|
return 3;
|
|
case 2:
|
|
return 4;
|
|
case 3:
|
|
return 5;
|
|
case 4:
|
|
return 6;
|
|
case 5:
|
|
return 7;
|
|
case 6:
|
|
return 8;
|
|
case 7:
|
|
return 9;
|
|
case 8:
|
|
return 10;
|
|
case 9:
|
|
return 11;
|
|
case 10:
|
|
return 12;
|
|
}
|
|
console.error("不正なATKです " + n);
|
|
return n;
|
|
};
|
|
Game_Enemy2.prototype.level = function () {
|
|
return this._level;
|
|
};
|
|
Game_Enemy2.prototype.element = function () {
|
|
for (var _i = 0, _a = this.enemy().traits; _i < _a.length; _i++) {
|
|
var t = _a[_i];
|
|
if (t.code == 31) {
|
|
return t.dataId;
|
|
}
|
|
}
|
|
return EnemyElement.none;
|
|
};
|
|
Game_Enemy2.prototype.atk2 = function () {
|
|
return this._atk;
|
|
};
|
|
Game_Enemy2.prototype.def2 = function () {
|
|
return this._def;
|
|
};
|
|
return Game_Enemy2;
|
|
})(Game_Enemy);
|