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 Nore; (function (Nore) { var FORMATION_W = 830 - 30; var Scene_Formation = /** @class */ (function (_super) { __extends(Scene_Formation, _super); function Scene_Formation() { return (_super !== null && _super.apply(this, arguments)) || this; } Scene_Formation.prototype.create = function () { _super.prototype.create.call(this); this.createPictures(); this.createWindowLayer(); this.createAllWindows(); this.createFormationWindow(); }; Scene_Formation.prototype.start = function () { _super.prototype.start.call(this); this._formationWindow.refresh(); this._formationDetailWindow.refresh(); }; Scene_Formation.prototype.createPictures = function () { var width = Graphics.width; var height = Graphics.height; var x = (Graphics.width - width) / 2; var y = (Graphics.height - height) / 2; this._pictureContainer = new Sprite(); this._pictureContainer.setFrame(x, y, width, height); for (var i = 0; i <= $gameScreen.maxPictures(); i++) { this._pictureContainer.addChild(new Sprite_Picture(i)); } this.addChild(this._pictureContainer); }; Scene_Formation.prototype.createFormationWindow = function () { this._formationWindow = new Window_Formation(); this.addWindow(this._formationWindow); this._formationDetailWindow = new Window_FormationDetail(); this._formationDetailWindow.activate(); this._formationDetailWindow.select(0); this._formationDetailWindow.setHandler( "cancel", this.onCancel.bind(this) ); this._formationDetailWindow.setHandler("ok", this.onOk.bind(this)); this.addWindow(this._formationDetailWindow); }; Scene_Formation.prototype.onCancel = function () { var formation = $slg.formation(); if (!formation.isValid()) { SoundManager.playBuzzer(); this._formationDetailWindow.activate(); } else { this.popScene(); } }; Scene_Formation.prototype.onOk = function () { var actor = this._formationDetailWindow.selectedActor(); if (!actor) { return; } var formation = $slg.formation(); formation.selectActor(actor); this._formationWindow.makeData(); this._formationWindow.refresh(); this._formationDetailWindow.makeData(); this._formationDetailWindow.refresh(); this._formationDetailWindow.activate(); }; return Scene_Formation; })(Nore.Scene_Talk); Nore.Scene_Formation = Scene_Formation; var Window_FormationSelectable = /** @class */ (function (_super) { __extends(Window_FormationSelectable, _super); function Window_FormationSelectable() { return (_super !== null && _super.apply(this, arguments)) || this; } Window_FormationSelectable.prototype.drawFormation = function ( index, actor, disable, imageOffset ) { if (disable === void 0) { disable = false; } if (imageOffset === void 0) { imageOffset = 0; } if (!actor) { return; } this.changePaintOpacity(true); var rect = this.itemRect(index); this.drawFormationRect(rect, actor, disable, imageOffset); }; Window_FormationSelectable.prototype.drawFormationRect = function ( rect, actor, disable, imageOffset ) { if (disable === void 0) { disable = false; } if (imageOffset === void 0) { imageOffset = 0; } this.contents.fontSize = 14; /*if (disable) { this.contents.textColor = '#DDDDDD'; } else { this.contents.textColor = ColorManager.normalColor(); }*/ this.contents.textColor = ColorManager.normalColor(); var frameX = 13; var frameY = 13; if (actor.rare() > 0) { var sprite = getFrameSprite(actor.rare(), actor.element()); /*if (disable) { sprite.alpha = 0.5; }*/ sprite.x = rect.x + imageOffset + frameX; sprite.y = rect.y + frameY; this._windowContentsSprite.addChild(sprite); } this.drawText(actor.name(), rect.x, rect.y + 82, 90, "center"); this.contents.textColor = ColorManager.normalColor(); this.contents.fontSize = 12; this.drawImage( actor, rect.x + imageOffset + frameX, rect.y + frameY, false ); if (disable) { var g = new PIXI.Graphics(); g.beginFill(0x000033, 0.8); g.drawRect(0, 0, rect.width, rect.height); g.endFill(); g.x = rect.x + 12; g.y = rect.y + 12; this._windowContentsSprite.addChild(g); } }; Window_FormationSelectable.prototype.drawImage = function ( actor, x, y, disable ) { var u = new BattleUnitDir2(actor, disable); var s = new Sprite_SlotUnit(u, new Rectangle(x + 18, y + 70, 100, 100)); this._windowContentsSprite.addChild(s); }; Window_FormationSelectable.prototype.itemHeight = function () { return 120; }; Window_FormationSelectable.prototype.itemWidth = function () { return 96; }; Window_FormationSelectable.prototype.selectedActor = function () { return this.item(this.index()); }; Window_FormationSelectable.prototype.item = function (index) { return null; }; return Window_FormationSelectable; })(Window_Selectable); var Window_Formation = /** @class */ (function (_super) { __extends(Window_Formation, _super); function Window_Formation() { var _this = this; var r = new Rectangle(Nore.MAIN_MENU_W, Nore.TOP_Y, FORMATION_W, 222); _this = _super.call(this, r) || this; _this.makeData(); _this.refresh(); return _this; } Window_Formation.prototype.maxItems = function () { return 5; }; Window_Formation.prototype.update = function () { _super.prototype.update.call(this); if ($slg.formation().isLevelUp()) { $slg.formation().clearLevelUp(); this.refresh(); } this.removeTutoArrow(); this.updateTabKey(); }; Window_Formation.prototype.removeTutoArrow = function () { if (!this._tutoArrow) { return; } if ($gameTutorial.nextTarget() == TextManager.target_0_3) { return; } this._windowContentsSprite.removeChild(this._tutoArrow); this._tutoArrow = null; }; Window_Formation.prototype.updateTabKey = function () { if (!this.active) { return; } if (Input.isTriggered("tab")) { this.callHandler("tab"); } }; Window_Formation.prototype.refresh = function () { this._tutoArrow = null; this._windowContentsSprite.removeChildren(); _super.prototype.refresh.call(this); this.refreshLabel(); }; Window_Formation.prototype.refreshLabel = function () { this.contents.fontSize = 14; var textX = 22; var offsetY = ConfigManager.language == "jp" ? 0 : 30; var s = this.getSprite(96, 314 + offsetY, 200, 24); s.x = 13; s.y = 11; this.addChild(s); }; Window_Formation.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; }; Window_Formation.prototype.drawTotalPower = function () {}; Window_Formation.prototype.makeData = function () { this._members = $slg.formation().battleMembers(); }; Window_Formation.prototype.maxCols = function () { return 5; }; Window_Formation.prototype.itemWidth = function () { return 154; }; Window_Formation.prototype.drawItem = function (index) { this.changePaintOpacity(true); var rect = this.itemRect(index); if (index >= $slg.formation().maxBattleMembers()) { this.drawIcon(1922, rect.x + 38, rect.y + 18); } var actor = this._members[index]; if (!actor) { return; } this.drawFormation(index, actor, false, 0); this.drawParam(0, "LV", actor.level(), rect); this.drawParam(1, "HP", actor.mhp(), rect); this.drawParam(2, "ATK", actor.atk(), rect); this.drawParam(3, TextManager.interval, actor.agiText(), rect); this.drawSkill(actor, rect); this.changePaintOpacity(true); var buttonY = 125 + rect.y; if (index > 0) { this.addLeftButton(index, buttonY); } if (index < $slg.formation().maxBattleMembers() - 1) { this.addRightButton(index, buttonY); } if (!actor.isMaxLevel()) { this.addLevelUpButton(index, buttonY); this.addTutoArrow(rect.x, buttonY); } }; Window_Formation.prototype.drawSkill = function (actor, rect) { var yy = rect.y + 86; var xx = rect.x + 90; var learnings = actor.learnings(); for (var i = 0; i < learnings.length; i++) { var l = learnings[i]; var iconIndex = Icon.skillEmpty; if (l.level <= actor.level()) { iconIndex = Icon.skill2; this.changePaintOpacity(true); } else { this.changePaintOpacity(false); } this.drawIcon(iconIndex, xx, yy); xx += 21; } }; Window_Formation.prototype.drawParam = function ( index, title, param, rect ) { var xx = rect.x - 20; var yy = 14 + index * 18; this.contents.fontSize = 14; //this.drawText(title, xx, yy, 100); this.drawText(param + "", xx, yy, 150, "right"); }; Window_Formation.prototype.buttonInterval = function () { return 47; }; Window_Formation.prototype.buttonOffset = function () { return -10; }; Window_Formation.prototype.addLevelUpButton = function (index, y) { var rect = this.itemRect(index); var button = new Sprite_Button2("levelup", true); button.x = rect.x + this.buttonInterval() + this.buttonOffset(); button.y = y; this.addChild(button); button.setClickHandler(this.onLevelUp.bind(this, index)); this._windowContentsSprite.addChild(button); }; Window_Formation.prototype.addLeftButton = function (index, y) { var rect = this.itemRect(index); var button = new Sprite_Button2("pageup", true); button.x = rect.x + this.buttonOffset(); button.y = y; this.addChild(button); button.setClickHandler(this.onLeft.bind(this, index)); this._windowContentsSprite.addChild(button); }; Window_Formation.prototype.addRightButton = function (index, y) { var rect = this.itemRect(index); var button = new Sprite_Button2("pagedown", true); button.x = rect.x + this.buttonInterval() * 2 + this.buttonOffset(); button.y = y; this.addChild(button); button.setClickHandler(this.onRight.bind(this, index)); this._windowContentsSprite.addChild(button); }; Window_Formation.prototype.onLevelUp = function (index) { if (!this.active) { return; } this.select(index); this.callHandler("tab"); }; Window_Formation.prototype.onLeft = function (index) { if (!this.active) { return; } this.select(index); this.pageup(); }; Window_Formation.prototype.onRight = function (index) { if (!this.active) { return; } this.select(index); this.pagedown(); }; Window_Formation.prototype.itemRect = function (index) { var rect = _super.prototype.itemRect.call(this, index); rect.x += 6; rect.y += 19; return rect; }; Window_Formation.prototype.setBattleActor = function (actor) { var index = this.index(); if (index == 4) { $gameSwitches.setValue(251, true); } $slg.formation().setActor(index, actor); this.makeData(); this.refresh(); }; Window_Formation.prototype.isCurrentItemEnabled = function () { return true; }; Window_Formation.prototype.item = function (index) { return this._members[index]; }; Window_Formation.prototype.pageup = function () { SoundManager.playCursor(); var index = this.index(); var next = index - 1; if (next < 0) { this.activate(); return; } $slg.formation().swap(index, next); this._members = $slg.formation().battleMembers(); this.refresh(); this.select(next); this.activate(); }; Window_Formation.prototype.pagedown = function () { SoundManager.playCursor(); var index = this.index(); var next = index + 1; if (next >= $slg.formation().maxBattleMembers()) { this.activate(); return; } $slg.formation().swap(index, next); this._members = $slg.formation().battleMembers(); this.refresh(); this.select(next); this.activate(); }; Window_Formation.prototype.addTutoArrow = function (x, y) { if (this._tutoArrow) { return; } if ($gameTutorial.nextTarget() != TextManager.target_0_3) { return; } var baseTexture2 = Nore.getSystemBaseTexture("0213_sys"); var texture = new PIXI.Texture(baseTexture2); var sprite = new PIXI.Sprite(texture); sprite.x = x + 37; sprite.y = y + 18; sprite.rotation = (-90 / 180) * Math.PI; this._tutoArrow = sprite; this._windowContentsSprite.addChild(sprite); }; return Window_Formation; })(Window_FormationSelectable); Nore.Window_Formation = Window_Formation; var Window_FormationList = /** @class */ (function (_super) { __extends(Window_FormationList, _super); function Window_FormationList() { var _this = this; var r = new Rectangle(Nore.MAIN_MENU_W, 338, FORMATION_W, 462); _this = _super.call(this, r) || this; _this.makeData(); _this.refresh(); return _this; } Window_FormationList.prototype.update = function () { if ($slg.formation().filterChanged()) { $slg.formation().clearFilterChanged(); this.makeData(); this.refresh(); } _super.prototype.update.call(this); }; Window_FormationList.prototype.refresh = function () { this._windowContentsSprite.removeChildren(); _super.prototype.refresh.call(this); }; Window_FormationList.prototype.drawAllItems = function () { this._windowContentsSprite.removeChildren(); _super.prototype.drawAllItems.call(this); }; Window_FormationList.prototype.makeData = function () { this._members = []; for ( var _i = 0, _a = $slg.formation().allMembers(); _i < _a.length; _i++ ) { var m = _a[_i]; if (this.include(m)) { this._members.push(m); } } var sort = $slg.formation().sortValue(); this._members = this._members.sort(function (a, b) { switch (sort) { case MonsterSort.newArrival: return 1; case MonsterSort.rare: if (a.rare() == b.rare()) { return a.element() - b.element(); } return b.rare() - a.rare(); case MonsterSort.element: if (a.element() == b.element()) { return b.rare() - a.rare(); } if (a.element() == MonsterElement.none) { return 1; } if (b.element() == MonsterElement.none) { return -1; } return a.element() - b.element(); } }); }; Window_FormationList.prototype.include = function (m) { if (this.rareNg(m)) { return false; } if (this.elementNg(m)) { return false; } return true; }; Window_FormationList.prototype.rareNg = function (m) { return !$slg.formation().isRareEnabled(m.rare()); }; Window_FormationList.prototype.elementNg = function (m) { return !$slg.formation().isElementEnabled(m.element()); }; Window_FormationList.prototype.maxCols = function () { return 5; }; Window_FormationList.prototype.itemWidth = function () { return 148; }; Window_FormationList.prototype.maxItems = function () { if (!this._members) { return 1; } return this._members.length; }; Window_FormationList.prototype.drawItem = function (index) { var rect = this.itemRect(index); var actor = this._members[index]; if (!actor) { return; } var formation = $slg.formation(); var slot = formation.slotBy(actor.id()); var isActive = slot >= 0; this.drawFormation(index, actor, isActive); this.changePaintOpacity(true); this.drawParam(0, "LV", actor.level(), rect); this.drawParam(1, "HP", actor.mhp(), rect); this.drawParam(2, "ATK", actor.atk(), rect); this.drawParam(3, TextManager.interval, actor.agiText(), rect); this.drawSkill(actor, rect); }; Window_FormationList.prototype.drawParam = function ( index, title, param, rect ) { var xx = rect.x - 20; var yy = rect.y + index * 18; this.contents.fontSize = 14; //this.drawText(title, xx, yy, 100); this.drawText(param + "", xx, yy, 150, "right"); }; Window_FormationList.prototype.drawSkill = function (actor, rect) { var yy = rect.y + 86; var xx = rect.x + 90; var learnings = actor.learnings(); for (var i = 0; i < learnings.length; i++) { var l = learnings[i]; var iconIndex = Icon.skillEmpty; if (l.level <= actor.level()) { iconIndex = Icon.skill2; this.changePaintOpacity(true); } else { this.changePaintOpacity(false); } this.drawIcon(iconIndex, xx, yy); xx += 21; } }; Window_FormationList.prototype.selectedActor = function () { return this._members[this.index()]; }; Window_FormationList.prototype.addIcon = function (index, x, y) { var ww = 32; var hh = 32; var xx = index % 16; var yy = Math.floor(index / 16); var sprite = new Sprite(); sprite.bitmap = ImageManager.loadSystem("IconSet"); sprite.setFrame(xx * ww, yy * hh, ww, hh); sprite.x = x; sprite.y = y; this._windowContentsSprite.addChild(sprite); }; Window_FormationList.prototype.item = function (index) { return this._members[index]; }; Window_FormationList.prototype.processTouch = function () { if (this._disableTouch) { return; } if (!this.active) { if (TouchInput.isPressed()) { this.onTouchSelect(true); } return; } _super.prototype.processTouch.call(this); }; Window_FormationList.prototype.onTouchSelect = function (trigger) { if (!this.visible) { return; } this._doubleTouch = false; if (!this.active) { var lastIndex = this.index(); var hitIndex = this.hitIndex(); if (hitIndex >= 0) { if (hitIndex === this.index()) { this._doubleTouch = true; } if (TouchInput.isTriggered()) { SoundManager.playCursor(); this.select(hitIndex); } } return; } _super.prototype.onTouchSelect.call(this, trigger); }; Window_FormationList.prototype.disableTouch = function () { this._disableTouch = true; }; Window_FormationList.prototype.enableTouch = function () { this._disableTouch = false; }; Window_FormationList.prototype.isCurrentItemEnabled = function () { var actor = this.selectedActor(); if (!actor) { return false; } if ($slg.formation().isBattleMamber(actor)) { return false; } return true; }; Window_FormationList.prototype.itemRect = function (index) { var r = _super.prototype.itemRect.call(this, index); r.x += 10; r.y += 2; return r; }; return Window_FormationList; })(Window_FormationSelectable); Nore.Window_FormationList = Window_FormationList; var FormationBarRate = /** @class */ (function () { function FormationBarRate(baseRate, totalRate) { this.baseRate = baseRate; this.totalRate = totalRate; } FormationBarRate.prototype.rank = function () { return Math.round((this.totalRate * 100) / 20); }; return FormationBarRate; })(); var Window_FormationDetail = /** @class */ (function (_super) { __extends(Window_FormationDetail, _super); function Window_FormationDetail() { var _this = this; var r = new Rectangle(980, Nore.TOP_Y, 300, 800 - Nore.TOP_Y); _this = _super.call(this, r) || this; _this.visible = false; return _this; } Window_FormationDetail.prototype.isShowLevelUp = function () { return this._levelUpWindow.visible; }; Window_FormationDetail.prototype.setLevelUpWindow = function ( levelUpWindow ) { this._levelUpWindow = levelUpWindow; }; Window_FormationDetail.prototype.setListWindow = function ( formationListWindow ) { this._formationListWindow = formationListWindow; }; Window_FormationDetail.prototype.setFormationWindow = function ( formationWindow ) { this._formationWindow = formationWindow; }; Window_FormationDetail.prototype.setup = function (actor) { if (this.isShowLevelUp()) { return; } this._actor = actor; this.refresh(); }; Window_FormationDetail.prototype.refresh = function () { this.changePaintOpacity(true); this._windowContentsSprite.removeChildren(); _super.prototype.refresh.call(this); this.drawLabel(); this.drawTraning(); this.drawSkills(); this.drawRare(); this.addButton(); this.visible = this._actor != null; }; Window_FormationDetail.prototype.drawLabel = function () { var s = this.getSprite(0, 264, 60, 130); s.x = 34; s.y = 150; this._windowContentsSprite.addChild(s); { var s_1 = this.getSprite(96, 290, 228, 14); s_1.x = 36; s_1.y = 288; this._windowContentsSprite.addChild(s_1); var s2 = this.getSprite(96, 290, 228, 14); s2.x = 36; s2.y = 288 + 174; this._windowContentsSprite.addChild(s2); } { var s_2 = this.getSprite(96, 260, 80, 30); s_2.x = 36; s_2.y = 314; this._windowContentsSprite.addChild(s_2); } }; Window_FormationDetail.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; }; Window_FormationDetail.prototype.drawTraning = function () { if (!this._actor) { return; } var info = $slg.formation().trainingInfo(); if (info.actor() != this._actor) { return; } this.contents.fontSize = 14; this.changeTextColor(ColorManager.crisisColor()); this.drawText(TextManager.inTraining2, 170, 5, 150); }; Window_FormationDetail.prototype.drawRare = function () { if (!this._actor) { return; } this.changePaintOpacity(true); this.drawIcon(this.rareIcon(this._actor.rare()), 110, 13); }; Window_FormationDetail.prototype.rareIcon = function (rare) { switch (rare) { case MonsterRare.common: return Icon.n; case MonsterRare.rare: return Icon.r; case MonsterRare.sr: return Icon.sr; case MonsterRare.ssr: return Icon.ssr; } }; Window_FormationDetail.prototype.addButton = function () { if (!this._actor) { return; } var cost = this._actor.levelUpCost(); if (cost == 0) { return; } this.changePaintOpacity(cost <= $gameParty.gold()); var yy = 54; var lvUpButton = new Sprite_Button2("levelup", true); lvUpButton.x = 106; lvUpButton.y = yy; this._windowContentsSprite.addChild(lvUpButton); lvUpButton.setClickHandler(this.onLevelUp.bind(this)); this._lvUpButton = lvUpButton; this.drawText(TextManager.detailLvUp, 170, yy - 5, 150); this.drawText(TextManager.detailLvUpCost + ":", 170, yy + 20, 150); this.drawText("%1".format(cost), 160, yy + 20, 82, "right"); this.drawIcon(Icon.gold, 237, yy + 22); }; Window_FormationDetail.prototype.disableOtherWindow = function () { this._formationListWindow.deactivate(); this._formationListWindow.disableTouch(); this._formationWindow.deactivate(); }; Window_FormationDetail.prototype.enableOtherWindow = function () { this._formationListWindow.enableTouch(); this._formationWindow.activate(); }; Window_FormationDetail.prototype.onLevelUp = function () { if (this._levelUpWindow.visible) { return; } SoundManager.playOk(); this.disableOtherWindow(); var onLevelUp = this.onLevelUpOk.bind(this); var onLevelUpCancel = this.onLevelUpCancel.bind(this); var onLevelUpTraining = this.onLevelUpTraining.bind(this); this._levelUpWindow.setup( this._actor, onLevelUp, onLevelUpCancel, onLevelUpTraining ); }; Window_FormationDetail.prototype.onLevelUpOk = function () { var cost = this._actor.levelUpCost(); SoundManager.playShop(); $slg.formation().levelUp(this._actor.actorId()); this.refresh(); $slg.formation().onLevelUp(); $gameParty.loseGold(cost); if (this._actor.isMaxLevel()) { this.enableOtherWindow(); this._levelUpWindow.hide(); } else { this._levelUpWindow.activate(); } }; Window_FormationDetail.prototype.onLevelUpCancel = function () { this.enableOtherWindow(); }; Window_FormationDetail.prototype.onLevelUpTraining = function () { var trainingInfo = $slg.formation().trainingInfo(); if (trainingInfo.actor() == this._actor) { this.enableOtherWindow(); return; } trainingInfo.setup(this._actor); SoundManager.playEquip(); this.refresh(); this.enableOtherWindow(); }; Window_FormationDetail.prototype.maxItems = function () { return 1; }; Window_FormationDetail.prototype.drawItem = function (index) { if (!this._actor) { return; } this.drawParam(0, "LV", this._actor.level(), 0, null); this.drawParam( 1, "HP", this._actor.mhp(), this._actor.mhpPlus(), this.hpBarRate() ); this.drawParam( 2, "ATK", this._actor.atk(), this._actor.atkPlus(), this.atkBarRate() ); this.drawParam( 3, TextManager.interval, this._actor.agiText(), this._actor.agiPlusText(), this.agiBarRate() ); this.drawFormation(index, this._actor); }; Window_FormationDetail.prototype.hpBarRate = function () { var max = 290; var min = 50; var mhp = this._actor.mhpBase(); var baseRate = (mhp - min) / (max - min); var total = this._actor.mhp(); var totalRate = (total - min) / (max - min); return new FormationBarRate(baseRate, totalRate); }; Window_FormationDetail.prototype.atkBarRate = function () { var max = 80; var min = 10; var mhp = this._actor.atkBase(); var baseRate = (mhp - min) / (max - min); var total = this._actor.atk(); var totalRate = (total - min) / (max - min); return new FormationBarRate(baseRate, totalRate); }; Window_FormationDetail.prototype.agiBarRate = function () { var max = 130; var min = 30; var mhp = max - this._actor.agiBase(); var baseRate = (mhp - min) / (max - min); var total = max - this._actor.agi(); var totalRate = (total - min) / (max - min); return new FormationBarRate(baseRate, totalRate); }; Window_FormationDetail.prototype.drawParam = function ( index, title, param, plus, barRate ) { var xx = 20; var yy = 136 + index * 32; this.contents.fontSize = 22; //this.drawText(title, xx, yy, 100); this.drawText(param + "", xx, yy, 175, "right"); if (barRate) { var barX = xx + 34; for (var i = 0; i < barRate.rank(); i++) { this.drawIcon(Icon.star, barX, yy + 4); barX += 18; } } if (plus > 0) { this.drawText("(+" + plus + ")", xx, yy, 232, "right"); } }; Window_FormationDetail.prototype.drawSkills = function () { if (!this._actor) { return; } var learnings = this._actor.learnings(); if (learnings.length == 0) { return; } this.drawSkillIcon(100, 304, learnings); this.changePaintOpacity(true); this.drawSkill(learnings[0], 340); if (learnings[1]) { this.changePaintOpacity(true); this.drawSkill(learnings[1], 470); } }; Window_FormationDetail.prototype.drawSkillIcon = function ( xx, yy, learnings ) { for (var i = 0; i < learnings.length; i++) { var l = learnings[i]; var iconIndex = Icon.skillEmpty; if (l.level <= this._actor.level()) { iconIndex = Icon.skill2; this.changePaintOpacity(true); } else { this.changePaintOpacity(false); } this.drawIcon(iconIndex, xx, yy); xx += 21; } }; Window_FormationDetail.prototype.drawSkill = function (learning, y) { var top = y; var left = 30; this.contents.fontSize = 16; this.changeTextColor(ColorManager.normalColor()); var lh = 25; var skill = $dataSkills[learning.skillId]; if (learning.level > 1) { this.drawText( TextManager.learnSkillLv + learning.level, left, top, 200 ); top += 25; } this.contents.fontSize = 16; this.changeTextColor("#f3de67"); this.changePaintOpacity(this._actor.level() >= learning.level); this.drawText(this.skillName(skill), left, top, 130); this.contents.fontSize = 16; this.changeTextColor(ColorManager.normalColor()); if (skill.stypeId == 2) { this.drawText(TextManager.passive, left + 134, top, 84, "right"); } else { if (ConfigManager.language == "jp") { this.drawText(TextManager.probability, left + 130, top, 120); } this.changeTextColor("#84ecff"); this.drawText( this._actor.skillRate(skill) + "%", left, top, 220, "right" ); } this.changeTextColor(ColorManager.normalColor()); var value = this.skillValue(skill); var texts = this.skillDescs(skill); this.drawText(texts[0].format(value), left, top + lh * 1, 220); if (texts.length > 1) { this.drawText(texts[1].format(value), left, top + lh * 2, 220); } }; Window_FormationDetail.prototype.skillDescs = function (skill) { switch (ConfigManager.language) { case "en": var result = []; if (skill.meta["descEn"]) { result.push(skill.meta["descEn"]); } if (skill.meta["desc1En"]) { result.push(skill.meta["desc1En"]); } if (skill.meta["desc2En"]) { result.push(skill.meta["desc2En"]); } if (result.length > 0) { return result; } break; case "ch": case "jp": break; } return skill.description.split("\n"); }; Window_FormationDetail.prototype.skillName = function (skill) { switch (ConfigManager.language) { case "en": if (skill.meta["nameEn"]) { return skill.meta["nameEn"]; } break; case "ch": case "jp": break; } return skill.name; }; Window_FormationDetail.prototype.skillValue = function (skill) { var valueMetaList = SKILL_VALUE_META_LIST; for ( var _i = 0, valueMetaList_1 = valueMetaList; _i < valueMetaList_1.length; _i++ ) { var m = valueMetaList_1[_i]; if (skill.meta[m]) { return skill.meta[m]; } } return 0; }; return Window_FormationDetail; })(Window_FormationSelectable); Nore.Window_FormationDetail = Window_FormationDetail; var Window_FormationFilter = /** @class */ (function (_super) { __extends(Window_FormationFilter, _super); function Window_FormationFilter() { var _this = this; var r = new Rectangle(Nore.MAIN_MENU_W, 270, FORMATION_W, 72); _this = _super.call(this, r) || this; _this.makeData(); _this.refresh(); return _this; } Window_FormationFilter.prototype.makeData = function () { this._data = []; this._data.push( new FormationFilter(MonsterRare.none, MonsterElement.none) ); this._data.push( new FormationFilter(MonsterRare.common, MonsterElement.none) ); this._data.push( new FormationFilter(MonsterRare.rare, MonsterElement.none) ); this._data.push(new FormationFilter(MonsterRare.sr, MonsterElement.none)); this._data.push( new FormationFilter(MonsterRare.ssr, MonsterElement.none) ); this._data.push( new FormationFilter(MonsterRare.none, MonsterElement.flame) ); this._data.push( new FormationFilter(MonsterRare.none, MonsterElement.water) ); this._data.push( new FormationFilter(MonsterRare.none, MonsterElement.wood) ); }; Window_FormationFilter.prototype.maxCols = function () { return this.maxItems(); }; Window_FormationFilter.prototype.maxItems = function () { if (this._data) { return this._data.length; } return 0; }; Window_FormationFilter.prototype.drawItem = function (index) { var item = this._data[index]; if (!item) { this.drawOrder(index); return; } var rect = this.itemRect(index); if (this.isSelected(item)) { this.contents.fillRect( rect.x, rect.y, rect.width, rect.height, "#777711" ); } if (item.rare() != MonsterRare.none) { this.drawIcon(item.iconIndex(), rect.x + 5 + item.iconX(), rect.y + 5); this.contents.fontSize = 14; var text = this.rareMonsterText(item.rare()); this.drawText(text, rect.x + 20, rect.y + 12, 64, "right"); } else { this.contents.fontSize = 26; this.contents.fontBold = true; this.changeTextColor(item.textColor()); this.changeOutlineColor(item.outlineColor()); this.drawText(item.name(), rect.x, rect.y + 2, rect.width, "center"); this.contents.fontBold = false; } this.changeTextColor(ColorManager.normalColor()); this.changeOutlineColor(ColorManager.outlineColor()); }; Window_FormationFilter.prototype.rareMonsterText = function (rare) { var n = 0; for ( var _i = 0, _a = $slg.formation().allMembers(); _i < _a.length; _i++ ) { var a = _a[_i]; if (a.rare() == rare) { n++; } } var total = 0; for (var key in KAIJIN_PARAMS) { var param = KAIJIN_PARAMS[key]; if (param[0] == rare) { total++; } } return n + "/" + total; }; Window_FormationFilter.prototype.drawOrder = function (index) { var rect = this.itemRect(index); var sort = $slg.formation().sortValue(); var text = "新着順"; switch (sort) { case MonsterSort.rare: text = "レア順"; break; case MonsterSort.element: text = "属性順"; break; } this.drawText(text, rect.x, rect.y, rect.width, "center"); }; Window_FormationFilter.prototype.isSelected = function (item) { if (item.element() != MonsterElement.none) { if ($slg.formation().isElementSelected(item.element())) { return true; } } if (item.rare() != MonsterRare.none) { if ($slg.formation().isRareSelected(item.rare())) { return true; } } return false; }; Window_FormationFilter.prototype.processTouch = function () { if (!this.active) { if (TouchInput.isTriggered()) { this.onTouchSelect(true); } return; } _super.prototype.processTouch.call(this); }; Window_FormationFilter.prototype._refreshCursor = function () {}; Window_FormationFilter.prototype.onTouchSelect = function (trigger) { this._doubleTouch = false; if (!this.active) { var lastIndex = this.index(); var hitIndex = this.hitIndex(); if (hitIndex >= 0) { if (hitIndex === this.index()) { this._doubleTouch = true; } SoundManager.playCursor(); this.select(hitIndex); } return; } _super.prototype.onTouchSelect.call(this, trigger); }; Window_FormationFilter.prototype.select = function (index) { if (!this._data) { return; } _super.prototype.select.call(this, index); var item = this._data[index]; if (index == 0) { $slg.formation().clearRareFilter(); $slg.formation().clearElementFilter(); this.refresh(); return; } if (index == this.maxItems()) { $slg.formation().changeSort(); this.refresh(); return; } if (item.element() != MonsterElement.none) { $slg.formation().putElementFilter(item.element()); this.refresh(); } if (item.rare() != MonsterRare.none) { $slg.formation().putRareFilter(item.rare()); this.refresh(); } }; Window_FormationFilter.prototype.itemRect = function (index) { var r = _super.prototype.itemRect.call(this, index); r.y += 2; return r; }; return Window_FormationFilter; })(Window_Selectable); Nore.Window_FormationFilter = Window_FormationFilter; var Window_FormationLevelUp = /** @class */ (function (_super) { __extends(Window_FormationLevelUp, _super); function Window_FormationLevelUp() { var _this = this; var r = new Rectangle(560, 72, 400, 530); _this = _super.call(this, r) || this; _this.makeData(); _this.refresh(); _this.setHandler("cancel", _this.onCancel.bind(_this)); return _this; } Window_FormationLevelUp.prototype.setup = function ( actor, onOk, onCancel, onTraining ) { this._actor = actor; this._onOk = onOk; this._onCancel = onCancel; this._onTraining = onTraining; this.refresh(); this.visible = true; this.activate(); this.select(-1); }; Window_FormationLevelUp.prototype.makeData = function () { if ($slg.facilityInfo().hasFacility(28)) { this._data = ["OK", "CANCEL", TextManager.training]; } else { this._data = ["OK", "CANCEL"]; } }; Window_FormationLevelUp.prototype.maxItems = function () { if (this._data) { return this._data.length; } return 0; }; Window_FormationLevelUp.prototype.maxCols = function () { return 3; }; Window_FormationLevelUp.prototype.itemRect = function (index) { var rect = _super.prototype.itemRect.call(this, index); rect.x += 74; rect.y += 424; if (index == 2) { rect.x = 166; rect.y = 108; } return rect; }; Window_FormationLevelUp.prototype.itemHeight = function () { return 44; }; Window_FormationLevelUp.prototype.itemWidth = function () { return 120; }; Window_FormationLevelUp.prototype.drawItem = function (index) { this.contents.fontSize = 20; var rect = this.itemRect(index); var item = this._data[index]; this.changePaintOpacity(true); if (index == 0) { this.changePaintOpacity(this.canLevelUp()); } this.drawText(item, rect.x, rect.y + 2, rect.width, "center"); }; Window_FormationLevelUp.prototype.refresh = function () { _super.prototype.refresh.call(this); this.removeTutoArrow(); if (!this._actor) { return; } this.refreshLabel(); this.drawDetail(); this.drawTitle(); this.drawParams(); this.drawTraining(); }; Window_FormationLevelUp.prototype.removeTutoArrow = function () { if (this._tutoArrow) { this.removeChild(this._tutoArrow); this._tutoArrow = null; } }; Window_FormationLevelUp.prototype.refreshLabel = function () { var s = this.getSprite(0, 264, 60, 130); s.x = 80; s.y = 254; this._windowContentsSprite.addChild(s); }; Window_FormationLevelUp.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; }; Window_FormationLevelUp.prototype.isOkEnabled = function () { if (!this._actor) { return false; } return true; }; Window_FormationLevelUp.prototype.canLevelUp = function () { if (!this._actor) { return false; } return this._actor.levelUpCost() <= $gameParty.gold(); }; Window_FormationLevelUp.prototype.callOkHandler = function () { Input.clear(); TouchInput.clear(); if (!this._onOk) { return; } switch (this.index()) { case 0: if (!this.canLevelUp()) { SoundManager.playBuzzer(); this.activate(); return; } this._onOk.call(this); this.refresh(); break; case 1: this._onCancel.call(this); this.hide(); break; case 2: this._onTraining.call(this); this.hide(); break; default: this.activate(); return; } }; Window_FormationLevelUp.prototype.onCancel = function () { this.hide(); this._onCancel.call(this); }; Window_FormationLevelUp.prototype.drawDetail = function () { this.changeTextColor(ColorManager.normalColor()); var actor = this._actor; var rect = new Rectangle(50, 60, 120, 120); this.drawFormationRect(rect, actor, false, 0); }; Window_FormationLevelUp.prototype.drawTitle = function () { this.contents.fontSize = 24; this.drawText(TextManager.formationLevelUp, 0, 10, 370, "center"); }; Window_FormationLevelUp.prototype.drawParams = function () { var copy = JsonEx.makeDeepCopy(this._actor); copy.levelUp(); if (this.canLevelUp()) { this.drawIcon(Icon.gold2, 70, 194); this.drawParam( 0, "GOLD", $gameParty.gold(), $gameParty.gold() - this._actor.levelUpCost() ); } else { this.drawText("Insufficient G", 70, 180, 200); } this.drawParam(1, "LV", this._actor.level(), copy.level()); this.drawParam(2, "HP", this._actor.mhp(), copy.mhp()); this.drawParam(3, "ATK", this._actor.atk(), copy.atk()); this.drawParam( 4, TextManager.interval, this._actor.agiText(), copy.agiText() ); if (this._actor.skills().length < copy.skills().length) { this.drawNewSkill(); } }; Window_FormationLevelUp.prototype.drawParam = function ( index, title, param, after ) { var xx = 100; var yy = 192 + index * 32; if (index > 0) { yy += 15; } this.contents.fontSize = 22; //this.drawText(title, xx, yy, 100); this.drawText(param + "", xx, yy, 105, "right"); this.drawText("→", xx + 124, yy, 45, "left"); this.drawText(after + "", xx, yy, 205, "right"); }; Window_FormationLevelUp.prototype.drawNewSkill = function () { this.changeTextColor("#84ecff"); this.drawText(TextManager.learnNewSkill, 88, 372, 200, "center"); }; Window_FormationLevelUp.prototype.drawTraining = function () { this.contents.fontSize = 16; this.changeTextColor(ColorManager.normalColor()); if (!$slg.facilityInfo().hasFacility(28)) { return; } this.addTutoArrow(200, 50); var trainingInfo = $slg.formation().trainingInfo(); var time = trainingInfo.calcTrainingTime(this._actor); var yy = 52; this.drawText(TextManager.trainingTime, 170, yy, 90); var sec = Math.floor(time / 60); if (sec > 60) { var min = Math.floor(sec / 60); sec = sec % 60; this.drawText( TextManager.levelUpMinSec.format(min, sec), 170, yy, 180, "right" ); } else { this.drawText( TextManager.levelUpSec.format(sec), 170, yy, 150, "right" ); } if (!trainingInfo.isEmpty()) { this.changeTextColor(ColorManager.crisisColor()); this.drawText( TextManager.inTraining.format(trainingInfo.actorName()), 170, 75, 220, "left" ); this.changeTextColor(ColorManager.normalColor()); } }; Window_FormationLevelUp.prototype.addTutoArrow = function (x, y) { if (this._tutoArrow) { return; } if ($gameTutorial.nextTarget() != TextManager.target_0_3) { return; } var baseTexture2 = Nore.getSystemBaseTexture("0213_sys"); var texture = new PIXI.Texture(baseTexture2); var sprite = new PIXI.Sprite(texture); sprite.x = x + 87; sprite.y = y + 50; //sprite.rotation = 90 / 180 * Math.PI; this._tutoArrow = sprite; this._windowContentsSprite.addChild(sprite); }; return Window_FormationLevelUp; })(Window_FormationSelectable); Nore.Window_FormationLevelUp = Window_FormationLevelUp; })(Nore || (Nore = {})); var MonsterSort; (function (MonsterSort) { MonsterSort[(MonsterSort["newArrival"] = 0)] = "newArrival"; MonsterSort[(MonsterSort["rare"] = 1)] = "rare"; MonsterSort[(MonsterSort["element"] = 2)] = "element"; })(MonsterSort || (MonsterSort = {})); var FormationFilter = /** @class */ (function () { function FormationFilter(rare, element) { this._rare = rare; this._element = element; } FormationFilter.prototype.rare = function () { return this._rare; }; FormationFilter.prototype.element = function () { return this._element; }; FormationFilter.prototype.name = function () { switch (this._rare) { case MonsterRare.common: return "N"; case MonsterRare.rare: return "R"; case MonsterRare.sr: return "SR"; case MonsterRare.ssr: return "SSR"; } switch (this._element) { case MonsterElement.flame: return TextManager.flame; case MonsterElement.water: return TextManager.water; case MonsterElement.wood: return TextManager.wood; } return TextManager.reset; }; FormationFilter.prototype.iconIndex = function () { switch (this._rare) { case MonsterRare.common: return Icon.n; case MonsterRare.rare: return Icon.r; case MonsterRare.sr: return Icon.sr; case MonsterRare.ssr: return Icon.ssr; } return -1; }; FormationFilter.prototype.iconX = function () { switch (this._rare) { case MonsterRare.common: return 12; case MonsterRare.rare: return 12; case MonsterRare.sr: return 6; } return 0; }; FormationFilter.prototype.textColor = function () { switch (this._element) { case MonsterElement.flame: return MonsterElementStringColor.flame; case MonsterElement.water: return MonsterElementStringColor.water; case MonsterElement.wood: return MonsterElementStringColor.wood; } return ColorManager.normalColor(); }; FormationFilter.prototype.outlineColor = function () { switch (this._element) { case MonsterElement.flame: case MonsterElement.water: case MonsterElement.wood: return "rgba(255, 255, 255, 0.9)"; } return ColorManager.outlineColor(); }; return FormationFilter; })(); function getFrameSprite(rare, element) { var baseTexture2 = Nore.getSystemBaseTexture("Frame"); var rect = new Rectangle(88 * (rare - 1), 0, 88, 89); var texture = new PIXI.Texture(baseTexture2, rect); var sprite = new PIXI.Sprite(texture); var index = -1; switch (element) { case MonsterElement.flame: index = 0; break; case MonsterElement.water: index = 1; break; case MonsterElement.wood: index = 2; break; } if (index >= 0) { var rect2 = new Rectangle(88 * index, 89, 88, 89); var texture2 = new PIXI.Texture(baseTexture2, rect2); var sprite2 = new PIXI.Sprite(texture2); sprite.addChild(sprite2); } return sprite; }