192 lines
5.6 KiB
JavaScript
192 lines
5.6 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 __());
|
|
};
|
|
})();
|
|
/*:ja
|
|
* @target MZ
|
|
* @author ル
|
|
*
|
|
* @command victory
|
|
* @text バトル勝利
|
|
* @des バトル勝利
|
|
*/
|
|
var Nore;
|
|
(function (Nore) {
|
|
var pluginName = "Nore_Battle";
|
|
PluginManager.registerCommand(pluginName, "victory", function (args) {
|
|
var troopData = $gameTemp.selectedTroop;
|
|
$slg.battleInfo().clear(troopData.areaId(), troopData.battleId());
|
|
});
|
|
// Battle Processing
|
|
Game_Interpreter.prototype.command301 = function (params) {
|
|
var _this = this;
|
|
if (!$gameParty.inBattle()) {
|
|
var troopId = void 0;
|
|
if (params[0] === 0) {
|
|
// Direct designation
|
|
troopId = params[1];
|
|
} else if (params[0] === 1) {
|
|
// Designation with a variable
|
|
troopId = $gameVariables.value(params[1]);
|
|
} else {
|
|
// Same as Random Encounters
|
|
troopId = $gamePlayer.makeEncounterTroopId();
|
|
}
|
|
if ($dataTroops[troopId]) {
|
|
BattleManager.setup(troopId, params[2], params[3]);
|
|
BattleManager.setEventCallback(function (n) {
|
|
_this._branch[_this._indent] = n;
|
|
});
|
|
$gamePlayer.makeEncounterCount();
|
|
SceneManager.push(Scene_Battle2);
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
})(Nore || (Nore = {}));
|
|
Sprite_Battleback.prototype.adjustPosition = function () {
|
|
this.width = 1280;
|
|
this.height = 800;
|
|
this.x = (Graphics.width - this.width) / 2;
|
|
if ($gameSystem.isSideView()) {
|
|
this.y = Graphics.height - this.height;
|
|
} else {
|
|
this.y = 0;
|
|
}
|
|
var ratioX = this.width / this.bitmap.width;
|
|
var ratioY = this.height / this.bitmap.height;
|
|
var scale = Math.max(ratioX, ratioY, 1.0);
|
|
this.scale.x = scale;
|
|
this.scale.y = scale;
|
|
};
|
|
var Scene_Battle2 = /** @class */ (function (_super) {
|
|
__extends(Scene_Battle2, _super);
|
|
function Scene_Battle2() {
|
|
return (_super !== null && _super.apply(this, arguments)) || this;
|
|
}
|
|
Scene_Battle2.prototype.createSpriteset = function () {
|
|
this._spriteset = new Spriteset_Battle2();
|
|
this.addChild(this._spriteset);
|
|
};
|
|
return Scene_Battle2;
|
|
})(Scene_Battle);
|
|
var Spriteset_Battle2 = /** @class */ (function (_super) {
|
|
__extends(Spriteset_Battle2, _super);
|
|
function Spriteset_Battle2() {
|
|
return (_super !== null && _super.apply(this, arguments)) || this;
|
|
}
|
|
Spriteset_Battle2.prototype.createBattleField = function () {
|
|
var width = Graphics.boxWidth;
|
|
var height = Graphics.boxHeight;
|
|
var x = (Graphics.width - width) / 2;
|
|
var y = (Graphics.height - height) / 2;
|
|
this._battleField = new Sprite();
|
|
this._battleField.setFrame(0, 0, width, height);
|
|
this._battleField.x = x;
|
|
this._battleField.y = y - this.battleFieldOffsetY();
|
|
this._baseSprite.addChild(this._battleField);
|
|
this._effectsContainer = this._battleField;
|
|
this._uiContainer = new Sprite();
|
|
this._uiContainer.setFrame(0, 0, width, height);
|
|
this._uiContainer.x = x;
|
|
this._uiContainer.y = y - this.battleFieldOffsetY();
|
|
this._baseSprite.addChild(this._uiContainer);
|
|
};
|
|
Spriteset_Battle2.prototype.createEnemies = function () {
|
|
_super.prototype.createEnemies.call(this);
|
|
this._enemyHpSprite = new Sprite_EnemyHp();
|
|
this._uiContainer.addChild(this._enemyHpSprite);
|
|
};
|
|
return Spriteset_Battle2;
|
|
})(Spriteset_Battle);
|
|
var Sprite_EnemyHp = /** @class */ (function (_super) {
|
|
__extends(Sprite_EnemyHp, _super);
|
|
function Sprite_EnemyHp() {
|
|
var _this = _super.call(this) || this;
|
|
_this.x = 20;
|
|
_this.y = 580;
|
|
_this.bitmap = new Bitmap(1020, 400);
|
|
_this.bitmap.fontSize = 26;
|
|
_this.refresh();
|
|
return _this;
|
|
}
|
|
Sprite_EnemyHp.prototype.update = function () {
|
|
_super.prototype.update.call(this);
|
|
if ($gameParty.isDirty()) {
|
|
this.refresh();
|
|
}
|
|
};
|
|
Sprite_EnemyHp.prototype.refresh = function () {
|
|
return;
|
|
$gameParty.clearDirty();
|
|
this.bitmap.clear();
|
|
var xxx = 100;
|
|
var yy = 0;
|
|
this.bitmap.drawText("戦闘員HP", xxx, yy, 100, 40);
|
|
this.bitmap.drawText(
|
|
"%1".format($gameParty.hp()),
|
|
xxx,
|
|
yy,
|
|
200,
|
|
40,
|
|
"right"
|
|
);
|
|
xxx += 220;
|
|
var yyy = 8;
|
|
var h = 22;
|
|
var w = this.gaugeWidth();
|
|
this.bitmap.fillRect(xxx - 1, yyy - 1, w + 2, h + 2, "#000");
|
|
this.bitmap.fillRect(
|
|
xxx,
|
|
yyy,
|
|
w * $gameParty.hpRate(),
|
|
h,
|
|
ColorManager.hpGaugeColor1()
|
|
);
|
|
};
|
|
Sprite_EnemyHp.prototype.gaugeWidth = function () {
|
|
var w = $gameParty.combatant();
|
|
return w;
|
|
};
|
|
return Sprite_EnemyHp;
|
|
})(Sprite);
|
|
BattleManager.gainExp = function () {
|
|
var exp = this._rewards.exp;
|
|
$gameParty.gainEnergy(exp);
|
|
};
|
|
var _BattleManager_startTurn = BattleManager.startTurn;
|
|
BattleManager.startTurn = function () {
|
|
p("turnCount:" + $gameTroop.turnCount());
|
|
if ($gameTroop.turnCount() >= 1) {
|
|
this.processVictory();
|
|
return;
|
|
}
|
|
_BattleManager_startTurn.call(this);
|
|
};
|