import { game } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){
return {
name:'huicui',
connect:true,
character:{
dc_liuli:['male','shu',3,['dcfuli','dcdehua']],
yue_daqiao:['female','wu',3,['dcqiqin','dczixi']],
dc_kongrong:['male','qun',3,['dckrmingshi','lirang']],
dc_sp_menghuo:['male','qun',4,['dcmanwang']],
dc_lingcao:['male','wu','4/5',['dcdufeng']],
yue_xiaoqiao:['female','wu',3,['dcqiqin','dcweiwan']],
dc_dongzhao:['male','wei',3,['dcyijia','dcdingji']],
kuaiqi:['male','wei',3,['dcliangxiu','dcxunjie']],
yue_caiyong:['male','qun',3,['dcjiaowei','dcfeibai']],
pangshanmin:['male','wei',3,['dccaisi','dczhuoli']],
dc_jiachong:['male','wei',3,['dcbeini','dcshizong']],
dc_sunchen:['male','wu',4,['dczigu','dczuowei']],
dc_zhangmancheng:['male','qun',4,['dclvecheng','dczhongji']],
yue_zhoufei:['female','wu',3,['dclingkong','dcxianshu']],
dc_wuban:['male','shu',4,['dcyouzhan'],['clan:陈留吴氏']],
yue_caiwenji:['female','qun',3,['dcshuangjia','dcbeifen']],
liuchongluojun:['male','qun',3,['dcminze','dcjini']],
yuechen:['male','wei',4,['dcporui','dcgonghu']],
zhangkai:['male','qun',4,['dcxiangshu']],
gaoxiang:['male','shu',4,['dcchiying']],
yuanyin:['male','qun',3,['dcmoshou','dcyunjiu']],
dongwan:['female','qun',3,['dcshengdu','dcjieling']],
zhangchu:['female','qun',3,['dcjizhong','dcrihui','dcguangshi']],
peiyuanshao:['male','qun',4,['dcmoyu']],
mengjie:['male','qun',3,['dcyinlu','dcyouqi']],
dc_huojun:['male','shu',4,['dcgue','dcsigong']],
dc_sunhanhua:['female','wu',3,['dchuiling','dcchongxu']],
dc_sunziliufang:['male','wei',3,['dcqinshen','dcweidang']],
yuantanyuanxiyuanshang:['male','qun',4,['dcneifa']],
qiaorui:['male','qun',4,['dcaishou','dcsaowei']],
xianglang:['male','shu',3,['dckanji','dcqianzheng']],
qinlang:['male','wei',4,['dchaochong','dcjinjin']],
furongfuqian:['male','shu','4/6',['dcxuewei','dcyuguan']],
zhenghun:['male','wei',3,['dcqiangzhi','dcpitian']],
dc_zhaotongzhaoguang:['male','shu',4,['yizan_use','dcqingren','dclongyuan']],
dc_huanghao:['male','shu',3,['dcqinqing','huisheng','dccunwei']],
liupi:['male','qun',4,['dcjuying']],
dc_sp_jiaxu:['male','wei',3,['zhenlue','dcjianshu','dcyongdi']],
leibo:['male','qun',4,['dcsilve','dcshuaijie']],
gongsundu:['male','qun',4,['dczhenze','dcanliao']],
panghui:['male','wei',5,['dcyiyong']],
dc_yuejiu:['male','qun',4,['dccuijin']],
chenjiao:['male','wei',3,['dcxieshou','dcqingyan','dcqizi']],
wanglie:['male','qun',3,['dcchongwang','dchuagui']],
chengui:['male','qun',3,['dcyingtu','dccongshi']],
dc_huangquan:['male','shu',3,['dcquanjian','dctujue']],
yinfuren:['female','wei',3,['dcyingyu','dcyongbi']],
dc_lvkuanglvxiang:['male','wei',4,['dcshuhe','dcliehou']],
guanhai:['male','qun',4,['suoliang','qinbao']],
huzhao:['male','qun',3,['midu','xianwang']],
dc_liuba:['male','shu',3,['dczhubi','dcliuzhuan']],
zhangxun:['male','qun',4,['suizheng']],
zongyu:['male','shu',3,['zyqiao','chengshang']],
dc_jiling:['male','qun',4,['dcshuangren']],
dc_yanghu:['male','wei',3,['dcdeshao','dcmingfa']],
caimaozhangyun:['male','wei',4,['lianzhou','jinglan']],
tenggongzhu:['female','wu',3,['xingchong','liunian']],
dc_huangchengyan:['male','qun',3,['dcjiezhen','dczecai','dcyinshi']],
dc_gaolan:['male','qun',4,['xizhen']],
guanning:['male','qun','3/7',['dunshi']],
dc_jiben:['male','qun',3,['xunli','zhishi','lieyi']],
mamidi:['male','qun','4/6',['bingjie','zhengding']],
re_dengzhi:['male','shu',3,['jianliang','weimeng']],
fengxi:['male','wu',3,['yusui','boyan']],
re_miheng:['male','qun',3,['rekuangcai','reshejian']],
re_chendeng:['male','qun',3,['refuyuan','reyingshui','rewangzu']],
wanniangongzhu:['female','qun',3,['zhenge','xinghan']],
re_xunchen:['male','qun',3,['refenglve','anyong'],['clan:颍川荀氏']],
re_kanze:['male','wu',3,['xiashu','rekuanshi']],
lvlingqi:['female','qun',4,['guowu','zhuangrong']],
zhanghu:['male','wei',4,['cuijian','zhtongyuan']],
luyusheng:['female','wu',3,['zhente','zhiwei']],
huaxin:['male','wei',3,['spwanggui','xibing']],
mengyou:['male','qun',5,['manyi','dcmanzhi']],
liuyong:['male','shu',3,['zhuning','fengxiang']],
dc_sunru:['female','wu',3,['xiecui','youxu']],
xiahoulingnv:['female','wei',4,['fuping','weilie']],
zhangyao:['female','wu',3,['yuanyu','xiyan']],
tengyin:['male','wu',3,['chenjian','xixiu']],
zhangxuan:['female','wu',4,['tongli','shezang']],
wangtao:['female','shu',3,['huguan','yaopei']],
wangyue:['female','shu',3,['huguan','mingluan']],
zhaoyan:['female','wu',3,['jinhui','qingman']],
heyan:['male','wei',3,['yachai','qingtan']],
re_sunluyu:['female','wu',3,['remeibu','remumu']],
re_dongbai:['female','qun',3,['relianzhu','rexiahui']],
zhoushan:['male','wu',4,['dcmiyun','dcdanying']],
dc_caiyang:['male','wei',4,['dcxunji','dcjiaofeng']],
xiahoujie:['male','wei',5,['liedan','zhuangdan']],
caoxing:['male','qun',4,['cxliushi','zhanwan']],
re_chunyuqiong:['male','qun',4,['recangchu','reliangying','reshishou']],
xingdaorong:['male','qun','4/6',['xuxie']],
re_panfeng:['male','qun',4,['xinkuangfu']],
jiangfei:['male','shu',3,['dcshengxi','dcshoucheng']],
},
characterSort:{
huicui:{
sp_baigei:['re_panfeng','xingdaorong','caoxing','re_chunyuqiong','xiahoujie','dc_caiyang','zhoushan'],
sp_caizijiaren:['dc_kongrong','re_dongbai','re_sunluyu','heyan','zhaoyan','wangtao','wangyue','zhangxuan','tengyin','zhangyao','xiahoulingnv','dc_sunru','pangshanmin','kuaiqi'],
sp_zhilan:['dc_liuli','liuyong','wanniangongzhu','zhanghu','lvlingqi','tenggongzhu','panghui','dc_zhaotongzhaoguang','yuantanyuanxiyuanshang','yuechen','dc_lingcao'],
sp_guixin:['re_kanze','re_chendeng','caimaozhangyun','dc_lvkuanglvxiang','dc_gaolan','yinfuren','chengui','chenjiao','dc_sp_jiaxu','qinlang','dc_dongzhao'],
sp_daihan:['mamidi','dc_jiling','zhangxun','dc_yuejiu','wanglie','leibo','qiaorui','dongwan','yuanyin'],
sp_jianghu:['guanning','huzhao','dc_huangchengyan','mengjie'],
sp_zongheng:['huaxin','luyusheng','re_xunchen','re_miheng','fengxi','re_dengzhi','dc_yanghu','zongyu'],
sp_taiping:['guanhai','liupi','peiyuanshao','zhangchu','zhangkai','dc_zhangmancheng'],
sp_yanhan:['dc_liuba','dc_huangquan','furongfuqian','xianglang','dc_huojun','gaoxiang','dc_wuban','jiangfei'],
sp_jishi:['dc_jiben','zhenghun','dc_sunhanhua','liuchongluojun'],
sp_raoting:['dc_huanghao','dc_sunziliufang','dc_sunchen','dc_jiachong'],
sp_yijun:['gongsundu','mengyou','dc_sp_menghuo'],
sp_zhengyin:['yue_caiwenji','yue_zhoufei','yue_caiyong','yue_xiaoqiao','yue_daqiao'],
}
},
/** @type { importCharacterConfig['skill'] } */
skill:{
//刘理
dcfuli:{
audio:2,
enable:'phaseUse',
filter(event,player){
return player.getDiscardableCards(player,'h').some(card=>!player.getStorage('dcfuli').includes(get.type2(card)));
},
async content(event,trigger,player){
await player.showHandcards(get.translation(player)+'发动了【抚黎】');
const getNum=(type)=>{
let num=['basic','trick','equip'].indexOf(type);
if(num===-1) num=3;
return num;
};
const types=player.getDiscardableCards(player,'h').filter(card=>{
return !player.getStorage('dcfuli').includes(get.type2(card));
}).reduce((list,card)=>list.add(get.type2(card)),[]).sort((a,b)=>{
return getNum(a)-getNum(b);
});
if(types.length){
const {result:{control}}=await player.chooseControl(types).set('ai',()=>{
const player=get.event('player'),types=get.event('controls').slice();
const getNum=(type)=>{
const cards=player.getDiscardableCards(player,'h').filter(card=>get.type2(card)==type);
const countCards=(target,player,cards)=>{
return target.countCards('h')-(target==player?cards.length:0);
};
const max=game.findPlayer(target=>{
return !game.hasPlayer(target2=>{
return countCards(target2,player,cards)>countCards(target,player,cards);
});
}).countCards('h');
return Math.min(max,cards.reduce((sum,card)=>sum+get.cardNameLength(card),0))/cards.length;
};
return types.sort((a,b)=>{
return getNum(b)-getNum(a);
})[0];
}).set('prompt','弃置一种类别的所有手牌,然后摸这些牌的名字字数之和的牌');
if(control){
if(!player.storage.dcfuli){
player.when({global:'phaseAfter'}).then(()=>delete player.storage.dcfuli);
}
player.markAuto('dcfuli',[control]);
const cards=player.getDiscardableCards(player,'h').filter(card=>get.type2(card)==control);
await player.discard(cards);
const max=game.findPlayer(target=>target.isMaxHandcard()).countCards('h');
const num=Math.min(max,cards.reduce((sum,card)=>sum+get.cardNameLength(card),0));
if(num) await player.draw(num);
if(cards.some(card=>card.name!='shandian'&&get.tag(card,'damage'))){
const {result:{bool,targets}}=await player.chooseTarget('抚黎:是否令一名角色的攻击范围-1直到你的下个回合开始?')
.set('ai',target=>{
const player=get.event('player'),num=target.getAttackRange();
return -get.sgn(get.attitude(player,target))*(target.getAttackRange()+(num<=0?(-num+0.5):num));
});
if(bool){
const target=targets[0];
player.line(target);
target.addSkill('dcfuli_range');
target.addMark('dcfuli_range',1,false);
player.when(['phaseBegin','dieBegin']).then(()=>{
target.removeMark('dcfuli_range',1,false);
if(!target.hasMark('dcfuli_range')) target.removeSkill('dcfuli_range');
}).vars({target:target});
}
}
}
}
},
ai:{
order:1,
result:{
player(player){
const types=player.getDiscardableCards(player,'h').filter(card=>!player.getStorage('dcfuli').includes(get.type2(card)));
if(!types.some(type=>{
const cards=player.getDiscardableCards(player,'h').filter(card=>get.type2(card)==type);
const countCards=(target,player,cards)=>{
return target.countCards('h')-(target==player?cards.length:0);
};
return !game.filterPlayer(target=>{
return !game.hasPlayer(target2=>{
return countCards(target2,player,cards)>countCards(target,player,cards);
});
}).includes(player);
})) return 0;
return 1;
},
},
},
subSkill:{
range:{
charlotte:true,
onremove:true,
mod:{
attackRange(player,num){
return num-player.countMark('dcfuli_range');
},
},
marktext:' - ',
intro:{content:'攻击范围-#'},
},
},
},
dcdehua:{
audio:2,
trigger:{global:'roundStart'},
forced:true,
async content(event,trigger,player){
const list=lib.inpile.filter(name=>{
if(get.type(name)==='delay') return false;
const card=new lib.element.VCard({name:name});
return get.tag(card,'damage')&&player.hasUseTarget(card);
});
if(list.length){
const {result:{bool,links}}=await player.chooseButton(['###德化###
视为使用一张仍可以使用的伤害类卡牌
',[list,'vcard']],true).set('ai',button=>{
const name=button.link[2],player=get.player();
let value=player.getUseValue({name,isCard:true},null,true);
if(player.countCards('h',card=>get.name(card)===name&&player.hasUseTarget(card))) value/=3;
if(name==='sha') value/=2;
if(player.getStorage('dcdehua').includes('sha')) value=Math.max(0.1,value);
return value;
});
if(bool){
const name=links[0][2],card=new lib.element.VCard({name:name});
await player.chooseUseTarget(card,true);
player.markAuto('dcdehua',[name]);
}
}
if(!lib.inpile.some(name=>{
if(get.type(name)==='delay') return false;
const card=new lib.element.VCard({name:name});
return get.tag(card,'damage')&&!player.getStorage('dcdehua').includes(name);
})) player.removeSkillLog('dcdehua');
},
mod:{
maxHandcard(player,num){
return num+player.getStorage('dcdehua').length;
},
cardEnabled(card,player){
if(player.getStorage('dcdehua').includes(card.name)&&(get.position(card)=='h'||card.cards&&card.cards.some(i=>get.position(i)=='h'))) return false;
},
cardSavable(card,player){
if(player.getStorage('dcdehua').includes(card.name)&&(get.position(card)=='h'||card.cards&&card.cards.some(i=>get.position(i)=='h'))) return false;
},
aiValue(player,card){
if(player.getStorage('dcdehua').includes(get.name(card))) return 0;
},
aiUseful(){
return lib.skill.dcdehua.mod.aiValue.apply(this,arguments);
},
},
intro:{
content(storage){
return '手牌上限+'+storage.length+'
不能从手牌中使用'+get.translation(storage);
},
},
},
//蒋琬费祎
dcshengxi:{
inherit:'reshengxi',
trigger:{player:'phaseDiscardEnd'},
},
dcshoucheng:{
audio:'shoucheng',
global:'dcshoucheng_ai',
trigger:{
global:['equipAfter','addJudgeAfter','loseAfter','gainAfter','loseAsyncAfter','addToExpansionAfter'],
},
filter(event,player){
const target=_status.currentPhase;
return game.hasPlayer(current=>{
if(target&¤t==target) return false;
let evt=event.getl(current);
return evt&&evt.hs&&evt.hs.length&¤t.countCards('h')==0;
});
},
direct:true,
async content(event,trigger,player){
const targetx=_status.currentPhase;
const targets=game.filterPlayer(current=>{
if(targetx&¤t==targetx) return false;
let evt=trigger.getl(current);
return evt&&evt.hs&&evt.hs.length&¤t.countCards('h')==0;
}).sortBySeat(targetx||player);
for(const target of targets){
if(!target.isIn()) continue;
const {result:{bool}}=await player.chooseBool(get.prompt2('dcshoucheng',target)).set('choice',get.attitude(player,target)>0);
if(bool){
player.logSkill('dcshoucheng',target);
if(target!=player) player.addExpose(0.2);
target.draw(2);
}
}
},
ai:{
threaten(player,target){
return Math.sqrt(game.countPlayer(i=>{
return get.attitude(target,i)>0;
}));
},
},
subSkill:{
ai:{
ai:{
noh:true,
skillTagFilter(player,tag,arg){
if(player===_status.currentPhase||player.countCards('h')!=1) return false;
return game.hasPlayer(current=>{
return current.hasSkill('dcshoucheng')&&get.attitude(current,player)>0;
});
}
}
}
}
},
//乐大乔
dczixi:{
init(){
game.addGlobalSkill('dczixi_judge');
game.broadcastAll((list)=>{
list.forEach(name=>{
const namex='dczixi_'+name;
if(!lib.card[namex]){
lib.card[namex]={
type:'special_delay',
fullskin:true,
noEffect:true,
wuxieable:false,
};
lib.card[namex].cardimage=name;
lib.translate[namex]=lib.translate[name]+'·姊希';
lib.translate[namex+'_info']='由【姊希】技能创造的无效果【'+lib.translate[name]+'】';
}
});
},lib.skill.dczixi.zixiList);
},
audio:2,
trigger:{player:['phaseUseBegin','phaseUseEnd']},
filter(event,player){
return player.countCards('h',card=>{
return card.hasGaintag('dcqiqin_tag')&&lib.skill.dczixi.zixiList.some(name=>{
return game.hasPlayer(target=>target.canAddJudge(get.autoViewAs({name:'dczixi_'+name},[card])));
});
})>0;
},
zixiList:['lebu','bingliang','shandian'],
direct:true,
async content(event,trigger,player){
const names=lib.skill.dczixi.zixiList.filter(name=>{
return player.countCards('h',card=>{
return card.hasGaintag('dcqiqin_tag')&&game.hasPlayer(target=>target.canAddJudge(get.autoViewAs({name:'dczixi_'+name},[card])));
});
});
let map={};
for(const name of names){
map[get.translation(name)]=name;
}
const {result:{bool,links}}=await player.chooseButton(2,[
'###'+get.prompt('dczixi')+'###将一张“琴”以你选择的牌名置于一名角色的判定区
',
player.getCards('h'),
[Object.keys(map),'tdnodes'],
]).set('filterButton',button=>{
const type=typeof button.link,card=button.link;
if(ui.selected.buttons.length&&type==typeof ui.selected.buttons[0].link) return false;
if(type=='string') return true;
return card.hasGaintag('dcqiqin_tag')&&lib.skill.dczixi.zixiList.some(name=>{
return game.hasPlayer(target=>target.canAddJudge(get.autoViewAs({name:'dczixi_'+name},[card])));
});
}).set('ai',button=>{
const player=get.event('player'),list=Object.keys(get.event('map'));
if(typeof button.link=='string'){
const card=player.getCards('h',card=>{
if(get.value(card)>=7) return false;
return card.hasGaintag('dcqiqin_tag')&&game.hasPlayer(target=>target.canAddJudge(get.autoViewAs({name:'dczixi_'+name},[card])));
}).sort((a,b)=>get.value(a)-get.value(b))[0];
if(game.hasPlayer(current=>{
return get.attitude(player,current)<0&&lib.skill.dczixi.zixiList.some(name=>current.canAddJudge(get.autoViewAs({name:'dczixi_'+name},[card])));
})) return list.indexOf(button.link)+1;
return 1/(list.indexOf(button.link)+1);
}
return 7-get.value(button.link);
}).set('map',map);
if(bool){
const name=links.find(i=>typeof i=='string'),card=links.find(j=>j!=name),cardname=map[name];
const {result:{bool,targets}}=await player.chooseTarget('请选择【'+name+'('+get.translation(card)+')】置入的目标',(cardx,player,target)=>{
return target.canAddJudge(get.autoViewAs({name:'dczixi_'+get.event('name')},[get.event('card')]));
},true).set('ai',target=>{
const player=get.event('player'),card=get.event('card');
if(game.hasPlayer(current=>{
return get.attitude(player,current)<0&¤t.canAddJudge(get.autoViewAs({name:'dczixi_'+get.event('name')},[card]));
})) return -target.countCards('j')-1;
return target.countCards('j')+1;
}).set('card',card).set('name',cardname);
if(bool){
const target=targets[0];
player.logSkill('dczixi',target);
player.$give(card,target,false);
await game.asyncDelay(0.5);
target.addJudge({name:'dczixi_'+cardname},[card]);
}
}
},
group:'dczixi_effect',
subSkill:{
judge:{
mod:{
targetEnabled(card,player,target){
const list=lib.skill.dczixi.zixiList;
const name=(typeof card=='string')?card:(card.viewAs?card.viewAs:card.name);
if(name.indexOf('dczixi_')==0){
const namex=name.slice('dczixi_'.length);
if(list.includes(namex)&&target.hasJudge(namex)) return false;
}
else if(list.includes(name)&&target.hasJudge('dczixi_'+name)) return false;
},
},
ai:{
threaten(player,target){
if(!player.hasSkill('dczixi')||![1,2,3].includes(target.countCards('j'))) return;
return 3+target.countCards('j');
},
},
},
effect:{
audio:'dczixi',
trigger:{player:'useCardToTargeted'},
filter(event,player){
return event.isFirstTarget&&event.targets.length==1&&[1,2,3].includes(event.target.countCards('j'))&&(get.type(event.card)=='basic'||get.type(event.card)=='trick');
},
prompt2(event,player){
const target=event.target,str=get.translation(target);
return [
'令'+get.translation(event.card)+'对'+str+'额外结算一次',
'摸两张牌',
'弃置'+str+'判定区里的所有牌,对其造成3点伤害',
][target.countCards('j')-1];
},
check(event,player){
const target=event.target,num=target.countCards('j');
if(num==2) return true;
if(num==1) return get.effect(target,event.card,player,player)>0;
return get.attitude(player,target)<0&&get.damageEffect(target,player,player)>0;
},
logTarget:'target',
async content(event,trigger,player){
const target=trigger.target,num=target.countCards('j');
switch(num){
case 1:
trigger.getParent().effectCount++;
game.log(trigger.card,'额外结算一次');
break;
case 2:
player.draw(2);
break;
case 3:
target.discard(target.getCards('j')).discarder=player;
target.damage(3);
break;
}
},
},
},
},
//孔融
dckrmingshi:{
audio:'mingshi',
trigger:{player:'damageBegin4'},
filter(event,player){
return event.source&&event.source.countCards('h')>player.countCards('h');
},
forced:true,
logTarget:'source',
async content(event,trigger,player){
const target=trigger.source;
const {result:{bool}}=await target.chooseToDiscard('名士:弃置一张手牌,或防止对'+get.translation(player)+'造成的伤害').set('ai',card=>{
if(get.event('goon')) return 0;
return 6-get.value(card);
}).set('goon',get.damageEffect(player,target,target)<=0);
if(!bool) trigger.cancel();
},
ai:{
effect:{
target_use(card,player,target,current){
if(get.tag(card,'damage')&&target!=player){
if(_status.event.name=='dckrmingshi') return;
if(get.attitude(player,target)>0&¤t<0) return 'zerotarget';
var bs=player.getCards('h');
bs.remove(card);
if(card.cards) bs.removeArray(card.cards);
else bs.removeArray(ui.selected.cards);
if(bs.length>target.countCards('h')){
if(bs.some(bsi=>get.value(bsi)<7)) return [1,0,1,-0.5];
return [1,0,0.3,0];
}
return [1,0,1,-0.5];
}
},
},
},
},
//新服SP孟获
dcmanwang:{
audio:'spmanwang',
inherit:'spmanwang',
check:function(card){
var player=_status.event.player;
var max=Math.min(player.isDamaged()?3:2,4-player.countMark('dcmanwang'));
if(!max&&!player.hasSkill('dcpanqin')) return 0;
if(max==0&&ui.selected.length>0) return 0;
return 7-ui.selected.cards.length-get.value(card);
},
content:function(){
var num=Math.min(cards.length,4-player.countMark('dcmanwang'));
if(num>=1) player.addSkill('dcpanqin');
if(num>=2) player.draw();
if(num>=3) player.recover();
if(num>=4){
player.draw(2);
player.removeSkill('dcpanqin');
}
},
ai:{
order:2,
result:{
player:function(player,target){
if(player.getUseValue({name:'nanman'})<=0) return 0;
if(player.getStat('skill').spmanwang&&player.hasSkill('dcpanqin')) return 0;
return 1;
},
},
},
derivation:'dcpanqin',
},
dcpanqin:{
audio:'sppanqin',
inherit:'sppanqin',
content:function(){
var cards=[];
player.getHistory('lose',function(evt){
if(evt.type!='discard'||evt.getParent(trigger.name)!=trigger) return false;
for(var i of evt.cards2){
if(get.position(i,true)=='d'){
cards.add(i);
}
}
});
player.chooseUseTarget(true,{name:'nanman'},cards);
player.addTempSkill('dcpanqin_eff');
},
subSkill:{
eff:{
charlotte:true,
trigger:{player:'useCard'},
filter:function(event,player){
return event.card.name=='nanman'&&event.getParent(2).name=='dcpanqin'&&player.countMark('dcmanwang')<4&&player.hasSkill('dcmanwang',null,null,false)&&event.cards.length<=event.targets.length;
},
forced:true,
popup:false,
content:function(){
'step 0'
player.addMark('dcmanwang',1,false);
switch(player.countMark('dcmanwang')){
case 1:
player.draw(2);
player.removeSkill('dcpanqin');
break;
case 2:
player.recover();
break;
case 3:
player.draw();
break;
case 4:
player.addSkill('dcpanqin');
break;
}
'step 1'
player.gainMaxHp();
player.recover();
},
}
}
},
//凌操
dcdufeng:{
audio:2,
trigger:{player:'phaseUseBegin'},
forced:true,
async content(event,trigger,player){
const list=[];
for(let i=1;i<6;i++){
if(player.isDisabled(i)) continue;
list.push('equip'+i);
}
list.push('cancel2');
const next=player.chooseControl(list);
next.set('prompt','独锋:请废除一个装备栏,或点击“取消”失去1点体力');
next.set('ai',()=>{
const list=get.event().list.slice(),player=get.player();
if(player.hp<=2&&list.length>1) list.remove('cancel2');
const listx=list.filter(subtype=>!player.getEquips(subtype).length);
if(listx.length) return listx.randomGet();
return list.randomGet();
})
next.set('list',list);
const {result}=await next;
if(result.control=='cancel2') await player.loseHp();
else await player.disableEquip(result.control);
if(!player.isIn()) return;
const num=Math.min(player.countDisabled()+player.getDamagedHp(),player.maxHp);
await player.draw(num);
player.addTempSkill('dcdufeng_effect');
player.addMark('dcdufeng_effect',num,false);
},
subSkill:{
effect:{
charlotte:true,
onremove:true,
intro:{
content:'本回合攻击范围与使用【杀】的次数上限均为#',
},
mod:{
attackRangeBase(player,num){
return player.countMark('dcdufeng_effect');
},
cardUsable(card,player,num){
if(card.name=='sha') return player.countMark('dcdufeng_effect');
},
},
}
},
},
//小乔
dcqiqin:{
audio:2,
audioname:['yue_daqiao'],
trigger:{
global:'phaseBefore',
player:'enterGame'
},
filter:function(event,player){
return event.name!='phase'||game.phaseNumber==0;
},
forced:true,
content:function(){
let cards=player.getCards('h');
player.addGaintag(cards,'dcqiqin_tag');
player.markAuto('dcqiqin',cards);
},
group:'dcqiqin_restore',
subSkill:{
tag:{},
restore:{
audio:'dcqiqin',
audioname:['yue_daqiao'],
trigger:{player:'phaseZhunbeiBegin'},
filter:function(event,player){
const targets=game.players.slice().concat(game.dead);
return targets.some(target=>target.getStorage('dcqiqin').filterInD('d').length);
},
forced:true,
content:function(){
const targets=game.players.slice().concat(game.dead);
const cards=targets.reduce((list,target)=>list.addArray(target.getStorage('dcqiqin').filterInD('d')),[]);
player.gain(cards,'gain2').gaintag.add('dcqiqin_tag');
},
},
},
mod:{
ignoredHandcard:function(card,player){
if(card.hasGaintag('dcqiqin_tag')) return true;
},
cardDiscardable:function(card,player,name){
if(name=='phaseDiscard'&&card.hasGaintag('dcqiqin_tag')) return false;
},
},
},
dcweiwan:{
audio:2,
enable:'phaseUse',
filter:(event,player)=>{
return player.countCards(lib.skill.dcweiwan.position,card=>{
return lib.skill.dcweiwan.filterCard(card,player);
})&&game.hasPlayer(target=>{
return lib.skill.dcweiwan.filterTarget(null,player,target);
});
},
filterCard:(card,player)=>{
return card.hasGaintag('dcqiqin_tag')&&lib.filter.cardDiscardable(card,player);
},
filterTarget:(card,player,target)=>{
return target!=player&&target.countCards('he');
},
position:'h',
check:(card)=>{
const player=_status.event.player;
const target = game.players.reduce((result, current) => {
if (current === player) return result;
const effect = Math.abs(lib.skill.dcweiwan.ai.result.target(player, current));
return effect > result[1] ? [current, effect] : result;
}, [null, 0])[0];
return target?lib.skill.dcweiwan.getWeiWanEffect(player,card,target):0;
},
usable:1,
content:function*(event,map){
let player=map.player,target=event.target;
let suit=get.suit(event.cards[0],player);
let cards=target.getCards('hej',card=>get.suit(card,target)!=suit&&lib.filter.canBeGained(card,player,target));
if(!cards.length){
player.chat('无牌可得!!');
return;
}
let suits=lib.suit.slice();
suits.reverse();
suits.add('none');
suits.forEach(suit2=>{
let cards2=cards.filter(card=>get.suit(card,target)==suit2);
if(cards2.length){
cards2.randomRemove();
cards.removeArray(cards2);
}
});
if(!cards.length){
player.chat('无牌可得!!');
return;
}
player.gain(cards,target,'give');
switch(cards.length){
case 1:
target.loseHp();
break;
case 2:
player.addTempSkill('tanbei_effect3');
target.addTempSkill('tanbei_effect1');
break;
case 3:
player.addTempSkill('tanbei_effect3');
target.addTempSkill('tanbei_effect2');
break;
}
},
ai:{
order:9,
result:{
target:(player,target)=>{
const att=get.sgn(get.attitude(player,target))-1;
const cards=player.getCards(lib.skill.dcweiwan.position,card=>lib.skill.dcweiwan.filterCard(card,player));
return att * cards.reduce((result, card) => {
const effect = lib.skill.dcweiwan.getWeiWanEffect(player, card, target);
return effect > result ? effect : result;
},0);
},
},
},
getWeiWanEffect:(player,cardx,target)=>{
const suit=get.suit(cardx,player);
const cards=target.getCards('hej',card=>get.suit(card,target)!==suit&&lib.filter.canBeGained(card,player,target));
const num=lib.suits.filter(suit=>cards.some(card=>get.suit(card,target)===suit)).length;
switch(num){
case 1:
return num+Math.max(0,get.sgn(get.effect(target,{name:'losehp'},player,player)));
case 2:
return num+player.countCards('he',card=>player.canUse(card,target,false)&&get.effect(target,card,player,player)>0);
case 3:
return Math.ceil(num / 2);
default:
return num;
}
},
},
//董昭
dcyijia:{
audio:2,
trigger:{global:'damageEnd'},
filter:function(event,player){
if(!event.player.isIn()) return false;
if(get.distance(player,event.player)>1) return false;
return player.canMoveCard(null,true,game.filterPlayer(i=>i!=event.player),event.player,'canReplace');
},
check:function(event,player){
return player.canMoveCard(true,true,game.filterPlayer(i=>i!=event.player),event.player,'canReplace');
},
prompt2:function(event,player){
return `将场上一张装备牌移动至${get.translation(event.player)}的装备区内(替换原装备)。然后若其因此脱离了一名角色的攻击范围,你摸一张牌。`;
},
logTarget:'player',
line:false,
content:function*(event,map){
const player=map.player,trigger=map.trigger,target=trigger.player;
const inRangeList=game.filterPlayer(current=>current.inRange(target));
yield player.moveCard(true,game.filterPlayer(i=>i!=target),target,'canReplace');
const leaveSomeone=inRangeList.some(current=>!current.inRange(target));
if(leaveSomeone) player.draw();
},
ai:{
maixie:true,
expose:0.2,
threaten:3.3,
},
},
dcdingji:{
audio:2,
trigger:{player:'phaseZhunbeiBegin'},
direct:true,
content:function*(event,map){
const player=map.player;
let result;
result=yield player.chooseTarget(get.prompt2('dcdingji')).set('ai',target=>{
let att=get.attitude(get.player(),target)/2;
const delta=5-target.countCards('h');
let fix=1;
const hs=target.getCards('h');
outer:for(let i=0;i0){
if(target.hasSkillTag('nogain')) att/=3;
return Math.sqrt(delta)*att*fix;
}
if(delta>-2&&att>0) return fix==0.5?0.1:-1;
return -Math.sqrt(-delta)*att/2;
});
if(!result.bool) return event.finish();
const target=result.targets[0];
player.logSkill('dcdingji',target);
if(target!=player) player.addExpose(0.3);
const delta=5-target.countCards('h');
if(delta!=0){
yield target[delta>0?'draw':'chooseToDiscard'](Math.abs(delta),true);
}
target.showHandcards();
const hs=target.getCards('h');
let hasSame=false;
outer:for(let i=0;i{
if(!['basic','trick'].includes(info[0])) return false;
if(!target.hasUseTarget(new lib.element.VCard({name:info[2],nature:info[3],isCard:true}))) return false;
return hs.some(card=>{
return get.name(card)==info[2]&&get.is.sameNature([card,info[3]],true);
});
});
if(!list.length) return event.finish();
result=yield target.chooseButton(['是否视为使用其中一张牌?',[list,'vcard']]).set('ai',button=>{
return get.player().getUseValue({name:button.link[2]});
});
if(result.bool){
target.chooseUseTarget(new lib.element.VCard({
name:result.links[0][2],
nature:result.links[0][3],
isCard:true,
}),true,false);
}
},
},
//蒯祺
dcliangxiu:{
audio:2,
enable:'phaseUse',
filter:function(event,player){
return player.hasCard(card=>{
const type=get.type2(card,player);
return player.hasCard(cardx=>{
if(card==cardx) return false;
return get.type2(cardx,player)!=type;
},'he');
},'he');
},
filterCard:function(card,player){
if(!ui.selected.cards.length) return true;
return get.type2(ui.selected.cards[0],player)!=get.type2(card,player);
},
selectCard:2,
check:function(card){
const player=get.player();
const bannedTypes=[];
bannedTypes.addArray(player.getStorage('dcliangxiu'));
if(!ui.selected.cards.length){
let val=get.value(card);
if(val>5.5) return 0;
if(bannedTypes.includes(get.type2(card,player))) return 7.5-val;
return 5.5-val;
}
bannedTypes.addArray(ui.selected.cards.map(card=>get.type2(card,player)));
bannedTypes.add(get.type2(card,player));
const filter=card=>!bannedTypes.includes(get.type2(card,player));
if(!get.cardPile(filter)) return 0;
return 6-get.value(card);
},
position:'he',
complexCard:true,
onremove:true,
content:function*(event,map){
const player=map.player;
const cards=[];
const bannedTypes=[];
bannedTypes.addArray(event.cards.map(card=>get.type2(card,player)));
bannedTypes.addArray(player.getStorage('dcliangxiu'));
const filter=card=>!bannedTypes.includes(get.type2(card,player));
const piles=['cardPile','discardPile'];
for(const pile of piles){
for(let i=0;i=2) break;
}
}
if(cards.length>=2) break;
}
let result;
if(!cards.length){
player.chat('没牌了…');
game.log('但是哪里都找不到没有符合条件的牌!');
event.finish();
return;
}
else if(cards.length==1) result={bool:true,links:cards};
else result=yield player.chooseButton(['良秀:获得一张牌',cards],true).set('ai',get.buttonValue);
if(result.bool){
const toGain=result.links;
player.markAuto('dcliangxiu',get.type2(toGain[0],false));
player.when({global:'phaseChange'}).then(()=>{
player.unmarkSkill('dcliangxiu');
});
player.gain(toGain,'gain2');
}
},
intro:{
content:'已因此技能获得过$牌',
onunmark:true,
},
ai:{
order:2,
result:{player:1},
},
},
dcxunjie:{
audio:2,
trigger:{global:'phaseEnd'},
filter:function(event,player){
if(['handcard','hp'].every(i=>player.isTempBanned(`dcxunjie_${i}`))) return false;
return player.hasHistory('gain',evt=>{
return !evt.getParent('phaseDraw',true);
});
},
direct:true,
content:function*(event,map){
const player=map.player;
const choices=[];
const choiceList=[
'令一名角色将手牌数摸或弃置至与其体力值相同',
'令一名角色将体力回复或失去至与其手牌数相同',
];
if(!player.isTempBanned('dcxunjie_handcard')) choices.push('选项一');
else choiceList[0]=''+choiceList[0]+'(已被选择过)';
if(!player.isTempBanned('dcxunjie_hp')) choices.push('选项二');
else choiceList[1]=''+choiceList[1]+'(已被选择过)';
let result;
if(_status.connectMode) game.broadcastAll(()=>{_status.noclearcountdown=true});
if(choices.length==1) result={control:choices[0]};
else result=yield player.chooseControl(choices,'cancel2').set('choiceList',choiceList).set('prompt',get.prompt('dcxunjie')).set('ai',()=>{
return get.event('choice');
}).set('choice',(()=>{
const getValue=(index,target)=>{
let att=get.attitude(player,target);
att=Math.sign(att)*Math.sqrt(Math.abs(att));
let delt=target.getHp(true)-target.countCards('h');
if(index==1&&delt<0) delt=0;
return (1-3*index)*att*delt;
}
const list=game.filterPlayer().map(current=>{
const val0=getValue(0,current),val1=getValue(1,current);
return [val0,val1,Math.max(val0,val1)];
}).sort((a,b)=>{
return b[2]-a[2];
});
const toChoose=list[0];
if(toChoose[2]<=0) return 'cancel2';
return toChoose[0]>toChoose[1]?0:1;
})());
if(result.control=='cancel2'){
if(_status.connectMode){game.broadcastAll(()=>{delete _status.noclearcountdown;game.stopCountChoose()})}
return event.finish();
}
let prompt='';
const choice=result.control,index=choice=='选项一'?0:1;
if(choices.length==1){
prompt=`###${get.prompt('dcxunjie')}###${choiceList[index]}
`;
}
else prompt=`###殉节:请选择一名角色###${choiceList[index].replace('一名','该')}
`;
result=yield player.chooseTarget(prompt).set('ai',target=>{
const player=get.player(),index=get.event('index');
let att=get.attitude(player,target);
att=Math.sign(att)*Math.sqrt(Math.abs(att));
let delt=target.getHp(true)-target.countCards('h');
if(index==1&&delt<0) delt=0;
return (1-2*index)*att*delt;
}).set('index',index);
if(_status.connectMode){game.broadcastAll(()=>{delete _status.noclearcountdown;game.stopCountChoose()})}
if(!result.bool) return event.finish();
const target=result.targets[0];
player.logSkill('dcxunjie',target);
player.tempBanSkill(`dcxunjie_${index==0?'handcard':'hp'}`,'roundStart',false);
const delt=(target.getHp(true)-target.countCards('h'))*(1-2*index);
if(delt==0) event.finish();
else if(index==0) target[delt>0?'draw':'chooseToDiscard'](Math.abs(delt),true);
else target[delt>0?'recover':'loseHp'](Math.abs(delt));
}
},
//乐蔡邕
dcjiaowei:{
audio:2,
trigger:{
global:'phaseBefore',
player:'enterGame'
},
forced:true,
filter:function(event,player){
return (event.name!='phase'||game.phaseNumber==0);
},
group:'dcjiaowei_prevent',
content:function*(event,map){
const player=map.player;
var cards=player.getCards('h');
player.addGaintag(cards,'dcjiaowei_tag');
},
mod:{
ignoredHandcard:function(card,player){
if(card.hasGaintag('dcjiaowei_tag')) return true;
},
cardDiscardable:function(card,player,name){
if(name=='phaseDiscard'&&card.hasGaintag('dcjiaowei_tag')) return false;
},
},
subSkill:{
prevent:{
audio:'dcjiaowei',
trigger:{
player:'damageBegin4',
},
forced:true,
filter:function(event,player){
if(!event.source||!event.source.isIn()) return false;
return event.source.countCards('h')<=player.countCards('h',card=>card.hasGaintag('dcjiaowei_tag'));
},
content:function*(event,map){
map.trigger.cancel();
},
ai:{
effect:{
target:function(card,player,target){
if(get.tag(card,'damage')){
const num=target.countCards('h',card=>card.hasGaintag('dcjiaowei_tag'));
let cards=[];
if(card.cards) cards.addArray(card.cards);
if(ui.selected.cards) cards.addArray(ui.selected.cards);
cards=cards.filter(card=>{
if(get.itemtype(card)!='card') return false;
return get.owner(card)==player&&get.position(card)=='e';
});
if(player.countCards('h')-cards.length<=num) return 'zeroplayertarget';
}
},
},
},
},
},
},
dcfeibai:{
audio:2,
trigger:{player:'useCardAfter'},
usable:1,
locked:false,
filter:function(event,player){
return player.getHistory('useCard').indexOf(event)>0;
},
prompt2:function(event,player){
const history=player.getHistory('useCard');
const ind=history.indexOf(event)-1,evt=history[ind];
const len=get.cardNameLength(event.card)+get.cardNameLength(evt.card);
return `随机获得一张字数为${len}的牌`;
},
check:function(event,player){
const history=player.getHistory('useCard');
const ind=history.indexOf(event)-1,evt=history[ind];
const len=get.cardNameLength(event.card)+get.cardNameLength(evt.card);
return player.countCards('h',card=>card.hasGaintag('dcjiaowei_tag'))<=len||get.cardPile(card=>{
return get.cardNameLength(card,false)==len;
});
},
content:function*(event,map){
const player=map.player,trigger=map.trigger;
const history=player.getHistory('useCard');
const ind=history.indexOf(trigger)-1,evt=history[ind];
const len=get.cardNameLength(trigger.card)+get.cardNameLength(evt.card);
const card=get.cardPile(card=>{
return get.cardNameLength(card,false)==len;
});
if(card){
yield player.gain(card,'gain2');
}
else{
let str=`没有${len}字的牌…`;
if(len==5&&Math.random()<=0.2) str='五字不行哇';
player.chat(str);
game.log(`但是找不到字数为${len}的牌!`);
}
if(player.countCards('h',card=>card.hasGaintag('dcjiaowei_tag'))<=len){
player.storage.counttrigger.dcfeibai--;
game.log(player,'重置了','#【飞白】');
}
},
mod:{
aiOrder:function(player,card,num){
const evt=player.getLastUsed();
if(!evt) return;
const len=get.cardNameLength(card)+get.cardNameLength(evt.card);
const cardx=get.cardPile(card=>{
return get.cardNameLength(card,false)==len;
});
if(cardx) return num+8+(len==2||len==4?2:0);
},
}
},
//庞山民
dccaisi:{
audio:2,
trigger:{player:'useCardAfter'},
filter:function(event,player){
if(get.type(event.card)!='basic') return false;
if(player.getHistory('gain',evt=>{
return evt.getParent().name==='dccaisi';
}).reduce((num,evt)=>{
return num+evt.cards.length;
},0)>player.maxHp) return false;
return _status.currentPhase;
},
prompt2:function(event,player){
const num=player.hasSkill('dccaisi_more')?2:1;
return `从${player==_status.currentPhase?'牌堆':'弃牌'}堆中随机获得${get.cnNumber(num)}张非基本牌`;
},
content:function*(event,map){
const player=map.player,trigger=map.trigger;
const position=player==_status.currentPhase?'cardPile':'discardPile';
let cards=[],num=player.hasSkill('dccaisi_more')?2:1;
player.removeSkill('dccaisi_more');
while(num>0){
num--;
let card=get[position](card=>get.type(card)!='basic'&&!cards.includes(card));
if(card) cards.add(card);
else break;
}
if(cards.length) player.gain(cards,'gain2');
else{
player.chat('没有非基本牌…');
game.log(`但是${position=='discardPile'?'弃':''}牌堆里没有非基本牌!`);
}
player.addTempSkill('dccaisi_more');
},
subSkill:{more:{charlotte:true}},
},
dczhuoli:{
audio:2,
trigger:{global:'phaseEnd'},
forced:true,
filter:function(event,player){
return player.getHistory('useCard').length>player.getHp()||player.getHistory('gain').reduce((sum,evt)=>sum+evt.cards.length,0)>player.getHp();
},
content:function*(event,map){
const player=map.player;
if(player.maxHp0;
},
selectCard:function(){
const player=get.player();
const delt=player.countCards('h')-player.maxHp;
return delt>0?delt:-1;
},
promptfunc:()=>{
const player=get.player();
const delt=player.countCards('h')-player.maxHp;
let str='';
if(delt>0) str+=`弃置${get.cnNumber(delt)}张牌`;
else if(delt==0) str+=`点击“确定”`;
else str+=`摸${get.cnNumber(-delt)}张牌`;
return `${str},然后选择两名角色,前者视为对后者使用一张【杀】,且这两者的非锁定技失效。`;
},
content:function*(event,map){
var player=map.player;
if(player.countCards('h'){
var sha=new lib.element.VCard({name:'sha',isCard:true});
if(ui.selected.targets.length){
var targetx=ui.selected.targets[0];
return targetx.canUse(sha,target,false);
}
return lib.filter.cardEnabled(sha,target);
}).set('targetprompt',['打人','被打']).set('multitarget',true).set('ai',target=>{
var aiTargets=get.event('aiTargets');
if(aiTargets){
return aiTargets[ui.selected.targets.length]==target?10:0;
}
return 0;
}).set('aiTargets',(()=>{
var targets=[],eff=0;
var sha=new lib.element.VCard({name:'sha',isCard:true});
for(var user of game.filterPlayer()){
for(var target of game.filterPlayer()){
if(user==target) continue;
var targetsx=[user,target];
targetsx.forEach(i=>i.addSkill('dcbeini_fengyin'));
var effx=get.effect(target,sha,user,player);
targetsx.forEach(i=>i.removeSkill('dcbeini_fengyin'));
if(user==player) effx+=1;
if(get.attitude(player,user)>0) effx-=0.1;
if(effx>eff){
eff=effx;
targets=targetsx;
}
}
}
if(targets.length) return targets;
return null;
})());
if(result.bool){
var user=result.targets[0],target=result.targets[1];
result.targets.forEach(i=>i.addTempSkill('dcbeini_fengyin'));
var sha=new lib.element.VCard({name:'sha',isCard:true});
if(user.canUse(sha,target,false)) user.useCard(sha,target,false,'noai');
}
},
ai:{
order:0.1,
result:{
player:function(player){
if(player.countCards('h')-player.maxHp>=3) return 1;
return game.hasPlayer(current=>get.attitude(player,current)<=0)?1:0;
}
},
},
subSkill:{
fengyin:{
inherit:'fengyin',
},
}
},
dcshizong:{
audio:2,
enable:'chooseToUse',
hiddenCard:function(player,name){
if(get.type(name)!='basic') return false;
return player.countCards('he')>=player.countMark('dcshizong')+1;
},
filter:function(event,player){
if(event.type=='wuxie'||event.dcshizong) return false;
if(player.countCards('he'){
if(info[0]!='basic') return;
const card={name:info[2],nature:info[3],isCard:true};
return event.filterCard(card,player,event);
})
return ui.create.dialog('恃纵',[vcards,'vcard'],'hidden');
},
check:function(button){
if(get.event().getParent().type!='phase') return 1;
const player=get.player();
const card={name:button.link[2],nature:button.link[3]};
if(game.hasPlayer(current=>{
return player.canUse(card,current)&&get.effect(current,card,player,player)>0;
})){
switch(button.link[2]){
case 'tao':return 5;
case 'jiu':return 3.01;
case 'sha':
if(button.link[3]=='fire') return 2.95;
else if(button.link[3]=='thunder') return 2.92;
else return 2.9;
}
}
return 0;
},
backup:function(links,player){
return {
filterCard:true,
filterTarget:lib.filter.notMe,
selectTarget:1,
selectCard:()=>get.player().countMark('dcshizong')+1,
viewAs:{
name:links[0][2],
nature:links[0][3],
suit:'none',
number:null,
isCard:true,
},
position:'he',
popname:true,
ignoreMod:true,
ai1:function(card){
return 1/(1.1+Math.max(-1,get.value(card)));
},
ai2:function(target){
const att=get.attitude(get.player(),target);
const value=ui.selected.cards.map(card=>get.value(card)).reduce((p,c)=>{
return p+c;
},0);
if(value>0||player.getHp()<=1) return att;
return -att;
},
precontent:function*(event,map){
var player=map.player,target=event.result.targets[0];
player.logSkill('dcshizong',target);
if(!player.countMark('dcshizong')) player.when({global:'phaseAfter'}).then(()=>delete player.storage.dcshizong);
player.addMark('dcshizong',1,false);
yield player.give(event.result.cards.slice(),target);
var viewAs=new lib.element.VCard({name:event.result.card.name,nature:event.result.card.nature,isCard:true});
var result=yield target.chooseCard('恃纵:是否将一张牌置于牌堆底?',`若如此做,${get.translation(player)}视为使用一张${get.translation(viewAs.nature)}【${get.translation(viewAs.name)}】`,'he').set('ai',card=>{
if(get.event('goon')) return 7-get.value(card);
return 0;
}).set('goon',get.attitude(target,player)*(player.getUseValue(viewAs)||1)>=1);
var card=event.result.cards[0];
if(result.bool){
var card=result.cards[0];
game.delayex();
var next=target.loseToDiscardpile(card,ui.cardPile);
next.log=false;
if(get.position(card)=='e'){
game.log(target,'将',card,'置于了牌堆底');
}
else{
next.blank=true;
game.log(target,'将一张牌置于了牌堆底');
}
result=yield next;
game.broadcastAll(viewAs=>{
lib.skill.dcshizong_backup2.viewAs=viewAs;
},lib.skill.dcshizong_backup.viewAs);
var evt=event.getParent();
evt.set('_backupevent','dcshizong_backup2');
evt.set('openskilldialog',`请选择${get.translation(viewAs.nature)}${get.translation(viewAs.name)}的目标`);
evt.backup('dcshizong_backup2');
evt.set('norestore',true);
evt.set('custom',{
add:{},
replace:{window:function(){}}
});
evt.goto(0);
if(target!=_status.currentPhase) player.tempBanSkill('dcshizong');
}
else{
target.chat('不放!');
game.log(target,'选择不将牌置于牌堆底');
var evt=event.getParent();
evt.set('dcshizong',true);
evt.goto(0);
}
game.delayx();
},
ai:{
order:10,
},
}
},
prompt:function(links,player){
return `###恃纵:选择要交出的牌和目标角色###将${get.cnNumber(player.countMark('dcshizong')+1)}张牌交给一名其他角色,其可以选择将一张牌置于牌堆底,视为你使用一张${get.translation(links[0][3]||'')}${get.translation(links[0][2])}。`;
}
},
ai:{
order:function(){
const player=get.player(),event=get.event();
if(event.filterCard({name:'jiu'},player,event)&&get.effect(player,{name:'jiu'})>0){
return get.order({name:'jiu'})+0.1;
}
return get.order({name:'sha'})+0.1;
},
respondSha:true,
fireAttack:true,
respondShan:true,
skillTagFilter:function(player,tag,arg){
if(tag=='fireAttack') return true;
if(player.countCards('he')false,
selectCard:-1,
precontent:function(){
delete event.result.skill;
}
},
},
},
//张曼成
dclvecheng:{
audio:2,
enable:'phaseUse',
usable:1,
filterTarget:lib.filter.notMe,
content:function(){
player.addTempSkill('dclvecheng_xiongluan');
player.markAuto('dclvecheng_xiongluan',[target]);
var cards=player.getCards('h','sha');
if(cards.length) player.addGaintag(cards,'dclvecheng_xiongluan');
},
ai:{
threaten:3.1,
order:3.5,
expose:0.2,
result:{
target:function(player,target){
if(player.getStorage('dclvecheng_xiongluan').includes(target)) return 0;
if(target.getEquip('bagua')||target.getEquip('rewrite_bagua')) return -0.6;
var hs=player.countCards('h',card=>{
if(!player.canUse(card,target)) return false;
return get.name(card)=='sha'&&get.effect(target,card,player,player)>0;
});
var ts=target.hp;
if(hs>=ts&&ts>1) return -2;
return -1;
}
}
},
subSkill:{
xiongluan:{
trigger:{player:'phaseEnd'},
charlotte:true,
forced:true,
popup:false,
onremove:function(player,skill){
player.removeGaintag('dclvecheng_xiongluan');
delete player.storage[skill];
},
filter:function(event,player){
return player.getStorage('dclvecheng_xiongluan').some(i=>i.isIn());
},
content:function(){
'step 0'
event.targets=player.getStorage('dclvecheng_xiongluan').slice();
event.targets.sortBySeat();
'step 1'
if(!event.targets.length){
event.finish();
return;
}
var target=event.targets.shift();
event.target=target;
target.showHandcards();
var cards=target.getCards('h','sha');
if(!cards.length) event.redo();
else event.forced=false;
'step 2'
var forced=event.forced;
var prompt2=forced?'掠城:选择对'+get.translation(player)+'使用的【杀】':'掠城:是否依次对'+get.translation(player)+'使用所有的【杀】?';
target.chooseToUse(forced,function(card,player,event){
if(get.itemtype(card)!='card'||get.name(card)!='sha') return false;
return lib.filter.filterCard.apply(this,arguments);
},prompt2).set('targetRequired',true).set('complexSelect',true).set('filterTarget',function(card,player,target){
if(target!=_status.event.sourcex&&!ui.selected.targets.includes(_status.event.sourcex)) return false;
return lib.filter.targetEnabled.apply(this,arguments);
}).set('sourcex',player);
'step 3'
if(result.bool){
if(target.countCards('h','sha')){
event.forced=true;
event.goto(2);
return;
}
}
event.forced=false;
event.goto(1);
},
intro:{
content:'对$使用“掠城”【杀】无任何次数限制',
},
mod:{
cardUsableTarget:function(card,player,target){
if(!card.cards||card.cards.length!=1) return;
if(card.name=='sha'&&card.cards[0].hasGaintag('dclvecheng_xiongluan')&&player.getStorage('dclvecheng_xiongluan').includes(target)) return true;
},
}
}
}
},
dczhongji:{
audio:2,
trigger:{player:'useCard'},
filter:function(event,player){
if(player.countCards('h')>=player.maxHp) return false;
var suit=get.suit(event.card);
return !lib.suit.includes(suit)||!player.countCards('h',{suit:suit});
},
check:function(event,player){
var num=Math.min(20,player.maxHp-player.countCards('h'));
if(num<=0) return false;
var numx=player.getHistory('useSkill',evt=>{
return evt.skill=='dczhongji';
}).length+1;
if(numx>num) return false;
if(_status.currentPhase!=player) return true;
if(player.hasCard(card=>{
var suit=get.suit(card);
return player.hasValueTarget(card)&&!player.hasCard(cardx=>{
return cardx!=card&&get.suit(cardx)==suit;
});
})) return false;
return true;
},
prompt2:function(event,player){
var num=Math.min(20,player.maxHp-player.countCards('h'));
var str=num>0?'摸'+get.cnNumber(num)+'张牌,然后':'';
return str+'弃置'+get.cnNumber(1+player.getHistory('useSkill',evt=>{
return evt.skill=='dczhongji';
}).length)+'张牌';
},
content:function(){
'step 0'
var num=Math.min(20,player.maxHp-player.countCards('h'));
if(num>0) player.draw(num);
'step 1'
var num=player.getHistory('useSkill',evt=>{
return evt.skill=='dczhongji';
}).length;
player.chooseToDiscard('螽集:请弃置'+get.cnNumber(num)+'张牌','he',true,num).set('ai',get.unuseful);
},
ai:{
threaten:3.2,
}
},
//乐周妃
dclingkong:{
audio:2,
trigger:{
global:'phaseBefore',
player:'enterGame'
},
forced:true,
filter:function(event,player){
return (event.name!='phase'||game.phaseNumber==0);
},
content:function(){
'step 0'
var cards=player.getCards('h');
player.addGaintag(cards,'dclingkong_tag');
},
mod:{
ignoredHandcard:function(card,player){
if(card.hasGaintag('dclingkong_tag')){
return true;
}
},
cardDiscardable:function(card,player,name){
if(name=='phaseDiscard'&&card.hasGaintag('dclingkong_tag')){
return false;
}
},
},
group:'dclingkong_marker',
subSkill:{
marker:{
audio:'dclingkong',
trigger:{player:['gainAfter','loseAsyncAfter']},
forced:true,
filter:(event,player)=>{
if(event.getParent('phaseDraw',true)) return false;
const evt=player.getHistory('gain',i=>!i.getParent('phaseDraw',true))[0];
if(!evt) return false;
if(event.name=='gain'){
if(evt!=event||event.getlx===false) return false;
}
else if(evt.getParent()!=event) return false;
const hs=player.getCards('h');
if(!hs.length) return false;
const cards=event.getg(player);
return cards.some(card=>hs.includes(card));
},
content:function(){
var hs=player.getCards('h'),cards=trigger.getg(player);
cards=cards.filter(card=>hs.includes(card));
player.addGaintag(cards,'dclingkong_tag');
game.delayx();
},
},
},
},
dcxianshu:{
audio:2,
enable:'phaseUse',
filter:(event,player)=>{
return game.hasPlayer(current=>current!=player)&&player.hasCard(card=>card.hasGaintag('dclingkong_tag'),'h');
},
filterCard:(card)=>card.hasGaintag('dclingkong_tag'),
filterTarget:lib.filter.notMe,
discard:false,
lose:false,
delay:false,
position:'h',
check:card=>{
const player=_status.event.player,event=_status.event,color=get.color(card);
if(color=='red'){
return (event.getTempCache('dcxianshu','red')
||event.putTempCache('dcxianshu','red',game.hasPlayer(current=>{
return current!=player&¤t.hp<=player.hp&¤t.isDamaged()&&get.recoverEffect(current,player,player)>0;
}).toString()))=='true'?(7-get.value(card)):0;
}
else if(color=='black'){
return (event.getTempCache('dcxianshu','black')
||event.putTempCache('dcxianshu','black',game.hasPlayer(current=>{
return current!=player&¤t.hp>=player.hp&&get.effect(current,{name:'losehp'},player,player)>0;
}).toString()))=='true'?(7-get.value(card)):0;
}
return 6-get.value(card);
},
content:function(){
'step 0'
player.give(cards,target,true);
event.color=get.color(cards[0],player);
'step 1'
if(target.isIn()){
var num=Math.min(Math.abs(target.getHp()-player.getHp()),5);
if(num>0) player.draw(num);
}
'step 2'
if(event.color=='red'){
if(target.getHp()<=player.getHp()&&target.isDamaged()) target.recover();
}
else if(event.color=='black'){
if(target.getHp()>=player.getHp()) target.loseHp()
}
},
ai:{
combo:'dclingkong',
order:10,
result:{
player:function(player,target){
if(!ui.selected.cards.length) return 0;
let num=target.getHp()-player.getHp();
const card=ui.selected.cards[0],color=get.color(card);
if(color=='red'&&target.getHp()<=player.getHp()&&target.isDamaged()) num++;
else if(color=='black'&&target.getHp()>=player.getHp()) num--;
return Math.min(Math.abs(num),5)*1.1;
},
target:function(player,target){
if(!ui.selected.cards.length) return 0;
const card=ui.selected.cards[0],color=get.color(card),val=get.value(card,target);
if(color=='red'&&target.getHp()<=player.getHp()&&target.isDamaged()) return get.recoverEffect(target,player,target)+val/1.4;
else if(color=='black'&&target.getHp()>=player.getHp()) return get.effect(target,{name:'losehp'},player,target)+val/1.4;
return val/1.4;
},
},
},
},
//吴班
dcyouzhan:{
audio:2,
trigger:{
global:['loseAfter','equipAfter','addJudgeAfter','gainAfter','loseAsyncAfter','addToExpansionAfter'],
},
forced:true,
direct:true,
filter:function(event,player){
if(player!=_status.currentPhase) return false;
return game.hasPlayer(current=>{
if(current==player) return false;
var evt=event.getl(current);
return evt&&evt.cards2.length;
});
},
content:function(){
'step 0'
var targets=game.filterPlayer(current=>{
if(current==player) return false;
var evt=trigger.getl(current);
return evt&&evt.cards2.length;
});
event.targets=targets;
player.logSkill('dcyouzhan',targets);
'step 1'
event.target=targets.shift();
event.num=trigger.getl(event.target).cards2.length;
'step 2'
player.draw().gaintag=['dcyouzhan'];
player.addTempSkill('dcyouzhan_limit');
target.addTempSkill('dcyouzhan_effect');
target.addMark('dcyouzhan_effect',1,false);
target.addTempSkill('dcyouzhan_draw');
if(--event.num) event.redo();
'step 3'
if(targets.length){
event.goto(1);
}
},
ai:{
damageBonus:true,
skillTagFilter:function(player,tag,arg){
if(!arg||!arg.target||!arg.target.hasSkill('dcyouzhan_effect')) return false;
}
},
subSkill:{
effect:{
audio:'dcyouzhan',
trigger:{
player:'damageBegin3',
},
filter:function(event,player){
return player.hasMark('dcyouzhan_effect');
},
forced:true,
charlotte:true,
onremove:true,
content:function(){
'step 0'
trigger.num+=player.countMark('dcyouzhan_effect');
player.removeSkill('dcyouzhan_effect');
},
mark:true,
intro:{
content:'本回合下一次受到的伤害+#',
},
ai:{
effect:{
target:function(card,player,target){
if(get.tag(card,'damage')) return 1+0.5*target.countMark('dcyouzhan_effect');
}
}
}
},
draw:{
trigger:{
global:'phaseJieshuBegin',
},
forced:true,
charlotte:true,
filter:function(event,player){
return !player.getHistory('damage').length;
},
content:function(){
player.draw(Math.min(3,player.getHistory('lose').length));
},
},
limit:{
charlotte:true,
onremove:function(player){
player.removeGaintag('dcyouzhan');
},
mod:{
ignoredHandcard:function(card,player){
if(card.hasGaintag('dcyouzhan')) return true;
},
cardDiscardable:function(card,player,name){
if(name=='phaseDiscard'&&card.hasGaintag('dcyouzhan')) return false;
},
},
}
}
},
//乐蔡文姬
dcshuangjia:{
audio:2,
trigger:{
global:'phaseBefore',
player:'enterGame'
},
forced:true,
filter:function(event,player){
return (event.name!='phase'||game.phaseNumber==0);
},
content:function(){
'step 0'
var cards=player.getCards('h');
player.addGaintag(cards,'dcshuangjia_tag');
},
mod:{
ignoredHandcard:function(card,player){
if(card.hasGaintag('dcshuangjia_tag')){
return true;
}
},
cardDiscardable:function(card,player,name){
if(name=='phaseDiscard'&&card.hasGaintag('dcshuangjia_tag')){
return false;
}
},
globalTo:function(from,to,distance){
return distance+Math.min(5,to.countCards('h',card=>card.hasGaintag('dcshuangjia_tag')));
}
},
},
dcbeifen:{
audio:2,
trigger:{
player:['loseAfter'],
global:['equipAfter','addJudgeAfter','gainAfter','loseAsyncAfter','addToExpansionAfter'],
},
filter:function(event,player){
var evt=event.getl(player);
if(!evt||!evt.hs||!evt.hs.length) return false;
if(event.name=='lose'){
for(var i in event.gaintag_map){
if(event.gaintag_map[i].includes('dcshuangjia_tag')) return true;
}
return false;
}
return player.hasHistory('lose',evt=>{
if(event!=evt.getParent()) return false;
for(var i in evt.gaintag_map){
if(evt.gaintag_map[i].includes('dcshuangjia_tag')) return true;
}
return false;
});
},
forced:true,
content:function(){
var suits=lib.suit.slice();
player.countCards('h',card=>{
if(!card.hasGaintag('dcshuangjia_tag')) return false;
suits.remove(get.suit(card));
});
var cards=[];
while(suits.length){
var suit=suits.shift();
var card=get.cardPile(cardx=>{
return get.suit(cardx,false)==suit;
});
if(card) cards.push(card);
}
if(cards.length){
player.gain(cards,'gain2');
}
},
mod:{
cardUsable:function(card,player){
var len=player.countCards('h');
var cnt=player.countCards('h',card=>card.hasGaintag('dcshuangjia_tag'));
if(2*cntcard.hasGaintag('dcshuangjia_tag'));
if(2*cnt{
if(!cardx.hasGaintag('dcshuangjia_tag')) return false;
if(card==cardx) return false;
suits.remove(get.suit(cardx));
});
if(suits.length) return num+suits.length*2.5;
}
},
},
},
//孟优
dcmanzhi:{
audio:2,
trigger:{player:['phaseZhunbeiBegin','phaseJieshuBegin']},
filter:function(event,player){
if(event.name=='phaseJieshu'){
var del=0;
game.getGlobalHistory('changeHp',evt=>{
if(evt.player!=player) return;
for(var phase of lib.phaseName){
var evtx=evt.getParent(phase);
if(evtx&&evtx.name==phase){
del+=evt.num;
break;
}
}
});
if(del!=0) return false;
}
return game.hasPlayer(current=>{
if(current==player) return false;
return !player.hasSkill('dcmanzhi_1')&¤t.countCards('he')||!player.hasSkill('dcmanzhi_2')&¤t.countCards('hej');
})
},
direct:true,
content:function(){
'step 0'
if(_status.connectMode) game.broadcastAll(function(){_status.noclearcountdown=true});
player.chooseTarget(get.prompt2('dcmanzhi'),(card,player,target)=>{
if(player==target) return false;
return !player.hasSkill('dcmanzhi_1')&&target.countCards('he')||!player.hasSkill('dcmanzhi_2')&&target.countCards('hej');
}).set('ai',target=>{
return 1-get.attitude(get.player(),target);
});
'step 1'
if(result.bool){
var target=result.targets[0];
event.target=target;
var choices=[];
var choiceList=[
'令其交给你两张牌,然后其视为使用一张无距离限制的【杀】',
'你获得其区域内的至多两张牌,然后交给其等量的牌并摸一张牌'
];
var chosen=[player.hasSkill('dcmanzhi_1'),player.hasSkill('dcmanzhi_2')];
if(target.countCards('he')&&(!chosen[0]||trigger.name=='phaseZhunbei')) choices.push('选项一');
else choiceList[0]=''+choiceList[0]+(chosen[0]?'(已被选择过)':'')+'';
if(target.countCards('hej')&&(!chosen[1]||trigger.name=='phaseZhunbei')) choices.push('选项二');
else choiceList[1]=''+choiceList[1]+(chosen[1]?'(已被选择过)':'')+'';
if(trigger.name=='phaseJieshu') choices.push('cancel2');
player.chooseControl(choices).set('choiceList',choiceList).set('ai',()=>{
return _status.event.choice;
}).set('choice',function(){
if(target.getUseValue({name:'sha'},false)>5&&!player.hasShan()&&trigger.name=='phaseZhunbei') return 1;
return 0;
}()).set('prompt','蛮智:请选择一项');
}
else{
if(_status.connectMode){game.broadcastAll(function(){delete _status.noclearcountdown;game.stopCountChoose()});}
event.finish();
}
'step 2'
if(_status.connectMode){game.broadcastAll(function(){delete _status.noclearcountdown;game.stopCountChoose()});}
if(result.control=='cancel2'){event.finish();return;}
player.logSkill('dcmanzhi',target);
if(result.control=='选项一'){
player.addTempSkill('dcmanzhi_1');
target.chooseCard(2,'he','蛮智:请交给'+get.translation(player)+'两张牌',true);
}
else{
player.addTempSkill('dcmanzhi_2');
player.gainPlayerCard(target,'hej',[1,2],true);
event.goto(5);
}
'step 3'
if(result.bool){
target.give(result.cards,player);
}
else event.finish();
'step 4'
target.chooseUseTarget('sha',true,'nodistance');
event.finish();
'step 5'
if(result.bool&&target.isIn()){
var num=result.cards.length,hs=player.getCards('he');
if(!hs.length) event.finish();
else if(hs.lengthplayer.hasValueTarget(card),'h')){
if(get.position(card)=='e') return 0;
return 8-get.value(card);
}
return 6-get.value(card);
},
content:function(){
'step 0'
var targets=game.filterPlayer(current=>{
return current.countGainableCards(player,'e');
});
if(targets.length==0) event._result={bool:false};
else if(targets.length==1) event._result={bool:true,targets:targets};
else player.chooseTarget('自固:获得一名角色装备区里的一张牌',true,(card,player,target)=>{
return target.countGainableCards(player,'e');
}).set('ai',target=>{
if(target==_status.event.player) return 10;
if(get.attitude(_status.event.player,target)<0){
if(target.hasCard(card=>{
return get.value(card,player)>=6;
})) return 12;
return 8;
}
return 0;
});
'step 1'
if(result.bool){
var target=result.targets[0];
event.target=target;
player.gainPlayerCard('e',target,true);
}
'step 2'
if(!result.bool||target==player||!result.cards||!result.cards.some(i=>get.owner(i)==player)) player.draw();
},
ai:{
order:function(item,player){
if(!player.hasSkill('dczuowei')) return 9;
if(player.countCards('h')==player.countCards('e')+1&&!player.hasCard(card=>player.hasValueTarget(card),'h')) return 9;
return 1;
},
result:{
player:1
}
}
},
dczuowei:{
audio:2,
trigger:{player:'useCard'},
filter:function(event,player){
if(_status.currentPhase!=player) return false;
if(!player.hasSkill('dczuowei_ban')) return true;
return Math.sign(player.countCards('h')-Math.max(1,player.countCards('e')))>=0;
},
direct:true,
locked:false,
content:function(){
'step 0'
var hs=player.countCards('h');
var es=Math.max(1,player.countCards('e'));
var sign=Math.sign(hs-es);
event.sign=sign;
if(sign>0) player.chooseBool(get.prompt('dczuowei'),'令'+get.translation(trigger.card)+'不可被响应').set('ai',()=>1);
else if(sign==0) player.chooseTarget(get.prompt('dczuowei'),'对一名其他角色造成1点伤害',lib.filter.notMe).set('ai',target=>{
return get.damageEffect(target,_status.event.player,_status.event.player);
});
else player.chooseBool(get.prompt('dczuowei'),'摸两张牌,然后本回合你不能再触发该分支').set('ai',()=>1);
'step 1'
if(!result.bool) event.finish()
else if(event.sign<=0&&!event.isMine()&&!event.isOnline()) game.delayx();
'step 2'
var sign=event.sign;
if(sign>0){
player.logSkill('dczuowei');
trigger.directHit.addArray(game.players);
event.finish();
}
else if(sign==0){
var target=result.targets[0];
player.logSkill('dczuowei',target);
target.damage();
}
else{
player.logSkill('dczuowei');
player.draw(2);
player.addTempSkill('dczuowei_ban');
}
},
subSkill:{
ban:{charlotte:true}
},
mod:{
aiValue:function(player,card,num){
if(_status.currentPhase!=player) return;
const event=get.event();
if(!player.isPhaseUsing()) return;
if(event.type!='phase') return;
const cardsh=[],cardse=[];
for(const cardx of ui.selected.cards){
const pos=get.position(cardx);
if(pos=='h') cardsh.add(cardx);
else if(pos=='e') cardse.add(cardx);
}
const hs=player.countCards('h')-cardsh.length,es=Math.max(1,player.countCards('e')-cardse.length);
const delt=hs-es;
if(delt<=0) return;
if(get.position(card)=='h'&&delt==1) return num/1.25;
},
aiUseful:function(){
return lib.skill.dczuowei.mod.aiValue.apply(this,arguments);
},
aiOrder:function(player,card,num){
if(player.hasSkill('dczuowei_ban')||_status.currentPhase!=player) return;
const cardsh=[],cardse=[];
const pos=get.position(card);
if(pos=='h') cardsh.add(card);
else if(pos=='e') cardse.add(card);
if(get.tag(card,'draw')||get.tag(card,'gain')){
const hs=player.countCards('h')-cardsh.length,es=Math.max(1,player.countCards('e')-cardse.length+(get.type(card)=='equip'));
if(player.hasSkill('dczuowei_ban')&&hsMath.max(1,player.countCards('e'))) return [1,3];
}
}
}
},
//刘宠骆俊
dcminze:{
audio:2,
enable:'phaseUse',
filterTarget:function(card,player,target){
if(player.getStorage('dcminze_targeted').includes(target)) return false;
return target.countCards('h')get.name(i,player)));
},
ai:{
order:6.5,
expose:0.2,
},
subSkill:{
targeted:{onremove:true,charlotte:true},
given:{
charlotte:true,
onremove:true,
intro:{
content:'本回合以此法交出的牌名:$',
},
},
draw:{
trigger:{player:'phaseJieshuBegin'},
filter:function(event,player){
return player.getStorage('dcminze_given').length;
},
forced:true,
locked:false,
content:function(){
var num=Math.min(5,player.getStorage('dcminze_given').length)-player.countCards('h');
if(num>0) player.draw(num);
}
}
}
},
dcjini:{
audio:2,
trigger:{player:'damageEnd'},
direct:true,
filter:function(event,player){
return player.maxHp-player.countMark('dcjini_counted')>0;
},
content:function(){
'step 0'
player.chooseCard(get.prompt2('dcjini'),[1,player.maxHp-player.countMark('dcjini_counted')],lib.filter.cardRecastable).set('ai',card=>{
return 6-get.value(card);
});
'step 1'
if(result.bool){
var cards=result.cards;
player.logSkill('dcjini');
player.addTempSkill('dcjini_counted');
player.addMark('dcjini_counted',cards.length,false);
event.recast=player.recast(cards);
}
else event.finish();
'step 2'
if(trigger.source&&trigger.source.isIn()&&player.hasHistory('gain',evt=>evt.getParent(2)==event.recast&&evt.cards.some(value=>get.name(value)=='sha'))){
player.chooseToUse(function(card){
if(get.name(card)!='sha') return false;
return lib.filter.filterCard.apply(this,arguments);
},'击逆:是否对'+get.translation(trigger.source)+'使用一张不可被响应的杀?').set('complexSelect',true).set('filterTarget',function(card,player,target){
if(target!=_status.event.sourcex&&!ui.selected.targets.includes(_status.event.sourcex)) return false;
return lib.filter.targetEnabled.apply(this,arguments);
}).set('sourcex',trigger.source).set('oncard',()=>{
_status.event.directHit.addArray(game.players);
});
}
},
subSkill:{
counted:{
onremove:true,
charlotte:true
}
}
},
//乐綝
dcporui:{
audio:2,
trigger:{global:'phaseJieshuBegin'},
filter:function(event,player){
if(player==event.player) return false;
if(player.countMark('dcporui_round')>=(player.hasMark('dcgonghu_basic')?2:1)||player.countCards('h')==0) return false;
return game.hasPlayer(current=>{
if(current==player||current==event.player) return false;
return current.hasHistory('lose',function(evt){
return evt.cards2.length>0;
});
})&&player.countCards('he')>0;
},
direct:true,
content:function(){
'step 0'
var map={};
game.countPlayer(function(current){
if(current==player||current==trigger.player) return false;
if(current.hasHistory('lose',function(evt){
return evt.cards2.length>0;
})) map[current.playerid]=Math.min(5,current.getHistory('lose').reduce(function(num,evt){
return num+evt.cards2.length;
},0))+1;
});
player.chooseCardTarget({
prompt:get.prompt('dcporui'),
prompt2:get.skillInfoTranslation('dcporui',player),
filterCard:function(card,player){
return lib.filter.cardDiscardable(card,player,'dcporui');
},
position:'he',
filterTarget:function(card,player,target){
return Object.keys(_status.event.map).includes(target.playerid);
},
ai1:function(card){
return 7-get.value(card);
},
ai2:function(target){
return get.effect(target,{name:'sha'},_status.event.player,_status.event.player)*_status.event.map[target.playerid];
}
}).set('map',map);
'step 1'
if(result.bool){
var target=result.targets[0],cards=result.cards;
event.target=target;
player.logSkill('dcporui',target);
player.discard(cards);
event.num2=Math.min(5,target.getHistory('lose').reduce(function(num,evt){
return num+evt.cards2.length;
},0));
event.num=event.num2+1;
player.addTempSkill('dcporui_round','roundStart');
player.addMark('dcporui_round',1,false);
}
else event.finish();
'step 2'
var card={name:'sha',isCard:true,storage:{dcporui:true}};
if(player.canUse(card,target,false)&&target.isIn()){
player.useCard(card,target);
event.num--;
}
else event.goto(4);
'step 3'
if(event.num>0) event.goto(2);
'step 4'
if(!player.hasMark('dcgonghu_damage')&&target.isIn()){
var cards=player.getCards('h');
if(cards.length==0) event._result={bool:false};
else if(cards.length<=event.num2) event._result={bool:true,cards:cards};
else player.chooseCard('破锐:交给'+get.translation(target)+get.cnNumber(event.num2)+'张手牌',true,event.num2);
}
else event.finish();
'step 5'
if(result.bool){
player.give(result.cards,target);
}
event.finish();
'step 6'
if(player.hasMark('dcgonghu_basic')){
if(!target.hasHistory('damage',evt=>{
return evt.card&&evt.card.storage&&evt.card.storage.dcporui&&evt.getParent('dcporui')==event;
})){
player.recover();
}
}
},
subSkill:{
round:{charlotte:true,onremove:true}
},
ai:{
expose:0.4,
threaten:3.8,
}
},
dcgonghu:{
audio:2,
trigger:{
player:['loseAfter','damageEnd'],
source:'damageSource',
global:['equipAfter','addJudgeAfter','gainAfter','loseAsyncAfter','addToExpansionAfter'],
},
forced:true,
filter:function(event,player){
if(event.name=='damage'){
if(player.hasMark('dcgonghu_damage')) return false;
var num=0;
player.getHistory('damage',evt=>num+=evt.num);
player.getHistory('sourceDamage',evt=>num+=evt.num);
return num>1;
}
if(!_status.currentPhase||_status.currentPhase==player) return false;
if(player.hasMark('dcgonghu_basic')) return false;
if(_status.currentPhase&&_status.currentPhase==player) return false;
var evt=event.getl(player);
if(!evt||!evt.cards2||!evt.cards2.some(i=>get.type2(i,player)=='basic')) return false;
var num=0;
player.getHistory('lose',function(evtx){
if(num<2){
if(evtx&&evtx.cards2) num+=evtx.cards2.filter(i=>get.type2(i,player)=='basic').length;
}
});
return num>=2;
},
group:['dcgonghu_basic','dcgonghu_trick'],
content:function(){
player.addMark('dcgonghu_'+(trigger.name=='damage'?'damage':'basic'),1,false);
game.log(player,'修改了技能','#g【破锐】');
},
subSkill:{
trick:{
audio:'dcgonghu',
trigger:{player:'useCard2'},
direct:true,
locked:true,
filter:function(event,player){
if(!player.hasMark('dcgonghu_basic')||!player.hasMark('dcgonghu_damage')) return false;
var card=event.card;
if(get.color(card,false)!='red'||get.type(card,null,true)!='trick') return false;
var info=get.info(card);
if(info.allowMultiple==false) return false;
if(event.targets&&!info.multitarget){
if(game.hasPlayer(function(current){
return !event.targets.includes(current)&&lib.filter.targetEnabled2(card,player,current);
})){
return true;
}
}
return false;
},
content:function(){
'step 0'
var prompt2='为'+get.translation(trigger.card)+'增加一个目标'
player.chooseTarget(get.prompt('dcgonghu_trick'),function(card,player,target){
var player=_status.event.player;
return !_status.event.targets.includes(target)&&lib.filter.targetEnabled2(_status.event.card,player,target);
}).set('prompt2',prompt2).set('ai',function(target){
var trigger=_status.event.getTrigger();
var player=_status.event.player;
return get.effect(target,trigger.card,player,player);
}).set('card',trigger.card).set('targets',trigger.targets);
'step 1'
if(result.bool){
if(!event.isMine()&&!event.isOnline()) game.delayx();
event.targets=result.targets;
}
else{
event.finish();
}
'step 2'
if(event.targets){
player.logSkill('dcgonghu_trick',event.targets);
trigger.targets.addArray(event.targets);
}
},
},
basic:{
audio:'dcgonghu',
trigger:{player:'useCard'},
forced:true,
filter:function(event,player){
if(!player.hasMark('dcgonghu_basic')||!player.hasMark('dcgonghu_damage')) return false;
var card=event.card;
return (get.color(card,false)=='red'&&get.type(card,null,false)=='basic');
},
content:function(){
trigger.directHit.addArray(game.filterPlayer());
game.log(trigger.card,'不可被响应');
},
},
}
},
//张闿
dcxiangshu:{
audio:2,
trigger:{global:'phaseUseBegin'},
direct:true,
filter:function(event,player){
return event.player!=player&&event.player.countCards('h')>=event.player.hp;
},
content:function(){
'step 0'
var list=[0,1,2,3,4,5,'cancel2'];
player.chooseControl(list).set('prompt',get.prompt2('dcxiangshu')).set('ai',()=>{
return _status.event.choice;
}).set('choice',function(){
if(get.attitude(player,trigger.player)>0) return 'cancel2';
var cards=trigger.player.getCards('h');
var num=0;
for(var card of cards){
if(!trigger.player.hasValueTarget(card)){
num++;
if(num>=5) break;
}
}
if(cards.length>=3&&Math.random()<0.5) num=Math.max(0,num-1);
return num;
}());
'step 1'
if(result.control!='cancel2'){
player.logSkill('dcxiangshu',trigger.player);
var num=result.index;
player.storage.dcxiangshu_lottery=num;
player.addTempSkill('dcxiangshu_lottery','phaseUseAfter');
}
else event.finish();
'step 2'
player.chooseToDiscard('相鼠:是否弃置一张牌不公布此数字?').set('ai',card=>2-get.value(card));
'step 3'
if(!result.bool){
var num=player.storage.dcxiangshu_lottery;
player.markSkill('dcxiangshu_lottery');
player.popup(num);
game.log(player,'选择了数字','#g'+num);
}
},
subSkill:{
lottery:{
audio:'dcxiangshu',
trigger:{global:'phaseUseEnd'},
charlotte:true,
forced:true,
onremove:true,
logTarget:'player',
filter:function(event,player){
return typeof player.storage.dcxiangshu_lottery=='number'&&Math.abs(event.player.countCards('h')-player.storage.dcxiangshu_lottery)<=1;
},
content:function(){
var delt=Math.abs(trigger.player.countCards('h')-player.storage.dcxiangshu_lottery);
if(delt<=1&&trigger.player.countGainableCards('he',player)>0){
player.gainPlayerCard(trigger.player,'he',true);
}
if(delt==0){
trigger.player.damage(player);
}
},
intro:{content:'猜测的数字为#'}
}
}
},
//裴元绍
dcmoyu:{
audio:2,
init:()=>{
game.addGlobalSkill('dcmoyu_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('dcmoyu'),true)) game.removeGlobalSkill('dcmoyu_ai');
},
enable:'phaseUse',
filter:function(event,player){
return !player.hasSkill('dcmoyu_ban')&&game.hasPlayer(current=>lib.skill.dcmoyu.filterTarget(null,player,current));
},
filterTarget:function(card,player,target){
return player!=target&&!player.getStorage('dcmoyu_clear').includes(target)&&target.countGainableCards(player,'hej');
},
content:function(){
'step 0'
player.addTempSkill('dcmoyu_clear');
player.markAuto('dcmoyu_clear',[target]);
player.gainPlayerCard(target,'hej',true);
'step 1'
var num=player.getStorage('dcmoyu_clear').length;
target.chooseToUse(function(card,player,event){
if(get.name(card)!='sha') return false;
return lib.filter.filterCard.apply(this,arguments);
},'是否对'+get.translation(player)+'使用一张无距离限制的【杀】(伤害基数为'+num+')?').set('targetRequired',true).set('complexSelect',true).set('filterTarget',function(card,player,target){
if(target!=_status.event.sourcex&&!ui.selected.targets.includes(_status.event.sourcex)) return false;
return lib.filter.targetEnabled.apply(this,arguments);
}).set('sourcex',player).set('num',num).set('oncard',card=>{
_status.event.baseDamage=_status.event.getParent().num;
});
'step 2'
if(result.bool){
if(player.hasHistory('damage',evt=>{
return evt.card&&evt.card.name=='sha'&&evt.getParent(4)==event;
})) player.addTempSkill('dcmoyu_ban');
}
},
subSkill:{
clear:{
charlotte:true,
onremove:true,
},
ban:{
charlotte:true,
mark:true,
marktext:'欲',
intro:{content:'偷马贼被反打了!'},
},
ai:{
trigger:{player:'dieAfter'},
filter:()=>{
return !game.hasPlayer(i=>i.hasSkill('dcmoyu'),true);
},
silent:true,
forceDie:true,
content:()=>{
game.removeGlobalSkill('dcmoyu_ai');
},
ai:{
effect:{
target:function(card,player,target,current){
if(get.type(card)=='delay'&¤t<0){
var currentx=_status.currentPhase;
if(!currentx||!currentx.isIn()) return;
var list=game.filterPlayer(current=>{
if(current==target) return true;
if(!current.hasSkill('dcmoyu')) return false;
if(current.hasJudge('lebu')) return false;
return get.attitude(current,target)>0;
});
list.sortBySeat(currentx);
if(list.indexOf(target)!=0) return 'zerotarget';
}
},
},
}
}
},
ai:{
order:9,
threaten:2.4,
result:{
target:function(player,target){
var num=get.sgn(get.attitude(player,target));
var eff=get.effect(target,{name:'shunshou'},player,player)*num;
if(eff*num>0) return eff/10;
if(player.hasShan()&&!target.hasSkillTag('directHit_ai',true,{
target:player,
card:{name:'sha'},
},true)) return eff;
if(target.hasSha()&&player.hp+player.countCards('hs',function(card){
var mod2=game.checkMod(card,player,'unchanged','cardEnabled2',player);
if(mod2!='unchanged') return mod2;
var mod=game.checkMod(card,player,player,'unchanged','cardSavable',player);
if(mod!='unchanged') return mod;
var savable=get.info(card).savable;
if(typeof savable=='function') savable=savable(card,player,player);
return savable;
})<=player.getStorage('dcmoyu_clear').length+1) return 0;
return eff;
}
}
}
},
//张楚
dcjizhong:{
audio:2,
enable:'phaseUse',
usable:1,
filterTarget:lib.filter.notMe,
selectTarget:1,
content:function(){
'step 0'
target.draw(2);
'step 1'
var marked=target.hasMark('dcjizhong');
var cards=target.getCards('h');
if(marked){
if(cards.length<=3) event._result={bool:true,cards:cards};
else target.chooseCard(`集众:交给${get.translation(player)}三张手牌`,3,true);
}
else{
target.chooseCard(`集众:交给${get.translation(player)}三张手牌,或点击“取消”获得“信众”标记`,3).set('ai',card=>{
if(get.event('goon')) return 20-get.value(card);
return 1-get.value(card);
}).set('goon',get.attitude(target,player)>0);
}
'step 2'
if(!result.bool){
target.addMark('dcjizhong',1);
}
else{
target.give(result.cards,player);
}
},
marktext:'信',
intro:{
name:'信众',
name2:'信众',
markcount:()=>0,
content:'已成为信徒',
},
ai:{
order:9.5,
result:{
target:function(player,target){
var num=target.countCards('h');
if(num<=1) return -num;
if(get.attitude(player,target)>0) return 1;
return -1/(num/2+1);
}
}
}
},
dcrihui:{
audio:2,
trigger:{player:'useCardAfter'},
usable:1,
filter:function(event,player){
if(!event.targets||event.targets.length!=1||event.targets[0]==player) return false;
var card=event.card;
var target=event.targets[0];
var marked=target.hasMark('dcjizhong');
return (get.type(card)=='trick'||get.color(card)=='black'&&get.type(card)=='basic')&&
(marked||!marked&&game.hasPlayer(current=>current.hasMark('dcjizhong')));
},
direct:true,
content:function(){
'step 0'
var target=trigger.targets[0];
var card={name:trigger.card.name,nature:trigger.card.nature,isCard:true};
event.target=target;
event.card=card;
if(target.hasMark('dcjizhong')) player.gainPlayerCard(get.prompt('dcrihui',target),target,'hej').set('logSkill',['dcrihui',target]);
else{
player.chooseBool(get.prompt('dcrihui',target),'令所有有“信众”的角色依次视为对其使用一张'+get.translation(card)).set('ai',()=>{
return _status.event.bool;
}).set('bool',function(){
var eff=0;
game.countPlayer(current=>{
if(!current.hasMark('dcjizhong')) return;
eff+=get.effect(target,card,current,player);
});
return eff>0;
}());
}
'step 1'
if(!result.bool){
player.storage.counttrigger.dcrihui--;
event.finish();
return;
}
if(target.hasMark('dcjizhong')) event.finish();
else{
player.logSkill('dcrihui',target);
event.targets=game.filterPlayer(current=>current.hasMark('dcjizhong'));
event.targets.sortBySeat(_status.currentPhase);
}
'step 2'
var current=event.targets.shift();
if(current.canUse(card,target,false)){
current.useCard(card,target,false);
}
if(event.targets.length) event.redo();
}
},
dcguangshi:{
audio:2,
trigger:{player:'phaseZhunbeiBegin'},
filter:function(event,player){
return !game.hasPlayer(current=>current!=player&&!current.hasMark('dcjizhong'));
},
forced:true,
content:function(){
player.draw(2);
player.loseHp();
}
},
//董绾
dcshengdu:{
audio:2,
trigger:{player:'phaseBegin'},
direct:true,
content:function(){
'step 0'
player.chooseTarget(get.prompt2('dcshengdu'),lib.filter.notMe).set('ai',target=>{
var player=_status.event.player;
var att=get.attitude(player,target);
var eff=get.effect(target,{
name:'sha',
storage:{dcjieling:true},
},player,player);
var value=att/5;
if(value<0) value=-value/1.3;
value=Math.max(value-eff/20,0.01);
return value;
});
'step 1'
if(result.bool){
var target=result.targets[0];
player.logSkill('dcshengdu',target);
target.addMark('dcshengdu',1);
}
},
intro:{content:'mark'},
group:'dcshengdu_effect',
subSkill:{
effect:{
audio:'dcshengdu',
trigger:{global:'gainAfter'},
filter:function(event,player){
return event.getParent(2).name=='phaseDraw'&&event.player.hasMark('dcshengdu');
},
forced:true,
logTarget:'player',
content:function(){
var num=trigger.player.countMark('dcshengdu');
player.draw(num*trigger.cards.length);
trigger.player.removeMark('dcshengdu',num);
},
}
}
},
dcjieling:{
audio:2,
enable:'phaseUse',
position:'hs',
viewAs:{
name:'sha',
storage:{dcjieling:true}
},
filterCard:function(card,player){
if(player.getStorage('dcjieling_count').includes(get.suit(card))) return false;
if(ui.selected.cards.length){
return get.suit(card)!=get.suit(ui.selected.cards[0]);
}
return true;
},
selectCard:2,
complexCard:true,
check:function(card){
return 6-get.value(card);
},
precontent:function(){
player.addTempSkill('dcjieling_after');
event.getParent().addCount=false;
player.addTempSkill('dcjieling_count','phaseUseAfter');
player.markAuto('dcjieling_count',event.result.cards.reduce((list,card)=>list.add(get.suit(card,player)),[]));
},
ai:{
order:function(item,player){
return get.order({name:'sha'})+0.1;
},
},
locked:false,
mod:{
targetInRange:function(card){
if(card.storage&&card.storage.dcjieling) return true;
},
cardUsable:function(card,player,num){
if(card.storage&&card.storage.dcjieling) return Infinity;
},
},
subSkill:{
after:{
charlotte:true,
audio:'dcjieling',
trigger:{global:'useCardAfter'},
filter:function(event,player){
return event.card.name=='sha'&&event.card.storage&&event.card.storage.dcjieling;
},
direct:true,
content:function(){
'step 0'
var damaged=game.hasPlayer2(current=>{
return current.hasHistory('damage',evt=>evt.card==trigger.card);
});
var targets=trigger.targets.filter(i=>i.isIn());
player.logSkill('dcjieling_after',targets);
if(damaged){
for(var target of targets){
target.loseHp();
}
}
else{
for(var target of targets){
target.addMark('dcshengdu',1);
}
}
}
},
count:{
intro:{
content:function(s,p){
let str='此阶段已转化过的卡牌花色:';
for(let i=0;ievt.skill=='dcmoshou').length%3+1;
return '摸'+get.cnNumber(num)+'张牌';
},
content:function(){
var num=player.getAllHistory('useSkill',evt=>evt.skill=='dcmoshou').length;
player.storage.dcmoshou=num;
player.syncStorage('dcmoshou');
player.markSkill('dcmoshou');
num=(num-1)%3+1;
player.draw(num);
},
mark:true,
marktext:'守',
intro:{
markcount:function(storage,player){
if(typeof storage!='number') return 1;
return storage%3+1;
},
content:'本局游戏已发动过$次技能',
}
},
dcyunjiu:{
audio:2,
trigger:{global:'dieAfter'},
direct:true,
content:function(){
'step 0'
var evt=trigger.player.getHistory('lose',evtx=>{
return evtx.getParent(2)==trigger;
})[0];
if(!evt) event.finish();
else{
var cards=[];
//冷知识,角色死亡后只有手牌区和装备区的牌是被系统弃置的,其余牌的处理方式均为置入弃牌堆
cards.addArray(evt.hs).addArray(evt.es);
event.cards=cards.filterInD('d');
var num=cards.length;
if(num){
event.videoId=lib.status.videoId++;
var func=function(cards,id){
var num=cards.length;
var dialog=ui.create.dialog(get.prompt('dcyunjiu'),'弃置'+get.cnNumber(num)+'张牌,令一名其他角色获得以下这些牌
',cards);
dialog.videoId=id;
return dialog;
};
if(player.isOnline2()){
player.send(func,cards,event.videoId);
}
event.dialog=func(cards,event.videoId);
if(player!=game.me||_status.auto){
event.dialog.style.display='none';
}
player.chooseCardTarget({
prompt:false,
filterTarget:lib.filter.notMe,
filterCard:lib.filter.cardDiscardable,
selectCard:num,
position:'he',
goon:function(){
if(!game.hasPlayer(current=>get.attitude(player,current))>0) return false;
var value=0;
for(var card of cards){
value+=get.value(card,player,'raw')-1.2;
}
return value>0;
}(),
ai1:function(card){
if(_status.event.goon){
if(ui.selected.cards.length==_status.event.selectCard[1]-1&&ui.selected.cards.length>0) return 7-get.value(card);
return 5.5-get.value(card);
}
return 0;
},
ai2:function(target){
return get.attitude(_status.event.player,target)/Math.sqrt(target.countCards('h')+1);
}
});
}
else event.finish();
}
'step 1'
if(player.isOnline2()){player.send('closeDialog',event.videoId)}
event.dialog.close();
if(result.bool){
var cardsx=result.cards,target=result.targets[0];
player.logSkill('dcyunjiu',target);
player.discard(cardsx);
target.gain(cards.filterInD('d'),'gain2').giver=player;
}
else event.finish();
'step 2'
player.gainMaxHp();
player.recover();
}
},
//高翔
dcchiying:{
audio:2,
enable:'phaseUse',
usable:1,
filterTarget:function(card,player,target){
return target.hp<=player.hp;
},
content:function(){
'step 0'
var targets=game.filterPlayer(current=>target.inRange(current)&¤t!=player).sortBySeat(player);
event.targets=targets;
if(!targets.length) event.finish();
'step 1'
var current=targets.shift();
if(current.countCards('he')) current.chooseToDiscard('驰应:请弃置一张牌','he',true);
if(targets.length) event.redo();
'step 2'
if(target!=player){
var cards=[];
game.getGlobalHistory('cardMove',evt=>{
if(evt.getParent(3)==event){
cards.addArray(evt.cards.filter(card=>get.type(card)=='basic'));
}
});
cards=cards.filterInD('d');
if(cards.length) target.gain(cards,'gain2');
}
},
ai:{
order:6,
result:{
target:function(player,target){
var targets=game.filterPlayer(current=>target.inRange(current)&¤t!=player);
var eff=0;
for(var targetx of targets){
var effx=get.effect(targetx,{name:'guohe_copy2'},player,target);
if(get.attitude(player,targetx)<0) effx/=2;
eff+=effx;
}
return (target==player?0.5:1)*eff*(get.attitude(player,target)<=0?0.75:1);
}
}
}
},
//霍峻
dcgue:{
audio:2,
enable:['chooseToUse','chooseToRespond'],
hiddenCard:function(player,name){
if(player.getStorage('dcgue').includes(_status.currentPhase)) return false;
return name=='sha'||name=='shan';
},
filter:function(event,player){
//if(event.dcgue||event.type=='wuxie'||player==_status.currentPhase||player.getStorage('dcgue').includes(_status.currentPhase)) return false;
if(event.dcgue||event.type=='wuxie'||player==_status.currentPhase) return false;
if(!player.countCards('h')||player.hasSkill('dcgue_blocker',null,null,false)) return false;
for(var name of ['sha','shan']){
if(event.filterCard({name:name,isCard:true},player,event)) return true;
}
return false;
},
chooseButton:{
dialog:function(event,player){
var vcards=[];
for(var name of ['sha','shan']){
var card={name:name,isCard:true};
if(event.filterCard(card,player,event)) vcards.push(['基本','',name]);
}
return ui.create.dialog('孤扼',[vcards,'vcard'],'hidden');
},
check:function(button){
if(_status.event.player.countCards('h',{name:['sha','shan']})>1) return 0;
return 1;
},
backup:function(links,player){
return {
filterCard:()=>false,
selectCard:-1,
viewAs:{
name:links[0][2],
isCard:true,
},
popname:true,
precontent:function(){
'step 0'
player.logSkill('dcgue');
player.addTempSkill('dcgue_blocker');
player.showHandcards();
delete event.result.skill;
'step 1'
if(player.countCards('h',{name:['sha','shan']})>1){
var evt=event.getParent();
evt.set('dcgue',true);
evt.goto(0);
delete evt.openskilldialog;
return;
}
//else player.markAuto('dcgue',[_status.currentPhase]);
game.delayx();
},
}
},
prompt:function(links,player){
return '展示所有手牌'+(player.countCards('h',{name:['sha','shan']})<=1?',然后视为使用【'+get.translation(links[0][2])+'】':'');
}
},
subSkill:{blocker:{charlotte:true}},
//intro:{content:'已于$的回合发动过技能'},
ai:{
order:1,
respondSha:true,
respondShan:true,
skillTagFilter:function(player,tag,arg){
//if(player.getStorage('dcgue').includes(_status.currentPhase)) return false;
if(player.countCards('h',{name:['sha','shan']})>1) return false;
},
result:{
player:function(player){
if(player.countCards('h',{name:['sha','shan']})>1) return 0;
return 1;
}
}
}
},
dcsigong:{
audio:2,
trigger:{global:'phaseEnd'},
filter:function(event,player){
if(player.hasSkill('dcsigong_round')) return false;
if(event.player==player||!event.player.isIn()) return false;
if(!player.canUse('sha',event.player,false)) return false;
var respondEvts=[];
game.countPlayer2(current=>respondEvts.addArray(current.getHistory('useCard')).addArray(current.getHistory('respond')));
respondEvts=respondEvts.filter(i=>i.respondTo).map(evt=>evt.respondTo);
return event.player.hasHistory('useCard',evt=>{
return respondEvts.some(list=>list[1]==evt.card);
});
},
direct:true,
content:function(){
'step 0'
var num=1-player.countCards('h');
event.num=num;
var prompt2='';
if(num>=0){
var next=player.chooseBool().set('ai',()=>_status.event.goon);
prompt2+=(num>0?'摸一张牌,':'')+'视为对'+get.translation(trigger.player)+'使用一张【杀】(伤害基数+1)';
}
else{
var next=player.chooseToDiscard(-num).set('ai',card=>{
if(_status.event.goon) return 5.2-get.value(card);
return 0;
}).set('logSkill',['dcsigong',trigger.player]);
prompt2+='将手牌数弃置至1,视为对'+get.translation(trigger.player)+'使用一张【杀】(伤害基数+1)';
}
next.set('prompt',get.prompt('dcsigong',trigger.player));
next.set('prompt2',prompt2);
next.set('goon',get.effect(trigger.player,{name:'sha'},player,player)>0);
'step 1'
if(result.bool){
if(num>=0) player.logSkill('dcsigong',trigger.player);
if(num>0) player.draw(num,'nodelay');
event.num=Math.max(1,Math.abs(num));
}
else event.finish();
'step 2'
if(player.canUse('sha',trigger.player,false)){
player.addTempSkill('dcsigong_check');
player.useCard({name:'sha',isCard:true},trigger.player,false).set('shanReq',num).set('oncard',card=>{
var evt=_status.event;
evt.baseDamage++;
for(var target of game.filterPlayer(null,null,true)){
var id=target.playerid;
var map=evt.customArgs;
if(!map[id]) map[id]={};
map[id].shanRequired=evt.shanReq;
}
});
}
},
subSkill:{
round:{charlotte:true},
check:{
charlotte:true,
forced:true,
popup:false,
trigger:{source:'damageSource'},
filter:function(event,player){
return event.card&&event.card.name=='sha'&&event.getParent(3).name=='dcsigong';
},
content:function(){
player.addTempSkill('dcsigong_round','roundStart');
}
}
}
},
//孙寒华
dchuiling:{
audio:2,
trigger:{player:'useCard'},
forced:true,
direct:true,
filter:function(){
return ui.discardPile.childNodes.length>0;
},
onremove:true,
mark:true,
marktext:'灵',
intro:{
name2:'灵',
mark:function(dialog,storage,player){
dialog.addText('共有'+(storage||0)+'个标记');
dialog.addText('注:图标的颜色代表弃牌堆中较多的颜色');
},
},
global:'dchuiling_hint',
content:function(){
'step 0'
var mark=false;
var red=0,black=0;
for(var i=0;iblack){
player.logSkill('dchuiling');
player.recover();
event.finish();
if(get.color(trigger.card)=='black') mark=true;
event.logged=true;
}
else{
if(!event.isMine()&&!event.isOnline()) game.delayx();
player.chooseTarget(get.prompt('dchuiling'),'弃置一名角色的一张牌',(card,player,target)=>{
return target.countDiscardableCards(player,'he')>0;
}).set('ai',target=>{
return get.effect(target,{name:'guohe_copy2'},_status.event.player);
});
if(get.color(trigger.card)=='red') mark=true;
}
if(mark){
if(!event.logged) player.logSkill('dchuiling');
player.addMark('dchuiling',1);
event.logged=true;
}
'step 1'
if(result.bool){
var target=result.targets[0];
if(!event.logged) player.logSkill('dchuiling',target);
else player.line(target);
player.discardPlayerCard(target,'he',true);
}
},
subSkill:{
hint:{
trigger:{
global:['loseAfter','loseAsyncAfter','cardsDiscardAfter','equipAfter'],
},
forced:true,
popup:false,
lastDo:true,
forceDie:true,
forceOut:true,
filter:function(event,player){
if(event._dchuiling_checked) return false;
event._dchuiling_checked=true;
var cards=event.getd();
if(!cards.filterInD('d').length) return false;
return true;
},
markColor:[
['rgba(241, 42, 42, 0.75)', 'black'],
['',''],
['rgba(18, 4, 4, 0.75)', 'rgb(200, 200, 200)']
],
content:function(){
'step 0'
var red=0,black=0;
for(var i=0;i灵';
for(var player of game.players){
if(player.marks.dchuiling){
player.marks.dchuiling.firstChild.style.backgroundColor=bgColor;
player.marks.dchuiling.firstChild.innerHTML=text;
}
}
},Math.sign(black-red)+1);
},
}
},
mod:{
aiOrder:function(player,card,num){
if(get.itemtype(card)!='card') return;
var len=ui.discardPile.childNodes.length;
if(!len){
var type=get.type(card);
if(type=='basic'||type=='trick'){
if(player.getDamagedHp()>0){
return num+(get.color(card)=='red'?15:10);
}
return num+10;
}
return;
}
if(len>40) return;
var red=0,black=0;
for(var i=0;i0){
return num+(get.color(card)=='red'?15:10);
}
return num+10;
}
return;
}
else{
var color=get.color(card);
if(color=='red'&&redblack) return num+10;
}
},
}
},
dcchongxu:{
audio:2,
enable:'phaseUse',
limited:true,
skillAnimation:true,
animationColor:'wood',
derivation:['dctaji','dcqinghuang'],
filterCard:()=>false,
selectCard:[0,1],
prompt:function(){
return '限定技。你可以失去〖汇灵〗,增加'+Math.min(game.countPlayer(),_status.event.player.countMark('dchuiling'))+'点体力上限,然后获得〖踏寂〗和〖清荒〗。'
},
filter:function(event,player){
return player.countMark('dchuiling')>=4;
},
content:function(){
'step 0'
player.awakenSkill('dcchongxu');
player.gainMaxHp(Math.min(game.countPlayer(),player.countMark('dchuiling')));
player.removeSkill('dchuiling');
'step 1'
player.addSkillLog('dctaji');
player.addSkillLog('dcqinghuang');
},
ai:{
order:function(itemp,player){
if(player.hasCard(card=>{
return get.type(card)!='equip'&&player.getUseValue(card)>1;
},'h')) return 12;
return 0.1;
},
result:{
player:function(player){
var count=player.countMark('dchuiling');
if(count>=game.countPlayer()-1) return 1;
return (count>=6||player.hp<=2)?1:0;
}
}
}
},
dctaji:{
audio:2,
trigger:{
player:'loseAfter',
global:['equipAfter','addJudgeAfter','gainAfter','loseAsyncAfter','addToExpansionAfter'],
},
forced:true,
locked:false,
filter:function(event,player){
var evt=event.getl(player);
return evt&&evt.hs&&evt.hs.length;
},
content:function(){
'step 0'
var evt=trigger.getParent();
var effects=[
['useCard',function(){
'step 0'
var targets=game.filterPlayer(current=>{
return current.countDiscardableCards(player,'he')&¤t!=player;
});
if(!targets.length) event.finish();
else player.chooseTarget('踏寂:弃置其他角色一张牌',true,(card,player,target)=>{
return _status.event.targets.includes(target);
}).set('targets',targets).set('ai',target=>{
return get.effect(target,{name:'guohe_copy2'},_status.event.player);
});
'step 1'
if(result.bool){
var target=result.targets[0];
player.line(target);
player.discardPlayerCard(target,'he',true);
}
}],
['respond',function(){
player.draw();
}],
['discard',function(){
player.recover();
}],
['other',function(){
player.addSkill('dctaji_damage');
player.addMark('dctaji_damage',1,false);
game.log(player,'下一次对其他角色造成的伤害','#g+1');
}]
];
var name=evt.name;
if(trigger.name=='loseAsync') name=evt.type;
var list=['useCard','respond','discard','other'];
if(!list.includes(name)) name='other';
for(var i=0;i<1+player.countMark('dcqinghuang_add');i++){
if(!list.length) break;
if(!list.includes(name)) name=list.randomRemove(1)[0];
if(name=='useCard') list.remove('useCard');
for(var effect of effects){
if(effect[0]==name){
list.remove(name);
var next=game.createEvent('dctaji_'+name);
next.player=player;
next.setContent(effect[1]);
break;
}
}
}
},
subSkill:{
damage:{
trigger:{source:'damageBegin1'},
forced:true,
charlotte:true,
onremove:true,
filter:function(event,player){
return event.player!=player;
},
content:function(){
trigger.num+=player.countMark('dctaji_damage');
player.removeSkill('dctaji_damage');
},
intro:{
content:'下次对其他角色造成伤害时,此伤害+#',
}
}
}
},
dcqinghuang:{
audio:2,
trigger:{player:'phaseUseBegin'},
filter:function(event,player){
return player.maxHp>1;
},
check:function(event,player){
var num1=player.countCards('h');
var num2=player.countCards('h',card=>player.hasValueTarget(card));
var num3=player.getHandcardLimit();
if(player.isDamaged()){
return num2>1||num1-num2-num3>0;
}
else{
return num2>2+Math.max(0,3-player.hp)||player.hp>2&&num1-num2-num3>2;
}
},
content:function(){
player.loseMaxHp();
player.addTempSkill('dcqinghuang_add');
player.addMark('dcqinghuang_add',1,false);
},
subSkill:{
add:{
charlotte:true,
onremove:true,
}
}
},
//孟节
dcyinlu:{
audio:2,
trigger:{
global:'phaseBefore',
player:'enterGame',
},
forced:true,
locked:false,
derivation:['dcyinlu_lequan','dcyinlu_huoxi','dcyinlu_zhangqi','dcyinlu_yunxiang'],
global:['dcyinlu_lequan','dcyinlu_huoxi','dcyinlu_zhangqi','dcyinlu_yunxiang'],
group:'dcyinlu_move',
filter:function(event,player){
return (event.name!='phase'||game.phaseNumber==0);
},
hasMark:function(target){
return lib.skill.dcyinlu.derivation.some(i=>target.hasMark(i));
},
content:function(){
'step 0'
event.marks=lib.skill.dcyinlu.derivation.slice(0,3);
if(game.countPlayer()<=2) event.goto(3);
'step 1'
player.chooseTarget('引路:令三名角色分别获得〖引路〗标记',true,3).set('targetprompt',()=>{
return get.translation(lib.skill.dcyinlu.derivation[ui.selected.targets.length-1]);
}).set('complexSelect',true).set('ai',target=>{
var player=_status.event.player;
if(ui.selected.targets.length==2) return get.effect(target,{name:'losehp'},player,player);
return get.attitude(player,target);
});
'step 2'
if(result.bool){
var targets=result.targets;
player.line(targets);
for(var i=0;i