部分重写OL吕伯奢

This commit is contained in:
copcap 2023-10-26 05:24:11 +08:00
parent 979a2e76eb
commit 4404cb09aa
No known key found for this signature in database
GPG Key ID: 9AE7B8AF097EC926
2 changed files with 143 additions and 97 deletions

View File

@ -1557,6 +1557,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){ content:function(){
player.addToExpansion(trigger.cards.filterInD(),'gain2').gaintag.add('olfushi'); player.addToExpansion(trigger.cards.filterInD(),'gain2').gaintag.add('olfushi');
}, },
marktext:'豕',
intro:{ intro:{
content:'expansion', content:'expansion',
markcount:'expansion', markcount:'expansion',
@ -1570,35 +1571,53 @@ game.import('character',function(lib,game,ui,get,ai,_status){
wusheng:{ wusheng:{
enable:'chooseToUse', enable:'chooseToUse',
filter:function(event,player){ filter:function(event,player){
if(event.olfushi) return false; return player.getExpansions('olfushi').length&&event.filterCard({name:'sha',isCard:true},player,event);
return player.getExpansions('olfushi').length;
}, },
filterCard:()=>false, chooseButton:{
selectCard:-1, dialog:function(event,player){
viewAs:{name:'sha'}, return ui.create.dialog(
prompt:'将任意“缚豕”牌置入弃牌堆并摸等量的牌,视为使用一张【杀】', '###缚豕###<div class="text center">重铸任意“缚豕”牌,视为使用一张【杀】并执行等量项</div>',
precontent:function(){ player.getExpansions('olfushi'),
'step 0' [['额外目标','伤害-1','伤害+1'],'tdnodes'],
delete event.result.skill; 'hidden'
player.chooseButton([2,Infinity],[ );
'###缚豕###<div class="text center">将任意“缚豕”牌置入弃牌堆并摸等量的牌,并选择执行等量项(超过三张默认全部执行)</div>', },
player.getExpansions('olfushi'), filter:function(button){
[['额外目标','伤害-1','伤害+1'],'tdnodes'], const cards=ui.selected.buttons.filter(button=>typeof button.link=='object');
]).set('filterOk',()=>{ if(cards.length>=3&&typeof button.link=='string') return false;
return true;
},
select:[2,Infinity],
filterOk:()=>{
if(!ui.selected.buttons.length) return false; if(!ui.selected.buttons.length) return false;
var controls=ui.selected.buttons.filter(button=>typeof button.link=='string'); const controls=ui.selected.buttons.filter(button=>typeof button.link=='string');
var cards=ui.selected.buttons.filter(button=>typeof button.link=='object'); const cards=ui.selected.buttons.filter(button=>typeof button.link=='object');
return Math.min(cards.length,3)==controls.length; if(cards.length>=3){
}).set('ai',function(button){ const dialog=get.event().dialog;
var player=_status.event.player; if(dialog&&dialog.buttons){
var trigger=_status.event.getParent().result; dialog.buttons.forEach(button=>{
var targets=game.filterPlayer(target=>{ if(typeof button.link!='string') return;
return !trigger.targets.contains(target)&&player.canUse(trigger.card,target); button.classList.remove('selectable');
button.classList.remove('selected');
ui.selected.buttons.remove(button);
});
}
return true;
}
return cards.length==controls.length;
},
check:function(button){
const player=get.player();
const card=new lib.element.VCard({name:'sha',isCard:true});
const targets=game.filterPlayer(target=>{
return player.canUse(card,target);
}); });
var num1=targets.filter(target=>get.effect(target,trigger.card,player,player)>0).length; const num0=targets.filter(target=>get.effect(target,card,player,player)>0).length;
var num2=targets.length-num1; if(num0<=0) return 0;
var list; const num1=Math.max(0,num0-1);
var num3=player.getExpansions('olfushi').length; const num2=targets.length-num1;
const num3=player.getExpansions('olfushi').length;
let list;
if((num1>0&&num2>0)||(num1==0&&num2==0)){ if((num1>0&&num2>0)||(num1==0&&num2==0)){
switch(num3){ switch(num3){
case 1: case 1:
@ -1628,7 +1647,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else if(num1==0){ else if(num1==0){
switch(num3){ switch(num3){
case 1: case 1:
list=['伤害-1']; list=['伤害+1'];
break; break;
default: default:
list=['伤害-1','伤害+1']; list=['伤害-1','伤害+1'];
@ -1636,37 +1655,59 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
} }
if(typeof button.link=='string'){ if(typeof button.link=='string'){
if(list.contains(button.link)) return 114514; if(list.includes(button.link)) return 114514;
return -1; return -1;
} }
else{ else{
var cards=ui.selected.buttons.filter(button=>typeof button.link=='object'); const cards=ui.selected.buttons.filter(button=>typeof button.link=='object');
if(list.length==3||cards.length<list.length) return 1/(get.value(button.link)||0.5); if(list.length==3&&(player.getHp()<=2||cards.length<num3-1)||cards.length<list.length) return 1/(get.value(button.link)||0.5);
return -1; return -1;
} }
}); },
'step 1' backup:function(links,player){
if(result.bool){ var cards=links.filter(button=>typeof button=='object');
var controls=result.links.filter(button=>typeof button=='string'); var controls=links.filter(button=>typeof button=='string');
var cards=result.links.filter(button=>typeof button=='object'); if(!controls.length) controls=['额外目标','伤害-1','伤害+1'];
player.logSkill('olfushi'); return {
player.recast(cards); audio:'olfushi',
event.result.card.olfushi_buff=controls; selectCard:-1,
player.addTempSkill('olfushi_buff'); position:'x',
cards:cards,
controls:controls,
filterCard:function(card){
return lib.skill.olfushi_wusheng_backup.cards.includes(card);
},
viewAs:{
name:'sha',
isCard:true,
},
precontent:function(){
var cards=lib.skill.olfushi_wusheng_backup.cards.slice();
var controls=lib.skill.olfushi_wusheng_backup.controls.slice();
player.logSkill('olfushi');
delete event.result.skill;
event.result.card=new lib.element.VCard(lib.skill.olfushi_wusheng_backup.viewAs);
event.result.cards=[];
player.recast(cards);
event.result.card.storage.olfushi_buff=controls;
player.addTempSkill('olfushi_buff');
}
}
},
prompt:function(links,player){
let controls=links.filter(button=>typeof button=='string');
if(!controls.length) controls=['额外目标','伤害-1','伤害+1'];
return `选择【杀】的目标(${controls.join('、')}`;
} }
else{
event.getParent().olfushi=true;
event.getParent().goto(0);
return;
}
},
order:function(item,player){
return get.order({name:'sha'})+0.1;
}, },
ai:{ ai:{
order:function(item,player){
return get.order({name:'sha'})+0.1;
},
result:{player:1},
respondSha:true, respondSha:true,
skillTagFilter:function(player,tag,arg){ skillTagFilter:function(player,tag,arg){
if(arg=='respond'||_status.event.olfushi) return false; if(arg=='respond') return false;
if(!player.getExpansions('olfushi').length) return false; if(!player.getExpansions('olfushi').length) return false;
}, },
}, },
@ -1675,37 +1716,39 @@ game.import('character',function(lib,game,ui,get,ai,_status){
charlotte:true, charlotte:true,
trigger:{player:['useCard2','useCardToPlayered']}, trigger:{player:['useCard2','useCardToPlayered']},
filter:function(event,player,name){ filter:function(event,player,name){
if(!event.card.olfushi_buff) return false; if(!event.card.storage||!event.card.storage.olfushi_buff) return false;
if(name=='useCard2') return true; if(name=='useCard2') return true;
return event.getParent().triggeredTargets3.length==event.targets.length&&event.card.olfushi_buff.length>1&&event.card.olfushi_buff.contains('伤害-1')&&!event.targets.some(target=>!event.targets.contains(target.getPrevious())&&!event.targets.contains(target.getNext())); return event.getParent().triggeredTargets3.length==event.targets.length&&event.card.storage.olfushi_buff.length>1&&event.card.storage.olfushi_buff.includes('伤害-1')&&!event.targets.some(target=>!event.targets.includes(target.getPrevious())&&!event.targets.includes(target.getNext()));
}, },
forced:true, forced:true,
popup:false, popup:false,
content:function(){ content:function(){
'step 0' 'step 0'
if(event.triggername=='useCardToPlayered'){ if(event.triggername=='useCardToPlayered'){
trigger.getParent().addCount=false; if(trigger.getParent().addCount!==false){
if(player.stat[player.stat.length-1].card.sha>0){ trigger.getParent().addCount=false;
player.stat[player.stat.length-1].card.sha--; if(player.stat[player.stat.length-1].card.sha>0){
player.stat[player.stat.length-1].card.sha--;
}
} }
game.log(trigger.card,'不计入次数'); game.log(trigger.card,'不计入次数');
event.finish(); event.finish();
return; return;
} }
var list=trigger.card.olfushi_buff; var list=trigger.card.storage.olfushi_buff;
event.list=list; event.list=list;
if(list.contains('额外目标')&&game.hasPlayer(target=>{ var canBeAddedTargets=game.filterPlayer(target=>{
return !trigger.targets.contains(target)&&player.canUse(trigger.card,target); return !trigger.targets.includes(target)&&player.canUse(trigger.card,target);
})){ });
player.chooseTarget('请选择'+get.translation(trigger.card)+'的额外目标',function(card,player,target){ if(!list.includes('额外目标')||!canBeAddedTargets.length) event._result={bool:false};
var trigger=_status.event.getTrigger(); else if(canBeAddedTargets.length==1) event._result={bool:true,targets:canBeAddedTargets};
return !trigger.targets.contains(target)&&player.canUse(trigger.card,target); else player.chooseTarget('请选择'+get.translation(trigger.card)+'的额外目标',function(card,player,target){
},true).set('ai',function(target){ var trigger=_status.event.getTrigger();
var player=_status.event.player; return !trigger.targets.includes(target)&&player.canUse(trigger.card,target);
return get.attitude(player,target); },true).set('ai',function(target){
}); var player=_status.event.player;
} return get.attitude(player,target);
else event._result={bool:false}; });
'step 1' 'step 1'
if(result.bool){ if(result.bool){
var targets=result.targets.sortBySeat(); var targets=result.targets.sortBySeat();
@ -1714,51 +1757,51 @@ game.import('character',function(lib,game,ui,get,ai,_status){
game.log(targets,'成为了',trigger.card,'的额外目标'); game.log(targets,'成为了',trigger.card,'的额外目标');
} }
'step 2' 'step 2'
if(event.list.contains('伤害-1')){ if(!event.list.includes('伤害-1')) event._result={bool:false};
player.chooseTarget('请选择'+get.translation(trigger.card)+'伤害-1的目标',function(card,player,target){ else if(trigger.targets.length==1) event._result={bool:true,targets:trigger.targets.slice()};
var trigger=_status.event.getTrigger(); else player.chooseTarget('请选择'+get.translation(trigger.card)+'伤害-1的目标',function(card,player,target){
return trigger.targets.contains(target); var trigger=_status.event.getTrigger();
},true).set('ai',function(target){ return trigger.targets.contains(target);
var player=_status.event.player; },true).set('ai',function(target){
return get.attitude(player,target); var player=_status.event.player;
}); return get.attitude(player,target);
} });
else event._result={bool:false};
'step 3' 'step 3'
if(result.bool){ if(result.bool){
var target=result.targets[0]; var target=result.targets[0];
player.line(target); player.line(target);
game.log(target,'受到',trigger.card,'的伤害-1'); game.log(trigger.card,'对',target,'的伤害-1');
target.addTempSkill('olfushi_buff2'); player.addTempSkill('olfushi_buff2');
target.markAuto('olfushi_buff2',[trigger.card]); player.initStorage('olfushi_buff2',[]);
player.getStorage('olfushi_buff2').push([target,trigger.card]);
} }
'step 4' 'step 4'
if(event.list.contains('伤害+1')){ if(!event.list.contains('伤害+1')) event.finish();
player.chooseTarget('请选择'+get.translation(trigger.card)+'伤害+1的目标',function(card,player,target){ else if(trigger.targets.length==1) event._result={bool:true,targets:trigger.targets.slice()};
var trigger=_status.event.getTrigger(); else player.chooseTarget('请选择'+get.translation(trigger.card)+'伤害+1的目标',function(card,player,target){
return trigger.targets.contains(target); var trigger=_status.event.getTrigger();
},true).set('ai',function(target){ return trigger.targets.contains(target);
var player=_status.event.player; },true).set('ai',function(target){
return get.damageEffect(target,player,player); var player=_status.event.player;
}); return get.damageEffect(target,player,player);
} });
else event.finish();
'step 5' 'step 5'
if(result.bool){ if(result.bool){
var target=result.targets[0]; var target=result.targets[0];
player.line(target); player.line(target);
game.log(target,'受到',trigger.card,'的伤害+1'); game.log(trigger.card,'对',target,'的伤害+1');
target.addTempSkill('olfushi_buff3'); player.addTempSkill('olfushi_buff3');
target.markAuto('olfushi_buff3',[trigger.card]); player.initStorage('olfushi_buff3',[]);
player.getStorage('olfushi_buff3').push([target,trigger.card]);
} }
}, },
}, },
buff2:{ buff2:{
charlotte:true, charlotte:true,
onremove:true, onremove:true,
trigger:{player:'damageBegin2'}, trigger:{source:'damageBegin2'},
filter:function(event,player){ filter:function(event,player){
return event.card&&player.getStorage('olfushi_buff2').contains(event.card); return event.card&&player.getStorage('olfushi_buff2').some(info=>info[0]==event.player&&info[1]==event.card);
}, },
forced:true, forced:true,
popup:false, popup:false,
@ -1782,9 +1825,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
buff3:{ buff3:{
charlotte:true, charlotte:true,
onremove:true, onremove:true,
trigger:{player:'damageBegin1'}, trigger:{source:'damageBegin1'},
filter:function(event,player){ filter:function(event,player){
return event.card&&player.getStorage('olfushi_buff3').contains(event.card); return event.card&&player.getStorage('olfushi_buff3').some(info=>info[0]==event.player&&info[1]==event.card);
}, },
forced:true, forced:true,
popup:false, popup:false,
@ -1792,6 +1835,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger.num++; trigger.num++;
}, },
}, },
wusheng_backup:{},
}, },
}, },
oldongdao:{ oldongdao:{
@ -26410,7 +26454,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
skill_feiyi_B_info:'每回合每项限一次当你的手牌数变为1后你可以展示此唯一手牌A并摸一张牌然后你选择一项①本回合使用点数大于A的点数的牌额外结算一次②本回合使用点数小于A的点数的牌额外结算一次。', skill_feiyi_B_info:'每回合每项限一次当你的手牌数变为1后你可以展示此唯一手牌A并摸一张牌然后你选择一项①本回合使用点数大于A的点数的牌额外结算一次②本回合使用点数小于A的点数的牌额外结算一次。',
lvboshe:'吕伯奢', lvboshe:'吕伯奢',
olfushi:'缚豕', olfushi:'缚豕',
olfushi_info:'①一名角色使用【杀】结算完毕后若你与其的距离不大于1你将此【杀】对应的所有实体牌置于武将牌上。②你可以将任意张“缚豕“牌置入弃牌堆并摸等量的牌视为使用一张具有以下等同于置入弃牌堆牌数量的效果的【杀】1.此【杀】额外指定一个目标2.此【杀】对其中一个目标角色造成的伤害-13.此【杀】对其中一个目标造成的伤害+1。且此【杀】指定最后一个目标后若此【杀】选择的效果和选择的目标均相邻,则此【杀】不计入次数限制。', olfushi_info:'①一名角色使用【杀】结算结束后若你至其的距离不大于1你将此【杀】对应的所有实体牌置于武将牌上。②当你需要使用一张【杀】时你可以重铸任意张“缚豕”牌视为使用一张【杀】并选择X项X为你以此法重铸的牌数且至多为31.你为此【杀】额外指定一个目标2.你选择此【杀】的一个目标角色,此牌对其造成的伤害-13.你选择此【杀】的一个目标角色,此【杀】对其造成的伤害+1。当此【杀】指定最后一个目标后若此牌被选择的效果选项相邻且此牌的目标角色座位连续,则此【杀】不计入次数限制。',
oldongdao:'东道', oldongdao:'东道',
oldongdao_info:'农民的回合结束时:阴,你可以令地主进行一个额外回合;阳,其可以进行一个额外回合。', oldongdao_info:'农民的回合结束时:阴,你可以令地主进行一个额外回合;阳,其可以进行一个额外回合。',
zhangyan:'张燕', zhangyan:'张燕',

View File

@ -15510,6 +15510,7 @@
next.set('ai',info.chooseButton.check||function(){return 1;}); next.set('ai',info.chooseButton.check||function(){return 1;});
next.set('filterButton',info.chooseButton.filter||function(){return true;}); next.set('filterButton',info.chooseButton.filter||function(){return true;});
next.set('selectButton',info.chooseButton.select||1); next.set('selectButton',info.chooseButton.select||1);
next.set('filterOk',info.chooseButton.filterOk||(()=>true));
if(event.id) next._parent_id=event.id; if(event.id) next._parent_id=event.id;
next.type='chooseToUse_button'; next.type='chooseToUse_button';
} }
@ -15693,6 +15694,7 @@
next.set('ai',info.chooseButton.check||function(){return 1;}); next.set('ai',info.chooseButton.check||function(){return 1;});
next.set('filterButton',info.chooseButton.filter||function(){return true;}); next.set('filterButton',info.chooseButton.filter||function(){return true;});
next.set('selectButton',info.chooseButton.select||1); next.set('selectButton',info.chooseButton.select||1);
next.set('filterOk',info.chooseButton.filterOk||(()=>true));
} }
event.buttoned=event.result.skill; event.buttoned=event.result.skill;
} }