IBuff.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. Object.defineProperty(i, "__esModule", {value: !0}),
  5. (i.BUFF_TYPE = i.BuffAttr = void 0),
  6. (i.BuffAttr = class {
  7. constructor() {
  8. (this.ObjectPoolKey = null), (this.attr = null), (this.defaultAttr = null);
  9. }
  10. static create(t) {
  11. const e = ObjectPool.pop("BuffAttr");
  12. return (e.defaultAttr = t || Object.create(null)), e;
  13. }
  14. setBuffValue(t, e) {
  15. this.attr[t] = e;
  16. }
  17. getBuffValue(t) {
  18. return this.attr[t];
  19. }
  20. resetBuffByType(t) {
  21. this.setBuffValue(t, 0);
  22. }
  23. addBuffValue(t, e) {
  24. -1 < o.indexOf(t)
  25. ? ((this.attr[t] = (this.attr[t] * e) / 100), this.attr[t] <= 0 && (this.attr[t] = 0.01))
  26. : (this.attr[t] += e);
  27. }
  28. addBuffAttr(t) {
  29. if (t) {
  30. const e = this.attr,
  31. i = t.attr;
  32. for (const s in i) {
  33. const t = i[s];
  34. -1 < a.indexOf(s)
  35. ? ((e[s] = (100 * e[s] - 100 + (100 * t - 100) + 100) / 100), e[s] <= 0 && (e[s] = 0.01))
  36. : -1 < o.indexOf(s)
  37. ? ((e[s] = e[s] * t), e[s] <= 0 && (e[s] = 0.01))
  38. : (e[s] += t);
  39. }
  40. }
  41. }
  42. claFinish() {
  43. for (let t = 0; t < a.length; t++) {
  44. var e = a[t],
  45. i = 100 + this[e];
  46. this.attr[e] = i < 0 ? 0.01 : i / 100;
  47. }
  48. }
  49. reset() {
  50. this.attr = Object.assign(Object.create(null), this.defaultAttr);
  51. }
  52. });
  53. let s = [];
  54. ((i = e = i.BUFF_TYPE || (i.BUFF_TYPE = {}))[(i.ADD_IDLE = 0)] = "ADD_IDLE"),
  55. (i[(i.CUSTOMER_MOVE_SPEED = 1)] = "CUSTOMER_MOVE_SPEED"),
  56. (i[(i.WAITER_SPEED = 2)] = "WAITER_SPEED"),
  57. (i[(i.CHEF_SPEED = 3)] = "CHEF_SPEED"),
  58. (i[(i.COOK_SPEED = 4)] = "COOK_SPEED"),
  59. (i[(i.FOOD_SELL_RATE = 5)] = "FOOD_SELL_RATE"),
  60. (i[(i.ALL_EMPLOYEES_MOVE_SPEED = 6)] = "ALL_EMPLOYEES_MOVE_SPEED");
  61. const o = [e[e.ADD_IDLE], e[e.FOOD_SELL_RATE]],
  62. a = [];
  63. for (const n in e) isNaN(n) && s.push(n);