This commit is contained in:
Spmario233 2023-08-03 14:46:53 +08:00
parent fd15241714
commit 3ecc2810e3
7 changed files with 109 additions and 185 deletions

View File

@ -455,6 +455,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player:'useCard',
},
filter:function(event,player){
var len=lib.skill.dcweidang.getLength(event.card);
if(player.hasHistory('useCard',function(evt){
return evt!=event&&lib.skill.dcweidang.getLength(evt.card)==len;
},event)) return false;
if(!player.getStat().skill.clanguangu) return false;
var history=player.getAllHistory('useSkill',evt=>{
return evt.skill=='clanguangu_backup';
@ -468,7 +472,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
break;
}
}
if(num&&lib.skill.dcweidang.getLength(event.card)==num) return true;
if(num&&len==num) return true;
return false;
},
forced:true,

View File

@ -625,7 +625,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.line(target,'fire');
var num=target.countCards('h')-player.countCards('h');
if(num>0) target.chooseToDiscard('h',true,num);
else target.draw(Math.min(5,num));
else target.draw(Math.min(5,-num));
}
},
subSkill:{
@ -1927,7 +1927,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var storage=player.getStorage('dddchashi');
if(!storage||!storage.length) return false;
if(event.player!=storage[1]||!event.player.isIn()) return false;
if(!player.getCards('h').contains(storage[0])||!storage[0].hasGaintag('dddchashi')) return false;
if(!player.getCards('he').contains(storage[0])||!storage[0].hasGaintag('dddchashi')) return false;
if(get.suit(event.card)!=get.suit(storage[0])) return false;
var evt=event.getParent('phaseUse');
if(evt.player)
@ -2354,7 +2354,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var history=current.actionHistory;
for(var i=history.length-2;i>=0;i--){
var evts=history[i].useSkill;
for(evt of evts){
for(var evt of evts){
if(evt.skill=='dddfengzheng_global') return true;
}
if(history[i].isRound) break;
@ -2367,7 +2367,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var history=current.actionHistory;
for(var i=history.length-2;i>=0;i--){
var evts=history[i].useSkill;
for(evt of evts){
for(var evt of evts){
if(evt.skill=='dddfengzheng_global') return true;
}
if(history[i].isRound) break;
@ -2382,7 +2382,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var history=current.actionHistory;
for(var i=history.length-2;i>=0;i--){
var evts=history[i].useSkill;
for(evt of evts){
for(var evt of evts){
if(evt.skill=='dddfengzheng_global') return true;
}
if(history[i].isRound) break;
@ -3108,35 +3108,38 @@ game.import('character',function(lib,game,ui,get,ai,_status){
subSkill:{
act:{
trigger:{
global:'phaseBefore',
global:['phaseBefore','phaseAfter','phaseYouxueed'],
},
forced:true,
firstDo:true,
charlotte:true,
filter:function(event,player){
var seat=event.player.getSeatNum(),seatP=event.player.getPrevious().getSeatNum();
return !player.hasSkill('dddyouxue_acted')&&seat>=player.countMark('dddyouxue')&&(seatP>seat||seatP<player.countMark('dddyouxue'))||
event.player==player&&event.skill!='dddyouxue_act';
filter:function(event,player,name){
if(event.skill) return false;
var vseat=player.countMark('dddyouxue');
if(name!='phaseBefore'){
if(player.hasSkill('dddyouxue_acted',null,false,false)) return false;
var seat=event.player.getSeatNum();
var next=event.player.next;
if(!game.players.contains(next)) next=game.findNext(next);
var seat2=next.getSeatNum();
if(seat==seat2) return false;
if(seat<seat2) return vseat>seat&&vseat<=seat2;
return seat2>=vseat;
}
else{
return event.player==player;
}
},
content:function(){
'step 0'
var seat=trigger.player.getSeatNum(),seatP=trigger.player.getPrevious().getSeatNum();
if(trigger.player==player&&trigger.skill!='dddyouxue_act'&&(seat<player.countMark('dddyouxue')||seatP>=player.countMark('dddyouxue'))){
if(event.triggername=='phaseBefore'){
trigger.finish();
trigger.untrigger(true);
trigger._triggered=5;
event.finish();
return;
trigger.trigger('phaseYouxueed');
}
trigger.player.getPrevious().getHistory('custom').push({'dddyouxue':true});
player.insertPhase();
player.addTempSkill('dddyouxue_acted','roundStart');
if(!trigger._finished){
trigger.finish();
trigger.untrigger(true);
trigger._triggered=5;
var evt=trigger.player.insertPhase();
delete evt.skill;
else{
player.insertPhase('dddyouxue_act');
player.addTempSkill('dddyouxue_acted','roundStart');
}
}
},

View File

@ -4437,20 +4437,23 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
filter:function(button){
var evt=_status.event,player=_status.event.player;
if(!evt.dialog._chooseButton){
var evt2=_status.event.getParent();
return evt2.filterCard(get.autoViewAs({name:evt.dialog._cardName},[button.link]),player,evt2);
if(evt.dialog){
if(!evt.dialog._chooseButton){
var evt2=_status.event.getParent();
return evt2.filterCard(get.autoViewAs({name:evt.dialog._cardName},[button.link]),player,evt2);
}
if(ui.selected.buttons.length){
var str=ui.selected.buttons[0].link;
if(typeof str!='string'||typeof button.link=='string') return false;
var evt2=_status.event.getParent();
return evt2.filterCard(get.autoViewAs({name:str},[button.link]),player,evt2);
}
return typeof button.link=='string';
}
if(ui.selected.buttons.length){
var str=ui.selected.buttons[0].link;
if(typeof str!='string'||typeof button.link=='string') return false;
var evt2=_status.event.getParent();
return evt2.filterCard(get.autoViewAs({name:str},[button.link]),player,evt2);
}
return typeof button.link=='string';
return false;
},
select:function(){
return (_status.event.dialog._chooseButton||1);
return _status.event.dialog?(_status.event.dialog._chooseButton||1):1;
},
backup:function(links,player){
var card,name;
@ -12955,7 +12958,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
zhaotongzhaoguang:['dc_zhaotongzhaoguang','zhaotongzhaoguang'],
yangbiao:['yangbiao','dc_yangbiao','jsrg_yangbiao'],
qiaozhou:['yj_qiaozhou','qiaozhou'],
sunhanhua:['dc_qiaozhou','sunhanhua'],
sunhanhua:['dc_sunhanhua','sunhanhua'],
},
translate:{
liuzan:'手杀留赞',

View File

@ -9670,7 +9670,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player:"enterGame",
},
forced:true,
filter:function(event){
filter:function(event,player){
return game.hasPlayer(current=>current!=player)&&(event.name!='phase'||game.phaseNumber==0);
},
content:function(){

View File

@ -1571,15 +1571,21 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return dialog;
},
filter:function(button){
var opts=_status.event.dialog._chosenOpt;
if(opts&&opts.length&&opts[0].link=='交出锦囊牌'&&typeof button.link!=typeof opts[0].link){
return false;
if(_status.event.dialog){
var opts=_status.event.dialog._chosenOpt;
if(opts&&opts.length&&opts[0].link=='交出锦囊牌'&&typeof button.link!=typeof opts[0].link){
return false;
}
return true;
}
return true;
return false;
},
select:function(){
var opts=_status.event.dialog._chosenOpt;
return opts&&opts.length&&opts[0].link=='交出锦囊牌'?0:1;
if(_status.event.dialog){
var opts=_status.event.dialog._chosenOpt;
return opts&&opts.length&&opts[0].link=='交出锦囊牌'?0:1;
}
return 0;
},
check:function(button){
if(_status.event.getParent().type!='phase') return 1;

View File

@ -13075,55 +13075,19 @@
if(event.dialog&&typeof event.dialog=='object') event.dialog.close();
var dialog=info.chooseButton.dialog(event,player);
if(info.chooseButton.chooseControl){
var choices=info.chooseButton.chooseControl(event,player);
var choicesx=choices.slice(0);
choicesx.remove('cancel2');
if(choicesx.length==1&&dialog.direct||dialog.forceDirect){
event._result={
bool:true,
control:choicesx[0],
index:0,
}
}
else{
var next=player.chooseControl(choices);
next.dialog=dialog;
next.set('ai',info.chooseButton.check||function(){return 0;});
if(event.id) next._parent_id=event.id;
next.type='chooseToUse_button';
}
var next=player.chooseControl(info.chooseButton.chooseControl(event,player));
next.dialog=dialog;
next.set('ai',info.chooseButton.check||function(){return 0;});
if(event.id) next._parent_id=event.id;
next.type='chooseToUse_button';
}
else{
var ai=info.chooseButton.check||function(){return 1;};
var filterButton=info.chooseButton.filter||function(){return true};
var selectButton=info.chooseButton.select||1;
var chooseable=[];
var evt=game.createEvent('emptyEvent');
event.next.remove(evt);
evt.parent=_status.event;
evt.player=player;
var tmpevt=_status.event;
_status.event=evt;
for(var i=0;i<dialog.buttons.length;i++){
var btn=dialog.buttons[i];
if(filterButton(btn,player)) chooseable.push(btn);
}
_status.event=tmpevt;
if(chooseable.length==1&&dialog.direct||dialog.forceDirect){
event._result={
bool:true,
buttons:chooseable[0],
links:[chooseable[0].link],
}
}
else{
var next=player.chooseButton(dialog);
next.set('ai',ai);
next.set('filterButton',filterButton);
next.set('selectButton',selectButton);
if(event.id) next._parent_id=event.id;
next.type='chooseToUse_button';
}
var next=player.chooseButton(dialog);
next.set('ai',info.chooseButton.check||function(){return 1;});
next.set('filterButton',info.chooseButton.filter||function(){return true;});
next.set('selectButton',info.chooseButton.select||1);
if(event.id) next._parent_id=event.id;
next.type='chooseToUse_button';
}
event.buttoned=event.result.skill;
}
@ -13292,51 +13256,15 @@
if(event.dialog&&typeof event.dialog=='object') event.dialog.close();
var dialog=info.chooseButton.dialog(event,player);
if(info.chooseButton.chooseControl){
var choices=info.chooseButton.chooseControl(event,player);
var choicesx=choices.slice(0);
choicesx.remove('cancel2');
if(choicesx.length==1&&dialog.direct||dialog.forceDirect){
event._result={
bool:true,
control:choicesx[0],
index:0,
}
}
else{
var next=player.chooseControl(choices);
next.dialog=dialog;
next.set('ai',info.chooseButton.check||function(){return 0;});
}
var next=player.chooseControl(info.chooseButton.chooseControl(event,player));
next.dialog=dialog;
next.set('ai',info.chooseButton.check||function(){return 0;});
}
else{
var ai=info.chooseButton.check||function(){return 1;};
var filterButton=info.chooseButton.filter||function(){return true};
var selectButton=info.chooseButton.select||1;
var chooseable=[];
var evt=game.createEvent('emptyEvent');
event.next.remove(evt);
evt.parent=_status.event;
evt.player=player;
var tmpevt=_status.event;
_status.event=evt;
for(var i=0;i<dialog.buttons.length;i++){
var btn=dialog.buttons[i];
if(filterButton(btn,player)) chooseable.push(btn);
}
_status.event=tmpevt;
if(chooseable.length==1&&dialog.direct||dialog.forceDirect){
event._result={
bool:true,
buttons:chooseable[0],
links:[chooseable[0].link],
}
}
else{
var next=player.chooseButton(dialog);
next.set('ai',ai);
next.set('filterButton',filterButton);
next.set('selectButton',selectButton);
}
var next=player.chooseButton(dialog);
next.set('ai',info.chooseButton.check||function(){return 1;});
next.set('filterButton',info.chooseButton.filter||function(){return true;});
next.set('selectButton',info.chooseButton.select||1);
}
event.buttoned=event.result.skill;
}

View File

@ -396,7 +396,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
gz_zhonghui:['male','ye',4,['gzquanji','gzpaiyi'],['gzskin']],
gz_simazhao:['male','ye',3,['gzzhaoxin','gzsuzhi'],['gzskin']],
gz_gongsunyuan:['male','ye',4,['gzrehuaiyi','gzrezisui'],['gzskin']],
gz_gongsunyuan:['male','ye',4,['gzhuaiyi','gzzisui'],['gzskin']],
gz_sunchen:['male','ye',4,['gzshilu','gzxiongnve']],
gz_tangzi:['male','wu',4,['gzxingzhao'],['doublegroup:wu:wei','gzskin']],
gz_mengda:['male','wei',4,['qiuan','liangfan'],['doublegroup:wei:shu']],
@ -405,7 +405,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
gz_shixie:['male','qun',3,['gzbiluan','gzrelixia'],['doublegroup:qun:wu','gzskin']],
gz_zhanglu:['male','qun',3,['gzrebushi','gzremidao'],['doublegroup:qun:wei','gzskin']],
gz_dongzhao:['male','wei',3,['quanjin','zaoyun']],
gz_re_xushu:['male','shu',4,['gzqiance','gzjujian'],['gzskin']],
gz_re_xushu:['male','shu',4,['gzzhuhai','gzpozhen','gzjiancai'],['gzskin']],
gz_wujing:['male','wu',4,['donggui','fengyang'],['gzskin']],
gz_yanbaihu:['male','qun',4,['gzzhidao','gzyjili'],['gzskin']],
gz_xuyou:['male','wei',3,['gzchenglve','gzshicai'],['doublegroup:wei:qun','gzskin']],
@ -510,7 +510,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
gz_bianfuren:['female','wei',3,['wanwei','gzyuejian']],
gz_xunyou:['male','wei',3,['gzqice','zhiyu'],['gzskin']],
gz_lingtong:['male','wu',4,['xuanlve','yongjin'],['gzskin']],
gz_lvfan:['male','wu',3,['gzdiaodu','gzdiancai']],
gz_lvfan:['male','wu',3,['xindiaodu','gzdiancai']],
gz_masu:['male','shu',3,['sanyao','gzzhiman'],['gzskin']],
gz_shamoke:['male','shu',4,['gzjili'],['gzskin']],
@ -1001,40 +1001,22 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
//delay:0,
content:function(){
'step 0'
if(!_status.gzrejinghe_tianshu){
if(!player.storage.gzrejinghe_tianshu){
var list=lib.skill.gzrejinghe.derivation.slice(0);
list.remove('gzrejinghe_faq');
var list2=list.slice(0,get.rand(0,list.length));
list.removeArray(list2);
list.addArray(list2);
_status.gzrejinghe_tianshu=list;
ui.gzretianshu=ui.create.system('天书',null,true);
lib.setPopped(ui.gzretianshu,function(){
var dialog=ui.create.dialog('hidden');
dialog.content.style['overflow-x']='visible';
var list=_status.gzrejinghe_tianshu;
var core=document.createElement('div');
var centerX=-10,centerY=80,radius=80;
var radian=Math.PI*2/list.length;
for(var i=0;i<list.length;i++){
var td=document.createElement('div');
td.innerHTML=get.translation(list[i]).slice(0,1);
td.style.position='absolute';
core.appendChild(td);
td.style.left=(centerX+radius*Math.sin(radian*i))+'px';
td.style.top=(centerY-radius*Math.cos(radian*i))+'px';
}
dialog.content.appendChild(core);
return dialog;
},250);
player.storage.gzrejinghe_tianshu=list;
}
else{
var first=_status.gzrejinghe_tianshu[0];
_status.gzrejinghe_tianshu.remove(first);
_status.gzrejinghe_tianshu.push(first);
var first=player.storage.gzrejinghe_tianshu[0];
player.storage.gzrejinghe_tianshu.remove(first);
player.storage.gzrejinghe_tianshu.push(first);
}
game.log(player,'转动了','#g“天书”');
var skill=_status.gzrejinghe_tianshu[0];
player.markSkill('gzrejinghe');
var skill=player.storage.gzrejinghe_tianshu[0];
event.skill=skill;
var cardname='gzrejinghe_'+skill;
lib.card[cardname]={
@ -1067,6 +1049,26 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
game.log(target,'获得了技能','#g【'+get.translation(skill)+'】');
}
},
intro:{
name:'写满技能的天书',
markcount:()=>8,
mark:function(dialog,storage,player){
dialog.content.style['overflow-x']='visible';
var list=player.storage.gzrejinghe_tianshu;
var core=document.createElement('div');
var centerX=-10,centerY=80,radius=80;
var radian=Math.PI*2/list.length;
for(var i=0;i<list.length;i++){
var td=document.createElement('div');
td.innerHTML=get.translation(list[i]).slice(0,1);
td.style.position='absolute';
core.appendChild(td);
td.style.left=(centerX+radius*Math.sin(radian*i))+'px';
td.style.top=(centerY-radius*Math.cos(radian*i))+'px';
}
dialog.content.appendChild(core);
},
},
ai:{
order:10,
result:{target:1},
@ -13188,7 +13190,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
'step 6'
if(result.bool){
target.chat('加入');
if(!_status.yexinjia_list) _status.yexinjia_list=['夏','商','周','秦','汉','隋','唐','宋','辽','金','元','明','清'];
if(!_status.yexinjia_list) _status.yexinjia_list=['夏','商','周','秦','汉','隋','唐','宋','辽','金','元','明'];
source.chooseControl(_status.yexinjia_list).set('prompt','请选择自己所属的野心家势力的标识').set('ai',()=>(_status.yexinjia_list?_status.yexinjia_list.randomGet():0));
}
else{
@ -15530,28 +15532,6 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
this.node.identity.dataset.color='unknown';
this.node.identity.classList.add('guessing');
}
//南华老仙天书重连显示
if(_status.gzrejinghe_tianshu){
ui.gzretianshu=ui.create.system('天书',null,true);
lib.setPopped(ui.gzretianshu,function(){
var dialog=ui.create.dialog('hidden');
dialog.content.style['overflow-x']='visible';
var list=_status.gzrejinghe_tianshu;
var core=document.createElement('div');
var centerX=-10,centerY=80,radius=80;
var radian=Math.PI*2/list.length;
for(var i=0;i<list.length;i++){
var td=document.createElement('div');
td.innerHTML=get.translation(list[i]).slice(0,1);
td.style.position='absolute';
core.appendChild(td);
td.style.left=(centerX+radius*Math.sin(radian*i))+'px';
td.style.top=(centerY-radius*Math.cos(radian*i))+'px';
}
dialog.content.appendChild(core);
return dialog;
},250);
}
},
dieAfter2:function(source){
var that=this;