UNPKG

@ffxiv-teamcraft/simulator

Version:
71 lines 3.29 kB
"use strict"; 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 __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.QualityAction = void 0; var general_action_1 = require("./general-action"); var action_type_1 = require("./action-type"); var buff_enum_1 = require("../buff.enum"); var step_state_1 = require("../step-state"); var QualityAction = /** @class */ (function (_super) { __extends(QualityAction, _super); function QualityAction() { return _super !== null && _super.apply(this, arguments) || this; } QualityAction.prototype.getType = function () { return action_type_1.ActionType.QUALITY; }; QualityAction.prototype.execute = function (simulation, safe, skipStackAddition) { var _a; if (safe === void 0) { safe = false; } if (skipStackAddition === void 0) { skipStackAddition = false; } var buffMod = this.getBaseBonus(simulation); var conditionMod = this.getBaseCondition(simulation); var potency = this.getPotency(simulation); var qualityIncrease = Math.floor(this.getBaseQuality(simulation)); switch (simulation.state) { case step_state_1.StepState.EXCELLENT: conditionMod *= 4; break; case step_state_1.StepState.POOR: conditionMod *= 0.5; break; case step_state_1.StepState.GOOD: conditionMod *= simulation.crafterStats.splendorous ? 1.75 : 1.5; break; default: break; } var iqMod = ((_a = simulation.getBuff(buff_enum_1.Buff.INNER_QUIET)) === null || _a === void 0 ? void 0 : _a.stacks) || 0; var buffMult = 1; if (simulation.hasBuff(buff_enum_1.Buff.GREAT_STRIDES)) { buffMult += 1; simulation.removeBuff(buff_enum_1.Buff.GREAT_STRIDES); } if (simulation.hasBuff(buff_enum_1.Buff.INNOVATION)) { buffMult += 0.5; } buffMod = (buffMod * buffMult * (100 + iqMod * 10)) / 100; var efficiency = Math.fround(potency * buffMod); simulation.quality += Math.floor((qualityIncrease * conditionMod * efficiency) / 100); if (!skipStackAddition && simulation.crafterStats.level >= 11) { simulation.addInnerQuietStacks(1); } }; return QualityAction; }(general_action_1.GeneralAction)); exports.QualityAction = QualityAction; //# sourceMappingURL=quality-action.js.map