随便改一些类的写法
This commit is contained in:
parent
79cfc9e136
commit
3a9df5bcc3
|
@ -1,62 +1,61 @@
|
||||||
let merge_skill = false;
|
let merge_skill = false;
|
||||||
|
|
||||||
const Attributes = {
|
class Attributes {
|
||||||
/*0: "Fire",
|
static "0" = "Fire";
|
||||||
1: "Water",
|
static "1" = "Water";
|
||||||
2: "Wood",
|
static "2" = "Wood";
|
||||||
3: "Light",
|
static "3" = "Light";
|
||||||
4: "Dark",
|
static "4" = "Dark";
|
||||||
5: "Heart",
|
static "5" = "Heart";
|
||||||
6: "Jammer",
|
static "6" = "Jammer";
|
||||||
7: "Poison",
|
static "7" = "Poison";
|
||||||
8: "MPoison",
|
static "8" = "MPoison";
|
||||||
9: "Bomb",*/
|
static "9" = "Bomb";
|
||||||
Fire: 0,
|
static Fire = 0;
|
||||||
Water: 1,
|
static Water = 1;
|
||||||
Wood: 2,
|
static Wood = 2;
|
||||||
Light: 3,
|
static Light = 3;
|
||||||
Dark: 4,
|
static Dark = 4;
|
||||||
Heart: 5,
|
static Heart = 5;
|
||||||
Jammer: 6,
|
static Jammer = 6;
|
||||||
Poison: 7,
|
static Poison = 7;
|
||||||
MPoison: 8,
|
static MPoison = 8;
|
||||||
Bomb: 9,
|
static Bomb = 9;
|
||||||
|
static get all() {
|
||||||
|
return [
|
||||||
|
Attributes.Fire,
|
||||||
|
Attributes.Water,
|
||||||
|
Attributes.Wood,
|
||||||
|
Attributes.Light,
|
||||||
|
Attributes.Dark
|
||||||
|
];
|
||||||
|
}
|
||||||
|
static get _6color() {
|
||||||
|
return [
|
||||||
|
Attributes.Fire,
|
||||||
|
Attributes.Water,
|
||||||
|
Attributes.Wood,
|
||||||
|
Attributes.Light,
|
||||||
|
Attributes.Dark,
|
||||||
|
Attributes.Heart
|
||||||
|
];
|
||||||
|
}
|
||||||
|
static get orbs() {
|
||||||
|
return [
|
||||||
|
Attributes.Fire,
|
||||||
|
Attributes.Water,
|
||||||
|
Attributes.Wood,
|
||||||
|
Attributes.Light,
|
||||||
|
Attributes.Dark,
|
||||||
|
Attributes.Heart,
|
||||||
|
Attributes.Jammer,
|
||||||
|
Attributes.Poison,
|
||||||
|
Attributes.MPoison,
|
||||||
|
Attributes.Bomb
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Object.entries(Attributes).forEach(([name, oid])=>Attributes[oid] = name)
|
|
||||||
|
|
||||||
Attributes.all = function () {
|
|
||||||
return [
|
|
||||||
this.Fire,
|
|
||||||
this.Water,
|
|
||||||
this.Wood,
|
|
||||||
this.Light,
|
|
||||||
this.Dark
|
|
||||||
];
|
|
||||||
}
|
|
||||||
Attributes._6color = function () {
|
|
||||||
return [
|
|
||||||
this.Fire,
|
|
||||||
this.Water,
|
|
||||||
this.Wood,
|
|
||||||
this.Light,
|
|
||||||
this.Dark,
|
|
||||||
this.Heart
|
|
||||||
];
|
|
||||||
}
|
|
||||||
Attributes.orbs = function () {
|
|
||||||
return [
|
|
||||||
this.Fire,
|
|
||||||
this.Water,
|
|
||||||
this.Wood,
|
|
||||||
this.Light,
|
|
||||||
this.Dark,
|
|
||||||
this.Heart,
|
|
||||||
this.Jammer,
|
|
||||||
this.Poison,
|
|
||||||
this.MPoison,
|
|
||||||
this.Bomb,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
//代码来自于 https://www.jianshu.com/p/3644833bca33
|
//代码来自于 https://www.jianshu.com/p/3644833bca33
|
||||||
function isEqual(obj1,obj2) {
|
function isEqual(obj1,obj2) {
|
||||||
//判断是否是对象或数组
|
//判断是否是对象或数组
|
||||||
|
@ -863,7 +862,7 @@ const c = {
|
||||||
return { hp: { min: min / 100, max: max / 100 } };
|
return { hp: { min: min / 100, max: max / 100 } };
|
||||||
},
|
},
|
||||||
exact: function (type, value, attrs, multiple = false) {
|
exact: function (type, value, attrs, multiple = false) {
|
||||||
if (attrs === void 0) { attrs = Attributes.all(); }
|
if (attrs === void 0) { attrs = Attributes.all; }
|
||||||
return { exact: { type: type, value: value, attrs: attrs, multiple: multiple} };
|
return { exact: { type: type, value: value, attrs: attrs, multiple: multiple} };
|
||||||
},
|
},
|
||||||
combos: function (min) {
|
combos: function (min) {
|
||||||
|
@ -1417,7 +1416,7 @@ const skillObjectParsers = {
|
||||||
const attrs = [attrs1, attrs2, attrs3, attrs4].filter(Boolean);
|
const attrs = [attrs1, attrs2, attrs3, attrs4].filter(Boolean);
|
||||||
return powerUp(null, null, p.scaleMatchAttrs(attrs.flatMap(Bin.unflags), min, bonus ? attrs.length : min, [mul, 100], [bonus ?? 0, 0]), null, v.percent(percent));
|
return powerUp(null, null, p.scaleMatchAttrs(attrs.flatMap(Bin.unflags), min, bonus ? attrs.length : min, [mul, 100], [bonus ?? 0, 0]), null, v.percent(percent));
|
||||||
},
|
},
|
||||||
[172]() { return setOrbState(Attributes.orbs(), 'unlocked'); },
|
[172]() { return setOrbState(Attributes.orbs, 'unlocked'); },
|
||||||
[173](turns, attrAbsorb, comboAbsorb, damageAbsorb) {
|
[173](turns, attrAbsorb, comboAbsorb, damageAbsorb) {
|
||||||
return activeTurns(turns, voidEnemyBuff(
|
return activeTurns(turns, voidEnemyBuff(
|
||||||
[
|
[
|
||||||
|
@ -1488,7 +1487,7 @@ const skillObjectParsers = {
|
||||||
},
|
},
|
||||||
[189]() {
|
[189]() {
|
||||||
return [
|
return [
|
||||||
setOrbState(Attributes.orbs(), 'unlocked'),
|
setOrbState(Attributes.orbs, 'unlocked'),
|
||||||
boardChange([0,1,2,3]),
|
boardChange([0,1,2,3]),
|
||||||
autoPath(3),
|
autoPath(3),
|
||||||
];
|
];
|
||||||
|
@ -1748,7 +1747,7 @@ const skillObjectParsers = {
|
||||||
|
|
||||||
[257]() {
|
[257]() {
|
||||||
return [
|
return [
|
||||||
setOrbState(Attributes.orbs(), 'unlocked'),
|
setOrbState(Attributes.orbs, 'unlocked'),
|
||||||
boardChange([0,1,2,3,4,5]),
|
boardChange([0,1,2,3,4,5]),
|
||||||
autoPath(5),
|
autoPath(5),
|
||||||
];
|
];
|
||||||
|
@ -1764,7 +1763,7 @@ const skillObjectParsers = {
|
||||||
[259](percent) { return breakingShield(v.xShield(percent)); },
|
[259](percent) { return breakingShield(v.xShield(percent)); },
|
||||||
[260](skillStage, voiceId) { return skillPlayVoice(skillStage, voiceId); },
|
[260](skillStage, voiceId) { return skillPlayVoice(skillStage, voiceId); },
|
||||||
[261](percent) { return gravity(v.xCHP(percent), 'single'); },
|
[261](percent) { return gravity(v.xCHP(percent), 'single'); },
|
||||||
[262](count) { return setOrbState(Attributes.orbs(), 'nail', {count: v.constant(count)}); },
|
[262](count) { return setOrbState(Attributes.orbs, 'nail', {count: v.constant(count)}); },
|
||||||
[263](turns, cap, attr, type) { //按属性改变伤害上限主动技
|
[263](turns, cap, attr, type) { //按属性改变伤害上限主动技
|
||||||
return activeTurns(turns,
|
return activeTurns(turns,
|
||||||
increaseDamageCapacity(cap * 1e8, void 0, Bin.unflags(attr), Bin.unflags(type))
|
increaseDamageCapacity(cap * 1e8, void 0, Bin.unflags(attr), Bin.unflags(type))
|
||||||
|
@ -2642,7 +2641,7 @@ function renderSkill(skill, option = {})
|
||||||
if (condition) dict.condition = renderCondition(condition);
|
if (condition) dict.condition = renderCondition(condition);
|
||||||
|
|
||||||
let targetDict = {}, attrs_types = [];
|
let targetDict = {}, attrs_types = [];
|
||||||
if (attrs?.length && !isEqual(attrs, Attributes.all()))
|
if (attrs?.length && !isEqual(attrs, Attributes.all))
|
||||||
{
|
{
|
||||||
targetDict.attrs = renderAttrs(attrs || [], {affix: attrs?.filter(attr=> attr !== 5)?.length});
|
targetDict.attrs = renderAttrs(attrs || [], {affix: attrs?.filter(attr=> attr !== 5)?.length});
|
||||||
attrs_types.push(targetDict.attrs);
|
attrs_types.push(targetDict.attrs);
|
||||||
|
@ -2762,7 +2761,7 @@ function renderSkill(skill, option = {})
|
||||||
}
|
}
|
||||||
|
|
||||||
let attrs_types = [];
|
let attrs_types = [];
|
||||||
if (attrs?.length && !isEqual(attrs, Attributes.all()))
|
if (attrs?.length && !isEqual(attrs, Attributes.all))
|
||||||
{
|
{
|
||||||
dict.attrs = renderAttrs(attrs || [], {affix: attrs?.filter(attr=> attr !== 5)?.length});
|
dict.attrs = renderAttrs(attrs || [], {affix: attrs?.filter(attr=> attr !== 5)?.length});
|
||||||
attrs_types.push(dict.attrs);
|
attrs_types.push(dict.attrs);
|
||||||
|
@ -2823,7 +2822,7 @@ function renderSkill(skill, option = {})
|
||||||
};
|
};
|
||||||
|
|
||||||
let targetDict = {}, attrs_types = [];
|
let targetDict = {}, attrs_types = [];
|
||||||
if (attrs?.length && !isEqual(attrs, Attributes.all()))
|
if (attrs?.length && !isEqual(attrs, Attributes.all))
|
||||||
{
|
{
|
||||||
targetDict.attrs = renderAttrs(attrs || [], {affix: attrs?.filter(attr=> attr !== 5)?.length});
|
targetDict.attrs = renderAttrs(attrs || [], {affix: attrs?.filter(attr=> attr !== 5)?.length});
|
||||||
attrs_types.push(targetDict.attrs);
|
attrs_types.push(targetDict.attrs);
|
||||||
|
@ -3029,7 +3028,7 @@ function renderAttrs(attrs, option = {}) {
|
||||||
|
|
||||||
const tsp = localTranslating.skill_parse;
|
const tsp = localTranslating.skill_parse;
|
||||||
let contentFrg;
|
let contentFrg;
|
||||||
if (isEqual(attrs, Attributes.all()))
|
if (isEqual(attrs, Attributes.all))
|
||||||
{
|
{
|
||||||
contentFrg = tsp.attrs.all();
|
contentFrg = tsp.attrs.all();
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,7 @@ DBOpenRequest.onupgradeneeded = function(event) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Plus extends Array {
|
class Plus extends Array {
|
||||||
|
static maxValue = 297;
|
||||||
constructor(hp = 0 , atk = 0, rcv = 0) {
|
constructor(hp = 0 , atk = 0, rcv = 0) {
|
||||||
super(3);//建立 Array
|
super(3);//建立 Array
|
||||||
if (Array.isArray(hp) && hp.length >= 3 //传入数组的形式
|
if (Array.isArray(hp) && hp.length >= 3 //传入数组的形式
|
||||||
|
@ -135,7 +136,7 @@ class Plus extends Array {
|
||||||
}
|
}
|
||||||
set hp(num) {
|
set hp(num) {
|
||||||
if (!Number.isInteger(num)) throw new TypeError("传入的 HP +值 不是整数");
|
if (!Number.isInteger(num)) throw new TypeError("传入的 HP +值 不是整数");
|
||||||
if (num < 0 || num > 99) throw new RangeError("HP +值应为 0-99 之间的整数");
|
if (num < 0 || num > Plus.maxValue) throw new RangeError("HP +值应为 0-99 之间的整数");
|
||||||
this[0] = num;
|
this[0] = num;
|
||||||
}
|
}
|
||||||
get atk() {
|
get atk() {
|
||||||
|
@ -143,7 +144,7 @@ class Plus extends Array {
|
||||||
}
|
}
|
||||||
set atk(num) {
|
set atk(num) {
|
||||||
if (!Number.isInteger(num)) throw new TypeError("传入的 ATK +值 不是整数");
|
if (!Number.isInteger(num)) throw new TypeError("传入的 ATK +值 不是整数");
|
||||||
if (num < 0 || num > 99) throw new RangeError("ATK +值应为 0-99 之间的整数");
|
if (num < 0 || num > Plus.maxValue) throw new RangeError("ATK +值应为 0-99 之间的整数");
|
||||||
this[1] = num;
|
this[1] = num;
|
||||||
}
|
}
|
||||||
get rcv() {
|
get rcv() {
|
||||||
|
@ -151,7 +152,7 @@ class Plus extends Array {
|
||||||
}
|
}
|
||||||
set rcv(num) {
|
set rcv(num) {
|
||||||
if (!Number.isInteger(num)) throw new TypeError("传入的 RCV +值 不是整数");
|
if (!Number.isInteger(num)) throw new TypeError("传入的 RCV +值 不是整数");
|
||||||
if (num < 0 || num > 99) throw new RangeError("RCV +值应为 0-99 之间的整数");
|
if (num < 0 || num > Plus.maxValue) throw new RangeError("RCV +值应为 0-99 之间的整数");
|
||||||
this[2] = num;
|
this[2] = num;
|
||||||
}
|
}
|
||||||
get is297() {
|
get is297() {
|
||||||
|
|
Loading…
Reference in New Issue