diff --git a/character/sb.js b/character/sb.js index 56a0eb4da..cdd1fc31a 100644 --- a/character/sb.js +++ b/character/sb.js @@ -5,6 +5,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ name:'sb', connect:true, character:{ + sb_caopi:['male','wei',3,['sbxingshang','sbfangzhu','sbsongwei'],['zhu']], sb_guanyu:['male','shu',4,['sbwusheng','sbyijue']], sb_huangyueying:['female','shu',3,['sbjizhi','sbqicai']], sb_sp_zhugeliang:['male','shu',3,['sbhuoji','sbkanpo']], @@ -55,6 +56,384 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, skill:{ + //曹丕 + sbxingshang:{ + audio:2, + trigger:{global:['die','damageEnd']}, + usable:1, + forced:true, + locked:false, + async content(event,trigger,player){ + player.addMark('sbxingshang',1); + }, + marktext:'颂', + intro:{ + name:'颂', + content:'mark', + }, + ai:{threaten:2.5}, + group:'sbxingshang_use', + subSkill:{ + use:{ + audio:'sbxingshang', + enable:'phaseUse', + filter:function(event,player){ + return game.hasPlayer(target=>{ + if(player.countMark('sbxingshang')>1) return true; + return target.isLinked()||target.isTurnedOver(); + }); + }, + usable:1, + chooseButton:{ + dialog:function(){ + var dialog=ui.create.dialog( + '行殇:请选择你要执行的一项', + [[ + [1,' ⒈复原一名角色的武将牌 '], + [2,' ⒉令一名角色摸'+Math.min(5,Math.max(1,game.dead.length))+'张牌 '], + ],'tdnodes'], + [[ + [3,' ⒊令一名体力上限小于10的角色加1点体力上限并回复1点体力,然后随机恢复一个被废除的装备栏 '], + ],'tdnodes'], + [[ + [4,' ⒋获得一名已阵亡角色的所有技能,然后失去武将牌上的所有技能 '], + ],'tdnodes'] + ); + return dialog; + }, + filter:function(button,player){ + if(button.link>player.countMark('sbxingshang')) return false; + switch(button.link){ + case 1: + return game.hasPlayer(target=>target.isLinked()||target.isTurnedOver()); + case 2: + return true; + case 3: + return game.hasPlayer(target=>target.maxHp<10); + case 4: + return game.dead.length; + } + }, + check:function(button){ + let player=_status.event.player; + switch(button.link){ + case 1: + return game.filterPlayer(current=>get.attitude(player,current)>0).reduce((list,target)=>{ + let num=0; + if(target.isLinked()) num+=0.5; + if(target.isTurnedOver()) num+=10; + return list.push(num); + },[]).sort((a,b)=>b-a)[0]; + case 2: + return Math.min(5,Math.max(1,game.dead.length)); + case 3: + return game.filterPlayer().reduce((list,target)=>list.push(get.recoverEffect(target,player,player)),[]).sort((a,b)=>b-a)[0]; + case 4: + return game.dead.reduce((list,target)=>{ + let num=0; + if(target.name&&lib.character[target.name]) num+=get.rank(target.name,true); + if(target.name2&&lib.character[target.name2]) num+=get.rank(target.name2,true); + return list.push(num); + },[]).sort((a,b)=>b-a)[0]; + } + }, + backup:function(links,player){ + return { + num:links[0], + audio:'sbxingshang', + filterTarget:function(card,player,target){ + switch(lib.skill.sbxingshang_use_backup.num){ + case 1: + return target=>target.isLinked()||target.isTurnedOver(); + case 2: + return true; + case 3: + return target.maxHp<10; + case 4: + return target==player; + } + }, + selectTarget:()=>lib.skill.sbxingshang_use_backup.num==4?-1:1, + async content(event,trigger,player){ + const target=event.targets[0]; + const num=lib.skill.sbxingshang_use_backup.num; + player.removeMark('sbxingshang',num); + switch(num){ + case 1: + if(target.isLinked()) target.link(false); + if(target.isTurnedOver()) target.turnOver(); + break; + case 2: + target.draw(Math.min(5,Math.max(1,game.dead.length))); + break; + case 3: + target.gainMaxHp(); + target.recover(); + let list=[]; + for (let i=1;i<=5;i++){ + if(target.hasDisabledSlot(i)) list.push('equip'+i); + } + if(list.length) target.enableEquip(list.randomGet()); + break; + case 4: + let map={}; + game.dead.forEach(target=>map[target.playerid]=get.translation(target)); + const {result:{control}}=await player.chooseControl(Object.values(map)).set('ai',()=>{ + const getNum=(target)=>{ + let num=0; + if(target.name&&lib.character[target.name]) num+=get.rank(target.name,true); + if(target.name2&&lib.character[target.name2]) num+=get.rank(target.name2,true); + return num; + }; + let controls=_status.event.controls.slice(); + controls=controls.map(name=>[name,game.dead.find(target=>_status.event.map[target.playerid]==name)]); + controls.sort((a,b)=>getNum(b[1])-getNum(a[1])); + return controls[0][0]; + }).set('prompt','获得一名已阵亡角色的所有技能').set('map',map); + if(control){ + const target2=game.dead.find(target=>map[target2.playerid]==control); + player.line(target2); + game.log(player,'选择了',target2); + const skills=target2.getStockSkills(true,true); + const skills2=player.getStockSkills(true,true); + player.addSkillLog(skills); + player.removeSkillLog(skills2); + } + } + }, + ai:{ + result:{ + target:function(player,target){ + switch(lib.skill.sbxingshang_use_backup.num){ + case 1: + let num=0; + if(target.isLinked()) num+=0.5; + if(target.isTurnedOver()) num+=10; + return num; + case 2: + return 1; + case 3: + return get.recoverEffect(target,player,player); + case 4: + return 1; + } + }, + }, + }, + } + }, + prompt:function(links,player){ + switch(links[0]){ + case 1: + return '复原一名角色的武将牌'; + case 2: + return '令一名角色摸'+get.cnNumber(Math.min(5,Math.max(1,game.dead.length)))+'张牌'; + case 3: + return '令一名体力上限小于10的角色加1点体力上限并回复1点体力,然后随机恢复一个被废除的装备栏'; + case 4: + return '获得一名已阵亡角色的所有技能,然后失去武将牌上的所有技能'; + } + } + }, + ai:{ + order:9, + result:{player:1}, + }, + }, + use_backup:{}, + }, + }, + sbfangzhu:{ + audio:2, + enable:'phaseUse', + filter:function(event,player){ + return player.countMark('sbxingshang')>1; + }, + usable:1, + chooseButton:{ + dialog:function(){ + var dialog=ui.create.dialog('放逐:请选择你要执行的一项','hidden'); + dialog.add([[ + [1,'移去2个“颂”标记,令一名其他角色的非Charlotte技能失效直到其回合结束'], + [2,'移去2个“颂”标记,令一名其他角色不能响应除其外的角色使用的牌直到其回合结束'], + [3,'移去3个“颂”标记,令一名其他角色将武将牌翻面'], + [4,'移去3个“颂”标记,令一名其他角色只能使用你选择的一种类型的牌直到其回合结束'] + ],'textbutton']); + return dialog; + }, + filter:function(button,player){ + if(button.link==4) return game.hasPlayer(target=>target!=player&&!target.hasSkill('sbfangzhu_ban')); + return true; + }, + check:function(button){ + let player=_status.event.player; + switch(button.link){ + case 1: + return game.filterPlayer(current=>get.attitude(player,current)<0).reduce((list,target)=>{ + let num=0; + if(target.name&&lib.character[target.name]) num+=get.rank(target.name,true); + if(target.name2&&lib.character[target.name2]) num+=get.rank(target.name2,true); + return list.push(num); + },[]).sort((a,b)=>b-a)[0]; + case 2: + return 0; + case 3: + return game.filterPlayer(target=>target!=player&&!target.hasSkill('sbfangzhu_ban')).reduce((list,target)=>{ + if(get.attitude(player,target)>0&&target.isTurnedOver()) return list.push(10*target.countCards('hs')+1); + if(get.attitude(player,target)<0&&!target.isTurnedOver()) return list.push(5*target.countCards('hs')+1); + return list.push(0); + },[]).sort((a,b)=>b-a)[0]; + case 4: + return 0; + } + }, + backup:function(links,player){ + return { + num:links[0], + audio:'sbfangzhu', + filterTarget:lib.filter.notMe, + async content(event,trigger,player){ + const target=event.target; + const num=lib.skill.sbfangzhu_backup.num; + player.removeMark('sbxingshang',num>2?3:2); + switch(num){ + case 1: + target.removeSkill('baiban'); + target.addTempSkill('baiban',{player:'phaseEnd'}); + break; + case 2: + target.addTempSkill('sbfangzhu_kill',{player:'phaseEnd'}); + break; + case 3: + target.turnOver(); + break; + case 4: + const {result:{control}}=await player.chooseControl('basic','trick','equip').set('ai',()=>'equip').set('prompt','放逐:请选择'+get.translation(target)+'仅能使用的类别的牌'); + if(control){ + player.line(target); + player.popup(get.translation(control)+'牌'); + target.addTempSkill('sbfangzhu_ban',{player:'phaseEnd'}); + target.markAuto('sbfangzhu_ban',[control]); + } + } + }, + ai:{ + result:{ + target:function(player,target){ + switch(lib.skill.sbfangzhu_backup.num){ + case 1: + let num=0; + if(target.name&&lib.character[target.name]) num+=get.rank(target.name,true); + if(target.name2&&lib.character[target.name2]) num+=get.rank(target.name2,true); + return num; + case 2: + return 0; + case 3: + if(get.attitude(player,target)>0&&target.isTurnedOver()) return 10*target.countCards('hs')+1; + if(get.attitude(player,target)<0&&!target.isTurnedOver()) return -5*target.countCards('hs')+1; + return 0; + case 4: + return 0; + } + }, + }, + }, + } + }, + prompt:function(links,player){ + switch(links[0]){ + case 1: + return '移去2个“颂”标记,令一名其他角色的非Charlotte技能失效直到其回合结束'; + case 2: + return '移去2个“颂”标记,令一名其他角色不能响应除其外的角色使用的牌直到其回合结束'; + case 3: + return '移去3个“颂”标记,令一名其他角色将武将牌翻面'; + case 4: + return '移去3个“颂”标记,令一名其他角色只能使用你选择的一种类型的牌直到其回合结束'; + } + } + }, + ai:{ + order:9, + result:{player:1}, + }, + subSkill:{ + backup:{}, + kill:{ + charlotte:true, + mark:true, + marktext:'禁', + intro:{content:'不能响应其他角色使用的牌'}, + trigger:{global:'useCard1'}, + filter:function(event,player){ + return event.player!=player; + }, + forced:true, + popup:false, + async content(event,trigger,player){ + trigger.directHit.add(player); + }, + }, + ban:{ + charlotte:true, + onremove:true, + mark:true, + marktext:'禁', + intro:{ + markcount:()=>0, + content:'只能使用$牌', + }, + mod:{ + cardEnabled:function(card,player){ + if(!player.getStorage('sbfangzhu_ban').includes(get.type2(card))) return false; + }, + cardSavable:function(card,player){ + if(!player.getStorage('sbfangzhu_ban').includes(get.type2(card))) return false; + }, + }, + }, + }, + }, + sbsongwei:{ + audio:2, + trigger:{player:'phaseUseBegin'}, + filter:function(event,player){ + return game.hasPlayer(target=>target.group=='wei'&&target!=player); + }, + zhuSkill:true, + forced:true, + locked:false, + async content(event,trigger,player){ + player.addMark('sbxingshang',game.countPlayer(target=>target.group=='wei'&&target!=player)); + }, + group:'sbsongwei_delete', + subSkill:{ + delete:{ + audio:'sbsongwei', + enable:'phaseUse', + filter:function(event,player){ + return game.hasPlayer(target=>lib.skill.sbsongwei.subSkill.delete.filterTarget(null,player,target)); + }, + filterTarget:function(card,player,target){ + return target!=player&&target.group=='wei'&&target.getStockSkills(false,true).length; + }, + skillAnimation:true, + animationColor:'thunder', + async content(event,trigger,player){ + player.awakenSkill('sbsongwei_delete'); + event.target.removeSkillLog(event.target.getStockSkills(false,true)); + }, + ai:{ + order:13, + result:{ + target:function(player,target){ + return -target.getStockSkills(false,true).length; + }, + }, + }, + }, + }, + }, //关羽 //矢 sbwusheng:{ @@ -254,19 +633,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, filter:function(event,player){ - if(!game.hasPlayer(target=>target!=player&&target.hasEmptySlot(2))) return false; return player.countCards('h',card=>lib.skill.sbqicai.filterCardx(card,player))||event.sbqicai&&event.sbqicai.length; }, filterCardx:function(card,player){ - if(player.getStorage('sbqicai').includes(card.name)) return false; - return get.type(card)=='equip'&&get.subtype(card)=='equip2'; + //if(player.getStorage('sbqicai').includes(card.name)) return false; + return get.type(card)=='equip'&&get.hasPlayer(target=>target!=player&&target.hasEmptySlot(get.subtype(card))); }, usable:1, chooseButton:{ dialog:function(event,player){ const list1=player.getCards('h',card=>lib.skill.sbqicai.filterCardx(card,player)); const list2=event.sbqicai; - var dialog=ui.create.dialog('###奇才###