322 lines
9.5 KiB
JavaScript
322 lines
9.5 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 Window_MilitaryDetail = /** @class */ (function (_super) {
|
||
__extends(Window_MilitaryDetail, _super);
|
||
function Window_MilitaryDetail() {
|
||
var _this = this;
|
||
var r = new Rectangle(580, 0, 520, 800 - Nore.TOP_Y);
|
||
_this = _super.call(this, r) || this;
|
||
_this._sprite1 = new Sprite_MilitaryEnemy(0);
|
||
_this.addChild(_this._sprite1);
|
||
_this._sprite2 = new Sprite_MilitaryEnemy(1);
|
||
_this.addChild(_this._sprite2);
|
||
_this._sprite1.visible = false;
|
||
_this._sprite2.visible = false;
|
||
return _this;
|
||
}
|
||
Window_MilitaryDetail.prototype.setPlace = function (place) {
|
||
if (this._place == place) {
|
||
return;
|
||
}
|
||
this._place = place;
|
||
this.refresh();
|
||
};
|
||
Window_MilitaryDetail.prototype.refresh = function () {
|
||
this.contents.clear();
|
||
this.refreshImage();
|
||
this.refreshDescription();
|
||
};
|
||
Window_MilitaryDetail.prototype.refreshImage = function () {
|
||
var enemyId = this._place.currentPlaceStage().enemyId();
|
||
var troop = $dataTroops[enemyId];
|
||
if (!troop) {
|
||
return;
|
||
}
|
||
if (troop.members[0]) {
|
||
var hero = new ClickerEnemy(troop.members[0].enemyId);
|
||
this._sprite1.setBattler(hero);
|
||
this._sprite1.visible = true;
|
||
}
|
||
if (troop.members[1]) {
|
||
var hero = new ClickerEnemy(troop.members[1].enemyId);
|
||
this._sprite2.setBattler(hero);
|
||
this._sprite2.visible = true;
|
||
} else {
|
||
this._sprite2.visible = false;
|
||
}
|
||
};
|
||
Window_MilitaryDetail.prototype.enemy = function () {
|
||
var enemyId = this._place._enemyId;
|
||
return new ClickerEnemy(enemyId);
|
||
};
|
||
Window_MilitaryDetail.prototype.refreshDescription = function () {
|
||
if (this.enemy().enemy().meta["enemyDesc"]) {
|
||
var desc = this.enemy().enemy().meta["enemyDesc"];
|
||
var text = TextManager["enemyDesc" + desc];
|
||
var texts = text.split("\n");
|
||
this.contents.textColor = ColorManager.normalColor();
|
||
this.contents.fontSize = 19;
|
||
var y = 30;
|
||
for (var _i = 0, texts_1 = texts; _i < texts_1.length; _i++) {
|
||
var t = texts_1[_i];
|
||
this.contents.drawText(t, 10, y, 480, 40, "center");
|
||
y += 26;
|
||
}
|
||
}
|
||
};
|
||
return Window_MilitaryDetail;
|
||
})(Window_Base);
|
||
var Sprite_MilitaryEnemy = /** @class */ (function (_super) {
|
||
__extends(Sprite_MilitaryEnemy, _super);
|
||
function Sprite_MilitaryEnemy(index) {
|
||
var _this = _super.call(this) || this;
|
||
_this.bitmap = new Bitmap(350, 740);
|
||
_this._index = index;
|
||
_this.addLabel();
|
||
_this._enemySprite = new Sprite_PlaceEnemy();
|
||
_this.addChild(_this._enemySprite);
|
||
_this.x = index * 236 + 22;
|
||
_this.y = 100;
|
||
return _this;
|
||
}
|
||
Sprite_MilitaryEnemy.prototype.setBattler = function (enemy) {
|
||
this.bitmap.clear();
|
||
this._enemy = enemy;
|
||
this._enemySprite.setBattler(enemy, 30);
|
||
this.refreshStatus();
|
||
this.refreshSkill();
|
||
};
|
||
Sprite_MilitaryEnemy.prototype.addLabel = function () {
|
||
var s = this.getSprite(0, 297, 56, 96);
|
||
s.x = 30;
|
||
s.y = 350;
|
||
this.addChild(s);
|
||
{
|
||
var s_1 = this.getSprite(96, 380, 200, 3);
|
||
s_1.x = 32;
|
||
s_1.y = 448;
|
||
this.addChild(s_1);
|
||
}
|
||
{
|
||
var s_2 = this.getSprite(96, 265, 100, 30);
|
||
s_2.x = 33;
|
||
s_2.y = 460;
|
||
this.addChild(s_2);
|
||
}
|
||
};
|
||
Sprite_MilitaryEnemy.prototype.refreshStatus = function () {
|
||
this.bitmap.fontSize = 20;
|
||
var enemy = this._enemy;
|
||
this.bitmap.textColor = ColorManager.normalColor();
|
||
var hpRateStr = enemy.enemy().meta["hpRate"];
|
||
var hpRate = 100;
|
||
if (hpRateStr) {
|
||
hpRate = parseInt(hpRateStr);
|
||
}
|
||
this.drawStatus("HP", enemy.mhp(), 0, hpRate);
|
||
var atkRate = 100;
|
||
if (hpRate < 100) {
|
||
atkRate = 75;
|
||
}
|
||
this.drawStatus(
|
||
"ATK",
|
||
Math.round((enemy.atk() / atkRate) * 100),
|
||
1,
|
||
atkRate
|
||
);
|
||
if (enemy.enemyId() == 53) {
|
||
// サキだけはSPDが下がったようにみせる
|
||
var rate = 0.4;
|
||
this.drawStatus("SPD", Math.round(enemy.spd() / rate), 2, rate * 100);
|
||
} else {
|
||
this.drawStatus("SPD", enemy.spd(), 2);
|
||
}
|
||
};
|
||
Sprite_MilitaryEnemy.prototype.getSprite = function (x, y, w, h) {
|
||
var baseTexture = Nore.getSystemBaseTexture("gacha");
|
||
var r = new Rectangle(x, y, w, h);
|
||
var texture = new PIXI.Texture(baseTexture, r);
|
||
var s = new PIXI.Sprite(texture);
|
||
return s;
|
||
};
|
||
Sprite_MilitaryEnemy.prototype.drawStatus = function (
|
||
label,
|
||
value,
|
||
yIndex,
|
||
rate
|
||
) {
|
||
if (rate === void 0) {
|
||
rate = 100;
|
||
}
|
||
var top = 340 + yIndex * 35;
|
||
var left = 50;
|
||
var w = 156;
|
||
this.bitmap.textColor = ColorManager.systemColor();
|
||
this.bitmap.textColor = ColorManager.normalColor();
|
||
this.bitmap.drawText(value, left, top, w, 40, "right");
|
||
if (rate < 100) {
|
||
this.bitmap.drawText(
|
||
"→ " + Math.round((value * rate) / 100),
|
||
left + 80,
|
||
top,
|
||
w,
|
||
40,
|
||
"right"
|
||
);
|
||
}
|
||
};
|
||
Sprite_MilitaryEnemy.prototype.refreshSkill = function () {
|
||
this.bitmap.textColor = ColorManager.normalColor();
|
||
var skillList = this._enemy.skills();
|
||
//p(skillList)
|
||
for (var i = 0; i < skillList.length; i++) {
|
||
this.drawSkill(skillList[i], i);
|
||
}
|
||
};
|
||
Sprite_MilitaryEnemy.prototype.drawSkill = function (skill, index) {
|
||
var top = 484 + index * 200;
|
||
var left = 34;
|
||
this.bitmap.textColor = ColorManager.normalColor();
|
||
this.bitmap.fontSize = 19;
|
||
//this.bitmap.fontBold = true;
|
||
this.bitmap.drawText(this.skillName(skill), left, top, 170, 40);
|
||
this.bitmap.fontBold = false;
|
||
this.bitmap.fontSize = 15;
|
||
var texts = this.skillDescription(skill).split("\n");
|
||
var value = this.skillValue(skill);
|
||
top += 28;
|
||
this.bitmap.drawText(texts[0].format(value), left, top, 190, 40);
|
||
if (texts.length > 1) {
|
||
this.bitmap.drawText(texts[1].format(value), left, top + 24, 190, 40);
|
||
}
|
||
this.bitmap.textColor = "#f3de67";
|
||
this.bitmap.drawText(TextManager.probability, left, top + 25 * 2, 150, 40);
|
||
this.bitmap.textColor = "#84ecff";
|
||
this.bitmap.drawText(
|
||
skill.successRate + "%",
|
||
left,
|
||
top + 25 * 2,
|
||
128,
|
||
40,
|
||
"right"
|
||
);
|
||
};
|
||
Sprite_MilitaryEnemy.prototype.skillName = function (skill) {
|
||
if (ConfigManager.language == "en") {
|
||
if (skill.meta["nameEn"]) {
|
||
return skill.meta["nameEn"];
|
||
}
|
||
}
|
||
return skill.name;
|
||
};
|
||
Sprite_MilitaryEnemy.prototype.skillValue = function (skill) {
|
||
if (skill.meta["damage"]) {
|
||
return skill.meta["damage"];
|
||
}
|
||
return "";
|
||
};
|
||
Sprite_MilitaryEnemy.prototype.skillDescription = function (skill) {
|
||
if (ConfigManager.language == "en") {
|
||
if (skill.meta["descEn"]) {
|
||
return skill.meta["descEn"];
|
||
}
|
||
if (skill.meta["desc1En"]) {
|
||
if (skill.meta["desc2En"]) {
|
||
return skill.meta["desc1En"] + "\n" + skill.meta["desc2En"];
|
||
} else {
|
||
return skill.meta["desc1En"];
|
||
}
|
||
}
|
||
}
|
||
return skill.description;
|
||
};
|
||
return Sprite_MilitaryEnemy;
|
||
})(Sprite_Clickable);
|
||
var Sprite_PlaceEnemy = /** @class */ (function (_super) {
|
||
__extends(Sprite_PlaceEnemy, _super);
|
||
function Sprite_PlaceEnemy() {
|
||
return (_super !== null && _super.apply(this, arguments)) || this;
|
||
}
|
||
Sprite_PlaceEnemy.prototype.setBattler = function (enemy, offsetY) {
|
||
if (offsetY === void 0) {
|
||
offsetY = 0;
|
||
}
|
||
this._enemy = enemy;
|
||
this._offsetY = offsetY;
|
||
this._name = enemy.battlerName();
|
||
if (this._name) {
|
||
this.visible = false;
|
||
this.bitmap = ImageManager.loadEnemy(this._name);
|
||
this.updateOutline();
|
||
}
|
||
};
|
||
Sprite_PlaceEnemy.prototype.update = function () {
|
||
_super.prototype.update.call(this);
|
||
this.updateBitmap();
|
||
this.updatePosition();
|
||
};
|
||
Sprite_PlaceEnemy.prototype.updateOutline = function () {
|
||
var filter3 = new PIXI.filters.OutlineFilter(3, this.pixiColor());
|
||
this.filters = [filter3];
|
||
};
|
||
Sprite_PlaceEnemy.prototype.pixiColor = function () {
|
||
switch (this._enemy.element()) {
|
||
case MonsterElement.flame:
|
||
return MonsterElementColor.flame;
|
||
case MonsterElement.water:
|
||
return MonsterElementColor.water;
|
||
case MonsterElement.wood:
|
||
return MonsterElementColor.wood;
|
||
}
|
||
return 0x888888;
|
||
};
|
||
Sprite_PlaceEnemy.prototype.updateBitmap = function () {
|
||
if (!this._name) {
|
||
return;
|
||
}
|
||
if (!this.bitmap) {
|
||
return;
|
||
}
|
||
this.bitmap = ImageManager.loadEnemy(this._name);
|
||
if (this.bitmap.isReady() && this.bitmap.width > 10) {
|
||
this.visible = true;
|
||
}
|
||
};
|
||
Sprite_PlaceEnemy.prototype.updatePosition = function () {
|
||
if (!this.bitmap) {
|
||
return;
|
||
}
|
||
this.x = (250 - this.bitmap.width) / 2;
|
||
this.y = 300 - this.bitmap.height + this._offsetY;
|
||
};
|
||
return Sprite_PlaceEnemy;
|
||
})(Sprite_Clickable);
|