diff --git a/character/jsrg/character.js b/character/jsrg/character.js index 20d20af2a..b02609cea 100644 --- a/character/jsrg/character.js +++ b/character/jsrg/character.js @@ -88,6 +88,12 @@ const characters = { hp: 4, skills: ["jsrgsaojian"], }, + jsrg_dongzhuo: { + sex: "male", + group: "qun", + hp: 4, + skills: ["jsrgguanshi", "jsrgcangxiong", "jsrgjiebing"], + }, }; export default characters; diff --git a/character/jsrg/skill.js b/character/jsrg/skill.js index bb0d83510..184b3eaa8 100644 --- a/character/jsrg/skill.js +++ b/character/jsrg/skill.js @@ -3,6 +3,190 @@ import { lib, game, ui, get, ai, _status } from "../../noname.js"; /** @type { importCharacterConfig['skill'] } */ const skills = { //江山如故·衰 + //董卓 + jsrgguanshi: { + enable: "phaseUse", + usable: 1, + viewAs: { name: "huogong" }, + viewAsFilter(player) { + return player.hasCard(card => get.name(card) === "sha", "hs"); + }, + filterCard(card) { + return get.name(card) === "sha"; + }, + selectTarget: [1, Infinity], + onuse(result, player) { + player.addTempSkill("jsrgguanshi_effect"); + }, + position: "hs", + //这个AI难写,交给157了! + check() { + return -1; + }, + ai: {}, + subSkill: { + effect: { + trigger: { + player: ["useCardToBefore", "useCardToAfter", "useCardToExcluded", "useCardToOmitted", "useCardToCancelled"], + }, + forced: true, + charlotte: true, + popup: false, + firstDo: true, + priority: 100, + filter(event, player, name) { + if (event.type !== "card" || event.skill !== "jsrgguanshi") return false; + const isUnhurted = event.card.storage && event.card.storage.jsrgguanshi; + if (name === "useCardToBefore") return isUnhurted; + return ( + !isUnhurted && + event.target && + !player.hasHistory("sourceDamage", evt => { + return evt.card === event.card && evt.getParent() === event; + }) + ); + }, + async content(event, trigger, player) { + if (event.triggername === "useCardToBefore") { + trigger.setContent(lib.card.juedou.content); + } else { + const card = trigger.card; + if (!card.storage) card.storage = {}; + card.storage.jsrgguanshi = true; + } + }, + }, + }, + }, + jsrgcangxiong: { + trigger: { + player: "loseAfter", + global: ["gainAfter", "loseAsyncAfter"], + }, + getIndex(event, player, triggername) { + if (event.type === "discard") { + return event.getl(player).cards2 || []; + } else if (event.name === "gain") { + if (event.player === player) return; + const cardsGained = event.getg(event.player), + cardsLost = event.getl(player).cards2; + return cardsLost.filter(card => cardsGained.includes(card)); + } else if (event.name === "loseAsync" && event.type === "gain") { + const cardsLost = event.getl(player).cards2; + if (!cardsLost.length) return []; + const cardsGained = []; + game.countPlayer2( + current => { + if (current !== player) cardsGained.addArray(event.getg(current)); + }, + null, + true + ); + return cardsLost.filter(card => cardsGained.includes(card)); + } + return []; + }, + filter(event, player, name, card) { + if (player.isDisabledJudge()) return false; + if (event.type === "discard") return get.position(card, true) === "d"; + else { + const owner = game.findPlayer2( + current => { + return current !== player && event.getg(current).includes(card); + }, + null, + true + ); + return owner.getCards("h").includes(card); + } + }, + prompt2(event, player, name, card){ + return `将${get.translation(card)}作为蓄谋牌置入判定区${player.isPhaseUsing() ? ",然后摸一张牌。" : ""}` + }, + async content(event, trigger, player) { + const card = event.indexedData; + if(get.position(card) === "d"){ + player.$gain2(card, false); + game.log(player, "使用", card, "进行了明目张胆的蓄谋") + } + else{ + get.owner(card).$giveAuto(card, player, false); + } + await game.asyncDelayx(); + await player.addJudge({ name: "xumou_jsrg" }, [card]); + if (player.isPhaseUsing()) await player.draw(); + }, + }, + jsrgjiebing: { + derivation: "jsrgbaowei", + trigger: { player: "phaseZhunbeiBegin" }, + forced: true, + juexingji: true, + skillAnimation: true, + animationColor: "gray", + filter(event, player) { + const target = lib.skill.jsrgjiebing.getZhugong(player); + return ( + target && + player.countCards("j", card => { + return (card.viewAs || card.name) == "xumou_jsrg"; + }) > target.getHp() + ); + }, + async content(event, trigger, player) { + await player.gainMaxHp(2); + await player.recover(2); + await player.addSkills("jsrgbaowei"); + }, + ai: { + combo: "jsrgcangxiong", + }, + getZhugong(player) { + const mode = get.mode(); + if (mode === "identity") { + if (_status.mode === "purple") { + return game.findPlayer(current => { + return current.isZhu2() && current.identity.slice(0, 1) === player.identity.slice(0, 1); + }); + } + return game.findPlayer(current => current.isZhu2()); + } else { + return game.findPlayer(current => current.getSeatNum() === 1); + } + }, + }, + jsrgbaowei: { + trigger: { player: "phaseJieshuBegin" }, + forced: true, + filter(event, player) { + return game.hasPlayer(current => { + return current !== player && (current.getHistory("useCard").length > 0 || current.getHistory("respond").length > 0); + }); + }, + async content(event, trigger, player){ + const targets = game.filterPlayer(current => { + return current !== player && (current.getHistory("useCard").length > 0 || current.getHistory("respond").length > 0); + }); + if (targets.length > 2){ + await player.loseHp(2); + } + else { + let target; + if (targets.length === 1) [target] = targets; + else [target] = await player.chooseTarget(true, "暴威:对一名目标角色造成2点伤害", (card, player, target)=>{ + return get.event("targets").includes(target); + }).set("targets", targets).set("ai", target=>{ + const player = get.player(); + return get.damageEffect(target, player, player) * (1.1 - get.sgn(get.attitude(player, target))); + }); + player.line(target, "green"); + target.damage(2); + } + }, + ai:{ + //这里应该写一个强命AI,但是比较麻烦,可能还要写全局AI技能,先摆了 + }, + }, //阳球 jsrgsaojian: { enable: "phaseUse", @@ -49,14 +233,14 @@ const skills = { if (target.countCards("h") > player.countCards("h")) player.loseHp(); } }, - ai:{ + ai: { order: 7, result: { - target(player, target){ + target(player, target) { //对面牌比自己少,就放心大胆弃牌 if (target.countCards("h") <= player.countCards("h") - 1) return -3; //残血别浪 - if (player.hp === 1 && get.effect(player, {name: "losehp"}, player, player)<0) return 0; + if (player.hp === 1 && get.effect(player, { name: "losehp" }, player, player) < 0) return 0; //血多无所谓 return -1; }, @@ -521,8 +705,14 @@ const skills = { jsrgtianyu: { trigger: { global: ["loseAsyncAfter", "cardsDiscardAfter"] }, frequent: true, - filter(event) { - return lib.skill.jsrgtianyu.getCards(event).length > 0; + getIndex(event) { + return lib.skill.jsrgtianyu.getCards(event); + }, + filter(event, player, triggername, card) { + return get.position(card, true) === "d"; + }, + frequent(event, player, triggername, card) { + return get.value(card, player) > 0; }, getCards(event) { const cards = event.getd().filter(card => { @@ -534,14 +724,11 @@ const skills = { }); return cards; }, + prompt2(event, player, triggername, card) { + return `获得即将进入弃牌堆的${get.translation(card)}`; + }, async content(event, trigger, player) { - const cards = lib.skill.jsrgtianyu.getCards(trigger); - let cardsToGain; - if (cards.length === 1) { - cardsToGain = cards; - } else { - cardsToGain = await player.chooseButton(["天予:选择获得任意张牌", cards], true, [1, cards.length]).forResult("links"); - } + const cards = event.indexedData; await player.gain(cards, "gain2"); }, }, @@ -1673,7 +1860,7 @@ const skills = { audio: "jsrgeqian", trigger: { player: "phaseJieshuBegin" }, filter(event, player) { - return player.countCards("h"); + return player.countCards("h") && !player.isDisabledJudge(); }, direct: true, async content(event, trigger, player) { @@ -1750,7 +1937,7 @@ const skills = { }, filter(event, player) { if (event.card.name != "sha") return false; - if (event.target != player) return !player.hasSkill("jsrgdaimou_other"); + if (event.target != player) return !player.hasSkill("jsrgdaimou_other") && !player.isDisabledJudge(); return ( !player.hasSkill("jsrgdaimou_me") && player.hasCard(card => { diff --git a/character/jsrg/sort.js b/character/jsrg/sort.js index 92812adc5..fa1619a0a 100644 --- a/character/jsrg/sort.js +++ b/character/jsrg/sort.js @@ -3,7 +3,7 @@ const characterSort = { jiangshanrugu_cheng: ["jsrg_sunce", "jsrg_xuyou", "jsrg_lvbu", "jsrg_zhanghe", "jsrg_zoushi", "jsrg_guanyu", "jsrg_chendeng", "jsrg_zhenji", "jsrg_zhangliao", "jsrg_xugong", "jsrg_chunyuqiong"], jiangshanrugu_zhuan: ["jsrg_guojia", "jsrg_zhangfei", "jsrg_machao", "jsrg_lougui", "jsrg_zhangren", "jsrg_huangzhong", "jsrg_xiahourong", "jsrg_sunshangxiang", "jsrg_pangtong", "jsrg_hansui", "jsrg_zhangchu", "jsrg_xiahouen", "jsrg_fanjiangzhangda"], jiangshanrugu_he: ["jsrg_zhugeliang", "jsrg_jiangwei", "jsrg_luxun", "jsrg_zhaoyun", "jsrg_simayi", "jsrg_guoxun", "jsrg_sunlubansunluyu", "jsrg_caofang", "jsrg_sunjun", "jsrg_liuyong", "jsrg_weiwenzhugezhi", "jsrg_zhangxuan", "jsrg_gaoxiang", "jsrg_guozhao"], - jiangshanrugu_shuai: ["jsrg_yuanshao", "jsrg_caojiewangfu", "jsrg_songhuanghou", "jsrg_zhangjiao"], + jiangshanrugu_shuai: ["jsrg_yuanshao", "jsrg_caojiewangfu", "jsrg_songhuanghou", "jsrg_zhangjiao", "jsrg_dongzhuo"], }; const characterSortTranslate = { diff --git a/character/jsrg/translate.js b/character/jsrg/translate.js index 496aa1eb0..3bdab65e2 100644 --- a/character/jsrg/translate.js +++ b/character/jsrg/translate.js @@ -391,6 +391,17 @@ const translates = { jsrg_yangqiu_prefix: "衰", jsrgsaojian: "扫奸", jsrgsaojian_info: "出牌阶段限一次,你可以观看一名其他角色的手牌,然后展示其中的一张(对该角色自己不可见)。然后该角色重复弃置一张手牌,直到其以此法弃置了五张牌/弃置了你选择的牌/没有可弃置的手牌。若其弃置完成后的手牌数大于你,则你失去1点体力。", + jsrg_dongzhuo: "衰董卓", + jsrg_dongzhuo_prefix: "衰", + jsrgguanshi: "观势", + jsrgguanshi_info: "出牌阶段限一次,你可以将【杀】当作【火攻】对任意名角色使用。当此【火攻】对一名目标角色结算结束后,若未对其造成伤害,则此牌对其余目标角色改为以【决斗】的形式结算。", + jsrgcangxiong: "藏凶", + jsrgcangxiong_info: "当你因弃置或被其他角色得到牌而失去一张牌后,你可以用此牌蓄谋。然后若此时在你的出牌阶段内,则你摸一张牌。", + jsrgjiebing: "劫柄", + jsrgjiebing_info_identity: "觉醒技。准备阶段,若你的蓄谋牌数大于主公的体力值,则你加2点体力上限并回复2点体力,然后获得〖暴威〗。", + jsrgjiebing_info: "觉醒技。准备阶段,若你的蓄谋牌数大于一号位的体力值,则你加2点体力上限并回复2点体力,然后获得〖暴威〗。", + jsrgbaowei: "暴威", + jsrgbaowei_info: "锁定技。结束阶段,若本回合内使用或打出过牌的其他角色数:大于2,则你失去2点体力;不大于2,则你对其中一名角色造成2点伤害。", }; export default translates; diff --git a/character/rank.js b/character/rank.js index 4dceb037a..59d900b1d 100644 --- a/character/rank.js +++ b/character/rank.js @@ -706,6 +706,7 @@ window.noname_character_rank = { "linghuyu", "key_mia", "jsrg_yangqiu", + "jsrg_yuanshao", ], bp: [ "xin_huojun", @@ -1103,8 +1104,8 @@ window.noname_character_rank = { "ol_wangyi", "chengji", "mb_sp_guanqiujian", - "jsrg_yuanshao", "jsrg_songhuanghou", + "jsrg_dongzhuo", ], b: [ "junk_guanyu", diff --git a/noname/library/element/content.js b/noname/library/element/content.js index a367e9ed8..bbafdc06d 100644 --- a/noname/library/element/content.js +++ b/noname/library/element/content.js @@ -2608,7 +2608,7 @@ export const Content = { const checkFrequent = function (info) { if (player.hasSkillTag("nofrequent", false, event.skill)) return false; if (typeof info.frequent == "boolean") return info.frequent; - if (typeof info.frequent == "function") return info.frequent(trigger, player); + if (typeof info.frequent == "function") return info.frequent(trigger, player, event.triggername, event.indexedData); if (info.frequent == "check" && typeof info.check == "function") return info.check(trigger, player); return false;