UNPKG

@ffxiv-teamcraft/simulator

Version:
82 lines 3.35 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.BuffAction = void 0; var action_type_1 = require("./action-type"); var crafting_action_1 = require("./crafting-action"); var step_state_1 = require("../step-state"); var BuffAction = /** @class */ (function (_super) { __extends(BuffAction, _super); function BuffAction() { return _super !== null && _super.apply(this, arguments) || this; } BuffAction.prototype.getType = function () { return action_type_1.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 === step_state_1.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; }(crafting_action_1.CraftingAction)); exports.BuffAction = BuffAction; //# sourceMappingURL=buff-action.js.map