362 lines
11 KiB
JavaScript
362 lines
11 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 addMoneyCost
|
|
* @text お金を追加
|
|
* @des お金を追加
|
|
* @arg value
|
|
* @type number
|
|
* @text value
|
|
* @desc value
|
|
*
|
|
*
|
|
* @command addMhpCost
|
|
* @text 戦闘員戦力を追加
|
|
* @des 戦闘員戦力を追加
|
|
* @arg value
|
|
* @type number
|
|
* @text value
|
|
* @desc value
|
|
*
|
|
* @command addActorCost
|
|
* @text 怪人数を追加
|
|
* @des 怪人数を追加
|
|
* @arg value
|
|
* @type number
|
|
* @text value
|
|
* @desc value
|
|
*
|
|
* @command addBattle
|
|
* @text 戦闘勝利数を追加
|
|
* @des 戦闘勝利数を追加
|
|
* @arg value
|
|
* @type number
|
|
* @text value
|
|
* @desc value
|
|
*
|
|
* @command addSw
|
|
* @text スイッチを追加
|
|
* @des スイッチを追加
|
|
* @arg value
|
|
* @type number
|
|
* @text value
|
|
* @desc value
|
|
*
|
|
* @command addStageCost
|
|
* @text ステージ条件を追加
|
|
* @des ステージ条件を追加
|
|
* @arg value
|
|
* @type number
|
|
* @text value
|
|
* @desc value
|
|
*
|
|
* @command clearCost
|
|
* @text 条件をクリア
|
|
* @des 条件をクリア
|
|
*/
|
|
var Nore;
|
|
(function (Nore) {
|
|
var pluginName = "Nore_DecisiveBattle";
|
|
PluginManager.registerCommand(pluginName, "addMoneyCost", function (args) {
|
|
var value = parseInt(args.value);
|
|
$slg.decisiveBattleInfo().addCost(DecisiveBattleCostType.gold, value);
|
|
});
|
|
PluginManager.registerCommand(pluginName, "addMhpCost", function (args) {
|
|
var value = parseInt(args.value);
|
|
$slg.decisiveBattleInfo().addCost(DecisiveBattleCostType.mhp, value);
|
|
});
|
|
PluginManager.registerCommand(pluginName, "addActorCost", function (args) {
|
|
var value = parseInt(args.value);
|
|
$slg.decisiveBattleInfo().addCost(DecisiveBattleCostType.actor, value);
|
|
});
|
|
PluginManager.registerCommand(pluginName, "addSw", function (args) {
|
|
var value = parseInt(args.value);
|
|
$slg.decisiveBattleInfo().addCost(DecisiveBattleCostType.sw, value);
|
|
});
|
|
PluginManager.registerCommand(pluginName, "addBattle", function (args) {
|
|
var value = parseInt(args.value);
|
|
$slg.decisiveBattleInfo().addCost(DecisiveBattleCostType.battle, value);
|
|
});
|
|
PluginManager.registerCommand(pluginName, "addStageCost", function (args) {
|
|
var value = parseInt(args.value);
|
|
$slg.decisiveBattleInfo().addCost(DecisiveBattleCostType.stage, value);
|
|
});
|
|
PluginManager.registerCommand(pluginName, "clearCost", function (args) {
|
|
var value = parseInt(args.value);
|
|
$slg.decisiveBattleInfo().clearCost();
|
|
});
|
|
Nore.STAGE4_KAIJIN = 14;
|
|
Nore.STAGE5_KAIJIN = 14;
|
|
var Window_DecisiveBattle = /** @class */ (function (_super) {
|
|
__extends(Window_DecisiveBattle, _super);
|
|
function Window_DecisiveBattle() {
|
|
var _this = _super.call(this, new Rectangle(210, 70, 540, 142)) || this;
|
|
_this.makeData();
|
|
_this.refresh();
|
|
return _this;
|
|
}
|
|
Window_DecisiveBattle.prototype.maxItems = function () {
|
|
if (!this._list) {
|
|
return 0;
|
|
}
|
|
return this._list.length;
|
|
};
|
|
Window_DecisiveBattle.prototype.makeData = function () {
|
|
this._list = $slg.decisiveBattleInfo().list();
|
|
};
|
|
Window_DecisiveBattle.prototype.lineHeight = function () {
|
|
return 50;
|
|
};
|
|
Window_DecisiveBattle.prototype.drawItem = function (index) {
|
|
this.changeTextColor(ColorManager.normalColor());
|
|
var rect = this.itemRect(index);
|
|
var cost = this._list[index];
|
|
this.contents.fontSize = 22;
|
|
var title = this.getTitle(cost.type(), cost.value());
|
|
this.drawText(title, rect.x + 8, rect.y, rect.width);
|
|
if (cost.type() == DecisiveBattleCostType.actor) {
|
|
this.changeTextColor(ColorManager.normalColor());
|
|
if (!cost.canExecute()) {
|
|
this.changeTextColor(ColorManager.deathColor());
|
|
}
|
|
this.drawText(cost.currentValue(), rect.x, rect.y, 250, "right");
|
|
this.changeTextColor(ColorManager.normalColor());
|
|
this.drawText("/", rect.x + 260, rect.y, 250);
|
|
this.drawText(cost.value(), rect.x + 100, rect.y, 250, "right");
|
|
} else {
|
|
if (cost.type() == DecisiveBattleCostType.stage) {
|
|
if (cost.value() == 1) {
|
|
if (!$gameSwitches.value(212)) {
|
|
this.drawText(
|
|
"センリのAVを撮影しましょう",
|
|
rect.x + 240,
|
|
rect.y,
|
|
250,
|
|
"right"
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (cost.canExecute()) {
|
|
this.changeTextColor(ColorManager.crisisColor());
|
|
this.drawText("OK", rect.x + 420, rect.y, 250);
|
|
}
|
|
};
|
|
Window_DecisiveBattle.prototype.getTitle = function (type, value) {
|
|
switch (type) {
|
|
case DecisiveBattleCostType.actor:
|
|
return TextManager.decisiveBattleMonster;
|
|
case DecisiveBattleCostType.sw:
|
|
return TextManager.decisiveBattleStage5_2;
|
|
case DecisiveBattleCostType.battle:
|
|
return TextManager.decisiveBattleStage1;
|
|
case DecisiveBattleCostType.stage:
|
|
if (value == 1) {
|
|
return TextManager.decisiveBattleStage1_2;
|
|
} else if (value == 2) {
|
|
return TextManager.decisiveBattleStage2;
|
|
} else if (value == 3) {
|
|
return TextManager.decisiveBattleStage3;
|
|
} else if (value == 4) {
|
|
return TextManager.decisiveBattleStage4;
|
|
} else if (value == 5) {
|
|
return TextManager.decisiveBattleStage5;
|
|
}
|
|
}
|
|
};
|
|
Window_DecisiveBattle.prototype.selectedCost = function () {
|
|
return this._list[this.index()];
|
|
};
|
|
return Window_DecisiveBattle;
|
|
})(Window_Selectable);
|
|
Nore.Window_DecisiveBattle = Window_DecisiveBattle;
|
|
})(Nore || (Nore = {}));
|
|
var BattleInfo = /** @class */ (function () {
|
|
function BattleInfo() {
|
|
this._stageMap = {};
|
|
}
|
|
BattleInfo.prototype.getStage = function (stageId) {
|
|
this._stageMap[stageId] =
|
|
this._stageMap[stageId] || new BattleStage(stageId);
|
|
var stage = this._stageMap[stageId];
|
|
return stage;
|
|
};
|
|
BattleInfo.prototype.getClearStageCount = function () {
|
|
var n = 0;
|
|
for (var key in this._stageMap) {
|
|
var stage = this._stageMap[key];
|
|
if (
|
|
stage.progress() == BattleProgress.win ||
|
|
stage.progress() == BattleProgress.finishScenario
|
|
) {
|
|
n++;
|
|
}
|
|
}
|
|
return n;
|
|
};
|
|
return BattleInfo;
|
|
})();
|
|
var DecisiveBattleCostType;
|
|
(function (DecisiveBattleCostType) {
|
|
DecisiveBattleCostType[(DecisiveBattleCostType["gold"] = 0)] = "gold";
|
|
DecisiveBattleCostType[(DecisiveBattleCostType["mhp"] = 1)] = "mhp";
|
|
DecisiveBattleCostType[(DecisiveBattleCostType["actor"] = 2)] = "actor";
|
|
DecisiveBattleCostType[(DecisiveBattleCostType["energy"] = 3)] = "energy";
|
|
DecisiveBattleCostType[(DecisiveBattleCostType["stage"] = 4)] = "stage";
|
|
DecisiveBattleCostType[(DecisiveBattleCostType["battle"] = 5)] = "battle";
|
|
DecisiveBattleCostType[(DecisiveBattleCostType["sw"] = 6)] = "sw";
|
|
})(DecisiveBattleCostType || (DecisiveBattleCostType = {}));
|
|
var DecisiveBattleInfo = /** @class */ (function () {
|
|
function DecisiveBattleInfo() {
|
|
this._list = [];
|
|
}
|
|
DecisiveBattleInfo.prototype.addCost = function (type, value) {
|
|
this._list.push(new DecisiveBattleCost(type, value));
|
|
this._list = this._list.sort(function (a, b) {
|
|
return a.sortValue() - b.sortValue();
|
|
});
|
|
};
|
|
DecisiveBattleInfo.prototype.list = function () {
|
|
return this._list;
|
|
};
|
|
DecisiveBattleInfo.prototype.canExecute = function () {
|
|
if ($gameSwitches.value(9)) {
|
|
// 実行済
|
|
return false;
|
|
}
|
|
for (var _i = 0, _a = this._list; _i < _a.length; _i++) {
|
|
var cost = _a[_i];
|
|
if (!cost.canExecute()) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
DecisiveBattleInfo.prototype.consumeCost = function () {
|
|
for (var _i = 0, _a = this._list; _i < _a.length; _i++) {
|
|
var cost = _a[_i];
|
|
cost.consumeCost();
|
|
}
|
|
};
|
|
DecisiveBattleInfo.prototype.clearCost = function () {
|
|
this._list = [];
|
|
};
|
|
return DecisiveBattleInfo;
|
|
})();
|
|
var DecisiveBattleCost = /** @class */ (function () {
|
|
function DecisiveBattleCost(type, value) {
|
|
this._type = type;
|
|
this._value = value;
|
|
}
|
|
DecisiveBattleCost.prototype.type = function () {
|
|
return this._type;
|
|
};
|
|
DecisiveBattleCost.prototype.value = function () {
|
|
return this._value;
|
|
};
|
|
DecisiveBattleCost.prototype.currentValue = function () {
|
|
switch (this._type) {
|
|
case DecisiveBattleCostType.battle:
|
|
return $slg.battleInfo().getClearStageCount();
|
|
//return $slg.battleField().clearStageId();
|
|
case DecisiveBattleCostType.gold:
|
|
return $gameParty.gold();
|
|
case DecisiveBattleCostType.mhp:
|
|
return $gameParty.combatant();
|
|
case DecisiveBattleCostType.energy:
|
|
return $gameParty.energy();
|
|
case DecisiveBattleCostType.actor:
|
|
return $slg.formation().kaijinCount();
|
|
}
|
|
return -1;
|
|
};
|
|
DecisiveBattleCost.prototype.canExecute = function () {
|
|
if (this._type == DecisiveBattleCostType.stage) {
|
|
switch (this._value) {
|
|
case 1:
|
|
return $gameSwitches.value(213);
|
|
case 2:
|
|
return $gameSwitches.value(243);
|
|
case 3:
|
|
return $gameSwitches.value(223);
|
|
case 4:
|
|
return $gameSwitches.value(238);
|
|
case 5:
|
|
return $gameSwitches.value(239);
|
|
}
|
|
return true;
|
|
}
|
|
if (this._type == DecisiveBattleCostType.battle) {
|
|
return $slg.clicker().getStage(this.value()).isDead();
|
|
}
|
|
if (this._type == DecisiveBattleCostType.sw) {
|
|
return $gameSwitches.value(this.value());
|
|
}
|
|
return this.currentValue() >= this.value();
|
|
};
|
|
DecisiveBattleCost.prototype.sortValue = function () {
|
|
if (this._type == DecisiveBattleCostType.stage) {
|
|
return -1;
|
|
}
|
|
return this._type * 100000 + this._value;
|
|
};
|
|
DecisiveBattleCost.prototype.finish = function () {
|
|
switch (this._type) {
|
|
case DecisiveBattleCostType.gold:
|
|
if ($gameParty.gold() < this.value()) {
|
|
return false;
|
|
}
|
|
$gameParty.loseGold(this.value());
|
|
return;
|
|
}
|
|
this._finished = true;
|
|
return true;
|
|
};
|
|
DecisiveBattleCost.prototype.isFinished = function () {
|
|
return this._finished;
|
|
};
|
|
DecisiveBattleCost.prototype.consumeCost = function () {
|
|
switch (this._type) {
|
|
case DecisiveBattleCostType.gold:
|
|
$gameParty.loseGold(this.value());
|
|
break;
|
|
case DecisiveBattleCostType.mhp:
|
|
case DecisiveBattleCostType.energy:
|
|
break;
|
|
}
|
|
};
|
|
return DecisiveBattleCost;
|
|
})();
|