From 9d8bf314b4be5899e461e47a672c7545a5150895 Mon Sep 17 00:00:00 2001 From: Tipx-L <138244655+Tipx-L@users.noreply.github.com> Date: Thu, 19 Oct 2023 02:45:39 -0700 Subject: [PATCH] Support more players and identities. --- game/game.js | 525 ++++++++++++++++++++++++++++-------- layout/newlayout/global.css | 9 - mode/identity.js | 498 +++++++++++----------------------- 3 files changed, 567 insertions(+), 465 deletions(-) diff --git a/game/game.js b/game/game.js index 1c8eeb4a2..aa38dfbda 100644 --- a/game/game.js +++ b/game/game.js @@ -432,8 +432,11 @@ }, } }, - //Yingbian - //应变 + /** + * Yingbian + * + * 应变 + */ yingbian:{ condition:{ color:new Map([ @@ -605,8 +608,32 @@ ['all','无视条件执行所有选项'] ]) }, - //The actual card name - //实际的卡牌名称 + /** + * Stratagem buff + * + * 谋攻强化 + */ + stratagemBuff:{ + buff:new Map([ + ['sha',[1,'require']], + ['shan',[1,'double']], + ['juedou',[2,'damage']], + ['huogong',[2,'damage']], + ['tao',[3,'double']] + ]), + prompt:new Map([ + ['sha','响应时所需【闪】数+1。'], + ['shan','视为两张【闪】的效果。'], + ['juedou','对目标造成的伤害+1。'], + ['huogong','造成的伤害+1。'], + ['tao','回复值+1。'] + ]) + }, + /** + * The actual card name + * + * 实际的卡牌名称 + */ actualCardName:new Map([ ['挟令','挟天子以令诸侯'], ['霹雳投石车','霹雳车'] @@ -4875,11 +4902,11 @@ name:'身份', connect:{ update:function(config,map){ - if(config.connect_identity_mode=='mougong'){ - map.connect_round1_use_nuqi.show(); + if(config.connect_identity_mode=='stratagem'){ + map.connect_round_one_use_fury.show(); } else{ - map.connect_round1_use_nuqi.hide(); + map.connect_round_one_use_fury.hide(); } if(config.connect_identity_mode=='zhong'){ map.connect_player_number.hide(); @@ -4890,7 +4917,7 @@ map.connect_special_identity.hide(); map.connect_double_character.show(); } - else if(config.connect_identity_mode=='mougong'){ + else if(config.connect_identity_mode=='stratagem'){ map.connect_double_character.show(); map.connect_player_number.show(); map.connect_limit_zhu.hide(); @@ -4935,7 +4962,7 @@ item:{ normal:'标准', zhong:'明忠', - mougong:'谋攻', + stratagem:'谋攻', purple:'3v3v2', }, restart:true, @@ -4945,14 +4972,8 @@ connect_player_number:{ name:'游戏人数', init:'8', - item:{ - '2':'两人', - '3':'三人', - '4':'四人', - '5':'五人', - '6':'六人', - '7':'七人', - '8':'八人' + get item(){ + return lib.mode.identity.config.player_number.item; }, frequent:true, restart:true, @@ -4980,7 +5001,9 @@ init:false, restart:true, // frequent:true, - intro:'开启后游戏中将有两个内奸(内奸胜利条件仍为主内1v1时击杀主公)' + get intro(){ + return lib.mode.identity.config.double_nei.intro; + } }, connect_double_character:{ name:'双将模式', @@ -5001,7 +5024,7 @@ frequent:true, intro:'开启后游戏中将增加军师、大将、贼首三个身份' }, - connect_round1_use_nuqi:{ + connect_round_one_use_fury:{ name:'开启首轮强化卡牌', init:false, frequent:false, @@ -5027,12 +5050,12 @@ }, config:{ update:function(config,map){ - if(config.identity_mode=='mougong'){ - map.round1_use_nuqi.show(); + if(config.identity_mode=='stratagem'){ + map.round_one_use_fury.show(); map.nei_auto_mark_camouflage.show(); } else{ - map.round1_use_nuqi.hide(); + map.round_one_use_fury.hide(); map.nei_auto_mark_camouflage.hide(); } if(config.identity_mode=='zhong'){ @@ -5064,7 +5087,7 @@ } map.continue_game.show(); } - else if(config.identity_mode=='mougong'){ + else if(config.identity_mode=='stratagem'){ map.continue_game.show(); map.player_number.show(); map.enhance_zhu.hide(); @@ -5188,7 +5211,7 @@ item:{ normal:'标准', zhong:'明忠', - mougong:'谋攻', + stratagem:'谋攻', purple:'3v3v2', }, restart:true, @@ -5198,14 +5221,12 @@ player_number:{ name:'游戏人数', init:'8', - item:{ - '2':'两人', - '3':'三人', - '4':'四人', - '5':'五人', - '6':'六人', - '7':'七人', - '8':'八人' + get item(){ + const minimumNumberOfPlayers=2,maximumNumberOfPlayers=Math.max(_status.maximumNumberOfPlayers||10,minimumNumberOfPlayers),item={}; + for(let playerNumber=minimumNumberOfPlayers;playerNumber<=maximumNumberOfPlayers;playerNumber++){ + item[playerNumber]=`${get.cnNumber(playerNumber)}人`; + } + return item; }, frequent:true, restart:true, @@ -5215,7 +5236,7 @@ init:false, restart:true, frequent:true, - intro:'开启后游戏中将有两个内奸(内奸胜利条件仍为主内1v1时击杀主公)' + intro:'若游戏人数不大于8,则开启后游戏中将有两个内奸(内奸胜利条件仍为主内1v1时击杀主公)' }, choose_group:{ name:'神武将选择势力', @@ -5361,7 +5382,7 @@ unlimited:'无限', }, }, - round1_use_nuqi:{ + round_one_use_fury:{ name:'开启首轮强化卡牌', init:false, frequent:false, @@ -5562,13 +5583,8 @@ connect_player_number:{ name:'游戏人数', init:'8', - item:{ - '3':'三人', - '4':'四人', - '5':'五人', - '6':'六人', - '7':'七人', - '8':'八人' + get item(){ + return lib.mode.guozhan.config.player_number.item; }, frequent:true, restart:true, @@ -5653,13 +5669,12 @@ player_number:{ name:'游戏人数', init:'8', - item:{ - '3':'三人', - '4':'四人', - '5':'五人', - '6':'六人', - '7':'七人', - '8':'八人' + get item(){ + const minimumNumberOfPlayers=3,maximumNumberOfPlayers=Math.max(_status.maximumNumberOfPlayers||10,minimumNumberOfPlayers),item={}; + for(let playerNumber=minimumNumberOfPlayers;playerNumber<=maximumNumberOfPlayers;playerNumber++){ + item[playerNumber]=`${get.cnNumber(playerNumber)}人`; + } + return item; }, frequent:true, restart:true, @@ -11097,11 +11112,15 @@ } }, layout:function(layout,nosave){ + const previousTransitionDuration=document.body.style.transitionDuration; + document.body.style.transitionDuration='1s'; + const previousFilter=document.body.style.filter,previousWebkitFilter=document.body.style.webkitFilter; + document.body.style.filter=document.body.style.webkitFilter='brightness(0)'; if(layout=='default') layout='mobile'; if(!nosave) game.saveConfig('layout',layout); game.layout=layout; ui.arena.hide(); - setTimeout(function(){ + new Promise(resolve=>setTimeout(resolve,500)).then(()=>{ if(game.layout=='default'){ ui.css.layout.href=''; } @@ -11196,17 +11215,26 @@ } ui.updatej(); ui.updatem(); - setTimeout(function(){ - ui.arena.show(); - if(game.me) game.me.update(); - setTimeout(function(){ - ui.updatex(); - },500); - setTimeout(function(){ - ui.updatec(); - },1000); - },100); - },500); + return new Promise(resolve=>setTimeout(resolve,100)); + }).then(()=>{ + ui.arena.show(); + if(game.me) game.me.update(); + return new Promise(resolve=>setTimeout(resolve,500)); + }).then(()=>{ + ui.updatex(); + ui.create.playerPositions(); + return new Promise(resolve=>setTimeout(resolve,500)); + }).then(()=>{ + ui.updatec(); + if(previousFilter) document.body.style.filter=previousFilter; + else document.body.style.removeProperty('filter'); + if(previousWebkitFilter) document.body.style.webkitFilter=previousWebkitFilter; + else document.body.style.removeProperty('-webkit-filter'); + return new Promise(resolve=>setTimeout(resolve,1000)); + }).then(()=>{ + if(previousTransitionDuration) document.body.style.transitionDuration=previousTransitionDuration; + else document.body.style.removeProperty('transition-duration'); + }); }, background:function(){ if(lib.config.image_background_random){ @@ -12302,6 +12330,7 @@ cooperation_use_info:'双方累计使用至少4种花色的牌', charge:'蓄力值', expandedSlots:'扩展装备栏', + _stratagem_add_buff:'强化' }, element:{ content:{ @@ -27991,7 +28020,7 @@ var player=this,mode=get.mode(); if(!this.isZhu) return false; if(mode=='identity'){ - if(_status.mode=='mougong'&&!this.identityShown) return false; + if(_status.mode=='stratagem'&&!this.identityShown) return false; return true; } if(mode=='versus'&&(_status.mode=='four'||_status.mode=='guandu')) return true; @@ -30396,7 +30425,6 @@ * @param {string} [nature] */ constructor(suitOrCard,numberOrCards,name,nature){ - if(typeof suitOrCard=='undefined'&&typeof numberOrCards=='undefined'&&typeof name=='undefined'&&typeof nature=='undefined') return; if(Array.isArray(suitOrCard)){ /** * @type {string} @@ -32436,6 +32464,217 @@ } }, skill:{ + _stratagem_add_buff:{ + enable:'chooseToUse', + filter:function(event,player){ + if(!event.stratagemSettings) return false; + if(game.roundNumber<2&&!event.stratagemSettings.roundOneUseFury) return false; + var cards=player.getCards('hs'); + var names=Array.from(lib.stratagemBuff.buff.keys()); + if(!names.length) return false; + for(var card of cards){ + if(!game.checkMod(card,player,'unchanged','cardEnabled2',player)) continue; + for(var name of names){ + var myName=get.name(card,player),nature=get.nature(card,player); + if(name==myName){ + if(event.filterCard({name:name,nature:nature,isCard:true,cards:[card]},player,event)){ + if(player.storage.stratagem_fury>=lib.stratagemBuff.buff.get(name)[0]) + return true; + } + } + } + } + return false; + }, + onChooseToUse:function(event){ + if(!event.stratagemSettings&&!game.online){ + event.set('stratagemSettings',{ + roundOneUseFury:_status.connectMode?lib.configOL.round_one_use_fury:get.config('round_one_use_fury') + }); + } + }, + check:function(card){ + var player=_status.event.player; + if(_status.event.type=='phase'){ + var name=get.name(card,player); + if(name=='sha'){ + if(game.hasPlayer(current=>{ + return player.canUse(card,current)&&(player.storage.zhibi&&!player.storage.zhibi.contains(current)||(get.effect(current,card,player,player)>=2-Math.max(0,(player.storage.stratagem_fury||0)-1)))&¤t.mayHaveShan()&&player.hasSkill('jiu'); + })) return 1; + return 0; + } else if(name=='tao'){ + if(player.hp<=2&&player.getDamagedHp()>=2) return 1; + return 0; + } + return 1; + } + else if(_status.event.type=='dying') return get.attitude(player,_status.event.dying)>3?1:0; + return (_status.event.getParent().shanRequired||1)>1&&get.damageEffect(player,_status.event.getParent().player||player,player)<0?1:0; + }, + position:'hs', + filterCard:function(card,player,event){ + event=event||_status.event; + var filter=event._backup.filterCard; + var names=Array.from(lib.stratagemBuff.buff.keys()); + for(var name of names){ + var myName=get.name(card,player),nature=get.nature(card,player); + if(name==myName){ + if(filter({name:name,nature:nature,isCard:true,cards:[card]},player,_status.event)){ + if(player.storage.stratagem_fury>=lib.stratagemBuff.buff.get(name)[0]){ + return true; + } + } + } + } + return false; + }, + viewAs:function(cards,player){ + var name=get.name(cards[0],player); + var nature=get.nature(cards[0],player); + if(name){ + return { + name:name, + nature:nature, + suit:get.suit(cards[0],player), + number:get.number(cards[0],player), + isCard:true, + cards:[cards[0]], + storage:{stratagemBuffed:1}, + }; + } + return null; + }, + prompt:()=>{ + const span=document.createElement('span'); + span.classList.add('text'); + span.style.fontFamily='yuanli'; + const stratagemBuff=lib.stratagemBuff,buff=stratagemBuff.buff; + stratagemBuff.prompt.forEach((prompt,cardName)=>{ + const li=document.createElement('li'); + li.innerHTML=`【${get.translation(cardName)}】:${buff.get(cardName)[0]}点怒气。${prompt}`; + span.appendChild(li); + }); + return `当你需要使用位于“强化表”内的非虚拟卡牌时,你可以消耗对应数量的怒气将其强化并使用。${document.createElement('hr').outerHTML}${span.outerHTML}`; + }, + precontent:function(){ + 'step 0' + player.changeFury(-lib.stratagemBuff.buff.get(event.result.card.name)[0]); + }, + ai:{ + order:function(item,player){ + var player=player||_status.event.player; + if(_status.event.type=='phase'){ + var cards=player.getCards('hs'); + for(var card of cards){ + if(!game.checkMod(card,player,'unchanged','cardEnabled2',player)) continue; + var name=get.name(card,player); + if(name=='sha'){ + if(game.hasPlayer(current=>{ + return player.canUse(card,current)&&(player.storage.zhibi&&!player.storage.zhibi.contains(current)||(get.effect(current,card,player,player)>=2-Math.max(0,(player.storage.stratagem_fury||0)-1)))&¤t.mayHaveShan(); + })) return get.order(card,player)+0.5; + } else if(name=='tao'){ + if(player.hp<=2&&player.getDamagedHp()>=2) return get.order(card,player)+0.5; + } + return 8; + } + } + return 3.5; + }, + }, + subSkill:{ + sha:{ + trigger:{player:'useCardToPlayered'}, + forced:true, + silent:true, + popup:false, + charlotte:true, + filter:function(event,player){ + return event.card.name=='sha'&&event.card.storage&&event.card.storage.stratagemBuffed&&lib.stratagemBuff.buff.get('sha')[1]=='require'&&!event.getParent().directHit.contains(event.target); + }, + content:function(){ + if(!trigger.card.storage.stratagem_logged){ + game.log(player,'触发了强化杀的效果'); + game.log('#y'+get.translation(trigger.card),'需要额外使用一张','#y【闪】','响应'); + trigger.card.storage.stratagem_logged=true; + } + var id=trigger.target.playerid; + var map=trigger.getParent().customArgs; + if(!map[id]) map[id]={}; + if(typeof map[id].shanRequired=='number'){ + map[id].shanRequired++; + } + else{ + map[id].shanRequired=2; + } + }, + ai:{ + directHit_ai:true, + skillTagFilter:function(player,tag,arg){ + if(arg.card.name!='sha'||(arg.card&&arg.card.storage&&!arg.card.storage.stratagemBuffed)||(arg.target.countCards('h','shan')>=1&&!arg.target.storage.stratagem_fury)) return false; + }, + }, + }, + shan:{ + trigger:{ + player:'shanEnd', + }, + forced:true, + silent:true, + popup:false, + charlotte:true, + filter:function(event,player){ + return event.getParent(3).name=='sha'&&event.getParent().card.storage&&event.getParent().card.storage.stratagemBuffed&&lib.stratagemBuff.buff.get('shan')[1]=='double'; + }, + content:function(event,player){ + if(!trigger.card.storage.stratagem_logged){ + game.log(player,'触发了强化闪的效果'); + game.log('#y'+get.translation(trigger.card),'视为两张','#y【闪】','的效果'); + trigger.card.storage.stratagem_logged=true; + } + if(trigger.getParent(3).shanRequired) trigger.getParent(3).shanRequired--; + } + }, + damage:{ + trigger:{player:'damageBegin1'}, + forced:true, + silent:true, + popup:false, + charlotte:true, + filter:function(event,player){ + if(!event.card) return false; + var names=Array.from(lib.stratagemBuff.buff.keys()),name=event.card.name; + return names.contains(name)&&event.getParent(2).player==event.source&&event.card.storage&&event.card.storage.stratagemBuffed&&lib.stratagemBuff.buff.get(name)[1]=='damage'; + }, + content:function(){ + if(!trigger.card.storage.stratagem_logged){ + game.log(player,'触发了强化'+get.translation(trigger.card.name)+'的效果'); + game.log('#y'+get.translation(trigger.card),'造成的伤害','#y+1'); + trigger.card.storage.stratagem_logged=true; + } + trigger.num++; + } + }, + tao:{ + trigger:{player:'useCard'}, + filter:function(event,player){ + return event.card.name=='tao'&&event.card.storage&&event.card.storage.stratagemBuffed&&lib.stratagemBuff.buff.get('tao')[1]=='double'; + }, + forced:true, + silent:true, + popup:false, + charlotte:true, + content:function(){ + if(!trigger.card.storage.stratagem_logged){ + game.log(player,'触发了强化桃的效果'); + game.log('#y'+get.translation(trigger.card),'的回复值','#y+1'); + trigger.card.storage.stratagem_logged=true; + } + if(!trigger.baseDamage) trigger.baseDamage=1; + trigger.baseDamage++; + }, + } + } + }, expandedSlots:{ markimage:'image/card/expandedSlots.png', intro:{ @@ -37095,7 +37334,7 @@ ui.updatehl(); for(var i=0;inew lib.element.Player(position,noclick), - connectPlayers:function(ip){ + /** + * @author curpond + * @author Tipx-L + * @param {number} [numberOfPlayers] + */ + connectPlayerPositions:numberOfPlayers=>{ + if(typeof numberOfPlayers!='number') numberOfPlayers=lib.configOL.number; + if(!numberOfPlayers) return; + const playerPositions=ui.playerPositions; + while(playerPositions.length){ + playerPositions.pop().remove(); + } + const temporaryPlayer=ui.create.div('.player.connect',ui.window).hide(); + const computedStyle=getComputedStyle(temporaryPlayer); + const halfWidth=parseFloat(computedStyle.width)/2; + const halfHeight=parseFloat(computedStyle.height)/2; + temporaryPlayer.remove(); + const halfNumberOfPlayers=Math.round(numberOfPlayers/2); + const upperPercentage=100/(halfNumberOfPlayers+1); + const scale=10/numberOfPlayers; + for(let ordinal=0;ordinal.player.connect[data-position='${ordinal}']{`, + `left:calc(${upperPercentage*(ordinal+1)}% - ${halfWidth}px);`, + `top:calc(${100/3}% - ${halfHeight}px);`, + scale<1?`transform:scale(${scale});`:'', + '}' + ].join(''))); + } + const lowerPercentage=100/(numberOfPlayers-halfNumberOfPlayers+1); + for(let ordinal=halfNumberOfPlayers;ordinal.player.connect[data-position='${ordinal}']{`, + `left:calc(${lowerPercentage*(ordinal-halfNumberOfPlayers+1)}% - ${halfWidth}px);`, + `top:calc(${100*2/3}% - ${halfHeight}px);`, + scale<1?`transform:scale(${scale});`:'', + '}' + ].join(''))); + } + }, + connectPlayers:ip=>{ + ui.create.connectPlayerPositions(); game.connectPlayers=[]; - for(var i=0;i<8;i++){ - var player=ui.create.player(ui.window); - player.dataset.position=i; + const numberOfPlayers=lib.configOL.number; + for(let position=0;position=lib.configOL.number){ - player.classList.add('unselectable2'); - } } var bar=ui.create.div(ui.window); @@ -52621,7 +52904,7 @@ for(var i of game.connectPlayers){ if(!i.nickname&&!i.classList.contains('unselectable2')) num++; } - if(num>=lib.configOL.number-1){ + if(num>=numberOfPlayers-1){ alert('至少要有两名玩家才能开始游戏!'); return; } @@ -52637,52 +52920,76 @@ ui.connectStartButton=button; ui.connectStartBar=bar; }, - players:function(num){ - if(num===0){ + /** + * @author curpond + * @author Tipx-L + * @param {number} [numberOfPlayers] + */ + playerPositions:numberOfPlayers=>{ + if(typeof numberOfPlayers!='number') numberOfPlayers=ui.arena.dataset.number; + //当人数小于8时,还是用以前的布局。 + if(!numberOfPlayers||numberOfPlayers<9) return; + const playerPositions=ui.playerPositions; + while(playerPositions.length){ + playerPositions.pop().remove(); + } + //单个人物的宽度。这里要设置玩家的实际的宽度 + const temporaryPlayer=ui.create.div('.player',ui.arena).hide(); + const computedStyle=getComputedStyle(temporaryPlayer); + const scale=8/numberOfPlayers; + //玩家顶部距离父容器上边缘的距离偏移的单位距离 + const oneThirdHeight=parseFloat(computedStyle.height)/3*scale; + const halfWidth=parseFloat(computedStyle.width)/2; + temporaryPlayer.remove(); + //列数,即假如8人场,除去自己后,上面7个人占7列 + const columnCount=numberOfPlayers-1; + const percentage=100/numberOfPlayers; + //仅当游戏人数大于8人,且玩家的座位号大于0时,设置玩家的位置。因为0号位是game.me在最下方,无需设置。 + for(let ordinal=1;ordinal.player[data-position='${ordinal}']{`, + `left:calc(${percentage*(reversedOrdinal+1)}% - ${halfWidth}px);`, + `top:${top}px;`, + `transform:scale(${scale});`, + '}' + ].join(''))); + } + }, + players:numberOfPlayers=>{ + if(numberOfPlayers===0){ return; } - if(num==undefined) num=lib.configOL.number; - if(num==undefined) num=get.playerNumber(); - if(typeof num=='string'){ - num=parseInt(num); + if(numberOfPlayers==undefined) numberOfPlayers=lib.configOL.number; + if(numberOfPlayers==undefined) numberOfPlayers=get.playerNumber(); + if(typeof numberOfPlayers=='string'){ + numberOfPlayers=parseInt(numberOfPlayers); } - if(!num) num=5; - for(var i=0;i0){ - players[i].previous=players[i-1]; - players[i].previousSeat=players[i-1]; + const players=game.players; + for(let ordinal=0;ordinal0){ + players[ordinal].previous=players[ordinal-1]; + players[ordinal].previousSeat=players[ordinal-1]; } - if(iui.arena.appendChild(player)); return players; }, me:function(hasme){ @@ -53487,7 +53794,7 @@ if(!game.getIdentityList) return; if(_status.video) return; if(this.parentNode.forceShown) return; - if(!_status.connectMode&&this.parentNode.ai.mougong_camouflage&&get.config('nei_auto_mark_camouflage')&&game.me.identity=='nei') return; + if(!_status.connectMode&&this.parentNode.ai.stratagem_camouflage&&get.config('nei_auto_mark_camouflage')&&game.me.identity=='nei') return; if(_status.clickingidentity){ for(var i=0;i<_status.clickingidentity[1].length;i++){ _status.clickingidentity[1][i].delete(); @@ -58405,7 +58712,7 @@ switch(config.identity_mode){ case 'purple':return '三对三对二'; case 'zhong':return (config.double_character?'双将':'')+'忠胆英杰'; - case 'mougong':return get.cnNumber(parseInt(config.number))+'人'+(config.double_character?'双将':'')+'谋攻'; + case 'stratagem':return get.cnNumber(parseInt(config.number))+'人'+(config.double_character?'双将':'')+'谋攻'; default:return get.cnNumber(parseInt(config.number))+'人'+(config.double_character?'双将':'')+'身份'; } } diff --git a/layout/newlayout/global.css b/layout/newlayout/global.css index 691d4bc6e..d80186a42 100644 --- a/layout/newlayout/global.css +++ b/layout/newlayout/global.css @@ -452,15 +452,6 @@ /*--------位置(1人)------*/ .player[data-position='0']{top:calc(100% - 170px);left:calc(50% - 75px);} /*--------位置(联机)------*/ -#window>.player.connect[data-position='0']{left:calc(200% / 7 - 1200px / 7);top:calc(300% / 7 - 160px + 5px);} -#window>.player.connect[data-position='1']{left:calc(300% / 7 - 750px / 7);top:calc(300% / 7 - 160px + 5px);} -#window>.player.connect[data-position='2']{left:calc(400% / 7 - 300px / 7);top:calc(300% / 7 - 160px + 5px);} -#window>.player.connect[data-position='3']{left:calc(500% / 7 + 150px / 7);top:calc(300% / 7 - 160px + 5px);} -#window>.player.connect[data-position='4']{left:calc(200% / 7 - 1200px / 7);top:calc(400% / 7 - 40px + 5px);} -#window>.player.connect[data-position='5']{left:calc(300% / 7 - 750px / 7);top:calc(400% / 7 - 40px + 5px);} -#window>.player.connect[data-position='6']{left:calc(400% / 7 - 300px / 7);top:calc(400% / 7 - 40px + 5px);} -#window>.player.connect[data-position='7']{left:calc(500% / 7 + 150px / 7);top:calc(400% / 7 - 40px + 5px);} - #window>.player.connect[data-position='c0']{left:calc(50% - 255px);top:calc(50% - 90px)} #window>.player.connect[data-position='c1']{left:calc(50% - 75px);top:calc(50% - 90px)} #window>.player.connect[data-position='c2']{left:calc(50% + 105px);top:calc(50% - 90px)} diff --git a/mode/identity.js b/mode/identity.js index eb53477b4..9e21e21e6 100644 --- a/mode/identity.js +++ b/mode/identity.js @@ -234,8 +234,8 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ game.players[i].ai.shown=0; } } - var isMougong=_status.mode=='mougong'; - if(isMougong){ + var stratagemMode=_status.mode=='stratagem'; + if(stratagemMode){ var beginner; if(_status.cheat_seat){ var seat=_status.cheat_seat.link; @@ -248,47 +248,30 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } event.beginner=beginner; - _status.mougong_buff={ - sha:[1,'require'], - shan:[1,'double'], - juedou:[2,'damage'], - huogong:[2,'damage'], - tao:[3,'double'], + var stratagemBroadcast=()=>{ + _status.stratagemFuryMax=3; + ui.css.stratagemCardStyle=lib.init.sheet([ + '.card.stratagem-fury-glow:before{', + 'opacity:0.2;', + 'box-shadow:rgba(0,0,0,0.2) 0 0 0 1px,rgb(255,109,12) 0 0 5px,rgb(255,0,0) 0 0 10px;', + 'background-color:yellow;', + '-webkit-filter:blur(5px);', + 'filter:blur(5px);', + '}' + ].join('')); }; - game.broadcastAll(function(){ - _status.mougong_nuqi_max=3; - var mougong_cardStyle=document.createElement('style'); - document.head.appendChild(mougong_cardStyle); - mougong_cardStyle.innerHTML='.card.mougong_nuqi_glow:before{opacity:0.2;box-shadow:rgba(0,0,0,0.2) 0 0 0 1px,rgb(255,109,12) 0 0 5px,rgb(255,0,0) 0 0 10px;background-color:yellow;-webkit-filter:blur(5px);filter:blur(5px);}'; - ui.css.mougong_cardStyle=mougong_cardStyle; - }); - if(_status.connectMode){ - _status.round1_use_nuqi=lib.configOL.round1_use_nuqi; - if(!_status.postReconnect.mougong_reinit){ - _status.postReconnect.mougong_reinit=[ - function(){ - _status.mougong_nuqi_max=3; - var mougong_cardStyle=document.createElement('style'); - document.head.appendChild(mougong_cardStyle); - mougong_cardStyle.innerHTML='.card.mougong_nuqi_glow:before{opacity:0.2;box-shadow:rgba(0,0,0,0.2) 0 0 0 1px,rgb(255,109,12) 0 0 5px,rgb(255,0,0) 0 0 10px;background-color:yellow;-webkit-filter:blur(5px);filter:blur(5px);}'; - ui.css.mougong_cardStyle=mougong_cardStyle; - },{} - ]; - } - } - else{ - _status.round1_use_nuqi=get.config('round1_use_nuqi'); - } + game.broadcastAll(stratagemBroadcast); + if(_status.connectMode&&!_status.postReconnect.stratagemReinit) _status.postReconnect.stratagemReinit=[stratagemBroadcast,{}]; for(var current of game.players){ - if(current.identity=='zhu') current.addSkill('mougong_showZhu'); - if(current.identity=='fan') current.addSkill('mougong_showFan'); + if(current.identity=='zhu') current.addSkill('stratagem_show_zhu'); + if(current.identity=='fan') current.addSkill('stratagem_show_fan'); } } if(game.zhu==game.me&&game.zhu.identity!='zhu'&&_status.brawl&&_status.brawl.identityShown){ delete game.zhu; } else{ - if(!isMougong) game.zhu.ai.shown=1; + if(!stratagemMode) game.zhu.ai.shown=1; if(game.zhu2){ game.zhong=game.zhu; game.zhu=game.zhu2; @@ -302,10 +285,10 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } var enhance_zhu=false; if(_status.connectMode){ - enhance_zhu=(!['zhong','mougong','purple'].includes(_status.mode)&&lib.configOL.enhance_zhu&&get.population('fan')>=3); + enhance_zhu=(!['zhong','stratagem','purple'].includes(_status.mode)&&lib.configOL.enhance_zhu&&get.population('fan')>=3); } else{ - enhance_zhu=(!['zhong','mougong','purple'].includes(_status.mode)&&get.config('enhance_zhu')&&get.population('fan')>=3); + enhance_zhu=(!['zhong','stratagem','purple'].includes(_status.mode)&&get.config('enhance_zhu')&&get.population('fan')>=3); } if(enhance_zhu){ var skill; @@ -341,18 +324,18 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ name2:players[i].name2, identity:players[i].identity }; - if(isMougong){ + if(stratagemMode){ ifo.translate=lib.translate[game.players[i].name]; - ifo.isCamouflaged=players[i].ai.mougong_camouflage; + ifo.isCamouflaged=players[i].ai.stratagemCamouflage; } info.push(ifo); } _status.videoInited=true; game.addVideo('init',null,info); - if(isMougong){ + if(stratagemMode){ game.addVideo('arrangeLib',null,{ skill:{ - mougong_nuqi:{ + stratagem_fury:{ mark:true, marktext:'🔥', intro:{ @@ -363,13 +346,13 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ }, }); for(var i=0;i5) return 5; return 4; @@ -434,8 +417,8 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ uiintro.add('
游戏模式:'+(lib.configOL.identity_mode=='zhong'?'明忠':'标准')); uiintro.add('
双将模式:'+(lib.configOL.double_character?'开启':'关闭')); if(lib.configOL.identity_mode!='zhong'){ - if(lib.configOL.identity_mode=='mougong'){ - uiintro.add('
首轮强化:'+(lib.configOL.round1_use_nuqi?'开启':'关闭')); + if(lib.configOL.identity_mode=='stratagem'){ + uiintro.add('
首轮强化:'+(lib.configOL.round_one_use_fury?'开启':'关闭')); } else{ uiintro.add('
双内奸:'+(lib.configOL.double_nei?'开启':'关闭')); @@ -494,7 +477,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } } } - else if(_status.mode=='mougong'){ + else if(_status.mode=='stratagem'){ if(game.zhu&&game.zhu.isZhu&&game.zhu.identityShown||game.me.identity=='zhu'){ return { fan:'反', @@ -553,7 +536,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ switch(_status.mode){ case 'purple':str2='3v3v2 - '+(game.me.identity.indexOf('r')==0?'暖色':'冷色')+lib.translate[game.me.identity+'2'];break; case 'zhong':str2='忠胆英杰 - '+lib.translate[game.me.identity+'2'];break; - case 'mougong':str2=get.cnNumber(get.playerNumber())+'人谋攻'+'-'+lib.translate[game.me.identity+'2']; + case 'stratagem':str2=get.cnNumber(get.playerNumber())+'人谋攻'+'-'+lib.translate[game.me.identity+'2']; default:str2=get.cnNumber(get.playerNumber())+'人'+ get.translation(lib.config.mode)+' - '+lib.translate[game.me.identity+'2'] } @@ -1066,14 +1049,13 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ },500); }); }, - chooseCharacterMougongOL:function(){ + chooseCharacterStratagemOL:function(){ var next=game.createEvent('chooseCharacter'); next.setContent(function(){ 'step 0' ui.arena.classList.add('choose-character'); var i; - var identityList; - identityList=lib.config.mode_config.identity.identity[game.players.length-2].slice(0); + var identityList=get.identityList(game.players.length); if(lib.configOL.double_nei){ switch(lib.configOL.number){ case 8: @@ -1286,14 +1268,14 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ _status.characterlist.remove(game.players[i].name2); } - var list=['mougong_nuqi','mougong_nuqi_dongcha','mougong_expose','mougong_addBuff','mougong_addBuff_sha','mougong_addBuff_shan','mougong_addBuff_tao','mougong_addBuff_damage','mougong_shanAi','mougong_cardEffect']; + var list=['stratagem_fury','stratagem_fury_insight','stratagem_expose','stratagem_shan_ai','stratagem_card_effect']; for(var i=0;i{ current.storage.zhibi=[]; current.storage.zhibi_for=[]; - current.markSkill('mougong_nuqi'); + current.markSkill('stratagem_fury'); }); setTimeout(function(){ @@ -1309,8 +1291,8 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ var next=game.createEvent('chooseCharacter'); next.showConfig=true; next.addPlayer=function(player){ - var list=lib.config.mode_config.identity.identity[game.players.length-3].slice(0); - var list2=lib.config.mode_config.identity.identity[game.players.length-2].slice(0); + var list=get.identityList(game.players.length-1); + var list2=get.identityList(game.players.length); for(var i=0;i4){ + if(!event.stratagemMode&&game.me==game.zhu&&game.players.length>4){ game.me.hp++; game.me.maxHp++; game.me.update(); } for(var i=0;i{ i.storage.zhibi=[]; i.storage.zhibi_for=[]; - i.markSkill('mougong_nuqi'); + i.markSkill('stratagem_fury'); }); } setTimeout(function(){ @@ -2129,8 +2111,8 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ game.chooseCharacterPurpleOL(); return; } - else if(_status.mode=='mougong'){ - game.chooseCharacterMougongOL(); + else if(_status.mode=='stratagem'){ + game.chooseCharacterStratagemOL(); return; } var next=game.createEvent('chooseCharacter'); @@ -2144,7 +2126,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ identityList=['zhu','zhong','mingzhong','nei','fan','fan','fan','fan']; } else{ - identityList=lib.config.mode_config.identity.identity[game.players.length-2].slice(0); + identityList=get.identityList(game.players.length); if(lib.configOL.double_nei){ switch(lib.configOL.number){ case 8: @@ -2611,33 +2593,31 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ sheshen:'舍身', sheshen_info:'锁定技,主公处于濒死状态即将死亡时,令主公+1体力上限,回复体力至X点(X为你的体力值数),获得你的所有牌,然后你死亡。', yexinbilu:'野心毕露', - mougong_nuqi:'怒气', - mougong_nuqi_dongcha:'洞察', - mougong_addBuff:'强化', - mougong_addBuff_info:'当你需要使用位于“强化表”内的非虚拟卡牌时,你可以消耗对应数量的怒气将其强化并使用。

  • 【杀】 :1点怒气。响应时所需【闪】数+1。
  • 【闪】 :1点怒气。视为两张【闪】的效果。
  • 【决斗】:2点怒气。对目标造成的伤害+1。
  • 【火攻】:2点怒气。造成的伤害+1。
  • 【桃】 :3点怒气。回复值+1。', - mougong_nuqi_cost1:'1🔥', - mougong_nuqi_cost2:'2🔥', - mougong_nuqi_cost3:'3🔥', + stratagem_fury:'怒气', + stratagem_fury_insight:'洞察', + stratagem_fury_cost1:'1🔥', + stratagem_fury_cost2:'2🔥', + stratagem_fury_cost3:'3🔥', }, element:{ player:{ - dongcha:function(target){ - var next=game.createEvent('mougongDongcha'); + insightInto:function(target){ + var next=game.createEvent('stratagemInsight'); next.player=this; next.target=target; - next.setContent('mougongDongcha'); + next.setContent('stratagemInsight'); return next; }, - changeNuqi:function(num){ + changeFury:function(num){ var player=this; - if(!player.storage.mougong_nuqi) player.storage.mougong_nuqi=0; - var tmp=player.storage.mougong_nuqi; - player.storage.mougong_nuqi+=num; - player.storage.mougong_nuqi=Math.max(Math.min(player.storage.mougong_nuqi,_status.mougong_nuqi_max),0); - var del=player.storage.mougong_nuqi-tmp; + if(!player.storage.stratagem_fury) player.storage.stratagem_fury=0; + var tmp=player.storage.stratagem_fury; + player.storage.stratagem_fury+=num; + player.storage.stratagem_fury=Math.max(Math.min(player.storage.stratagem_fury,_status.stratagemFuryMax),0); + var del=player.storage.stratagem_fury-tmp; if(del===0) return; game.log(player,del>=0?'获得了':'失去了',get.cnNumber(Math.abs(del))+'点怒气'); - player.markSkill('mougong_nuqi'); + player.markSkill('stratagem_fury'); }, addExpose:function(num){ if(!game.zhu||!game.zhu.isZhu||!game.zhu.identityShown) return; @@ -2691,7 +2671,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } }, dieAfter2:function(source){ - if(_status.mode=='mougong') return; + if(_status.mode=='stratagem') return; if(_status.mode=='purple'){ if(source){ if(this.identity=='rZhu'||this.identity=='bZhu'){ @@ -2831,8 +2811,8 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ }, logAi:function(targets,card){ if(this.ai.shown==1||this.isMad()) return; - var isMougong=get.mode()=='identity'&&_status.mode=='mougong'; - if(isMougong&&(!game.zhu||!game.zhu.isZhu||!game.zhu.identityShown)) return; + var stratagemMode=get.mode()=='identity'&&_status.mode=='stratagem'; + if(stratagemMode&&(!game.zhu||!game.zhu.isZhu||!game.zhu.identityShown)) return; if(typeof targets=='number'){ this.ai.shown+=targets; } @@ -2879,11 +2859,11 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ else this.ai.shown-=0.1; } } - if(!isMougong&&this!=game.me) this.ai.shown*=2; + if(!stratagemMode&&this!=game.me) this.ai.shown*=2; if(this.ai.shown>0.95) this.ai.shown=0.95; if(this.ai.shown<-0.5) this.ai.shown=-0.5; if(_status.mode=='purple') return; - if(isMougong) return; + if(stratagemMode) return; var marknow=(!_status.connectMode&&this!=game.me&&get.config('auto_mark_identity')&&this.ai.identity_mark!='finished'); // if(true){ @@ -2984,17 +2964,17 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } }, content:{ - mougongDongcha:function(event,map){ + stratagemInsight:function(event,map){ 'step 0' // var player=map.player,target=map.target; - if(!player.storage.mougong_nuqi){event.finish();return;} - // yield player.changeNuqi(-1); - player.changeNuqi(-1); + if(!player.storage.stratagem_fury){event.finish();return;} + // yield player.changeFury(-1); + player.changeFury(-1); 'step 1' if(!player.storage.zhibi) player.storage.zhibi=[]; if(!player.storage.zhibi.contains(target)) player.storage.zhibi.push(target); - var res=get.dongchaResult(player,target); - event.dongcha_result=res; + var res=get.insightResult(player,target); + event.insightResult=res; event.videoId=lib.status.videoId++; var send=(target,res,id)=>{ @@ -3032,7 +3012,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ game.broadcastAll('closeDialog',event.videoId); if(!_status.connectMode&&get.config('auto_mark_identity')&&!target.node.identity.firstChild.innerHTML.length){ game.broadcastAll(function(player,target,event){ - if(player.isUnderControl(true)) target.setIdentity(event.dongcha_result); + if(player.isUnderControl(true)) target.setIdentity(event.insightResult); },player,target,event); } }, @@ -3046,7 +3026,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } var target=list.randomGet(); event.target=target; - target.ai.mougong_camouflage=true; + target.ai.stratagemCamouflage=true; var neis=game.filterPlayer(i=>i.identity=='nei'); if(event.players.includes(game.me)&&game.me.identity=='nei'){ var str=get.translation(target)+'是反贼
    '; @@ -3090,7 +3070,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } } var target=list.randomGet(); - target.ai.mougong_camouflage=true; + target.ai.stratagemCamouflage=true; event.videoId=lib.status.videoId++; event.ai_targets=[]; var time=10000; @@ -3179,7 +3159,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ if(from==to||to.identityShown||from.storage.zhibi&&from.storage.zhibi.contains(to)||(_status.yeconfirm&&['rYe','bYe'].contains(to.identity)&&['rYe','bYe'].contains(to.identity))) return real*1.1; return ((to.ai.shown+0.1)*real+(from.identity.slice(0,1)==to.identity.slice(0,1)?3:-3)*(1-to.ai.shown)) } - else if(_status.mode=='mougong'){ + else if(_status.mode=='stratagem'){ var x=0,num=0,temp,i; if(_status.ai.customAttitude){ for(i=0;i<_status.ai.customAttitude.length;i++){ @@ -3195,15 +3175,15 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } var real=get.realAttitude(from,to),zhibi=from.storage.zhibi,zhibi_for=from.storage.zhibi_for,followCamouflage=true; if(to.ai.shown) return to.ai.shown*(real+(from.identity==to.identity||from.identity=='zhu'&&to.identity=='zhong'||from.identity=='zhong'&&to.identity=='zhu'||(to.identity=='nei'&&get.situation()<=0&&['zhu','zhong'].contains(from.identity)||get.situation()>=3&&from.identity=='fan')?3:-3)) - if(from==to||to.identityShown||((zhibi_for&&zhibi_for.contains(to))||(zhibi&&zhibi.contains(to)))&&!to.ai.mougong_camouflage) return real*1.1; - if(from.identity=='nei'&&to.ai.mougong_camouflage) return real*1.1; + if(from==to||to.identityShown||((zhibi_for&&zhibi_for.contains(to))||(zhibi&&zhibi.contains(to)))&&!to.ai.stratagemCamouflage) return real*1.1; + if(from.identity=='nei'&&to.ai.stratagemCamouflage) return real*1.1; if(to.identity=='nei'){ if(from.identity=='fan'){ if(get.population('zhong')==0){ if(zhibi){ var dead=game.dead.slice(); for(var current of dead){ - if(from.storage.zhibi.contains(current)&¤t.ai.mougong_camouflage){ + if(from.storage.zhibi.contains(current)&¤t.ai.stratagemCamouflage){ if(from.storage.zhibi_for&&from.storage.zhibi_for.contains(to)) return -7; } } @@ -3214,7 +3194,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } if(to.identity=='fan'&&from.identity=='nei'&&zhibi.contains(game.zhu)&&game.players.filter(i=>i!=from&&!zhibi.contains(i)).map(i=>i.identity).reduce((p,c)=>(!p.contains(c)?(p.push(c)&&p):p),[]).length==1) return real; for(var fan of game.dead){ - if(fan.identity!='fan'||!fan.storage.mougong_showFan) continue; + if(fan.identity!='fan'||!fan.storage.stratagem_show_fan) continue; for(var current of fan.storage.zhibi_for){ if(to==current){ return real; @@ -3222,14 +3202,14 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } } if(from.identity=='fan'&&to.identity=='fan'){ - if(from.ai.mougong_camouflage){ + if(from.ai.stratagemCamouflage){ var zhu=game.zhu&&game.zhu.isZhu&&game.zhu.identityShown?game.zhu:undefined; if(zhu){ if(zhu.storage.zhibi_for&&zhu.storage.zhibi_for.contains(to)) return 0; } if(zhibi&&zhibi.contains(to)) return -7; } - if(to.ai.mougong_camouflage){ + if(to.ai.stratagemCamouflage){ var zhu=game.zhu&&game.zhu.isZhu&&game.zhu.identityShown?game.zhu:undefined; if(zhu){ if(zhu.storage.zhibi_for&&zhu.storage.zhibi_for.contains(to)) return 0; @@ -3237,12 +3217,12 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ if(zhibi&&zhibi.contains(to)) return -7; } } - if(from.identity!='nei'&&zhibi&&zhibi.contains(to)&&!to.identityShown&&(followCamouflage&&to.ai.mougong_camouflage)) return -5; + if(from.identity!='nei'&&zhibi&&zhibi.contains(to)&&!to.identityShown&&(followCamouflage&&to.ai.stratagemCamouflage)) return -5; if(from.identity!='nei'&&zhibi_for&&zhibi_for.contains(to)&&!to.identityShown) return -5; if(zhibi){ for(var to2 of zhibi){ if(to2.storage.zhibi_for){ - if(to2.ai.mougong_camouflage){ + if(to2.ai.stratagemCamouflage){ for(var to3 of to2.storage.zhibi_for){ if(zhibi.slice().addArray(zhibi_for).contains(to3)){ if(to==to2){ @@ -3315,7 +3295,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ return -7; } } - else if(_status.mode=='mougong'){ + else if(_status.mode=='stratagem'){ if(!game.zhu){ if(from.identity=='nei'||to.identity=='nei') return -1; if(from.identity==to.identity) return 6; @@ -3718,17 +3698,42 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } return result; }, - dongchaResult:function(from,to){ + insightResult:function(from,to){ var friend='friend',enemy='enemy'; if(from.identity=='nei') return to.identity; if(to.identity=='nei') return friend; - if(from.ai.mougong_camouflage||to.ai.mougong_camouflage) return enemy; + if(from.ai.stratagemCamouflage||to.ai.stratagemCamouflage) return enemy; if(from.identity==to.identity||from.identity=='zhu'&&to.identity=='zhong'||from.identity=='zhong'&&to.identity=='zhu') return friend; return enemy; }, + /** + * @param {number} numberOfPlayers + * @returns {string[]} + */ + identityList:numberOfPlayers=>{ + const modeConfig=lib.config.mode_config; + if(modeConfig){ + const identityConfig=modeConfig.identity; + if(identityConfig){ + const identityLists=identityConfig.identity; + if(identityLists){ + const identityList=identityLists[numberOfPlayers-2]; + if(Array.isArray(identityList)) return identityList.slice(); + } + } + } + const numberOfPlayersExceptLord=numberOfPlayers-1,numberOfLoyalists=Math.round(numberOfPlayersExceptLord*3/9),numberOfSpys=Math.round(numberOfPlayersExceptLord*2/9); + return ['zhu'].concat(Array.from({ + length:numberOfLoyalists + },()=>'zhong'),Array.from({ + length:numberOfSpys + },()=>'nei'),Array.from({ + length:numberOfPlayersExceptLord-numberOfLoyalists-numberOfSpys + },()=>'fan')); + } }, skill:{ - mougong_nuqi:{ + stratagem_fury:{ mark:true, marktext:'🔥', silent:true, @@ -3738,16 +3743,16 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ player:['phaseBegin','damageEnd'], }, content:function(){ - player.changeNuqi(trigger.name=='damage'?trigger.num:1); + player.changeFury(trigger.name=='damage'?trigger.num:1); }, intro:{ name:'怒气', content:function(storage,player){ - return '当前怒气值:'+(storage||0)+'/'+_status.mougong_nuqi_max; + return '当前怒气值:'+(storage||0)+'/'+_status.stratagemFuryMax; }, }, subSkill:{ - dongcha:{ + insight:{ trigger:{ source:'damageSource', global:'loseHpEnd', @@ -3758,7 +3763,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ if(event.name=='loseHp'){ if(event.getParent()._trigger) source=event.getParent()._trigger.source; } - return player==source&&player.storage.mougong_nuqi>0&&event.player&&event.player.isIn()&&event.player!=player; + return player==source&&player.storage.stratagem_fury>0&&event.player&&event.player.isIn()&&event.player!=player; }, logTarget:'player', prompt2:function(event,player){ @@ -3771,7 +3776,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ }, content:function(){ game.log(player,'洞察了',trigger.player,'与其的阵营关系'); - player.dongcha(trigger.player); + player.insightInto(trigger.player); }, ai:{ order:15, @@ -3779,7 +3784,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ }, } }, - mougong_showZhu:{ + stratagem_show_zhu:{ trigger:{ player:['dying','phaseBefore'], global:'dieAfter', @@ -3793,13 +3798,13 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ charlotte:true, ruleSkill:true, filter:function(event,player){ - if(player.storage.mougong_showZhu) return false; + if(player.storage.stratagem_show_zhu) return false; if(player.identity=='zhu'){ if(event.player==player){ if(event.name=='dying') return true; - return game.roundNumber>=3; + return game.roundNumber>=Math.max(Math.round(get.totalPopulation()/2),3); } - if(event.name=='die') return game.dead.length>=2; + if(event.name=='die') return game.dead.length>=Math.max(Math.round(get.totalPopulation()/3),2); } return false; }, @@ -3807,7 +3812,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ 'step 0' if(trigger.name=='dying') game.delayx(); 'step 1' - player.storage.mougong_showZhu=true; + player.storage.stratagem_show_zhu=true; game.zhu=game.zhu||player; game.broadcastAll(function(player){ game.zhu=player; @@ -3842,7 +3847,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } } }, - mougong_showFan:{ + stratagem_show_fan:{ trigger:{ player:'dying', }, @@ -3852,13 +3857,13 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ charlotte:true, ruleSkill:true, filter:function(event,player){ - return player.ai.mougong_camouflage&&event.player==player&&!game.dead.length&&player.storage.mougong_nuqi>=2&&!player.storage.mougong_showFan; + return player.ai.stratagemCamouflage&&event.player==player&&!game.dead.length&&player.storage.stratagem_fury>=2&&!player.storage.stratagem_show_fan; }, content:function(){ 'step 0' game.delayx(); 'step 1' - player.storage.mougong_showFan=true; + player.storage.stratagem_show_fan=true; game.broadcastAll(function(player){ player.identityShown=true; player.ai.shown=1; @@ -3870,7 +3875,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ game.delay(2); player.playerfocus(800); 'step 2' - player.changeNuqi(-player.storage.mougong_nuqi); + player.changeFury(-player.storage.stratagem_fury); player.discard(player.getCards('hej')); player.link(false); player.turnOver(false); @@ -3878,208 +3883,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ player.draw(3); } }, - mougong_addBuff:{ - enable:'chooseToUse', - filter:function(event,player){ - if(!event.mougong_settings) return false; - if(game.roundNumber<2&&!event.mougong_settings.round1_use_nuqi) return false; - var cards=player.getCards('hs'); - if(!event.mougong_settings.mougong_buff) return false; - var names=Object.keys(event.mougong_settings.mougong_buff); - if(!names.length) return false; - for(var card of cards){ - if(!game.checkMod(card,player,'unchanged','cardEnabled2',player)) continue; - for(var name of names){ - var myName=get.name(card,player),nature=get.nature(card,player); - if(name==myName){ - if(event.filterCard({name:name,nature:nature,isCard:true,cards:[card]},player,event)){ - if(player.storage.mougong_nuqi>=event.mougong_settings.mougong_buff[name][0]) - return true; - } - } - } - } - return false; - }, - onChooseToUse:function(event){ - if(!event.mougong_settings&&!game.online){ - event.set('mougong_settings',{ - round1_use_nuqi:_status.round1_use_nuqi, - mougong_buff:_status.mougong_buff, - }); - } - }, - check:function(card){ - var player=_status.event.player; - if(_status.event.type=='phase'){ - var name=get.name(card,player); - if(name=='sha'){ - if(game.hasPlayer(current=>{ - return player.canUse(card,current)&&(player.storage.zhibi&&!player.storage.zhibi.contains(current)||(get.effect(current,card,player,player)>=2-Math.max(0,(player.storage.mougong_nuqi||0)-1)))&¤t.mayHaveShan()&&player.hasSkill('jiu'); - })) return 1; - return 0; - } else if(name=='tao'){ - if(player.hp<=2&&player.getDamagedHp()>=2) return 1; - return 0; - } - return 1; - } - else if(_status.event.type=='dying') return get.attitude(player,_status.event.dying)>3?1:0; - return (_status.event.getParent().shanRequired||1)>1&&get.damageEffect(player,_status.event.getParent().player||player,player)<0?1:0; - }, - position:'hs', - filterCard:function(card,player,event){ - event=event||_status.event; - var filter=event._backup.filterCard; - var names=Object.keys(event.mougong_settings.mougong_buff); - for(var name of names){ - var myName=get.name(card,player),nature=get.nature(card,player); - if(name==myName){ - if(filter({name:name,nature:nature,isCard:true,cards:[card]},player,_status.event)){ - if(player.storage.mougong_nuqi>=event.mougong_settings.mougong_buff[name][0]){ - return true; - } - } - } - } - return false; - }, - viewAs:function(cards,player){ - var name=get.name(cards[0],player); - var nature=get.nature(cards[0],player); - if(name){ - return { - name:name, - nature:nature, - suit:get.suit(cards[0],player), - number:get.number(cards[0],player), - isCard:true, - cards:[cards[0]], - storage:{mougong_buffed:true}, - }; - } - return null; - }, - precontent:function(){ - 'step 0' - player.changeNuqi(-_status.mougong_buff[event.result.card.name][0]); - }, - ai:{ - order:function(item,player){ - var player=player||_status.event.player; - if(_status.event.type=='phase'){ - var cards=player.getCards('hs'); - for(var card of cards){ - if(!game.checkMod(card,player,'unchanged','cardEnabled2',player)) continue; - var name=get.name(card,player); - if(name=='sha'){ - if(game.hasPlayer(current=>{ - return player.canUse(card,current)&&(player.storage.zhibi&&!player.storage.zhibi.contains(current)||(get.effect(current,card,player,player)>=2-Math.max(0,(player.storage.mougong_nuqi||0)-1)))&¤t.mayHaveShan(); - })) return get.order(card,player)+0.5; - } else if(name=='tao'){ - if(player.hp<=2&&player.getDamagedHp()>=2) return get.order(card,player)+0.5; - } - return 8; - } - } - return 3.5; - }, - }, - subSkill:{ - sha:{ - trigger:{player:'useCardToPlayered'}, - forced:true, - silent:true, - popup:false, - charlotte:true, - filter:function(event,player){ - return event.card.name=='sha'&&event.card.storage&&event.card.storage.mougong_buffed&&_status.mougong_buff['sha'][1]=='require'&&!event.getParent().directHit.contains(event.target); - }, - content:function(){ - if(!trigger.card.storage.mougong_logged){ - game.log(player,'触发了强化杀的效果'); - game.log('#y'+get.translation(trigger.card),'需要额外使用一张','#y【闪】','响应'); - trigger.card.storage.mougong_logged=true; - } - var id=trigger.target.playerid; - var map=trigger.getParent().customArgs; - if(!map[id]) map[id]={}; - if(typeof map[id].shanRequired=='number'){ - map[id].shanRequired++; - } - else{ - map[id].shanRequired=2; - } - }, - ai:{ - directHit_ai:true, - skillTagFilter:function(player,tag,arg){ - if(arg.card.name!='sha'||(arg.card&&arg.card.storage&&!arg.card.storage.mougong_buffed)||(arg.target.countCards('h','shan')>=1&&!arg.target.storage.mougong_nuqi)) return false; - }, - }, - }, - shan:{ - trigger:{ - player:'shanEnd', - }, - forced:true, - silent:true, - popup:false, - charlotte:true, - filter:function(event,player){ - return event.getParent(3).name=='sha'&&event.getParent().card.storage&&event.getParent().card.storage.mougong_buffed&&_status.mougong_buff['shan'][1]=='double'; - }, - content:function(event,player){ - if(!trigger.card.storage.mougong_logged){ - game.log(player,'触发了强化闪的效果'); - game.log('#y'+get.translation(trigger.card),'视为两张','#y【闪】','的效果'); - trigger.card.storage.mougong_logged=true; - } - if(trigger.getParent(3).shanRequired) trigger.getParent(3).shanRequired--; - } - }, - damage:{ - trigger:{player:'damageBegin1'}, - forced:true, - silent:true, - popup:false, - charlotte:true, - filter:function(event,player){ - if(!event.card) return false; - var names=Object.keys(_status.mougong_buff),name=event.card.name; - return names.contains(name)&&event.getParent(2).player==event.source&&event.card.storage&&event.card.storage.mougong_buffed&&_status.mougong_buff[name][1]=='damage'; - }, - content:function(){ - if(!trigger.card.storage.mougong_logged){ - game.log(player,'触发了强化'+get.translation(trigger.card.name)+'的效果'); - game.log('#y'+get.translation(trigger.card),'造成的伤害','#y+1'); - trigger.card.storage.mougong_logged=true; - } - trigger.num++; - } - }, - tao:{ - trigger:{player:'useCard'}, - filter:function(event,player){ - return event.card.name=='tao'&&event.card.storage&&event.card.storage.mougong_buffed&&_status.mougong_buff['tao'][1]=='double'; - }, - forced:true, - silent:true, - popup:false, - charlotte:true, - content:function(){ - if(!trigger.card.storage.mougong_logged){ - game.log(player,'触发了强化桃的效果'); - game.log('#y'+get.translation(trigger.card),'的回复值','#y+1'); - trigger.card.storage.mougong_logged=true; - } - if(!trigger.baseDamage) trigger.baseDamage=1; - trigger.baseDamage++; - }, - } - } - }, - mougong_expose:{ + stratagem_expose:{ trigger:{player:'useCard'}, forced:true, silent:true, @@ -4087,7 +3891,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ if(event.targets[0]==player) return false; return event.targets.length==1&&event.targets[0]&&((player.storage.zhibi.contains(event.targets[0])||event.targets[0].identityShown) || - game.players.slice().concat(game.dead).filter(current=>(current.storage.mougong_showFan||current.storage.mougong_showZhu)&¤t.identityShown&¤t.storage.zhibi_for.contains(event.targets[0])).length); + game.players.slice().concat(game.dead).filter(current=>(current.storage.stratagem_show_fan||current.storage.stratagem_show_zhu)&¤t.identityShown&¤t.storage.zhibi_for.contains(event.targets[0])).length); }, content:function(){ if(!trigger.targets[0].storage.zhibi_for) trigger.targets[0].storage.zhibi_for=[]; @@ -4095,7 +3899,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ } }, - mougong_shanAi:{ + stratagem_shan_ai:{ trigger:{ player:'chooseToUseBegin', }, @@ -4125,7 +3929,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ var target=_status.event.player; var evt=_status.event.getParent(2); var bool=true; - if(_status.event.getParent().shanRequired>1&&!get.is.object(card)&&(target.countCards('h','shan')<_status.event.getParent().shanRequired&&!(target.storage.mougong_nuqi>=1&&target.countCards('h','shan')==1&&_status.event.getParent().shanRequired<=2))){ + if(_status.event.getParent().shanRequired>1&&!get.is.object(card)&&(target.countCards('h','shan')<_status.event.getParent().shanRequired&&!(target.storage.stratagem_fury>=1&&target.countCards('h','shan')==1&&_status.event.getParent().shanRequired<=2))){ bool=false; } else if(target.hasSkillTag('useShan')){ @@ -4139,7 +3943,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ }).set('shanRequired',evt.shanRequired); }, }, - mougong_cardEffect:{ + stratagem_card_effect:{ trigger:{ player:['useCard1'], }, @@ -4148,12 +3952,12 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ forced:true, charlotte:true, filter:function(event,player,name){ - return event.card&&event.card.storage&&event.card.storage.mougong_buffed&&event.cards.length; + return event.card&&event.card.storage&&event.card.storage.stratagemBuffed&&event.cards.length; }, content:function(){ game.broadcastAll(function(cards){ for(var i of cards){ - i.clone.classList.add('mougong_nuqi_glow'); + i.clone.classList.add('stratagem-fury-glow'); } },trigger.cards); }