From b7c0aa0f8520048ed259675aa61faebac86257d5 Mon Sep 17 00:00:00 2001 From: copcap Date: Tue, 6 Feb 2024 03:41:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A5=9E=E8=AE=B8=E8=A4=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/extra.js | 176 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 175 insertions(+), 1 deletion(-) diff --git a/character/extra.js b/character/extra.js index 71e4f2936..e40d47f48 100755 --- a/character/extra.js +++ b/character/extra.js @@ -13,7 +13,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ extra_yin:['shen_liubei','shen_luxun'], extra_lei:['shen_ganning','shen_zhangliao'], extra_key:['key_kagari','key_shiki','db_key_hina'], - extra_decade:['shen_jiangwei','shen_machao','shen_zhangfei','shen_zhangjiao','shen_dengai'], + extra_decade:['shen_jiangwei','shen_machao','shen_zhangfei','shen_zhangjiao','shen_dengai','shen_xuzhu'], extra_ol:['ol_zhangliao','shen_caopi','shen_zhenji','shen_sunquan'], extra_mobilezhi:['shen_guojia','shen_xunyu'], extra_mobilexin:['shen_taishici','shen_sunce'], @@ -23,6 +23,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, character:{ + shen_xuzhu:['male','shen',5,['zhengqing','zhuangpo'],['wei']], shen_lusu:['male','shen',3,['dingzhou','tamo','zhimeng'],['wu']], shen_huatuo:['male','shen',3,['wuling','youyi'],['qun']], le_shen_jiaxu:['male','shen',4,['jxlianpo','jxzhaoluan'],['qun']], @@ -92,6 +93,172 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, /** @type { SMap } */ skill:{ + //神许褚 + zhengqing:{ + audio:2, + trigger:{global:'roundStart'}, + forced:true, + filter(){ + return game.hasPlayer(current=>{ + return current.countMark('zhengqing'); + })||lib.skill.zhengqing.getMostInfoLastRound()[0]>0; + }, + getMostInfoLastRound(){ + let max=-1,players=[]; + const history=game.getAllGlobalHistory(); + if(history.length<=2) return [max,players]; + for(let i=history.length-2;i>=0;i--){ + const evts=history[i]['everything'].filter(evt=>{ + if(evt.name!=='damage') return false; + const source=evt.source; + return source&&source.isIn(); + }); + if(evts.length){ + let curMax=-1,curPlayers=[]; + const map={}; + for(const evt of evts){ + const source=evt.source; + const id=source.playerid; + if(typeof map[id]!=='number') map[id]=0; + map[id]+=evt.num; + if(map[id]>curMax){ + curMax=map[id]; + curPlayers=[source]; + } + else if(map[id]==curMax){ + curPlayers.add(source); + } + } + if(curMax>max){ + max=curMax; + players=curPlayers.slice(); + } + else if(curMax===max){ + players.addArray(curPlayers); + } + } + if(history[i].isRound) break; + } + return [max,players]; + }, + async content(event,trigger,player){ + game.countPlayer(current=>{ + if(current.hasMark('zhengqing')) current.clearMark('zhengqing'); + }); + const [num,players]=lib.skill.zhengqing.getMostInfoLastRound(); + player.line(players,'thunder'); + const onlyMe=players.length===1&&players[0]===player; + const isMax=(player.getAllHistory('custom',evt=>evt&&evt.zhengqing_count).map(evt=>evt.zhengqing_count).sort((a,b)=>b-a)[0]||0)<=num; + players.forEach(current=>{ + current.addMark('zhengqing',num); + }) + if(onlyMe&&isMax){ + player.draw(num); + player.getHistory('custom').push({zhengqing_count:num}); + } + else{ + const drawers=[player].concat(players).sortBySeat(trigger.player); + for(const drawer of drawers){ + await drawer.draw(); + } + } + }, + marktext:'擎', + intro:{ + name:'争擎', + name2:'擎', + content:'mark', + }, + }, + zhuangpo:{ + audio:2, + enable:'chooseToUse', + onChooseToUse(event){ + if(!game.online&&!event.zhuangpo_cards){ + event.set('zhuangpo_cards',event.player.getCards('hes',card=>{ + const str=lib.skill.shencai.getStr(card); + return str.includes('【杀】'); + })); + } + }, + viewAs:{ + name:'juedou', + storage:{zhuangpo:true}, + }, + viewAsFilter(){ + return get.event('zhuangpo_cards').length>0; + }, + prompt:'将一张牌面信息包含“【杀】”的牌当【决斗】使用', + filterCard(card,player){ + return get.event('zhuangpo_cards').includes(card); + }, + position:'hes', + precontent(){ + player.addTempSkill('zhuangpo_effect'); + }, + subSkill:{ + effect:{ + trigger:{ + player:'useCardToPlayered', + }, + filter(event,player){ + const card=event.card; + if(!card||!card.storage||!card.storage.zhuangpo) return false; + return player.hasMark('zhengqing'); + }, + direct:true, + charlotte:true, + group:'zhuangpo_damage', + async content(event,trigger,player){ + const target=trigger.target; + const list=Array.from({length:player.countMark('zhengqing')},(_,i)=>{ + return get.cnNumber(i+1,true); + }); + const result=await player.chooseControl(list,'cancel2') + .set('prompt','壮魄:是否移去任意枚“擎”?') + .set('prompt2',`若如此做,${get.translation(target)}须弃置等量的牌`) + .set('ai',()=>get.event('choice')) + .set('choice',(()=>{ + if(get.attitude(player,target)>=0) return 'cancel2'; + const markCount=list.length; + const cards=target.getCards('he',card=>lib.filter.cardDiscardable(card,target)); + let allIn=false; + if(player.hp<2||target.hp+target.countCards('h',card=>target.canSaveCard(card,target))<=1+trigger.targets.some(current=>current.hasMark('zhengqing'))) allIn=true; + if(cards.map(card=>get.value(card)).reduce((p,c)=>p+c,0)/cards.length>5) allIn=true; + if(!player.isPhaseUsing()||!player.hasCard(card=>{ + if(!lib.skill.shencai.getStr(card).includes('【杀】')) return false; + return player.hasValueTarget(get.autoViewAs({name:'juedou'},[card])); + })) allIn=true; + const maxCount=Math.min(markCount,cards.length); + const toRemoveCount=allIn?maxCount:Math.ceil(Math.random()*maxCount); + return get.cnNumber(toRemoveCount,true); + })()) + .forResult(); + if(result.control==='cancel2') return; + const toRemoveCount=result.index+1; + player.logSkill('zhuangpo_effect',target); + player.popup(get.cnNumber(toRemoveCount)+'张'); + player.removeMark('zhengqing',toRemoveCount); + target.chooseToDiscard('he',toRemoveCount,true); + } + }, + damage:{ + audio:'zhuangpo', + trigger:{source:'damageBegin1'}, + filter(event,player){ + const card=event.card; + if(!card||!card.storage||!card.storage.zhuangpo) return false; + const evt=event.getParent(2); + return evt.targets&&evt.targets.some(current=>current.hasMark('zhengqing')); + }, + charlotte:true, + forced:true, + async content(event,trigger){ + trigger.num++; + }, + }, + }, + }, //神鲁肃 dingzhou:{ audio:2, @@ -8369,6 +8536,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ tamo_info:'游戏开始时,你可以重新分配除主公外所有角色的座次。', zhimeng:'智盟', zhimeng_info:'回合结束后,你可以与一名其他角色将各自所有手牌置于处理区,然后你随机获得这些牌中的一半(向上取整),其获得剩余的牌。', + shen_xuzhu:'神许褚', + shen_xuzhu_prefix:'神', + zhengqing:'争擎', + zhengqing_info:'锁定技。一轮游戏开始时,你移去所有角色的“擎”标记,令上一轮于一回合内造成伤害值最多的角色各获得X枚“擎”,且你与这些角色各摸一张牌(X为这些角色该回合内造成的伤害值)。若该角色为你且本次获得的“擎”数为本局游戏最多的一次,你改为摸X张牌。', + zhuangpo:'壮魄', + zhuangpo_info:'你可以将牌面信息中包含“【杀】”的牌当【决斗】使用,然后你获得如下效果:1.当此【决斗】指定目标后,若你有“擎”,你可以移去任意枚“擎”,令目标角色弃置等量的牌;2.当你造成渠道为此牌的伤害时,若此牌的所有目标角色中存在有“擎”的角色,此伤害+1。', + extra_feng:'神话再临·风', extra_huo:'神话再临·火',