UNPKG

@ffxiv-teamcraft/simulator

Version:
1,317 lines (1,276 loc) 112 kB
var Buff; (function (Buff) { Buff[Buff["INNER_QUIET"] = 0] = "INNER_QUIET"; Buff[Buff["WASTE_NOT"] = 1] = "WASTE_NOT"; Buff[Buff["WASTE_NOT_II"] = 2] = "WASTE_NOT_II"; Buff[Buff["MANIPULATION"] = 3] = "MANIPULATION"; Buff[Buff["GREAT_STRIDES"] = 4] = "GREAT_STRIDES"; Buff[Buff["INNOVATION"] = 5] = "INNOVATION"; Buff[Buff["VENERATION"] = 6] = "VENERATION"; Buff[Buff["MAKERS_MARK"] = 7] = "MAKERS_MARK"; Buff[Buff["MUSCLE_MEMORY"] = 8] = "MUSCLE_MEMORY"; Buff[Buff["FINAL_APPRAISAL"] = 9] = "FINAL_APPRAISAL"; Buff[Buff["HEART_AND_SOUL"] = 10] = "HEART_AND_SOUL"; Buff[Buff["EXPEDIENCE"] = 11] = "EXPEDIENCE"; Buff[Buff["TRAINED_PERFECTION"] = 12] = "TRAINED_PERFECTION"; })(Buff || (Buff = {})); var CrafterStats = /** @class */ (function () { function CrafterStats(jobId, craftsmanship, _control, cp, specialist, splendorous, level, levels) { this.jobId = jobId; this.craftsmanship = craftsmanship; this._control = _control; this.cp = cp; this.specialist = specialist; this.splendorous = splendorous; this.level = level; this.levels = levels; } CrafterStats.prototype.getControl = function (simulationState) { return this._control; }; return CrafterStats; }()); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ 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 (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var ActionType; (function (ActionType) { ActionType[ActionType["PROGRESSION"] = 0] = "PROGRESSION"; ActionType[ActionType["QUALITY"] = 1] = "QUALITY"; ActionType[ActionType["CP_RECOVERY"] = 2] = "CP_RECOVERY"; ActionType[ActionType["BUFF"] = 3] = "BUFF"; ActionType[ActionType["SPECIALTY"] = 4] = "SPECIALTY"; ActionType[ActionType["REPAIR"] = 5] = "REPAIR"; ActionType[ActionType["OTHER"] = 6] = "OTHER"; })(ActionType || (ActionType = {})); var CraftingJob; (function (CraftingJob) { CraftingJob[CraftingJob["ANY"] = -1] = "ANY"; CraftingJob[CraftingJob["CRP"] = 0] = "CRP"; CraftingJob[CraftingJob["BSM"] = 1] = "BSM"; CraftingJob[CraftingJob["ARM"] = 2] = "ARM"; CraftingJob[CraftingJob["GSM"] = 3] = "GSM"; CraftingJob[CraftingJob["LTW"] = 4] = "LTW"; CraftingJob[CraftingJob["WVR"] = 5] = "WVR"; CraftingJob[CraftingJob["ALC"] = 6] = "ALC"; CraftingJob[CraftingJob["CUL"] = 7] = "CUL"; })(CraftingJob || (CraftingJob = {})); var SimulationFailCause; (function (SimulationFailCause) { // Only used for safe mode, this is for when safe mode is enabled and action success rate is <100 at this moment. SimulationFailCause[SimulationFailCause["UNSAFE_ACTION"] = 0] = "UNSAFE_ACTION"; SimulationFailCause[SimulationFailCause["DURABILITY_REACHED_ZERO"] = 1] = "DURABILITY_REACHED_ZERO"; SimulationFailCause[SimulationFailCause["NOT_ENOUGH_CP"] = 2] = "NOT_ENOUGH_CP"; SimulationFailCause[SimulationFailCause["MISSING_LEVEL_REQUIREMENT"] = 3] = "MISSING_LEVEL_REQUIREMENT"; SimulationFailCause[SimulationFailCause["MISSING_STATS_REQUIREMENT"] = 4] = "MISSING_STATS_REQUIREMENT"; SimulationFailCause[SimulationFailCause["NOT_SPECIALIST"] = 5] = "NOT_SPECIALIST"; SimulationFailCause[SimulationFailCause["NO_INNER_QUIET"] = 6] = "NO_INNER_QUIET"; SimulationFailCause[SimulationFailCause["QUALITY_TOO_LOW"] = 7] = "QUALITY_TOO_LOW"; })(SimulationFailCause || (SimulationFailCause = {})); var StepState; (function (StepState) { StepState[StepState["NONE"] = 0] = "NONE"; StepState[StepState["NORMAL"] = 1] = "NORMAL"; StepState[StepState["GOOD"] = 2] = "GOOD"; StepState[StepState["EXCELLENT"] = 3] = "EXCELLENT"; StepState[StepState["POOR"] = 4] = "POOR"; // Only for expert recipes StepState[StepState["CENTERED"] = 5] = "CENTERED"; StepState[StepState["STURDY"] = 6] = "STURDY"; StepState[StepState["PLIANT"] = 7] = "PLIANT"; // Only for super expert recipes StepState[StepState["MALLEABLE"] = 8] = "MALLEABLE"; StepState[StepState["PRIMED"] = 9] = "PRIMED"; StepState[StepState["GOOD_OMEN"] = 10] = "GOOD_OMEN"; })(StepState || (StepState = {})); var Tables = /** @class */ (function () { function Tables() { } Tables.HQ_TABLE = [ 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 22, 23, 24, 26, 28, 31, 34, 38, 42, 47, 52, 58, 64, 68, 71, 74, 76, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 94, 96, 98, 100, ]; Tables.LEVEL_TABLE = { 51: 120, 52: 125, 53: 130, 54: 133, 55: 136, 56: 139, 57: 142, 58: 145, 59: 148, 60: 150, 61: 260, 62: 265, 63: 270, 64: 273, 65: 276, 66: 279, 67: 282, 68: 285, 69: 288, 70: 290, 71: 390, 72: 395, 73: 400, 74: 403, 75: 406, 76: 409, 77: 412, 78: 415, 79: 418, 80: 420, 81: 517, 82: 520, 83: 525, 84: 530, 85: 535, 86: 540, 87: 545, 88: 550, 89: 555, 90: 560, 91: 650, 92: 653, 93: 656, 94: 660, 95: 665, 96: 670, 97: 675, 98: 680, 99: 685, 100: 690, }; return Tables; }()); /** * This is the parent class of all actions in the simulator. */ var CraftingAction = /** @class */ (function () { function CraftingAction() { } /** * checks if the action can be moved inside the simulation state, * this is meant to prevent moving automatic actions (looking at you Whistle end progression tick). * @returns {boolean} */ CraftingAction.prototype.canBeMoved = function (currentIndex) { return true; }; CraftingAction.prototype.getId = function (jobId) { // Crafter ids are 8 to 15, we want indexes from 0 to 7, so... return this.getIds()[jobId - 8] || this.getIds()[0]; }; CraftingAction.prototype.getWaitDuration = function () { return this.getType() === ActionType.BUFF ? 2 : 3; }; /** * If an action is skipped on fail, it doesn't tick buffs. * Example: Observe, Master's Mend, buffs. */ CraftingAction.prototype.skipOnFail = function () { return false; }; CraftingAction.prototype.requiresGood = function () { return false; }; CraftingAction.prototype.hasCombo = function (simulation) { return false; }; CraftingAction.prototype.getSuccessRate = function (simulationState) { var baseRate = this._getSuccessRate(simulationState); if (simulationState.state === StepState.CENTERED) { return baseRate + 25; } return baseRate; }; CraftingAction.prototype.canBeUsed = function (simulationState, linear, safeMode) { var levelRequirement = this.getLevelRequirement(); var craftsmanshipRequirement = simulationState.recipe.craftsmanshipReq; var controlRequirement = simulationState.recipe.controlReq; if (safeMode && this.getSuccessRate(simulationState) < 100) { return false; } if (levelRequirement.job !== CraftingJob.ANY && simulationState.crafterStats.levels[levelRequirement.job] !== undefined) { return (simulationState.crafterStats.levels[levelRequirement.job] >= levelRequirement.level && this._canBeUsed(simulationState, linear)); } if (craftsmanshipRequirement && controlRequirement) { return (simulationState.crafterStats.craftsmanship >= craftsmanshipRequirement && simulationState.crafterStats._control >= controlRequirement && simulationState.crafterStats.level >= levelRequirement.level && this._canBeUsed(simulationState, linear)); } if (craftsmanshipRequirement) { return (simulationState.crafterStats.craftsmanship >= craftsmanshipRequirement && simulationState.crafterStats.level >= levelRequirement.level && this._canBeUsed(simulationState, linear)); } if (controlRequirement) { return (simulationState.crafterStats._control >= controlRequirement && simulationState.crafterStats.level >= levelRequirement.level && this._canBeUsed(simulationState, linear)); } return (simulationState.crafterStats.level >= levelRequirement.level && this._canBeUsed(simulationState, linear)); }; CraftingAction.prototype.getFailCause = function (simulationState, linear, safeMode) { if (simulationState.success) { return undefined; } var levelRequirement = this.getLevelRequirement(); var craftsmanshipRequirement = simulationState.recipe.craftsmanshipReq; var controlRequirement = simulationState.recipe.controlReq; if (safeMode && this.getSuccessRate(simulationState) < 100) { return SimulationFailCause.UNSAFE_ACTION; } if (levelRequirement.job !== CraftingJob.ANY && simulationState.crafterStats.levels[levelRequirement.job] !== undefined) { if (simulationState.crafterStats.levels[levelRequirement.job] < levelRequirement.level) { return SimulationFailCause.MISSING_LEVEL_REQUIREMENT; } } if (simulationState.crafterStats.level < levelRequirement.level) { return SimulationFailCause.MISSING_LEVEL_REQUIREMENT; } if (craftsmanshipRequirement && simulationState.crafterStats.craftsmanship < craftsmanshipRequirement) { return SimulationFailCause.MISSING_STATS_REQUIREMENT; } if (controlRequirement && simulationState.crafterStats._control < controlRequirement) { return SimulationFailCause.MISSING_STATS_REQUIREMENT; } return undefined; }; CraftingAction.prototype.getCPCost = function (simulationState, linear) { if (linear === void 0) { linear = false; } var baseCost = this.getBaseCPCost(simulationState); if (simulationState.state === StepState.PLIANT) { return Math.ceil(baseCost / 2); } return baseCost; }; CraftingAction.prototype.onFail = function (simulation) { // Base onFail does nothing, override to implement it, as it wont be used in most cases. }; CraftingAction.prototype.skipsBuffTicks = function () { return false; }; /** * Checks if this action is an instance of a given other action. * @param actionClass */ CraftingAction.prototype.is = function (actionClass) { return this instanceof actionClass; }; CraftingAction.prototype.getBaseProgression = function (simulation) { var stats = simulation.crafterStats; var baseValue = (stats.craftsmanship * 10) / simulation.recipe.progressDivider + 2; if (Tables.LEVEL_TABLE[stats.level] <= simulation.recipe.rlvl) { return Math.fround(baseValue * (simulation.recipe.progressModifier || 100) * Math.fround(0.01)); } return Math.floor(baseValue); }; CraftingAction.prototype.getBaseQuality = function (simulation) { var stats = simulation.crafterStats; var baseValue = (stats.getControl(simulation) * 10) / simulation.recipe.qualityDivider + 35; if (Tables.LEVEL_TABLE[stats.level] <= simulation.recipe.rlvl) { return Math.fround(baseValue * (simulation.recipe.qualityModifier || 100) * Math.fround(0.01)); } return Math.floor(baseValue); }; return CraftingAction; }()); /** * This is for every progress and quality actions */ var GeneralAction = /** @class */ (function (_super) { __extends(GeneralAction, _super); function GeneralAction() { return _super !== null && _super.apply(this, arguments) || this; } GeneralAction.prototype.getDurabilityCost = function (simulationState) { var divider = 1; if (simulationState.hasBuff(Buff.WASTE_NOT) || simulationState.hasBuff(Buff.WASTE_NOT_II)) { divider *= 2; } if (simulationState.state === StepState.STURDY) { divider *= 2; } return Math.ceil(this.getBaseDurabilityCost(simulationState) / divider); }; GeneralAction.prototype._getSuccessRate = function (simulationState) { return this.getBaseSuccessRate(simulationState); }; GeneralAction.prototype.getBaseBonus = function (simulation) { return 1; }; GeneralAction.prototype.getBaseCondition = function (simulation) { return 1; }; return GeneralAction; }(CraftingAction)); var ProgressAction = /** @class */ (function (_super) { __extends(ProgressAction, _super); function ProgressAction() { return _super !== null && _super.apply(this, arguments) || this; } ProgressAction.prototype.getType = function () { return ActionType.PROGRESSION; }; ProgressAction.prototype.execute = function (simulation) { var buffMod = this.getBaseBonus(simulation); var conditionMod = this.getBaseCondition(simulation); var potency = this.getPotency(simulation); var progressionIncrease = Math.floor(this.getBaseProgression(simulation)); switch (simulation.state) { case StepState.MALLEABLE: conditionMod *= 1.5; break; default: break; } if (simulation.hasBuff(Buff.MUSCLE_MEMORY)) { buffMod += 1; simulation.removeBuff(Buff.MUSCLE_MEMORY); } if (simulation.hasBuff(Buff.VENERATION)) { buffMod += 0.5; } var efficiency = potency * buffMod; simulation.progression += Math.floor((progressionIncrease * conditionMod * efficiency) / 100); if (simulation.hasBuff(Buff.FINAL_APPRAISAL) && simulation.progression >= simulation.recipe.progress) { simulation.progression = Math.min(simulation.progression, simulation.recipe.progress - 1); simulation.removeBuff(Buff.FINAL_APPRAISAL); } }; return ProgressAction; }(GeneralAction)); var BasicSynthesis = /** @class */ (function (_super) { __extends(BasicSynthesis, _super); function BasicSynthesis() { return _super !== null && _super.apply(this, arguments) || this; } BasicSynthesis.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 1 }; }; BasicSynthesis.prototype._canBeUsed = function (simulationState) { return true; }; BasicSynthesis.prototype.getBaseDurabilityCost = function (simulationState) { return 10; }; BasicSynthesis.prototype.getBaseSuccessRate = function (simulationState) { return 100; }; BasicSynthesis.prototype.getBaseCPCost = function (simulationState) { return 0; }; BasicSynthesis.prototype.getIds = function () { return [100001, 100015, 100030, 100075, 100045, 100060, 100090, 100105]; }; BasicSynthesis.prototype.getPotency = function (simulation) { if (simulation.crafterStats.level >= 31) { // Basic Synthesis Mastery return 120; } return 100; }; return BasicSynthesis; }(ProgressAction)); var CarefulSynthesis = /** @class */ (function (_super) { __extends(CarefulSynthesis, _super); function CarefulSynthesis() { return _super !== null && _super.apply(this, arguments) || this; } CarefulSynthesis.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 62 }; }; CarefulSynthesis.prototype._canBeUsed = function (simulationState) { return true; }; CarefulSynthesis.prototype.getBaseCPCost = function (simulationState) { return 7; }; CarefulSynthesis.prototype.getBaseDurabilityCost = function (simulationState) { return 10; }; CarefulSynthesis.prototype.getBaseSuccessRate = function (simulationState) { return 100; }; CarefulSynthesis.prototype.getIds = function () { return [100203, 100204, 100205, 100206, 100207, 100208, 100209, 100210]; }; CarefulSynthesis.prototype.getPotency = function (simulation) { return simulation.crafterStats.level >= 82 ? 180 : 150; }; return CarefulSynthesis; }(ProgressAction)); var RapidSynthesis = /** @class */ (function (_super) { __extends(RapidSynthesis, _super); function RapidSynthesis() { return _super !== null && _super.apply(this, arguments) || this; } RapidSynthesis.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 9 }; }; RapidSynthesis.prototype._canBeUsed = function (simulationState) { return true; }; RapidSynthesis.prototype.getBaseCPCost = function (simulationState) { return 0; }; RapidSynthesis.prototype.getBaseDurabilityCost = function (simulationState) { return 10; }; RapidSynthesis.prototype.getBaseSuccessRate = function (simulationState) { return 50; }; RapidSynthesis.prototype.getIds = function () { return [100363, 100364, 100365, 100366, 100367, 100368, 100369, 100370]; }; RapidSynthesis.prototype.getPotency = function (simulation) { if (simulation.crafterStats.level >= 63) { // Rapid Synthesis Mastery return 500; } return 250; }; return RapidSynthesis; }(ProgressAction)); var Groundwork = /** @class */ (function (_super) { __extends(Groundwork, _super); function Groundwork() { return _super !== null && _super.apply(this, arguments) || this; } Groundwork.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 72 }; }; Groundwork.prototype._canBeUsed = function (simulationState) { return true; }; Groundwork.prototype.getBaseCPCost = function (simulationState) { return 18; }; Groundwork.prototype.getBaseDurabilityCost = function (simulationState) { return 20; }; Groundwork.prototype.getBaseSuccessRate = function (simulationState) { return 100; }; Groundwork.prototype.getIds = function () { return [100403, 100404, 100405, 100406, 100407, 100408, 100409, 100410]; }; Groundwork.prototype.getPotency = function (simulation) { var basePotency = simulation.crafterStats.level >= 86 ? 360 : 300; if (simulation.hasBuff(Buff.TRAINED_PERFECTION) || simulation.durability >= this.getDurabilityCost(simulation)) { return basePotency; } return basePotency / 2; }; return Groundwork; }(ProgressAction)); /** * MuMe is just piece by piece with a different condition, cost and success rate. */ var MuscleMemory = /** @class */ (function (_super) { __extends(MuscleMemory, _super); function MuscleMemory() { return _super !== null && _super.apply(this, arguments) || this; } MuscleMemory.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 54 }; }; MuscleMemory.prototype.getType = function () { return ActionType.PROGRESSION; }; MuscleMemory.prototype.execute = function (simulation) { _super.prototype.execute.call(this, simulation); simulation.buffs.push({ duration: simulation.state === StepState.PRIMED ? 7 : 5, stacks: 0, buff: Buff.MUSCLE_MEMORY, appliedStep: simulation.steps.length, }); }; MuscleMemory.prototype._canBeUsed = function (simulation) { return simulation.steps.filter(function (step) { return !step.action.skipsBuffTicks(); }).length === 0; }; MuscleMemory.prototype.canBeMoved = function (currentIndex) { return currentIndex > 0; }; MuscleMemory.prototype.getBaseCPCost = function (simulation) { return 6; }; MuscleMemory.prototype.getIds = function () { return [100379, 100380, 100381, 100382, 100383, 100384, 100385, 100386]; }; MuscleMemory.prototype.getDurabilityCost = function (simulationState) { return 10; }; MuscleMemory.prototype._getSuccessRate = function (simulationState) { return 100; }; MuscleMemory.prototype.getBaseDurabilityCost = function (simulationState) { return 10; }; MuscleMemory.prototype.getBaseSuccessRate = function (simulationState) { return 100; }; MuscleMemory.prototype.getPotency = function (simulation) { return 300; }; return MuscleMemory; }(ProgressAction)); var QualityAction = /** @class */ (function (_super) { __extends(QualityAction, _super); function QualityAction() { return _super !== null && _super.apply(this, arguments) || this; } QualityAction.prototype.getType = function () { return 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 StepState.EXCELLENT: conditionMod *= 4; break; case StepState.POOR: conditionMod *= 0.5; break; case StepState.GOOD: conditionMod *= simulation.crafterStats.splendorous ? 1.75 : 1.5; break; default: break; } var iqMod = ((_a = simulation.getBuff(Buff.INNER_QUIET)) === null || _a === void 0 ? void 0 : _a.stacks) || 0; var buffMult = 1; if (simulation.hasBuff(Buff.GREAT_STRIDES)) { buffMult += 1; simulation.removeBuff(Buff.GREAT_STRIDES); } if (simulation.hasBuff(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; }(GeneralAction)); var BasicTouch = /** @class */ (function (_super) { __extends(BasicTouch, _super); function BasicTouch() { return _super !== null && _super.apply(this, arguments) || this; } BasicTouch.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 5 }; }; BasicTouch.prototype._canBeUsed = function (simulationState) { return true; }; BasicTouch.prototype.getBaseDurabilityCost = function (simulationState) { return 10; }; BasicTouch.prototype.getBaseSuccessRate = function (simulationState) { return 100; }; BasicTouch.prototype.getBaseCPCost = function (simulationState) { return 18; }; BasicTouch.prototype.getIds = function () { return [100002, 100016, 100031, 100076, 100046, 100061, 100091, 100106]; }; BasicTouch.prototype.getPotency = function (simulation) { return 100; }; return BasicTouch; }(QualityAction)); var StandardTouch = /** @class */ (function (_super) { __extends(StandardTouch, _super); function StandardTouch() { return _super !== null && _super.apply(this, arguments) || this; } StandardTouch.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 18 }; }; StandardTouch.prototype._canBeUsed = function (simulationState) { return true; }; StandardTouch.prototype.hasCombo = function (simulation) { return simulation.hasComboAvailable(new BasicTouch().getIds()[0]); }; StandardTouch.prototype.getBaseCPCost = function (simulationState) { return simulationState.hasComboAvailable(new BasicTouch().getIds()[0]) ? 18 : 32; }; StandardTouch.prototype.getBaseDurabilityCost = function (simulationState) { return 10; }; StandardTouch.prototype.getBaseSuccessRate = function (simulationState) { return 100; }; StandardTouch.prototype.getIds = function () { return [100004, 100018, 100034, 100078, 100048, 100064, 100093, 100109]; }; StandardTouch.prototype.getPotency = function (simulation) { return 125; }; return StandardTouch; }(QualityAction)); var HastyTouch = /** @class */ (function (_super) { __extends(HastyTouch, _super); function HastyTouch() { return _super !== null && _super.apply(this, arguments) || this; } HastyTouch.prototype.execute = function (simulation, safe, skipStackAddition) { if (safe === void 0) { safe = false; } if (skipStackAddition === void 0) { skipStackAddition = false; } _super.prototype.execute.call(this, simulation, safe, skipStackAddition); if (simulation.crafterStats.level >= 96) { simulation.buffs.push({ duration: 1, buff: Buff.EXPEDIENCE, stacks: 1, appliedStep: simulation.steps.length, }); } }; HastyTouch.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 9 }; }; HastyTouch.prototype._canBeUsed = function (simulationState) { return true; }; HastyTouch.prototype.getBaseCPCost = function (simulationState) { return 0; }; HastyTouch.prototype.getBaseDurabilityCost = function (simulationState) { return 10; }; HastyTouch.prototype.getBaseSuccessRate = function (simulationState) { return 60; }; HastyTouch.prototype.getIds = function () { return [100355, 100356, 100357, 100358, 100359, 100360, 100361, 100362]; }; HastyTouch.prototype.getPotency = function (simulation) { return 100; }; return HastyTouch; }(QualityAction)); var ByregotsBlessing = /** @class */ (function (_super) { __extends(ByregotsBlessing, _super); function ByregotsBlessing() { return _super !== null && _super.apply(this, arguments) || this; } ByregotsBlessing.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 50 }; }; ByregotsBlessing.prototype._canBeUsed = function (simulationState) { return (simulationState.hasBuff(Buff.INNER_QUIET) && simulationState.getBuff(Buff.INNER_QUIET).stacks > 0); }; ByregotsBlessing.prototype.getFailCause = function (simulationState, linear, safeMode) { var superCause = _super.prototype.getFailCause.call(this, simulationState, linear, safeMode); if (!simulationState.success && !superCause && !simulationState.hasBuff(Buff.INNER_QUIET)) { return SimulationFailCause.NO_INNER_QUIET; } return superCause; }; ByregotsBlessing.prototype.execute = function (simulation) { _super.prototype.execute.call(this, simulation); simulation.removeBuff(Buff.INNER_QUIET); }; ByregotsBlessing.prototype.getBaseCPCost = function (simulationState) { return 24; }; ByregotsBlessing.prototype.getBaseDurabilityCost = function (simulationState) { return 10; }; ByregotsBlessing.prototype.getBaseSuccessRate = function (simulationState) { return 100; }; ByregotsBlessing.prototype.getIds = function () { return [100339, 100340, 100341, 100342, 100343, 100344, 100345, 100346]; }; ByregotsBlessing.prototype.getPotency = function (simulation) { return Math.min(100 + simulation.getBuff(Buff.INNER_QUIET).stacks * 20, 300); }; return ByregotsBlessing; }(QualityAction)); var PreciseTouch = /** @class */ (function (_super) { __extends(PreciseTouch, _super); function PreciseTouch() { return _super !== null && _super.apply(this, arguments) || this; } PreciseTouch.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 53 }; }; PreciseTouch.prototype.execute = function (simulation) { _super.prototype.execute.call(this, simulation); simulation.addInnerQuietStacks(1); }; PreciseTouch.prototype.requiresGood = function () { return true; }; PreciseTouch.prototype._canBeUsed = function (simulationState, linear) { if (linear === void 0) { linear = false; } if (linear) { return true; } if (simulationState.safe && !simulationState.hasBuff(Buff.HEART_AND_SOUL)) { return false; } return (simulationState.hasBuff(Buff.HEART_AND_SOUL) || simulationState.state === StepState.GOOD || simulationState.state === StepState.EXCELLENT); }; PreciseTouch.prototype.getBaseCPCost = function (simulationState) { return 18; }; PreciseTouch.prototype.getBaseDurabilityCost = function (simulationState) { return 10; }; PreciseTouch.prototype.getBaseSuccessRate = function (simulationState) { return 100; }; PreciseTouch.prototype.getIds = function () { return [100128, 100129, 100130, 100131, 100132, 100133, 100134, 100135]; }; PreciseTouch.prototype.getPotency = function (simulation) { return 150; }; return PreciseTouch; }(QualityAction)); var PrudentTouch = /** @class */ (function (_super) { __extends(PrudentTouch, _super); function PrudentTouch() { return _super !== null && _super.apply(this, arguments) || this; } PrudentTouch.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 66 }; }; PrudentTouch.prototype._canBeUsed = function (simulationState) { return !(simulationState.hasBuff(Buff.WASTE_NOT) || simulationState.hasBuff(Buff.WASTE_NOT_II)); }; PrudentTouch.prototype.getBaseCPCost = function (simulationState) { return 25; }; PrudentTouch.prototype.getBaseDurabilityCost = function (simulationState) { return 5; }; PrudentTouch.prototype.getBaseSuccessRate = function (simulationState) { return 100; }; PrudentTouch.prototype.getIds = function () { return [100227, 100228, 100229, 100230, 100231, 100232, 100233, 100234]; }; PrudentTouch.prototype.getPotency = function (simulation) { return 100; }; return PrudentTouch; }(QualityAction)); var TricksOfTheTrade = /** @class */ (function (_super) { __extends(TricksOfTheTrade, _super); function TricksOfTheTrade() { return _super !== null && _super.apply(this, arguments) || this; } TricksOfTheTrade.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 13 }; }; TricksOfTheTrade.prototype.getType = function () { return ActionType.CP_RECOVERY; }; TricksOfTheTrade.prototype._canBeUsed = function (simulationState, linear) { if (linear === void 0) { linear = false; } if (linear) { return true; } if (simulationState.safe) { return false; } return (simulationState.state === StepState.GOOD || simulationState.state === StepState.EXCELLENT); }; TricksOfTheTrade.prototype.execute = function (simulation, safe) { if (simulation.hasBuff(Buff.HEART_AND_SOUL) || simulation.state === StepState.GOOD || simulation.state === StepState.EXCELLENT) { simulation.availableCP += 20; if (simulation.availableCP > simulation.maxCP) { simulation.availableCP = simulation.maxCP; } } }; TricksOfTheTrade.prototype.getBaseCPCost = function (simulationState) { return 0; }; TricksOfTheTrade.prototype.getIds = function () { return [100371, 100372, 100373, 100374, 100375, 100376, 100377, 100378]; }; TricksOfTheTrade.prototype._getSuccessRate = function (simulationState) { return 100; }; TricksOfTheTrade.prototype.getDurabilityCost = function (simulationState) { return 0; }; TricksOfTheTrade.prototype.skipOnFail = function () { return true; }; return TricksOfTheTrade; }(CraftingAction)); var MastersMend = /** @class */ (function (_super) { __extends(MastersMend, _super); function MastersMend() { return _super !== null && _super.apply(this, arguments) || this; } MastersMend.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 7 }; }; MastersMend.prototype.getType = function () { return ActionType.REPAIR; }; MastersMend.prototype._canBeUsed = function (simulationState) { return true; }; MastersMend.prototype.execute = function (simulation) { simulation.repair(30); }; MastersMend.prototype.getBaseCPCost = function (simulationState) { return 88; }; MastersMend.prototype.getDurabilityCost = function (simulationState) { return 0; }; MastersMend.prototype.getIds = function () { return [100003, 100017, 100032, 100047, 100062, 100077, 100092, 100107]; }; MastersMend.prototype._getSuccessRate = function (simulationState) { return 100; }; MastersMend.prototype.skipOnFail = function () { return true; }; return MastersMend; }(CraftingAction)); var BuffAction = /** @class */ (function (_super) { __extends(BuffAction, _super); function BuffAction() { return _super !== null && _super.apply(this, arguments) || this; } BuffAction.prototype.getType = function () { return ActionType.BUFF; }; BuffAction.prototype.canBeClipped = function () { return false; }; BuffAction.prototype.execute = function (simulation) { for (var _i = 0, _a = this.getOverrides(); _i < _a.length; _i++) { var buffToOverride = _a[_i]; simulation.removeBuff(buffToOverride); } simulation.buffs.push(this.getAppliedBuff(simulation)); }; BuffAction.prototype._canBeUsed = function (simulationState) { if (this.canBeClipped()) { return true; } return !simulationState.hasBuff(this.getBuff()); }; BuffAction.prototype.getDurabilityCost = function (simulationState) { return 0; }; BuffAction.prototype._getSuccessRate = function (simulationState) { return 100; }; BuffAction.prototype.skipOnFail = function () { return true; }; /** * Override this method if the buff overrides other buffs (steady hands for instance). * Don't forget to add super.getOverrides() to the array you'll return * @returns {Buff | null} */ BuffAction.prototype.getOverrides = function () { return [this.getBuff()]; }; BuffAction.prototype.getOnExpire = function () { // Adding a return here to avoid typescript compilation error due to empty block. return undefined; }; BuffAction.prototype.getAppliedBuff = function (simulation) { return { duration: simulation.state === StepState.PRIMED ? this.getDuration(simulation) + 2 : this.getDuration(simulation), tick: this.getTick(), onExpire: this.getOnExpire(), stacks: this.getInitialStacks(), buff: this.getBuff(), appliedStep: simulation.steps.length, }; }; return BuffAction; }(CraftingAction)); var Manipulation = /** @class */ (function (_super) { __extends(Manipulation, _super); function Manipulation() { return _super !== null && _super.apply(this, arguments) || this; } Manipulation.prototype.canBeClipped = function () { return true; }; Manipulation.prototype.getWaitDuration = function () { return 2; }; Manipulation.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 65 }; }; Manipulation.prototype.getType = function () { return ActionType.REPAIR; }; Manipulation.prototype.getBaseCPCost = function (simulationState) { return 96; }; Manipulation.prototype.getDuration = function (simulation) { return 8; }; Manipulation.prototype.getIds = function () { return [4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581]; }; Manipulation.prototype.getOverrides = function () { return _super.prototype.getOverrides.call(this).concat(Buff.MANIPULATION); }; Manipulation.prototype.getBuff = function () { return Buff.MANIPULATION; }; Manipulation.prototype.getInitialStacks = function () { return 0; }; Manipulation.prototype.getTick = function () { return function (simulation) { simulation.repair(5); }; }; return Manipulation; }(BuffAction)); var GreatStrides = /** @class */ (function (_super) { __extends(GreatStrides, _super); function GreatStrides() { return _super !== null && _super.apply(this, arguments) || this; } GreatStrides.prototype.canBeClipped = function () { return true; }; GreatStrides.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 21 }; }; GreatStrides.prototype.getBaseCPCost = function (simulationState) { return 32; }; GreatStrides.prototype.getDuration = function (simulation) { return 3; }; GreatStrides.prototype.getIds = function () { return [260, 261, 262, 263, 264, 265, 266, 267]; }; GreatStrides.prototype.getBuff = function () { return Buff.GREAT_STRIDES; }; GreatStrides.prototype.getInitialStacks = function () { return 0; }; GreatStrides.prototype.getTick = function () { return undefined; }; return GreatStrides; }(BuffAction)); var Innovation = /** @class */ (function (_super) { __extends(Innovation, _super); function Innovation() { return _super !== null && _super.apply(this, arguments) || this; } Innovation.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 26 }; }; Innovation.prototype.getBaseCPCost = function (simulationState) { return 18; }; Innovation.prototype.getBuff = function () { return Buff.INNOVATION; }; Innovation.prototype.getDuration = function (simulation) { return 4; }; Innovation.prototype.getIds = function () { return [19004, 19005, 19006, 19007, 19008, 19009, 19010, 19011]; }; Innovation.prototype.getInitialStacks = function () { return 0; }; Innovation.prototype.canBeClipped = function () { return true; }; Innovation.prototype.getTick = function () { return undefined; }; return Innovation; }(BuffAction)); var Veneration = /** @class */ (function (_super) { __extends(Veneration, _super); function Veneration() { return _super !== null && _super.apply(this, arguments) || this; } Veneration.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 15 }; }; Veneration.prototype.getBaseCPCost = function (simulationState) { return 18; }; Veneration.prototype.getBuff = function () { return Buff.VENERATION; }; Veneration.prototype.getDuration = function (simulation) { return 4; }; Veneration.prototype.getIds = function () { return [19297, 19298, 19299, 19300, 19301, 19302, 19303, 19304]; }; Veneration.prototype.getInitialStacks = function () { return 0; }; Veneration.prototype.canBeClipped = function () { return true; }; Veneration.prototype.getTick = function () { return undefined; }; return Veneration; }(BuffAction)); var Observe = /** @class */ (function (_super) { __extends(Observe, _super); function Observe() { return _super !== null && _super.apply(this, arguments) || this; } Observe.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 13 }; }; Observe.prototype.getType = function () { return ActionType.OTHER; }; Observe.prototype._canBeUsed = function (simulationState) { return true; }; Observe.prototype.execute = function (simulation) { // Nothing happens }; Observe.prototype.getBaseCPCost = function (simulationState) { return 7; }; Observe.prototype.getDurabilityCost = function (simulationState) { return 0; }; Observe.prototype.getIds = function () { return [100010, 100023, 100040, 100053, 100070, 100082, 100099, 100113]; }; Observe.prototype._getSuccessRate = function (simulationState) { return 100; }; Observe.prototype.skipOnFail = function () { return true; }; return Observe; }(CraftingAction)); var WasteNot = /** @class */ (function (_super) { __extends(WasteNot, _super); function WasteNot() { return _super !== null && _super.apply(this, arguments) || this; } WasteNot.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 15 }; }; WasteNot.prototype.getBaseCPCost = function (simulationState) { return 56; }; WasteNot.prototype.getDuration = function (simulation) { return 4; }; WasteNot.prototype.getIds = function () { return [4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638]; }; WasteNot.prototype.getBuff = function () { return Buff.WASTE_NOT; }; WasteNot.prototype.getInitialStacks = function () { return 0; }; WasteNot.prototype.canBeClipped = function () { return true; }; WasteNot.prototype.getOverrides = function () { return _super.prototype.getOverrides.call(this).concat(Buff.WASTE_NOT_II); }; WasteNot.prototype.getTick = function () { return undefined; }; return WasteNot; }(BuffAction)); var WasteNotII = /** @class */ (function (_super) { __extends(WasteNotII, _super); function WasteNotII() { return _super !== null && _super.apply(this, arguments) || this; } WasteNotII.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 47 }; }; WasteNotII.prototype.getBaseCPCost = function (simulationState) { return 98; }; WasteNotII.prototype.getDuration = function (simulation) { return 8; }; WasteNotII.prototype.getIds = function () { return [4639, 4640, 4641, 4642, 4643, 4644, 19002, 19003]; }; WasteNotII.prototype.getBuff = function () { return Buff.WASTE_NOT_II; }; WasteNotII.prototype.getInitialStacks = function () { return 0; }; WasteNotII.prototype.canBeClipped = function () { return true; }; WasteNotII.prototype.getOverrides = function () { return _super.prototype.getOverrides.call(this).concat(Buff.WASTE_NOT); }; WasteNotII.prototype.getTick = function () { return undefined; }; return WasteNotII; }(BuffAction)); var TrainedEye = /** @class */ (function (_super) { __extends(TrainedEye, _super); function TrainedEye() { return _super !== null && _super.apply(this, arguments) || this; } TrainedEye.prototype._canBeUsed = function (simulationState, linear) { return (!simulationState.recipe.expert && simulationState.crafterStats.level - simulationState.recipe.lvl >= 10 && simulationState.steps.length === 0); }; TrainedEye.prototype.skipOnFail = function () { return true; }; TrainedEye.prototype.execute = function (simulation) { simulation.quality = simulation.recipe.quality; }; TrainedEye.prototype.getBaseCPCost = function (simulationState) { return 250; }; TrainedEye.prototype.getDurabilityCost = function (simulationState) { return 0; }; TrainedEye.prototype.getIds = function () { return [100283, 100284, 100285, 100286, 100287, 100288, 100289, 100290]; }; TrainedEye.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 80 }; }; TrainedEye.prototype._getSuccessRate = function (simulationState) { return 100; }; TrainedEye.prototype.getType = function () { return ActionType.QUALITY; }; return TrainedEye; }(CraftingAction)); var PreparatoryTouch = /** @class */ (function (_super) { __extends(PreparatoryTouch, _super); function PreparatoryTouch() { return _super !== null && _super.apply(this, arguments) || this; } PreparatoryTouch.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 71 }; }; PreparatoryTouch.prototype.execute = function (simulation) { _super.prototype.execute.call(this, simulation); simulation.addInnerQuietStacks(1); }; PreparatoryTouch.prototype._canBeUsed = function (simulationState) { return true; }; PreparatoryTouch.prototype.getBaseCPCost = function (simulationState) { return 40; }; PreparatoryTouch.prototype.getBaseDurabilityCost = function (simulationState) { return 20; }; PreparatoryTouch.prototype.getBaseSuccessRate = function (simulationState) { return 100; }; PreparatoryTouch.prototype.getIds = function () { return [100299, 100300, 100301, 100302, 100303, 100304, 100305, 100306]; }; PreparatoryTouch.prototype.getPotency = function (simulation) { return 200; }; return PreparatoryTouch; }(QualityAction)); var IntensiveSynthesis = /** @class */ (function (_super) { __extends(IntensiveSynthesis, _super); function IntensiveSynthesis() { return _super !== null && _super.apply(this, arguments) || this; } IntensiveSynthesis.prototype.getLevelRequirement = function () { return { job: CraftingJob.ANY, level: 78 }; }; IntensiveSynthesis.prototype.requiresGood = function () { return true;