Merge pull request #874 from copcap/dev

谋荀彧
This commit is contained in:
Spmario233 2024-01-28 22:49:45 +08:00 committed by GitHub
commit 6cbf56a7b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 363 additions and 1 deletions

View File

@ -662,6 +662,7 @@ window.noname_character_rank={
'jsrg_simayi', 'jsrg_simayi',
'jsrg_zhaoyun', 'jsrg_zhaoyun',
'jsrg_zhangxuan', 'jsrg_zhangxuan',
'sb_xunyu',
], ],
bp:[ bp:[
'xin_huojun', 'xin_huojun',

View File

@ -5,6 +5,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
name:'sb', name:'sb',
connect:true, connect:true,
character:{ character:{
sb_xunyu:['male','wei',3,['sbquhu','sbjieming']],
sb_caopi:['male','wei',3,['sbxingshang','sbfangzhu','sbsongwei'],['zhu']], sb_caopi:['male','wei',3,['sbxingshang','sbfangzhu','sbsongwei'],['zhu']],
sb_guanyu:['male','shu',4,['sbwusheng','sbyijue']], sb_guanyu:['male','shu',4,['sbwusheng','sbyijue']],
sb_huangyueying:['female','shu',3,['sbjizhi','sbqicai']], sb_huangyueying:['female','shu',3,['sbjizhi','sbqicai']],
@ -56,6 +57,360 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
}, },
skill:{ skill:{
//荀彧
sbquhu:{
audio:2,
enable:'phaseUse',
usable:1,
filter(event,player){
return game.countPlayer(current=>lib.skill.sbquhu.filterTarget(null,player,current))>1;
},
filterTarget(card,player,target){
return player!=target&&target.countCards('he');
},
selectTarget:2,
multitarget:true,
multiline:true,
async content(event,trigger,player){
const targets=[player].addArray(event.targets);
targets.sortBySeat();
const {result}=await player.chooseCardOL(targets,'he',[1,Infinity],true,'驱虎:请将任意张牌扣置于武将牌上').set('ai',card=>{
const player=get.event().getParent(2).player;
let value=5;
if(get.player()==player) value-=0.5;
return value-get.useful(card);
});
const lose_list=[];
const map=new Map();
let myCards;
let minLength=Infinity;
for(let i=0;i<result.length;i++){
const current=targets[i],cards=result[i].cards;
if(current==player) myCards=cards;
else if(cards.length<minLength) minLength=cards.length;
lose_list.push([current,cards]);
map.set(current.playerid,cards);
}
await game.loseAsync({
lose_list,
log:true,
animate:'giveAuto',
gaintag:['sbquhu'],
}).setContent(lib.skill.sbquhu.addToExpansionMultiple);
await game.asyncDelay(1.5);
const isMin=minLength>myCards.length;
const sortedList=lose_list.filter(list=>list[0]!=player).sort((a,b)=>{
return 1000*(b[1].length-a[1].length)+(get.distance(player,a[0],'absolute')-get.distance(player,b[0],'absolute'));
});
const mostPlayer=sortedList[0][0],secondPlayer=sortedList[1][0];
await new Promise(resolve=>{
game.broadcastAll(lose_list=>{
lose_list.forEach(list=>list[0].prompt(`${get.cnNumber(list[1].length)}`,'wood'));
},lose_list);
setTimeout(()=>{
game.broadcastAll(lose_list=>{
lose_list.forEach(list=>list[0].unprompt());
},lose_list);
resolve();
},2000/(lib.config.speed=='vvfast'?3:1));
});
if(isMin){
await mostPlayer.gain(myCards,'give',player);
await game.asyncDelay();
const gain_list=lose_list.filter(list=>list[0]!=player);
game.loseAsync({
gain_list,
animate:'draw',
}).setContent('gaincardMultiple');
}
else{
mostPlayer.line(secondPlayer,'thunder');
await secondPlayer.damage(mostPlayer);
await game.asyncDelay();
await mostPlayer.gain(myCards,'give',player);
await game.asyncDelay();
await game.loseAsync({
lose_list:sortedList,
}).setContent(()=>{
for(var i=0;i<event.lose_list.length;i++){
var current=event.lose_list[i][0],cards=event.lose_list[i][1];
var next=current.lose(cards,ui.discardPile);
current.$throw(cards);
game.log(current,'将',cards,'置入了弃牌堆');
next.set('relatedEvent',event.getParent());
next.set('getlx',false);
}
});
await game.asyncDelayx();
}
},
addToExpansionMultiple(){
"step 0"
if(event.animate=='give') event.visible=true;
event.type='addToExpansion';
if(!event.gaintag) event.gaintag=[];
if(event.lose_list){
var map={},map2={};
for(var list of event.lose_list){
var player=list[0],cards=list[1];
var myId=player.playerid;
if(!map2[myId]) map2[myId]=[];
for(var i of cards){
var owner=get.owner(i,'judge');
if(owner&&(owner!=player||get.position(i)!='x')){
var id=owner.playerid;
if(!map[id]) map[id]=[[],[],[]];
map[id][0].push(i);
map2[myId].push(i);
var position=get.position(i);
if(position=='h') map[id][1].push(i);
else map[id][2].push(i);
}
else if(!event.updatePile&&get.position(i)=='c') event.updatePile=true;
}
}
event.losing_map=map;
event.gaining_map=map2;
for(var i in map){
var owner=(_status.connectMode?lib.playerOL:game.playerMap)[i];
var next=owner.lose(map[i][0],ui.special).set('forceDie',true).set('getlx',false);
next.set('relatedEvent',event.getParent());
next.set('forceDie',true);
next.set('getlx',false);
if(event.visible==true) next.set('visible',true);
}
}
else {
event.finish();
}
"step 1";
if(event.lose_list){
var map={};
for(var list of event.lose_list){
var player=list[0],cards=list[1];
for(var i=0;i<cards.length;i++){
if(cards[i].willBeDestroyed('expansion',player,event)){
cards[i].selfDestroy(event);
cards.splice(i--,1);
}
else if(event.losing_map){
for(var id in event.losing_map){
if(event.losing_map[id][0].includes(cards[i])){
var source=(_status.connectMode?lib.playerOL:game.playerMap)[id];
var hs=source.getCards('hejsx');
if(hs.includes(cards[i])){
cards.splice(i--,1);
}
}
}
}
}
}
}
if(cards.length==0){
event.finish();
return;
}
"step 2";
for(var j in event.gaining_map){
var map={};
var player=(_status.connectMode?lib.playerOL:game.playerMap)[j],cards=event.gaining_map[j];
var hs=player.getCards('x');
for(var i=0;i<cards.length;i++){
if(hs.includes(cards[i])){
cards.splice(i--,1);
}
}
for(var num=0;num<cards.length;num++){
if(_status.discarded){
_status.discarded.remove(cards[num]);
}
for(var num2=0;num2<cards[num].vanishtag.length;num2++){
if(cards[num].vanishtag[num2][0]!='_'){
cards[num].vanishtag.splice(num2--,1);
}
}
}
if(event.animate=='draw'){
player.$draw(cards.length);
if(event.log) game.log(player,'将',get.cnNumber(cards.length),'张牌置于了武将牌上');
game.pause();
setTimeout((player,cards)=>{
player.$addToExpansion(cards,null,event.gaintag);
for(var i of event.gaintag) player.markSkill(i);
game.resume();
},get.delayx(500,500),player,cards);
}
else if(event.animate=='gain'){
player.$gain(cards,false);
game.pause();
setTimeout((player,cards)=>{
player.$addToExpansion(cards,null,event.gaintag);
for(var i of event.gaintag) player.markSkill(i);
game.resume();
},get.delayx(700,700),player,cards);
}
else if(event.animate=='gain2'||event.animate=='draw2'){
var gain2t=300;
if(player.$gain2(cards)&&player==game.me){
gain2t=500;
}
game.pause();
setTimeout((player,cards)=>{
player.$addToExpansion(cards,null,event.gaintag);
for(var i of event.gaintag) player.markSkill(i);
game.resume();
},get.delayx(gain2t,gain2t),player,cards);
}
else if(event.animate=='give'||event.animate=='giveAuto'){
var evtmap=event.losing_map;
var entries=Object.entries(evtmap).map(entry=>[entry[0],entry[1][0]]);
var getOwner=(card)=>{
var entry=entries.find(entry=>entry[1].includes(card));
if(entry) return (_status.connectMode?lib.playerOL:game.playerMap)[entry[0]];
return null;
};
var gainmap={};
for(var cardx of cards){
var owner=getOwner(cardx);
if(owner){
var id=owner.playerid;
if(!gainmap[id]) gainmap[id]=[];
gainmap[id].push(cardx);
}
}
if(event.animate=='give'){
for(var i in gainmap){
var source=(_status.connectMode?lib.playerOL:game.playerMap)[i];
source.$give(evtmap[i][0],player,false);
if(event.log) game.log(player,'将',evtmap[i][0],'置于了武将牌上');
}
}
else{
for(var i in gainmap){
var source=(_status.connectMode?lib.playerOL:game.playerMap)[i];
if(evtmap[i][1].length){
source.$giveAuto(evtmap[i][1],player,false);
if(event.log) game.log(player,'将',get.cnNumber(evtmap[i][1].length),'张牌置于了武将牌上');
}
if(evtmap[i][2].length){
source.$give(evtmap[i][2],player,false);
if(event.log) game.log(player,'将',evtmap[i][2],'置于了武将牌上');
}
}
}
game.pause();
setTimeout((player,cards)=>{
player.$addToExpansion(cards,null,event.gaintag);
for(var i of event.gaintag) player.markSkill(i);
game.resume();
},get.delayx(500,500),player,cards);
}
else if(typeof event.animate=='function'){
var time=event.animate(event);
game.pause();
setTimeout((player,cards)=>{
player.$addToExpansion(cards,null,event.gaintag);
for(var i of event.gaintag) player.markSkill(i);
game.resume();
},get.delayx(time,time),player,cards);
}
else{
player.$addToExpansion(cards,null,event.gaintag);
for(var i of event.gaintag) player.markSkill(i);
event.finish();
}
}
"step 3";
game.delayx();
if(event.updatePile) game.updateRoundNumber();
},
intro:{
markcount:'expansion',
mark(dialog,storage,player){
const cards=player.getExpansions('sbquhu');
if(player.isUnderControl(true)) dialog.addAuto(cards);
else return '共有'+get.cnNumber(cards.length)+'张牌';
},
},
ai:{
order:3.5,
result:{
target(player,target){
let sgn=1,preAtt=0;
if(ui.selected.targets.length){
const selected=ui.selected.targets[0];
preAtt=get.attitude(player,selected);
if(preAtt>0) sgn=-1;
}
let eff=0.4*target.countCards('h',card=>{
return 5-get.useful(card);
})-1;
if(get.attitude(player,target)>0&&sgn<0||get.attitude(player,target)<0&&preAtt<0) eff=-Math.abs(eff);
return eff;
},
}
}
},
sbjieming:{
audio:2,
trigger:{
player:'damageEnd',
},
direct:true,
async content(event,trigger,player){
let num=Math.max(1,player.getDamagedHp());
const {result:{bool,targets}}=await player.chooseTarget(get.prompt('sbjieming'),`令一名角色摸三张牌,然后其可以弃置任意张牌。若其弃置的牌数小于${get.cnNumber(num)}你失去1点体力。`).set('ai',target=>{
if(get.event('nope')) return 0;
const player=get.player(),att=get.attitude(player,target);
if(att>2){
const num=Math.sqrt(Math.min(5,Math.max(1,target.countCards('he',card=>get.value(card)<5.5))));
return num*att;
}
return att/3;
}).set('nope',(player.getHp()+player.countCards('hs',card=>player.canSaveCard(card,player))<=1)&&num>3);
if(!bool) return;
const target=targets[0];
player.logSkill('sbjieming',target);
await target.draw(3);
num=Math.max(1,player.getDamagedHp());
const {result:{bool:bool2,cards}}=await target.chooseToDiscard('节命:是否弃置任意张牌?',`若你本次弃置的牌数小于${get.cnNumber(num)}张,${get.translation(player)}失去1点体力。`,[1,Infinity]).set('ai',card=>{
if(get.event('nope')) return 0;
if(ui.selected.cards.length>=get.event('num')) return 0;
return 5.5-get.value(card);
}).set('nope',get.attitude(target,player)*get.effect(player,{name:'losehp'},player,target)>=0).set('num',num);
if(!bool2||cards.length<num) player.loseHp();
},
ai:{
maixie:true,
maixie_hp:true,
effect:{
target(card,player,target,current){
if(get.tag(card,'damage')&&target.hp>1){
if(player.hasSkillTag('jueqing',false,target)) return [1,-2];
if(!target.hasFriend()) return;
let max=0;
const num=Math.max(1,player.getDamagedHp());
if(num>3) return 2;
const players=game.filterPlayer();
for(const current of players){
if(get.attitude(target,current)>0){
max=Math.max(current.countCards('he'),max);
}
}
switch(max){
case 0:return 2;
case 1:return 1.5;
case 2:return [1,2];
default:return [0,max];
}
}
if((card.name=='tao'||card.name=='caoyao')&&
target.hp>1&&target.countCards('h')<=target.hp) return [0,0];
},
},
},
},
//曹丕 //曹丕
sbxingshang:{ sbxingshang:{
audio:2, audio:2,
@ -6371,6 +6726,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
sbfangzhu_info:'出牌阶段限一次你可以1.移去2个“颂”标记令一名其他角色的非Charlotte技能失效直到其回合结束2.移去2个“颂”标记令一名其他角色不能响应除其以外的角色使用的牌直到其回合结束3.移去3个“颂”标记令一名其他角色将武将牌翻面4.移去3个“颂”标记令一名其他角色只能使用你选择的一种类型的牌直到其回合结束。', sbfangzhu_info:'出牌阶段限一次你可以1.移去2个“颂”标记令一名其他角色的非Charlotte技能失效直到其回合结束2.移去2个“颂”标记令一名其他角色不能响应除其以外的角色使用的牌直到其回合结束3.移去3个“颂”标记令一名其他角色将武将牌翻面4.移去3个“颂”标记令一名其他角色只能使用你选择的一种类型的牌直到其回合结束。',
sbsongwei:'颂威', sbsongwei:'颂威',
sbsongwei_info:'主公技。①出牌阶段开始时你获得Y个“颂”标记Y为场上其他魏势力角色数。②每局游戏限一次出牌阶段你可以令一名其他魏势力角色失去所有武将牌的技能。', sbsongwei_info:'主公技。①出牌阶段开始时你获得Y个“颂”标记Y为场上其他魏势力角色数。②每局游戏限一次出牌阶段你可以令一名其他魏势力角色失去所有武将牌的技能。',
sb_xunyu:'谋荀彧',
sb_xunyu_prefix:'谋',
sbquhu:'驱虎',
sbquhu_info:'出牌阶段限一次。你可以选择两名有牌的其他角色你与这些角色同时将任意张牌扣置于武将牌上。若你以此法扣置的牌唯一最少则扣置牌最多的其他角色获得你扣置的牌且这些角色获得各自扣置的牌否则这两名角色中扣置牌较多的角色对较少的角色造成1点伤害获得你扣置的牌然后这些角色将各自扣置的牌置入弃牌堆若这两名角色扣置的牌数相同视为与你逆时针最近座次的角色扣置牌较多。',
sbjieming:'节命',
sbjieming_info:'当你受到伤害后你可以令一名角色摸三张牌然后其可以弃置任意张牌。若其弃置的牌数小于X你失去1点体力X为你已损失的体力值至少为1。',
sb_zhi:'谋攻篇·知', sb_zhi:'谋攻篇·知',
sb_shi:'谋攻篇·识', sb_shi:'谋攻篇·识',

View File

@ -7722,7 +7722,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
yuji:['xin_yuji','re_yuji','yuji'], yuji:['xin_yuji','re_yuji','yuji'],
zhangjiao:['sp_zhangjiao','re_zhangjiao','sb_zhangjiao','zhangjiao'], zhangjiao:['sp_zhangjiao','re_zhangjiao','sb_zhangjiao','zhangjiao'],
dianwei:['dianwei','ol_dianwei','re_dianwei'], dianwei:['dianwei','ol_dianwei','re_dianwei'],
xunyu:['xunyu','ol_xunyu','re_xunyu'], xunyu:['xunyu','ol_xunyu','re_xunyu','sb_xunyu'],
sp_zhugeliang:['sp_zhugeliang','ol_sp_zhugeliang','re_sp_zhugeliang','sb_sp_zhugeliang'], sp_zhugeliang:['sp_zhugeliang','ol_sp_zhugeliang','re_sp_zhugeliang','sb_sp_zhugeliang'],
pangtong:['pangtong','ol_pangtong','re_pangtong','sb_pangtong'], pangtong:['pangtong','ol_pangtong','re_pangtong','sb_pangtong'],
re_jsp_pangtong:['re_jsp_pangtong','jsrg_pangtong','sp_pangtong'], re_jsp_pangtong:['re_jsp_pangtong','jsrg_pangtong','sp_pangtong'],