1050 lines
28 KiB
JavaScript
1050 lines
28 KiB
JavaScript
/*:ja
|
|
* @target MZ
|
|
* @author ル
|
|
*
|
|
* @command start
|
|
* @text バトルスタート
|
|
* @des バトルスタート
|
|
* @arg stageId
|
|
* @type number
|
|
* @text stageId
|
|
* @desc stageId
|
|
*
|
|
* @command end
|
|
* @text バトル終了
|
|
* @des バトル終了
|
|
*/
|
|
var Nore;
|
|
(function (Nore) {
|
|
var pluginName = "Nore_Clicker";
|
|
PluginManager.registerCommand(pluginName, "start", function (args) {
|
|
var stageId = parseInt(args.stageId);
|
|
$slg.clicker().start(stageId);
|
|
$slg.showSideBattle();
|
|
var spriteset = SceneManager._scene._spriteset;
|
|
if (spriteset) {
|
|
if (spriteset._clickerWindow) {
|
|
spriteset._clickerWindow.setup($slg.clickerStage());
|
|
}
|
|
}
|
|
});
|
|
PluginManager.registerCommand(pluginName, "end", function (args) {
|
|
$slg.clicker().setCurrentStage(-1);
|
|
});
|
|
})(Nore || (Nore = {}));
|
|
var WEAK_DAMAGE_RATE = 1.5;
|
|
var DEBUFF_DAMAGE_RATE = 1.5;
|
|
var ClickerPhase;
|
|
(function (ClickerPhase) {
|
|
ClickerPhase["battle"] = "battle";
|
|
ClickerPhase["win"] = "win";
|
|
})(ClickerPhase || (ClickerPhase = {}));
|
|
var LAST_STAGE_VAR = 66;
|
|
var IN_BATTLE_SW = 48;
|
|
var Clicker = /** @class */ (function () {
|
|
function Clicker() {
|
|
this._stageMap = {};
|
|
this._currentStageId = 1;
|
|
}
|
|
Clicker.prototype.getStage = function (enemyId) {
|
|
if (!this._stageMap[enemyId]) {
|
|
this._stageMap[enemyId] = new ClickerStage(enemyId);
|
|
}
|
|
return this._stageMap[enemyId];
|
|
};
|
|
Clicker.prototype.restoreStages = function () {
|
|
for (var key in this._stageMap) {
|
|
var stage = this._stageMap[key];
|
|
stage.findMaxStep();
|
|
}
|
|
};
|
|
Clicker.prototype.currentStage = function () {
|
|
return this.getStage(this._currentStageId);
|
|
};
|
|
Clicker.prototype.update = function () {
|
|
if (!$gameSwitches.value(211)) {
|
|
return;
|
|
}
|
|
this.currentStage().update();
|
|
if (this.currentStage().isDefeat()) {
|
|
$gameVariables.setValue(LAST_STAGE_VAR, this.currentStage().enemyId());
|
|
$gameParty.addCommonEvent(255, -1);
|
|
$slg.formation().recoverAll();
|
|
this.setCurrentStage(-1);
|
|
return;
|
|
}
|
|
if (this.currentStage().isDead()) {
|
|
this.nextStage();
|
|
}
|
|
if (this._currentStageId > 0) {
|
|
this.updateSkill();
|
|
}
|
|
};
|
|
Clicker.prototype.updateSkill = function () {
|
|
this.skill().setSpeed(this.skillSpeed());
|
|
this.skill().update();
|
|
};
|
|
Clicker.prototype.skillSpeed = function () {
|
|
if (this.currentStage().enemyId() == 55) {
|
|
// マリナ戦
|
|
return 2;
|
|
}
|
|
if (this.currentStage().enemyId() == 53) {
|
|
// サキ戦
|
|
return 2;
|
|
}
|
|
if (this.currentStage().enemyId() == 54) {
|
|
// ココナ戦
|
|
return 2;
|
|
}
|
|
if (this.currentStage().enemyId() == 100) {
|
|
// コクリュウ戦
|
|
return 2;
|
|
}
|
|
return 1;
|
|
};
|
|
Clicker.prototype.skill = function () {
|
|
this._skill = this._skill || new ClickerSkill(ClickerSkillType.attack);
|
|
return this._skill;
|
|
};
|
|
Clicker.prototype.nextStage = function () {
|
|
if (this.currentStage().isFinalStep()) {
|
|
this.reserveCommonEvent();
|
|
this.setCurrentStage(-1);
|
|
this.currentStage().update();
|
|
} else {
|
|
this.setCurrentStage(this._currentStageId + 1);
|
|
this.currentStage().start();
|
|
this.currentStage().update();
|
|
}
|
|
};
|
|
Clicker.prototype.selectNextStage = function () {
|
|
for (var i = 1; i < 30; i++) {
|
|
var e = $dataEnemies[this._currentStageId + i];
|
|
if (e && e.name.length > 0) {
|
|
this._currentStageId = e.id;
|
|
this.currentStage().update();
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
Clicker.prototype.start = function (id) {
|
|
var reserveCommon = -1;
|
|
if (id == 51) {
|
|
if (!$gameSwitches.value(226)) {
|
|
$gameParty.addCommonEvent(237, -1);
|
|
reserveCommon = 237;
|
|
}
|
|
}
|
|
this.setCurrentStage(id);
|
|
this.currentStage().start();
|
|
return reserveCommon;
|
|
};
|
|
Clicker.prototype.updateBattleSwitch = function () {
|
|
if (this._currentStageId > 0) {
|
|
$gameSwitches.setValue(IN_BATTLE_SW, true);
|
|
} else {
|
|
$gameSwitches.setValue(IN_BATTLE_SW, false);
|
|
}
|
|
};
|
|
Clicker.prototype.setCurrentStage = function (id) {
|
|
this._currentStageId = id;
|
|
this.updateBattleSwitch();
|
|
};
|
|
/*setCurrentStage(id: number) {
|
|
this._currentStageId = id;
|
|
this.currentStage().update();
|
|
}*/
|
|
Clicker.prototype.currentStageId = function () {
|
|
return this._currentStageId;
|
|
};
|
|
Clicker.prototype.reserveCommonEvent = function () {
|
|
var commonId = this.currentStage().enemy().meta["commonId"];
|
|
if (commonId) {
|
|
$gameParty.addCommonEvent(parseInt(commonId), -1);
|
|
}
|
|
this.currentStage().finishAfterEvent();
|
|
};
|
|
Clicker.prototype.escape = function () {
|
|
this.setCurrentStage(-1);
|
|
$gameTemp.reserveCommonEvent(141);
|
|
};
|
|
Clicker.prototype.waitTimeRate = function () {
|
|
return 3;
|
|
/*
|
|
switch ($slg.stage()) {
|
|
case 1:
|
|
return 3;
|
|
}
|
|
return 4;*/
|
|
};
|
|
return Clicker;
|
|
})();
|
|
var TargetType;
|
|
(function (TargetType) {
|
|
TargetType["left"] = "left";
|
|
TargetType["minHp"] = "minHp";
|
|
TargetType["maxHp"] = "maxHp";
|
|
TargetType["priority"] = "priority";
|
|
})(TargetType || (TargetType = {}));
|
|
var ClickerEnemy = /** @class */ (function () {
|
|
function ClickerEnemy(enemyId) {
|
|
this._enemyId = enemyId;
|
|
this._turn = 1;
|
|
this.recoverAll();
|
|
this.prepareAttack();
|
|
}
|
|
ClickerEnemy.prototype.recoverAll = function () {
|
|
this._hp = this.mhp();
|
|
if (this.enemy().meta["hpRate"]) {
|
|
var hpRate = parseInt(this.enemy().meta["hpRate"]);
|
|
this._hp *= hpRate / 100;
|
|
this._hp = Math.floor(this._hp);
|
|
}
|
|
this._wait = 0;
|
|
this._turn = 1;
|
|
};
|
|
ClickerEnemy.prototype.mhp = function () {
|
|
var n = this.enemy().params[0];
|
|
var rate = 1;
|
|
if ($gameSwitches.value(255)) {
|
|
// 防衛施設占拠
|
|
rate -= 0.05;
|
|
}
|
|
rate -= 0.1; // バランス調整
|
|
return Math.round(n * rate);
|
|
};
|
|
ClickerEnemy.prototype.hp = function () {
|
|
return this._hp;
|
|
};
|
|
ClickerEnemy.prototype.isAlive = function () {
|
|
return this._hp > 0;
|
|
};
|
|
ClickerEnemy.prototype.damage = function (n) {
|
|
if (this._hp <= 0) {
|
|
return;
|
|
}
|
|
this._hp -= n;
|
|
if (this._hp < 0) {
|
|
this._hp = 0;
|
|
this.invokeDeathSkill();
|
|
}
|
|
};
|
|
ClickerEnemy.prototype.addDebuff = function (skill) {
|
|
if (skill.meta["damageDebuff"]) {
|
|
this._damageDebuff = true;
|
|
}
|
|
if (skill.meta["defDebuff"]) {
|
|
this._defDebuff = true;
|
|
}
|
|
if (skill.meta["spdDown"]) {
|
|
this._wait -= 25;
|
|
if (this._wait < 0) {
|
|
this._wait = 0;
|
|
}
|
|
}
|
|
};
|
|
ClickerEnemy.prototype.invokeDeathSkill = function () {};
|
|
ClickerEnemy.prototype.battlerName = function () {
|
|
return this.enemy().battlerName;
|
|
};
|
|
ClickerEnemy.prototype.update = function () {
|
|
if (!this.isAlive()) {
|
|
return null;
|
|
}
|
|
this._wait++;
|
|
if (this._wait >= this._maxWait) {
|
|
this.prepareAttack();
|
|
var skill = this.invokeAttackSkill();
|
|
this._turn++;
|
|
return skill;
|
|
}
|
|
return null;
|
|
};
|
|
ClickerEnemy.prototype.invokeAttackSkill = function () {
|
|
for (var _i = 0, _a = this.skills(); _i < _a.length; _i++) {
|
|
var skill = _a[_i];
|
|
if (skill.stypeId == 1) {
|
|
if (this.isSkillEnabled(skill)) {
|
|
if (this.checkInvokeSkill(skill)) {
|
|
return skill;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return $dataSkills[1];
|
|
};
|
|
ClickerEnemy.prototype.isSkillEnabled = function (skill) {
|
|
if (this.isSkillConditionTurnDisabled(skill)) {
|
|
return false;
|
|
}
|
|
if (this.isSkillConditionTurnIntervalDisabled(skill)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
ClickerEnemy.prototype.isSkillConditionTurnIntervalDisabled = function (
|
|
skill
|
|
) {
|
|
var turn = parseInt(skill.meta["turnInterval"]);
|
|
if (isNaN(turn)) {
|
|
return false;
|
|
}
|
|
if (this._turn % turn == 0) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
ClickerEnemy.prototype.isSkillConditionTurnDisabled = function (skill) {
|
|
var turn = parseInt(skill.meta["turn"]);
|
|
if (isNaN(turn)) {
|
|
return false;
|
|
}
|
|
if (this._turn != turn) {
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
ClickerEnemy.prototype.calcDamage = function (skill) {
|
|
var atk = this.atk();
|
|
if (this._damageDebuff) {
|
|
atk /= 2;
|
|
}
|
|
var damageRate = skill.meta["damage"];
|
|
if (!damageRate) {
|
|
return Math.round(atk);
|
|
}
|
|
return Math.round((atk * parseInt(damageRate)) / 100);
|
|
};
|
|
ClickerEnemy.prototype.onAfterAttack = function () {
|
|
this._damageDebuff = false;
|
|
};
|
|
ClickerEnemy.prototype.onAfterDamage = function () {
|
|
this._defDebuff = false;
|
|
};
|
|
ClickerEnemy.prototype.isDefDebuff = function () {
|
|
return this._defDebuff;
|
|
};
|
|
ClickerEnemy.prototype.atk = function () {
|
|
return this.enemy().params[2];
|
|
};
|
|
ClickerEnemy.prototype.spd = function () {
|
|
return Math.floor(AGI_BASE_VALUE / this.enemy().params[6]);
|
|
};
|
|
ClickerEnemy.prototype.prepareAttack = function () {
|
|
this._maxWait = this.calcMaxWait();
|
|
if (this.isInvokeDoubleAttack()) {
|
|
this._maxWait = 16;
|
|
}
|
|
this._wait = 0;
|
|
};
|
|
ClickerEnemy.prototype.enemy = function () {
|
|
return $dataEnemies[this.enemyId()];
|
|
};
|
|
ClickerEnemy.prototype.enemyId = function () {
|
|
return this._enemyId;
|
|
};
|
|
ClickerEnemy.prototype.calcMaxWait = function () {
|
|
return this.enemy().params[6] * this.waitTimeRate();
|
|
};
|
|
ClickerEnemy.prototype.wait = function () {
|
|
return this._wait;
|
|
};
|
|
ClickerEnemy.prototype.maxWait = function () {
|
|
return this._maxWait;
|
|
};
|
|
ClickerEnemy.prototype.waitTimeRate = function () {
|
|
return $slg.clicker().waitTimeRate();
|
|
};
|
|
ClickerEnemy.prototype.targetType = function () {
|
|
return TargetType.priority;
|
|
};
|
|
ClickerEnemy.prototype.element = function () {
|
|
for (var _i = 0, _a = this.enemy().traits; _i < _a.length; _i++) {
|
|
var t = _a[_i];
|
|
if (t.code == 11) {
|
|
if (t.dataId == 2) {
|
|
return MonsterElement.flame;
|
|
}
|
|
if (t.dataId == 3) {
|
|
return MonsterElement.water;
|
|
}
|
|
if (t.dataId == 4) {
|
|
return MonsterElement.wood;
|
|
}
|
|
}
|
|
}
|
|
return MonsterElement.none;
|
|
};
|
|
ClickerEnemy.prototype.isWeak = function (element) {
|
|
switch (this.element()) {
|
|
case MonsterElement.flame:
|
|
return element == MonsterElement.water;
|
|
case MonsterElement.water:
|
|
return element == MonsterElement.wood;
|
|
case MonsterElement.wood:
|
|
return element == MonsterElement.flame;
|
|
}
|
|
return false;
|
|
};
|
|
ClickerEnemy.prototype.skills = function () {
|
|
var actions = this.enemy().actions;
|
|
var result = [];
|
|
for (var _i = 0, actions_1 = actions; _i < actions_1.length; _i++) {
|
|
var action = actions_1[_i];
|
|
if (action.skillId > 10) {
|
|
result.push($dataSkills[action.skillId]);
|
|
}
|
|
}
|
|
return result;
|
|
};
|
|
ClickerEnemy.prototype.getSkill = function (skillType) {
|
|
for (var _i = 0, _a = this.skills(); _i < _a.length; _i++) {
|
|
var skill = _a[_i];
|
|
if (skill.meta[skillType]) {
|
|
return skill;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
ClickerEnemy.prototype.isInvokeDoubleAttack = function () {
|
|
var skill = this.getSkill(SkillType.doubleAttack);
|
|
if (!skill) {
|
|
return false;
|
|
}
|
|
return this.checkInvokeSkill(skill);
|
|
};
|
|
ClickerEnemy.prototype.checkInvokeSkill = function (skill) {
|
|
return Math.randomInt(100) <= skill.successRate;
|
|
};
|
|
return ClickerEnemy;
|
|
})();
|
|
var SkillType;
|
|
(function (SkillType) {
|
|
SkillType["doubleAttack"] = "doubleAttack";
|
|
SkillType["targetAll"] = "targetAll";
|
|
SkillType["deathRecover"] = "deathRecover";
|
|
SkillType["recoverHp"] = "recoverHp";
|
|
SkillType["recoverHpAll"] = "recoverHpAll";
|
|
})(SkillType || (SkillType = {}));
|
|
var ClickerStage = /** @class */ (function () {
|
|
function ClickerStage(enemyId) {
|
|
this._damageList = [];
|
|
this._enemyDamageList = [];
|
|
this._enemyId = enemyId;
|
|
this.findMaxStep();
|
|
}
|
|
ClickerStage.prototype.start = function () {
|
|
this._defeatWait = 0;
|
|
this._enemyList = [];
|
|
var troop = $dataTroops[this._enemyId];
|
|
for (var _i = 0, _a = troop.members; _i < _a.length; _i++) {
|
|
var t = _a[_i];
|
|
var enemy = new ClickerEnemy(t.enemyId);
|
|
this._enemyList.push(enemy);
|
|
}
|
|
$slg.formation().recoverAll();
|
|
$slg.clicker().skill().onSetup();
|
|
};
|
|
ClickerStage.prototype.initialHpRate = function () {
|
|
var hpRate = this.enemy().meta["hpRate"];
|
|
if (!hpRate) {
|
|
return 1;
|
|
}
|
|
return parseInt(hpRate) / 100;
|
|
};
|
|
ClickerStage.prototype.findMaxStep = function () {
|
|
if (this._enemyId < 0) {
|
|
return;
|
|
}
|
|
var name = $dataEnemies[this._enemyId].name;
|
|
var max = parseInt($dataEnemies[this._enemyId].meta["step"]);
|
|
for (var i = 1; i <= 10; i++) {
|
|
var e = $dataEnemies[this._enemyId + i];
|
|
if (e.name == name) {
|
|
max = parseInt(e.meta["step"]);
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
this._maxStep = max;
|
|
};
|
|
ClickerStage.prototype.mapId = function () {
|
|
var map = this.enemy().meta["map"];
|
|
if (map) {
|
|
return parseInt(map);
|
|
}
|
|
return 1;
|
|
};
|
|
ClickerStage.prototype.enemyList = function () {
|
|
return this._enemyList;
|
|
};
|
|
ClickerStage.prototype.enemyId = function () {
|
|
return this._enemyId;
|
|
};
|
|
ClickerStage.prototype.enemy = function () {
|
|
return $dataEnemies[this.enemyId()];
|
|
};
|
|
ClickerStage.prototype.update = function () {
|
|
if (this._enemyId < 0) {
|
|
return;
|
|
}
|
|
this.saveLastUnits();
|
|
this.updateUnits();
|
|
this.updateEnemy();
|
|
};
|
|
ClickerStage.prototype.saveLastUnits = function () {
|
|
this._lastUnits = $slg.formation().battleMemberIds();
|
|
};
|
|
ClickerStage.prototype.isFormationChanged = function () {
|
|
if (!this._lastUnits) {
|
|
return false;
|
|
}
|
|
var units = $slg.formation().battleMemberIds();
|
|
if (this._lastUnits.length != units.length) {
|
|
return true;
|
|
}
|
|
for (var _i = 0, units_1 = units; _i < units_1.length; _i++) {
|
|
var u = units_1[_i];
|
|
if (!this._lastUnits.contains(u)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
ClickerStage.prototype.clearDamage = function () {
|
|
this._damageList = [];
|
|
};
|
|
ClickerStage.prototype.clearEnemyDamage = function () {
|
|
this._enemyDamageList = [];
|
|
};
|
|
ClickerStage.prototype.updateUnits = function () {
|
|
for (
|
|
var _i = 0, _a = $slg.formation().existBattleMembers();
|
|
_i < _a.length;
|
|
_i++
|
|
) {
|
|
var a = _a[_i];
|
|
if (a.updateWait()) {
|
|
this.attack(a);
|
|
}
|
|
}
|
|
/*const leader = $slg.formation().leader();
|
|
if (leader.updateWait()) {
|
|
this.attack(leader);
|
|
}*/
|
|
};
|
|
ClickerStage.prototype.updateEnemy = function () {
|
|
for (var _i = 0, _a = this._enemyList; _i < _a.length; _i++) {
|
|
var e = _a[_i];
|
|
var skill = e.update();
|
|
if (!skill) {
|
|
continue;
|
|
}
|
|
var targets = this.makeEnemyTargets(e, skill);
|
|
for (var _b = 0, targets_1 = targets; _b < targets_1.length; _b++) {
|
|
var a = targets_1[_b];
|
|
if (!a) {
|
|
continue;
|
|
}
|
|
var damage = e.calcDamage(skill);
|
|
e.onAfterAttack();
|
|
a.damage(damage);
|
|
a.addDebuff(skill);
|
|
this._enemyDamageList.push(new EnemyClickerDamage(damage, a, e, skill));
|
|
}
|
|
}
|
|
};
|
|
ClickerStage.prototype.makeEnemyTargets = function (e, skill) {
|
|
if (skill.meta["targetAll"]) {
|
|
return $slg.formation().aliveTargets();
|
|
}
|
|
if (skill.meta["target2"]) {
|
|
return $slg.formation().aliveTargetNum(2);
|
|
}
|
|
if (skill.meta["target3"]) {
|
|
return $slg.formation().aliveTargetNum(3);
|
|
}
|
|
if (skill.meta["targetFront3"]) {
|
|
return $slg.formation().aliveTargetFrontNum(3);
|
|
}
|
|
if (skill.meta["target"] == "top") {
|
|
return $slg.formation().aliveTargetTop();
|
|
}
|
|
if (skill.meta["target"] == "bottom") {
|
|
return $slg.formation().aliveTargetBottom();
|
|
}
|
|
switch (e.targetType()) {
|
|
case TargetType.priority:
|
|
return [$slg.formation().priorityTarget()];
|
|
case TargetType.left:
|
|
return [$slg.formation().leftTarget()];
|
|
default:
|
|
console.error("不正なターゲットです" + e.targetType());
|
|
}
|
|
};
|
|
ClickerStage.prototype.attackLeader = function () {
|
|
if (this.isDead()) {
|
|
return;
|
|
}
|
|
var target = this._enemyList[0];
|
|
var damage = this.calcLeaderDamage();
|
|
target.damage(damage);
|
|
target.onAfterDamage();
|
|
var skill = $dataSkills[162];
|
|
this._damageList.push(
|
|
new ClickerDamage(
|
|
damage,
|
|
new BattleActor(-1, 10, 1),
|
|
target,
|
|
skill,
|
|
false
|
|
)
|
|
);
|
|
};
|
|
ClickerStage.prototype.calcLeaderDamage = function () {
|
|
var n = 0;
|
|
for (
|
|
var _i = 0, _a = $slg.formation().battleMembers();
|
|
_i < _a.length;
|
|
_i++
|
|
) {
|
|
var b = _a[_i];
|
|
n += b.atk();
|
|
}
|
|
return n;
|
|
};
|
|
ClickerStage.prototype.attack = function (a) {
|
|
if (this.isDead()) {
|
|
return;
|
|
}
|
|
var skill = a.attackSkill();
|
|
var damage = a.atk() * this.skillDamageRate(skill);
|
|
if ($gameSwitches.value(323)) {
|
|
// 怪人王の研究所ボーナス
|
|
damage *= 1.05;
|
|
}
|
|
damage *= a.damageRate();
|
|
damage *= $gameSystem.difficultyDamageRate();
|
|
a.increaseTurn();
|
|
var targets = this.makeTargets(a, skill);
|
|
if (targets.length == 0) {
|
|
return;
|
|
}
|
|
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
|
var target = targets_2[_i];
|
|
if (target.isWeak(a.element())) {
|
|
damage *= WEAK_DAMAGE_RATE;
|
|
}
|
|
var isDebuff = false;
|
|
if (target.isDefDebuff()) {
|
|
damage *= DEBUFF_DAMAGE_RATE;
|
|
isDebuff = true;
|
|
}
|
|
damage = Math.round(damage);
|
|
a.onAfterAttack();
|
|
target.damage(damage);
|
|
target.onAfterDamage();
|
|
target.addDebuff(skill);
|
|
this._damageList.push(
|
|
new ClickerDamage(damage, a, target, skill, isDebuff)
|
|
);
|
|
}
|
|
};
|
|
ClickerStage.prototype.skillDamageRate = function (skill) {
|
|
var damageRate = skill.meta["damage"];
|
|
if (!damageRate) {
|
|
return 1;
|
|
}
|
|
return parseInt(damageRate) / 100;
|
|
};
|
|
ClickerStage.prototype.makeTargets = function (a, skill) {
|
|
if (skill && skill.meta["targetAll"]) {
|
|
var result = [];
|
|
for (var _i = 0, _a = this._enemyList; _i < _a.length; _i++) {
|
|
var a_1 = _a[_i];
|
|
if (a_1.isAlive()) {
|
|
result.push(a_1);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
var target = this.makeTarget(a, skill);
|
|
if (target) {
|
|
return [target];
|
|
}
|
|
return [];
|
|
};
|
|
ClickerStage.prototype.makeTarget = function (a, skill) {
|
|
var candidates = [];
|
|
for (var _i = 0, _a = this._enemyList; _i < _a.length; _i++) {
|
|
var a_2 = _a[_i];
|
|
if (a_2.isAlive()) {
|
|
candidates.push(a_2);
|
|
}
|
|
}
|
|
if (candidates.length == 0) {
|
|
return null;
|
|
}
|
|
var dice = Math.randomInt(candidates.length);
|
|
return candidates[dice];
|
|
};
|
|
ClickerStage.prototype.gainReward = function () {
|
|
var gold = this.enemy().gold;
|
|
if (gold > 0) {
|
|
AudioManager.playSe({ name: "Coin", volume: 80, pitch: 100, pan: 0 });
|
|
$gameParty.gainGold(gold);
|
|
}
|
|
};
|
|
ClickerStage.prototype.isWaitVictory = function () {
|
|
return this._victoryWait > 0;
|
|
};
|
|
ClickerStage.prototype.isDead = function () {
|
|
if (this._clear) {
|
|
return true;
|
|
}
|
|
if (this._victoryWait > 0) {
|
|
this._victoryWait--;
|
|
if (this._victoryWait == 0) {
|
|
this._clear = true;
|
|
this.gainReward();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
if (!this._enemyList) {
|
|
return false;
|
|
}
|
|
for (var _i = 0, _a = this._enemyList; _i < _a.length; _i++) {
|
|
var e = _a[_i];
|
|
if (e.isAlive()) {
|
|
return false;
|
|
}
|
|
}
|
|
this._victoryWait = 70;
|
|
return false;
|
|
};
|
|
ClickerStage.prototype.finishAfterEvent = function () {
|
|
this._finishAfterEvent = true;
|
|
};
|
|
ClickerStage.prototype.isBattleEnd = function () {
|
|
return this._clear || this._victoryWait > 0 || this._defeatWait > 0;
|
|
};
|
|
ClickerStage.prototype.isClear = function () {
|
|
if (this.hasCommonEvent()) {
|
|
if (this._finishAfterEvent) {
|
|
return true;
|
|
} else {
|
|
if (this.isClearSwOn()) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
} else {
|
|
if (this._clear) {
|
|
return true;
|
|
}
|
|
}
|
|
if (!this._enemyList) {
|
|
return false;
|
|
}
|
|
for (var _i = 0, _a = this._enemyList; _i < _a.length; _i++) {
|
|
var e = _a[_i];
|
|
if (e.isAlive()) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
ClickerStage.prototype.hasCommonEvent = function () {
|
|
if (!this.enemy()) {
|
|
return false;
|
|
}
|
|
var commonId = this.enemy().meta["commonId"];
|
|
return commonId != null;
|
|
};
|
|
ClickerStage.prototype.isClearSwOn = function () {
|
|
// 過去のバージョンですでにクリア済だった場合の処理
|
|
var clearSw = this.enemy().meta["clearSw"];
|
|
if (clearSw == null) {
|
|
return false;
|
|
}
|
|
return $gameSwitches.value(parseInt(clearSw));
|
|
};
|
|
ClickerStage.prototype.isDefeat = function () {
|
|
if (this._defeatWait > 0) {
|
|
this._defeatWait--;
|
|
if (this._defeatWait == 0) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
if ($slg.formation().isAllDead()) {
|
|
this._defeatWait = 50;
|
|
}
|
|
return false;
|
|
};
|
|
ClickerStage.prototype.damageList = function () {
|
|
return this._damageList;
|
|
};
|
|
ClickerStage.prototype.enemyDamageList = function () {
|
|
return this._enemyDamageList;
|
|
};
|
|
ClickerStage.prototype.name = function () {
|
|
if (!this.enemy()) {
|
|
return "";
|
|
}
|
|
var enemy = this.enemy();
|
|
var name = this.enemy().name;
|
|
switch (ConfigManager.language) {
|
|
case "en":
|
|
if (enemy.meta["nameEn"]) {
|
|
name = enemy.meta["nameEn"];
|
|
}
|
|
break;
|
|
case "ch":
|
|
case "jp":
|
|
break;
|
|
}
|
|
if (this.maxStep() == 1) {
|
|
return name;
|
|
}
|
|
return name + this.currentStep() + "/" + this.maxStep();
|
|
};
|
|
ClickerStage.prototype.currentStep = function () {
|
|
if (!this.enemy()) {
|
|
return 1;
|
|
}
|
|
return parseInt(this.enemy().meta["step"]);
|
|
};
|
|
ClickerStage.prototype.maxStep = function () {
|
|
if (!this._maxStep) {
|
|
this.findMaxStep();
|
|
}
|
|
return this._maxStep;
|
|
};
|
|
ClickerStage.prototype.isFinalStep = function () {
|
|
return this.currentStep() == this.maxStep();
|
|
};
|
|
ClickerStage.prototype.calcLeaderAttack = function () {
|
|
var max = $slg.facilityInfo().findMaxFacilityLevel(FacilityType.weapon);
|
|
switch (max) {
|
|
case 0:
|
|
return 2;
|
|
case 1:
|
|
return 5;
|
|
case 2:
|
|
return 10;
|
|
case 3:
|
|
return 15;
|
|
}
|
|
return 2;
|
|
var attack = 0;
|
|
for (
|
|
var _i = 0, _a = $slg.formation().battleMembers();
|
|
_i < _a.length;
|
|
_i++
|
|
) {
|
|
var a = _a[_i];
|
|
attack += a.atk();
|
|
}
|
|
return Math.floor(attack / 2);
|
|
};
|
|
ClickerStage.prototype.friendHp = function () {
|
|
var n = 0;
|
|
for (
|
|
var _i = 0, _a = $slg.formation().battleMembers();
|
|
_i < _a.length;
|
|
_i++
|
|
) {
|
|
var a = _a[_i];
|
|
n += a.hp();
|
|
}
|
|
return n;
|
|
};
|
|
ClickerStage.prototype.friendMhp = function () {
|
|
var n = 0;
|
|
for (
|
|
var _i = 0, _a = $slg.formation().battleMembers();
|
|
_i < _a.length;
|
|
_i++
|
|
) {
|
|
var a = _a[_i];
|
|
n += a.mhp();
|
|
}
|
|
return n;
|
|
};
|
|
ClickerStage.prototype.leaderName = function () {
|
|
return $gameActors.actor(10).name();
|
|
};
|
|
ClickerStage.prototype.inBattle = function () {
|
|
if (this._enemyId <= 0) {
|
|
return false;
|
|
}
|
|
if (this._defeatWait > 0) {
|
|
return false;
|
|
}
|
|
if (!this.enemyList()) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
ClickerStage.prototype.enemyAttackAnimeId = function () {
|
|
var anime = this.enemy().meta["anime"];
|
|
if (anime) {
|
|
return parseInt(anime);
|
|
}
|
|
return 197;
|
|
};
|
|
ClickerStage.prototype.isLastBoss = function () {
|
|
switch (this._enemyId) {
|
|
case 100:
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
ClickerStage.prototype.isBoss = function () {
|
|
switch (this._enemyId) {
|
|
case 6:
|
|
return true;
|
|
case 50:
|
|
return true;
|
|
case 55:
|
|
return true;
|
|
case 53:
|
|
return true;
|
|
case 54:
|
|
return true;
|
|
case 70:
|
|
return true;
|
|
case 71:
|
|
return true;
|
|
case 72:
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
return ClickerStage;
|
|
})();
|
|
var ClickerDamage = /** @class */ (function () {
|
|
function ClickerDamage(damage, battleActor, enemy, skill, isDebuff) {
|
|
this._damage = damage;
|
|
this._battleActor = battleActor;
|
|
this._enemy = enemy;
|
|
this._weak = enemy.isWeak(this._battleActor.element()) || isDebuff;
|
|
this._skill = skill;
|
|
}
|
|
ClickerDamage.prototype.damage = function () {
|
|
return this._damage;
|
|
};
|
|
ClickerDamage.prototype.battleActor = function () {
|
|
return this._battleActor;
|
|
};
|
|
ClickerDamage.prototype.enemy = function () {
|
|
return this._enemy;
|
|
};
|
|
ClickerDamage.prototype.isWeak = function () {
|
|
return this._weak;
|
|
};
|
|
ClickerDamage.prototype.element = function () {
|
|
return this._battleActor.element();
|
|
};
|
|
ClickerDamage.prototype.animationId = function () {
|
|
if (this._skill.id == 1) {
|
|
}
|
|
return this._skill.animationId;
|
|
};
|
|
return ClickerDamage;
|
|
})();
|
|
var EnemyClickerDamage = /** @class */ (function () {
|
|
function EnemyClickerDamage(damage, battleActor, enemy, skill) {
|
|
this._damage = damage;
|
|
this._battleActor = battleActor;
|
|
this._enemy = enemy;
|
|
this._weak = false; // 敵の攻撃は弱点なし
|
|
this._skill = skill;
|
|
//this._weak = battleActor.isWeak(enemy.element());
|
|
}
|
|
EnemyClickerDamage.prototype.damage = function () {
|
|
return this._damage;
|
|
};
|
|
EnemyClickerDamage.prototype.battleActor = function () {
|
|
return this._battleActor;
|
|
};
|
|
EnemyClickerDamage.prototype.enemy = function () {
|
|
return this._enemy;
|
|
};
|
|
EnemyClickerDamage.prototype.element = function () {
|
|
return this._enemy.element();
|
|
};
|
|
EnemyClickerDamage.prototype.isWeak = function () {
|
|
return this._weak;
|
|
};
|
|
EnemyClickerDamage.prototype.animeId = function () {
|
|
if (this._skill) {
|
|
return this._skill.animationId;
|
|
}
|
|
return this.defaultAnimeId();
|
|
};
|
|
EnemyClickerDamage.prototype.defaultAnimeId = function () {
|
|
return 197;
|
|
};
|
|
return EnemyClickerDamage;
|
|
})();
|
|
var ClickerSkillType;
|
|
(function (ClickerSkillType) {
|
|
ClickerSkillType["speedUp"] = "speedUp";
|
|
ClickerSkillType["attack"] = "attack";
|
|
})(ClickerSkillType || (ClickerSkillType = {}));
|
|
var ClickerSkill = /** @class */ (function () {
|
|
function ClickerSkill(type) {
|
|
this._remain = 0;
|
|
this._type = type;
|
|
this._remain = this.time();
|
|
}
|
|
ClickerSkill.prototype.setSpeed = function (s) {
|
|
this._speed = s;
|
|
};
|
|
ClickerSkill.prototype.update = function () {
|
|
if (this._active) {
|
|
this.updateActive();
|
|
} else {
|
|
this.updateCooling();
|
|
}
|
|
};
|
|
ClickerSkill.prototype.onSetup = function () {
|
|
this._active = false;
|
|
this._remain = this.time() / 2;
|
|
};
|
|
ClickerSkill.prototype.updateActive = function () {};
|
|
ClickerSkill.prototype.updateCooling = function () {
|
|
this._remain -= this._speed;
|
|
if (this._remain <= 0) {
|
|
this._active = true;
|
|
}
|
|
};
|
|
ClickerSkill.prototype.type = function () {
|
|
return this._type;
|
|
};
|
|
ClickerSkill.prototype.invoke = function () {
|
|
if (!this.isActive()) {
|
|
return false;
|
|
}
|
|
this._remain = this.time();
|
|
this._active = false;
|
|
return true;
|
|
};
|
|
ClickerSkill.prototype.time = function () {
|
|
return 1200;
|
|
};
|
|
ClickerSkill.prototype.isActive = function () {
|
|
return this._active;
|
|
};
|
|
ClickerSkill.prototype.remain = function () {
|
|
return this._remain;
|
|
};
|
|
ClickerSkill.prototype.timeRate = function () {
|
|
return (this.time() - this._remain) / this.time();
|
|
};
|
|
return ClickerSkill;
|
|
})();
|