12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- var t = require;
- var e = module;
- var i = exports;
- Object.defineProperty(i, "__esModule", {value: !0}), (i.AttributeBase = i.AttributeGroppKey = void 0);
- e = t("CostumeConst");
- ((t = i.AttributeGroppKey || (i.AttributeGroppKey = {}))[(t.BASE = 0)] = "BASE"), (t[(t.BUFF = 1)] = "BUFF");
- const h = {[e.CostumeAbilityType.doublebase]: e.CostumeAbilityType.base};
- i.AttributeBase = class {
- constructor() {
- (this.finalAttr = null),
- (this.attrGroups = null),
- (this.attrBites = null),
- (this.isNeedReCal = !1),
- this.reset();
- }
- addAttrBute(t, e) {
- (this.isNeedReCal = !0), (this.attrBites[t] = e);
- }
- removeAttrBute(t) {
- (this.isNeedReCal = !0), delete this.attrBites[t];
- }
- getAttrBute(t) {
- return this.attrBites[t];
- }
- addAttrDict(t, e) {
- (this.isNeedReCal = !0), (this.attrGroups[t] = e);
- }
- getAttrDict(t) {
- return this.attrGroups[t];
- }
- removeAttrDict(t) {
- (this.isNeedReCal = !0), delete this.attrGroups[t];
- }
- addAttrValue(t, e, i) {
- (this.isNeedReCal = !0), this.attrGroups[t] ? (this.attrGroups[t][e] = i) : (this.attrGroups[t] = {[e]: i});
- }
- removeAttrValue(t, e) {
- (this.isNeedReCal = !0), this.attrGroups[t] && delete this.attrGroups[t][e];
- }
- toString() {
- return `\u653b\u51fb:${this.finalAttr.ap}, \u6218\u529b:${this.finalAttr.power}, HP:${this.finalAttr.hp}, \u66b4\u51fb\u7387:${this.finalAttr.crit}, \u95ea\u907f\u7387:${this.finalAttr.dodge}`;
- }
- claFinishAttr() {
- const i = (this.finalAttr = Object.create(null));
- for (const e in this.attrGroups) {
- var s,
- o = this.attrGroups[e];
- for (s in o) {
- let t = o[s],
- e = i[s];
- null == e && (e = 0), (i[s] = e + t);
- }
- }
- for (const r in this.attrBites) {
- var a,
- n = this.attrBites[r].finalAttr;
- for (a in n) {
- let t = n[a],
- e = i[a];
- null == e && (e = 0), (i[a] = e + t);
- }
- }
- for (const l in i) {
- var t = h[l];
- t && i[t] && ((i[t] = (i[t] * i[l]) / 100), delete i[l]);
- }
- }
- reset() {
- (this.finalAttr = Object.create(null)),
- (this.attrGroups = Object.create(null)),
- (this.attrBites = Object.create(null));
- }
- };
|