Merge pull request #1425 from zhichaoxi2006/noname_get_plainText
优化〖博览〗、〖挈挟〗的字段筛选机制
This commit is contained in:
commit
a6d4b587ab
|
@ -1438,7 +1438,7 @@ const skills = {
|
||||||
var info = lib.character[name];
|
var info = lib.character[name];
|
||||||
if (
|
if (
|
||||||
info[3].some(function (skill) {
|
info[3].some(function (skill) {
|
||||||
var info = get.skillInfoTranslation(skill);
|
var info = get.plainText(get.skillInfoTranslation(skill));
|
||||||
if (!info.includes("【杀】")) return false;
|
if (!info.includes("【杀】")) return false;
|
||||||
var list = get.skillCategoriesOf(skill, player);
|
var list = get.skillCategoriesOf(skill, player);
|
||||||
list.remove("锁定技");
|
list.remove("锁定技");
|
||||||
|
@ -1470,7 +1470,7 @@ const skills = {
|
||||||
var name = button.link;
|
var name = button.link;
|
||||||
var info = lib.character[name];
|
var info = lib.character[name];
|
||||||
var skills = info[3].filter(function (skill) {
|
var skills = info[3].filter(function (skill) {
|
||||||
var info = get.skillInfoTranslation(skill);
|
var info = get.plainText(get.skillInfoTranslation(skill));
|
||||||
if (!info.includes("【杀】")) return false;
|
if (!info.includes("【杀】")) return false;
|
||||||
var list = get.skillCategoriesOf(skill, get.player());
|
var list = get.skillCategoriesOf(skill, get.player());
|
||||||
list.remove("锁定技");
|
list.remove("锁定技");
|
||||||
|
@ -1509,7 +1509,7 @@ const skills = {
|
||||||
node = ui.create.buttonPresets.character(item, "character", position, noclick);
|
node = ui.create.buttonPresets.character(item, "character", position, noclick);
|
||||||
const info = lib.character[item];
|
const info = lib.character[item];
|
||||||
const skills = info[3].filter(function (skill) {
|
const skills = info[3].filter(function (skill) {
|
||||||
var info = get.skillInfoTranslation(skill);
|
var info = get.plainText(get.skillInfoTranslation(skill));
|
||||||
if (!info.includes("【杀】")) return false;
|
if (!info.includes("【杀】")) return false;
|
||||||
var list = get.skillCategoriesOf(skill, get.player());
|
var list = get.skillCategoriesOf(skill, get.player());
|
||||||
list.remove("锁定技");
|
list.remove("锁定技");
|
||||||
|
@ -1588,7 +1588,7 @@ const skills = {
|
||||||
var maxHp = get.infoMaxHp(info[2]);
|
var maxHp = get.infoMaxHp(info[2]);
|
||||||
if (maxHp != 1) card.distance = { attackFrom: 1 - maxHp };
|
if (maxHp != 1) card.distance = { attackFrom: 1 - maxHp };
|
||||||
var skills = info[3].filter(function (skill) {
|
var skills = info[3].filter(function (skill) {
|
||||||
var info = get.skillInfoTranslation(skill);
|
var info = get.plainText(get.skillInfoTranslation(skill));
|
||||||
if (!info.includes("【杀】")) return false;
|
if (!info.includes("【杀】")) return false;
|
||||||
var list = get.skillCategoriesOf(skill, get.player());
|
var list = get.skillCategoriesOf(skill, get.player());
|
||||||
list.remove("锁定技");
|
list.remove("锁定技");
|
||||||
|
@ -1617,10 +1617,10 @@ const skills = {
|
||||||
if (skills.length) {
|
if (skills.length) {
|
||||||
for (var skill of skills) {
|
for (var skill of skills) {
|
||||||
if (lib.skill[skill].nobracket) {
|
if (lib.skill[skill].nobracket) {
|
||||||
append += '<div class="skilln">' + get.translation(skill) + '</div><div><span style="font-family: yuanli">' + get.skillInfoTranslation(skill) + "</span></div><br><br>";
|
append += '<div class="skilln">' + get.translation(skill) + '</div><div><span style="font-family: yuanli">' + get.plainText(get.skillInfoTranslation(skill)) + "</span></div><br><br>";
|
||||||
} else {
|
} else {
|
||||||
var translation = lib.translate[skill + "_ab"] || get.translation(skill).slice(0, 2);
|
var translation = lib.translate[skill + "_ab"] || get.translation(skill).slice(0, 2);
|
||||||
append += '<div class="skill">【' + translation + '】</div><div><span style="font-family: yuanli">' + get.skillInfoTranslation(skill) + "</span></div><br><br>";
|
append += '<div class="skill">【' + translation + '】</div><div><span style="font-family: yuanli">' + get.plainText(get.skillInfoTranslation(skill)) + "</span></div><br><br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
str = str.slice(0, str.length - 8);
|
str = str.slice(0, str.length - 8);
|
||||||
|
|
|
@ -1750,7 +1750,7 @@ const skills = {
|
||||||
var skill = lib.skill[j];
|
var skill = lib.skill[j];
|
||||||
if (!skill || skill.juexingji || skill.hiddenSkill || skill.zhuSkill || skill.dutySkill || skill.chargeSkill || lib.skill.bolan.banned.includes(j)) continue;
|
if (!skill || skill.juexingji || skill.hiddenSkill || skill.zhuSkill || skill.dutySkill || skill.chargeSkill || lib.skill.bolan.banned.includes(j)) continue;
|
||||||
if (skill.init || (skill.ai && (skill.ai.combo || skill.ai.notemp || skill.ai.neg))) continue;
|
if (skill.init || (skill.ai && (skill.ai.combo || skill.ai.notemp || skill.ai.neg))) continue;
|
||||||
var info = lib.translate[j + "_info"];
|
var info = get.plainText(lib.translate[j + "_info"]);
|
||||||
if (info && info.indexOf("出牌阶段限一次") != -1) skills.add(j);
|
if (info && info.indexOf("出牌阶段限一次") != -1) skills.add(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -974,6 +974,16 @@ export class Get {
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 用于将HTML代码转换为纯文本。
|
||||||
|
* @param { string } htmlContent
|
||||||
|
* @returns { string }
|
||||||
|
*/
|
||||||
|
plainText(htmlContent) {
|
||||||
|
var parser = new DOMParser();
|
||||||
|
var doc = parser.parseFromString(htmlContent || '', 'text/html');
|
||||||
|
return doc.body.textContent || doc.body.innerText;
|
||||||
|
}
|
||||||
inpilefull(type) {
|
inpilefull(type) {
|
||||||
var list = [];
|
var list = [];
|
||||||
for (var i in lib.cardPile) {
|
for (var i in lib.cardPile) {
|
||||||
|
|
Loading…
Reference in New Issue