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

View File

@ -15510,6 +15510,7 @@
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);
next.set('filterOk',info.chooseButton.filterOk||(()=>true));
if(event.id) next._parent_id=event.id;
next.type='chooseToUse_button';
}
@ -15693,6 +15694,7 @@
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);
next.set('filterOk',info.chooseButton.filterOk||(()=>true));
}
event.buttoned=event.result.skill;
}