初步更新:按点发动技能机制和cost分离机制
This commit is contained in:
parent
9fafbcc4e5
commit
4d03cfb902
|
@ -11709,16 +11709,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
filter:function (event){
|
||||
return (event.num>0)
|
||||
},
|
||||
getIndex(event, player, triggername){
|
||||
return event.num;
|
||||
},
|
||||
content:function (){
|
||||
'step 0'
|
||||
event.count=trigger.num;
|
||||
'step 1'
|
||||
player.draw(2);
|
||||
event.count--;
|
||||
if(_status.connectMode) game.broadcastAll(function(){_status.noclearcountdown=true});
|
||||
event.given_map={};
|
||||
event.num=2;
|
||||
'step 2'
|
||||
'step 1'
|
||||
player.chooseCardTarget({
|
||||
filterCard:function(card){
|
||||
return get.itemtype(card)=='card'&&!card.hasGaintag('reyiji_tag');
|
||||
|
@ -11737,7 +11737,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
return get.value(card,target)*get.attitude(player,target);
|
||||
},
|
||||
});
|
||||
'step 3'
|
||||
'step 2'
|
||||
if(result.bool){
|
||||
var res=result.cards,target=result.targets[0].playerid;
|
||||
player.addGaintag(res,'reyiji_tag');
|
||||
|
@ -11750,9 +11750,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
if(_status.connectMode){
|
||||
game.broadcastAll(function(){delete _status.noclearcountdown;game.stopCountChoose()});
|
||||
}
|
||||
event.goto(5);
|
||||
event.finish();
|
||||
}
|
||||
'step 4'
|
||||
'step 3'
|
||||
if(_status.connectMode){
|
||||
game.broadcastAll(function(){delete _status.noclearcountdown;game.stopCountChoose()});
|
||||
}
|
||||
|
@ -11771,16 +11771,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
giver:player,
|
||||
animate:'giveAuto',
|
||||
}).setContent('gaincardMultiple');
|
||||
'step 5'
|
||||
if(event.count>0&&player.hasSkill('new_reyiji')){
|
||||
player.chooseBool(get.prompt2('new_reyiji'));
|
||||
}
|
||||
else event.finish();
|
||||
'step 6'
|
||||
if(result.bool){
|
||||
player.logSkill('new_reyiji');
|
||||
event.goto(1);
|
||||
}
|
||||
},
|
||||
ai:{
|
||||
maixie:true,
|
||||
|
|
|
@ -98,17 +98,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
stdshushen:{
|
||||
audio:'shushen',
|
||||
trigger:{player:'recoverEnd'},
|
||||
direct:true,
|
||||
getIndex(event){
|
||||
return event.num||1;
|
||||
},
|
||||
async cost(event,trigger,player){
|
||||
event.result = await player.chooseTarget(get.prompt2('stdshushen'),lib.filter.notMe)
|
||||
.set('ai',target=>get.attitude(_status.event.player,target)).forResult();
|
||||
},
|
||||
async content(event,trigger,player){
|
||||
event.num=trigger.num||1;
|
||||
do {
|
||||
const {result:{bool,targets}}=await player.chooseTarget(get.prompt2('stdshushen'),lib.filter.notMe)
|
||||
.set('ai',target=>get.attitude(_status.event.player,target));
|
||||
if(!bool) return;
|
||||
const target=targets[0];
|
||||
player.logSkill('stdshushen',target);
|
||||
target.draw(target.countCards('h')?1:2);
|
||||
}while(--event.num>0&&player.hasSkill('stdshushen'));
|
||||
const target = event.targets[0];
|
||||
await target.draw(target.countCards('h') > 0 ? 1 : 2);
|
||||
},
|
||||
ai:{threaten:0.8,expose:0.1},
|
||||
},
|
||||
|
@ -178,13 +177,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
trigger:{global:'useCardToTarget'},
|
||||
logTarget:'target',
|
||||
audio:'tongji',
|
||||
direct:true,
|
||||
filter(event,player){
|
||||
return event.card.name=='sha'&&event.player!=player&&!event.targets.includes(player)&&
|
||||
event.target.inRange(player)&&event.target.countCards('he')>0;
|
||||
},
|
||||
async content(event,trigger,player){
|
||||
const {result:{bool,cards}}=await trigger.target.chooseCard('he','是否对'+get.translation(player)+'发动【同疾】?','弃置一张牌,将'+get.translation(trigger.card)+'转移给'+get.translation(player))
|
||||
async cost(event, trigger, player){
|
||||
const {result} = await trigger.target.chooseCard('he', '是否对'+get.translation(player)+'发动【同疾】?',
|
||||
'弃置一张牌,将'+get.translation(trigger.card)+'转移给'+get.translation(player), lib.filter.cardDiscardable)
|
||||
.set('ai',card=>{
|
||||
if(!_status.event.check) return -1;
|
||||
return get.unuseful(card)+9;
|
||||
|
@ -204,15 +203,22 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
}
|
||||
return -1;
|
||||
})()>0);
|
||||
if(bool){
|
||||
player.logSkill('retongji',trigger.target);
|
||||
trigger.target.discard(cards);
|
||||
const evt=trigger.getParent();
|
||||
evt.triggeredTargets2.remove(trigger.target);
|
||||
evt.targets.remove(trigger.target);
|
||||
evt.targets.push(player);
|
||||
if(result.bool){
|
||||
event.result = {
|
||||
bool:true,
|
||||
cost_data:{
|
||||
cards: result.cards
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
async content(event,trigger,player){
|
||||
trigger.target.discard(event.cost_data.cards);
|
||||
const evt=trigger.getParent();
|
||||
evt.triggeredTargets2.remove(trigger.target);
|
||||
evt.targets.remove(trigger.target);
|
||||
evt.targets.push(player);
|
||||
},
|
||||
},
|
||||
hujia:{
|
||||
audio:2,
|
||||
|
@ -324,13 +330,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
guicai:{
|
||||
audio:2,
|
||||
trigger:{global:'judge'},
|
||||
direct:true,
|
||||
preHidden:true,
|
||||
filter(event,player){
|
||||
return player.countCards(get.mode()=='guozhan'?'hes':'hs')>0;
|
||||
},
|
||||
async content(event,trigger,player){
|
||||
const {result:{bool:chooseCardResultBool,cards:chooseCardResultCards}}=await player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+
|
||||
async cost(event, trigger, player){
|
||||
const {result:{bool,cards}}=await player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+
|
||||
get.translation(trigger.player.judging[0])+','+get.prompt('guicai'),get.mode()=='guozhan'?'hes':'hs',card=>{
|
||||
const player=_status.event.player;
|
||||
const mod2=game.checkMod(card,player,'unchanged','cardEnabled2',player);
|
||||
|
@ -352,7 +357,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
return -result-get.value(card)/2;
|
||||
}
|
||||
}).set('judging',trigger.player.judging[0]).setHiddenSkill('guicai');
|
||||
if(!chooseCardResultBool) return;
|
||||
if(bool) event.result = {bool,cost_data:{cards}}
|
||||
},
|
||||
//技能的logSkill跟着打出牌走 不进行logSkill
|
||||
popup:false,
|
||||
async content(event,trigger,player){
|
||||
const chooseCardResultCards = event.cost_data.cards;
|
||||
player.respond(chooseCardResultCards,'guicai','highlight','noOrdering');
|
||||
if(trigger.player.judging[0].clone){
|
||||
trigger.player.judging[0].clone.classList.remove('thrownhighlight');
|
||||
|
@ -418,29 +428,30 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
ganglie_three:{
|
||||
audio:'ganglie',
|
||||
trigger:{player:'damageEnd'},
|
||||
direct:true,
|
||||
async content(event,trigger,player){
|
||||
const {result:{bool:chooseTargetResultBool,targets:chooseTargetResultTargets}}=await player.chooseTarget(get.prompt2('ganglie_three'),(card,player,target)=>{
|
||||
async cost(event, trigger, player){
|
||||
const {result} = await player.chooseTarget(get.prompt2('ganglie_three'),(card,player,target)=>{
|
||||
return target.isEnemyOf(player);
|
||||
}).set('ai',target=>{
|
||||
return -get.attitude(_status.event.player,target)/(1+target.countCards('h'));
|
||||
return -get.attitude(_status.event.player,target)/Math.sqrt(1+target.countCards('h'));
|
||||
});
|
||||
if(!chooseTargetResultBool) return;
|
||||
event.target=chooseTargetResultTargets[0];
|
||||
player.logSkill('ganglie_three',event.target);
|
||||
event.result = result;
|
||||
},
|
||||
async content(event, trigger, player){
|
||||
event.target = event.targets[0];
|
||||
player.logSkill('ganglie_three', event.target);
|
||||
const judgeEvent=player.judge(card=>{
|
||||
if(get.suit(card)=='heart') return -2;
|
||||
return 2;
|
||||
});
|
||||
judgeEvent.judge2=result=>result.bool;
|
||||
const {result:{judge}}=await judgeEvent;
|
||||
if(judge<2) return;
|
||||
const {result:{bool:chooseToDiscardResultBool}}=await event.target.chooseToDiscard(2).set('ai',card=>{
|
||||
if(card.name=='tao') return -10;
|
||||
if(card.name=='jiu'&&_status.event.player.hp==1) return -10;
|
||||
judgeEvent.judge2 = (result => result.bool);
|
||||
const {result:{judge}} = await judgeEvent;
|
||||
if (judge < 2) return;
|
||||
const {result:{bool:chooseToDiscardResultBool}} = await event.target.chooseToDiscard(2).set('ai',card=>{
|
||||
if (card.name=='tao') return -10;
|
||||
if (card.name=='jiu' && _status.event.player.hp==1) return -10;
|
||||
return get.unuseful(card)+2.5*(5-get.owner(card).hp);
|
||||
});
|
||||
if(chooseToDiscardResultBool==false){
|
||||
if (chooseToDiscardResultBool === false) {
|
||||
event.target.damage();
|
||||
}
|
||||
},
|
||||
|
@ -458,24 +469,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
tuxi:{
|
||||
audio:2,
|
||||
trigger:{player:'phaseDrawBegin1'},
|
||||
direct:true,
|
||||
filter(event,player){
|
||||
return !event.numFixed;
|
||||
},
|
||||
async content(event,trigger,player){
|
||||
let num=game.countPlayer(current=>current!=player&¤t.countCards('h')&&get.attitude(player,current)<=0);
|
||||
let check=num>=2;
|
||||
const {result:{bool,targets}}=await player.chooseTarget(get.prompt('tuxi'),'获得其他一至两名角色的各一张手牌',[1,2],(card,player,target)=>{
|
||||
return target.countCards('h')>0&&player!=target;
|
||||
},target=>{
|
||||
if(!_status.event.aicheck) return 0;
|
||||
const att=get.attitude(_status.event.player,target);
|
||||
if(target.hasSkill('tuntian')) return att/10;
|
||||
return 1-att;
|
||||
}).set('aicheck',check);
|
||||
if(!bool) return;
|
||||
player.logSkill('tuxi',targets);
|
||||
player.gainMultiple(targets);
|
||||
async cost(event, trigger, player){
|
||||
let num = game.countPlayer(current => current != player && current.countCards('h') && get.attitude(player,current) <= 0);
|
||||
let check = (num >= 2);
|
||||
const {result} = await player.chooseTarget(get.prompt('tuxi'), '获得其他一至两名角色的各一张手牌', [1,2], (card, player, target) => {
|
||||
return target.countCards('h') > 0 && player != target;
|
||||
}, target => {
|
||||
if (!_status.event.aicheck) return 0;
|
||||
const att=get.attitude(_status.event.player, target);
|
||||
if (target.hasSkill('tuntian')) return att / 10;
|
||||
return 1 - att;
|
||||
}).set('aicheck', check);
|
||||
event.result = result;
|
||||
},
|
||||
async content(event, trigger, player){
|
||||
player.gainMultiple(event.targets);
|
||||
trigger.changeToZero();
|
||||
game.asyncDelay();
|
||||
},
|
||||
|
@ -540,71 +551,63 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
filter(event){
|
||||
return event.num>0;
|
||||
},
|
||||
async content(event,trigger,player){
|
||||
event.count=trigger.num;
|
||||
// event.goto -> while
|
||||
while(true){
|
||||
event.count--;
|
||||
const {cards}=await game.cardsGotoOrdering(get.cards(2));
|
||||
if(_status.connectMode) game.broadcastAll(function(){_status.noclearcountdown=true});
|
||||
event.given_map={};
|
||||
if(!cards.length) return;
|
||||
// event.goto -> do while
|
||||
do{
|
||||
const {result:{bool,links}} =
|
||||
cards.length==1?
|
||||
{result:{links:cards.slice(0),bool: true}}:
|
||||
await player.chooseCardButton('遗计:请选择要分配的牌',true,cards,[1,cards.length])
|
||||
.set('ai',()=>{
|
||||
if(ui.selected.buttons.length==0) return 1;
|
||||
return 0;
|
||||
});
|
||||
if(!bool) return;
|
||||
cards.removeArray(links);
|
||||
event.togive=links.slice(0);
|
||||
const {result:{targets}}=await player.chooseTarget('选择一名角色获得'+get.translation(links),true)
|
||||
.set('ai',target=>{
|
||||
const att=get.attitude(_status.event.player,target);
|
||||
if(_status.event.enemy){
|
||||
return -att;
|
||||
}
|
||||
else if(att>0){
|
||||
return att/(1+target.countCards('h'));
|
||||
}
|
||||
else{
|
||||
return att/100;
|
||||
}
|
||||
})
|
||||
.set('enemy',get.value(event.togive[0],player,'raw')<0);
|
||||
if(targets.length){
|
||||
const id=targets[0].playerid,
|
||||
map=event.given_map;
|
||||
if(!map[id]) map[id]=[];
|
||||
map[id].addArray(event.togive);
|
||||
}
|
||||
}while(cards.length>0);
|
||||
if(_status.connectMode){
|
||||
game.broadcastAll(function(){delete _status.noclearcountdown;game.stopCountChoose()});
|
||||
getIndex(event, player, triggername){
|
||||
return event.num;
|
||||
},
|
||||
async content(event, trigger, player){
|
||||
const {cards}=await game.cardsGotoOrdering(get.cards(2));
|
||||
if(_status.connectMode) game.broadcastAll(function(){_status.noclearcountdown=true});
|
||||
event.given_map={};
|
||||
if(!cards.length) return;
|
||||
// event.goto -> do while
|
||||
do{
|
||||
const {result:{bool,links}} =
|
||||
cards.length==1?
|
||||
{result:{links:cards.slice(0),bool: true}}:
|
||||
await player.chooseCardButton('遗计:请选择要分配的牌',true,cards,[1,cards.length])
|
||||
.set('ai',()=>{
|
||||
if(ui.selected.buttons.length==0) return 1;
|
||||
return 0;
|
||||
});
|
||||
if(!bool) return;
|
||||
cards.removeArray(links);
|
||||
event.togive=links.slice(0);
|
||||
const {result:{targets}}=await player.chooseTarget('选择一名角色获得'+get.translation(links),true)
|
||||
.set('ai',target=>{
|
||||
const att=get.attitude(_status.event.player,target);
|
||||
if(_status.event.enemy){
|
||||
return -att;
|
||||
}
|
||||
else if(att>0){
|
||||
return att/(1+target.countCards('h'));
|
||||
}
|
||||
else{
|
||||
return att/100;
|
||||
}
|
||||
})
|
||||
.set('enemy',get.value(event.togive[0],player,'raw')<0);
|
||||
if(targets.length){
|
||||
const id=targets[0].playerid,
|
||||
map=event.given_map;
|
||||
if(!map[id]) map[id]=[];
|
||||
map[id].addArray(event.togive);
|
||||
}
|
||||
const list=[];
|
||||
for(const i in event.given_map){
|
||||
const source=(_status.connectMode?lib.playerOL:game.playerMap)[i];
|
||||
player.line(source,'green');
|
||||
if(player!==source&&(get.mode()!=='identity'||player.identity!=='nei')) player.addExpose(0.2);
|
||||
list.push([source, event.given_map[i]]);
|
||||
}
|
||||
game.loseAsync({
|
||||
gain_list:list,
|
||||
giver:player,
|
||||
animate:'draw',
|
||||
}).setContent('gaincardMultiple');
|
||||
if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name, player)){
|
||||
const {result:{bool:chooseBoolResultBool}}=await player.chooseBool(get.prompt2(event.name)).set('frequentSkill',event.name);
|
||||
if(chooseBoolResultBool) player.logSkill(event.name);
|
||||
else return;
|
||||
}
|
||||
else return;
|
||||
}while(cards.length>0);
|
||||
if(_status.connectMode){
|
||||
game.broadcastAll(function(){delete _status.noclearcountdown;game.stopCountChoose()});
|
||||
}
|
||||
const list=[];
|
||||
for(const i in event.given_map){
|
||||
const source=(_status.connectMode?lib.playerOL:game.playerMap)[i];
|
||||
player.line(source,'green');
|
||||
if(player!==source&&(get.mode()!=='identity'||player.identity!=='nei')) player.addExpose(0.2);
|
||||
list.push([source, event.given_map[i]]);
|
||||
}
|
||||
game.loseAsync({
|
||||
gain_list:list,
|
||||
giver:player,
|
||||
animate:'draw',
|
||||
}).setContent('gaincardMultiple');
|
||||
},
|
||||
ai:{
|
||||
maixie:true,
|
||||
|
@ -1632,7 +1635,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
audio:2,
|
||||
audioname:['re_daqiao','daxiaoqiao'],
|
||||
trigger:{target:'useCardToTarget'},
|
||||
direct:true,
|
||||
preHidden:true,
|
||||
filter(event,player){
|
||||
if(event.card.name!='sha') return false;
|
||||
|
@ -1642,8 +1644,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
current!=player&&lib.filter.targetEnabled(event.card,event.player,current);
|
||||
});
|
||||
},
|
||||
async content(event,trigger,player){
|
||||
const [bool,targets,cards]=await player.chooseCardTarget({
|
||||
async cost(event,trigger,player){
|
||||
event.result = await player.chooseCardTarget({
|
||||
position:'he',
|
||||
filterCard:lib.filter.cardDiscardable,
|
||||
filterTarget:(card,player,target)=>{
|
||||
|
@ -1674,17 +1676,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
source:trigger.player,
|
||||
card:trigger.card,
|
||||
})
|
||||
.setHiddenSkill(event.name)
|
||||
.forResult('bool','targets','cards');
|
||||
if(bool){
|
||||
const target=targets[0];
|
||||
player.logSkill(event.name,target);
|
||||
player.discard(cards);
|
||||
const evt=trigger.getParent();
|
||||
evt.triggeredTargets2.remove(player);
|
||||
evt.targets.remove(player);
|
||||
evt.targets.push(target);
|
||||
}
|
||||
.setHiddenSkill(event.name).forResult();
|
||||
},
|
||||
async content(event,trigger,player){
|
||||
const target = event.targets[0];
|
||||
player.logSkill(event.name,target);
|
||||
player.discard(event.cards);
|
||||
const evt=trigger.getParent();
|
||||
evt.triggeredTargets2.remove(player);
|
||||
evt.targets.remove(player);
|
||||
evt.targets.push(target);
|
||||
},
|
||||
ai:{
|
||||
effect:{
|
||||
|
@ -2209,9 +2210,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
trigger:{
|
||||
player:"phaseDrawEnd",
|
||||
},
|
||||
direct:true,
|
||||
async content(event,trigger,player){
|
||||
const list=['弃牌','摸牌','取消'];
|
||||
async cost(event,trigger,player){
|
||||
const list=['弃牌','摸牌','cancel2'];
|
||||
if(!player.countCards('he')) list.remove('弃牌');
|
||||
const control=await player.chooseControl(list,()=>{
|
||||
const player=_status.event.player;
|
||||
|
@ -2230,16 +2230,22 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
})
|
||||
.set('prompt',get.prompt2('new_jiangchi'))
|
||||
.forResultControl();
|
||||
if (control === 'cancel2') event.result = {bool: false};
|
||||
else event.result = {
|
||||
bool: true,
|
||||
cost_data: control
|
||||
};
|
||||
},
|
||||
async content(event,trigger,player){
|
||||
const control = event.cost_data;
|
||||
|
||||
if(control=='弃牌'){
|
||||
player.chooseToDiscard(true,'he');
|
||||
player.addTempSkill('jiangchi2','phaseUseEnd');
|
||||
player.logSkill('new_jiangchi');
|
||||
}
|
||||
else if(control=='摸牌'){
|
||||
player.draw();
|
||||
player.addTempSkill('new_jiangchi3','phaseEnd');
|
||||
player.logSkill('new_jiangchi');
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -2301,30 +2307,27 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
global:['dying','gainAfter','loseAsyncAfter'],
|
||||
},
|
||||
audio:2,
|
||||
filter(event,player){
|
||||
if(event.name=='dying') return true;
|
||||
if(event.giver!=player) return false;
|
||||
if(event.name=='gain'){
|
||||
return event.player!=player&&event.getg(event.player).length>0;
|
||||
getIndex:function(event, player){
|
||||
if (event.name !== 'loseAsync') return [event.player];
|
||||
else return game.filterPlayer(current => current != player && event.getg(current).length > 0).sortBySeat();
|
||||
},
|
||||
filter(event, player, triggername, target){
|
||||
if (!target.isIn()) return false;
|
||||
if (event.name === 'dying') return true;
|
||||
if (event.giver !== player) return false;
|
||||
if (event.name === 'gain') {
|
||||
return event.player!=player&&event.getg(target).length>0;
|
||||
}
|
||||
return game.hasPlayer(current=>current!=player&&event.getg(current).length>0);
|
||||
},
|
||||
direct:true,
|
||||
async content(event,trigger,player){
|
||||
if(trigger.name!='loseAsync') event.targets=[trigger.player];
|
||||
else event.targets=game.filterPlayer(current=>current!=player&&trigger.getg(current).length>0);
|
||||
do{
|
||||
const target=event.targets.shift();
|
||||
event.target=target;
|
||||
const {result:{bool}}=await player.chooseBool(get.prompt2('xinfu_jiyuan',target)).set('ai',()=>{
|
||||
const evt=_status.event;
|
||||
return get.attitude(player,evt.getParent().target)>0;
|
||||
});
|
||||
if(bool){
|
||||
player.logSkill('xinfu_jiyuan',target);
|
||||
target.draw();
|
||||
}
|
||||
}while(event.targets.length>0);
|
||||
logTarget(event, player, triggername, target){
|
||||
return target;
|
||||
},
|
||||
check(event, player, triggername, target){
|
||||
return get.attitude(player,target) > 0;
|
||||
},
|
||||
async content(event, trigger, player){
|
||||
event.targets[0].draw();
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -4302,7 +4302,7 @@ export class Game extends Uninstantable {
|
|||
* @param { GameEventPromise } event
|
||||
* @returns { GameEventPromise }
|
||||
*/
|
||||
static createTrigger(name, skill, player, event) {
|
||||
static createTrigger(name, skill, player, event, indexedData) {
|
||||
let info = get.info(skill);
|
||||
if (!info) return false;
|
||||
if ((player.isOut() || player.removed) && !info.forceOut) return;
|
||||
|
@ -4314,6 +4314,7 @@ export class Game extends Uninstantable {
|
|||
next.forceDie = true;
|
||||
next.includeOut = true;
|
||||
next._trigger = event;
|
||||
next.indexedData = indexedData;
|
||||
next.setContent('createTrigger');
|
||||
return next;
|
||||
}
|
||||
|
|
|
@ -2134,7 +2134,9 @@ export const Content = {
|
|||
event.doing = doingList.shift();
|
||||
while(true){
|
||||
if (trigger.filterStop && trigger.filterStop()) return;
|
||||
const usableSkills = event.doing.todoList.filter(info => lib.filter.filterTrigger(trigger, info.player, event.triggername, info.skill));
|
||||
const usableSkills = event.doing.todoList.filter(info => {
|
||||
return lib.filter.filterTrigger(trigger, info.player, event.triggername, info.skill, info.indexedData);
|
||||
});
|
||||
if (usableSkills.length == 0){
|
||||
break;
|
||||
}
|
||||
|
@ -2155,25 +2157,32 @@ export const Content = {
|
|||
event.current = silentSkill;
|
||||
}
|
||||
else {
|
||||
const currentChoice = event.choice[0];
|
||||
if (event.choice.length == 1) {
|
||||
const currentChoice = event.choice[0], skillsToChoose = event.choice.map(i => i.skill).unique();
|
||||
if (event.choice.length === 1 || skillsToChoose.length === 1) {
|
||||
event.current = currentChoice;
|
||||
}
|
||||
else{
|
||||
const currentPlayer = currentChoice.player , skillsToChoose = event.choice.map(i => i.skill);
|
||||
const currentPlayer = currentChoice.player;
|
||||
const next = currentPlayer.chooseControl(skillsToChoose);
|
||||
next.set('prompt', '选择下一个触发的技能');
|
||||
next.set('forceDie', true);
|
||||
next.set('arrangeSkill', true);
|
||||
next.set('includeOut', true);
|
||||
const {result} = await next;
|
||||
event.current = event.doing.todoList.find(info => info.skill == result.control);
|
||||
event.current = usableSkills.find(info => info.skill == result.control);
|
||||
}
|
||||
}
|
||||
}
|
||||
event.doing.doneList.push(event.current);
|
||||
event.doing.todoList.remove(event.current);
|
||||
await game.createTrigger(event.triggername, event.current.skill, event.current.player, trigger);
|
||||
const result = await game.createTrigger(event.triggername, event.current.skill, event.current.player, trigger, event.current.indexedData).forResult();
|
||||
if (result === 'cancelled'){
|
||||
for (let i = 0; i < event.doing.todoList.length; i++) {
|
||||
if (event.current.skill === event.doing.todoList[i].skill) {
|
||||
event.doing.todoList.splice(i--, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2214,6 +2223,24 @@ export const Content = {
|
|||
event._result = { bool: true };
|
||||
event._direct = true;
|
||||
}
|
||||
else if(info.cost){
|
||||
if (checkFrequent(info)) event.frequentSkill = true;
|
||||
if (player.isUnderControl()) game.swapPlayerAuto(player);
|
||||
//创建cost事件
|
||||
var next = game.createEvent(`${event.skill}_cost`);
|
||||
next.player = player;
|
||||
if (event.frequentSkill) next.set('frequentSkill', event.skill);
|
||||
next.set('forceDie', true);
|
||||
next.set('includeOut', true);
|
||||
next._trigger = trigger;
|
||||
next.triggername = event.triggername;
|
||||
next.skillHidden = event.skillHidden;
|
||||
next.indexedData = event.indexedData;
|
||||
if (info.forceDie) next.forceDie = true;
|
||||
if (info.forceOut) next.includeOut = true;
|
||||
next.skill = event.skill;
|
||||
next.setContent(info.cost);
|
||||
}
|
||||
else {
|
||||
if (checkFrequent(info)) event.frequentSkill = true;
|
||||
var str;
|
||||
|
@ -2221,19 +2248,19 @@ export const Content = {
|
|||
if (info.prompt) str = info.prompt;
|
||||
else if (typeof info.logTarget == 'string') str = get.prompt(event.skill, trigger[info.logTarget], player);
|
||||
else if (typeof info.logTarget == 'function') {
|
||||
const logTarget = info.logTarget(trigger, player);
|
||||
const logTarget = info.logTarget(trigger, player, event.triggername, event.indexedData);
|
||||
if (get.itemtype(logTarget).startsWith('player')) str = get.prompt(event.skill, logTarget, player);
|
||||
}
|
||||
else str = get.prompt(event.skill, null, player);
|
||||
if (typeof str == 'function') str = str(trigger, player);
|
||||
if (typeof str == 'function') str = str(trigger, player, event.triggername, event.indexedData);
|
||||
|
||||
var next = player.chooseBool(str);
|
||||
if (event.frequentSkill) next.set('frequentSkill', event.skill);
|
||||
next.set('forceDie', true);
|
||||
next.set('includeOut', true);
|
||||
next.ai = () => !check || check(trigger, player);
|
||||
next.ai = () => !check || check(trigger, player, event.triggername, event.indexedData);
|
||||
|
||||
if (typeof info.prompt2 == 'function') next.set('prompt2', info.prompt2(trigger, player));
|
||||
if (typeof info.prompt2 == 'function') next.set('prompt2', info.prompt2(trigger, player, event.triggername, event.indexedData));
|
||||
else if (typeof info.prompt2 == 'string') next.set('prompt2', info.prompt2);
|
||||
else if (info.prompt2 != false) {
|
||||
if (lib.dynamicTranslate[event.skill]) next.set('prompt2', lib.dynamicTranslate[event.skill](player, event.skill));
|
||||
|
@ -2257,18 +2284,31 @@ export const Content = {
|
|||
}
|
||||
"step 3";
|
||||
var info = get.info(event.skill);
|
||||
if (result && result.bool == false) {
|
||||
if (!result || !result.bool) {
|
||||
if (info.oncancel) info.oncancel(trigger, player);
|
||||
if (event.indexedData === true) {
|
||||
event.result = 'cancelled';
|
||||
}
|
||||
return event.finish();
|
||||
}
|
||||
let targets = null;
|
||||
if (result.targets && result.targets.length > 0) {
|
||||
targets = result.targets.slice(0);
|
||||
}
|
||||
else if (info.logTarget) {
|
||||
if (typeof info.logTarget === 'string') targets = trigger[info.logTarget];
|
||||
else if (typeof info.logTarget === 'function') targets = info.logTarget(trigger, player, event.triggername, event.indexedData);
|
||||
}
|
||||
if (get.itemtype(targets) === 'player'){
|
||||
targets = [targets];
|
||||
}
|
||||
if (info.popup != false && !info.direct) {
|
||||
if (info.popup) {
|
||||
player.popup(info.popup);
|
||||
game.log(player, '发动了', '【' + get.skillTranslation(event.skill, player) + '】');
|
||||
}
|
||||
else if (!info.logTarget || info.logLine === false) player.logSkill(event.skill, false, info.line);
|
||||
else if (typeof info.logTarget == 'string') player.logSkill(event.skill, trigger[info.logTarget], info.line);
|
||||
else if (typeof info.logTarget == 'function') player.logSkill(event.skill, info.logTarget(trigger, player), info.line);
|
||||
if (info.logLine === false) player.logSkill(event.skill, false, info.line);
|
||||
else player.logSkill(event.skill, targets, info.line);
|
||||
}
|
||||
var next = game.createEvent(event.skill);
|
||||
if (typeof info.usable == 'number') {
|
||||
|
@ -2280,7 +2320,6 @@ export const Content = {
|
|||
next.player = player;
|
||||
next._trigger = trigger;
|
||||
next.triggername = event.triggername;
|
||||
|
||||
// if ("contents" in info && Array.isArray(info.contents)) {
|
||||
// next.setContents(info.contents);
|
||||
// } else {
|
||||
|
@ -2290,6 +2329,10 @@ export const Content = {
|
|||
next.skillHidden = event.skillHidden;
|
||||
if (info.forceDie) next.forceDie = true;
|
||||
if (info.forceOut) next.includeOut = true;
|
||||
//语法糖部分
|
||||
if ('cost_data' in result) next.cost_data = result.cost_data;
|
||||
if (get.itemtype(targets) == 'players') next.targets = targets.slice(0);
|
||||
if (get.itemtype(result.cards) === 'cards') next.cards = result.cards.slice(0);
|
||||
"step 4";
|
||||
if (!player._hookTrigger) return;
|
||||
if (player._hookTrigger.some(i => {
|
||||
|
|
|
@ -791,11 +791,36 @@ export class GameEvent {
|
|||
|
||||
const info = lib.skill[skill];
|
||||
const list = info.firstDo ? firstDo.todoList : info.lastDo ? lastDo.todoList : this.todoList;
|
||||
list.push({
|
||||
skill: skill,
|
||||
player: this.player,
|
||||
priority: get.priority(skill),
|
||||
});
|
||||
if(info.getIndex){
|
||||
const indexedResult = info.getIndex(event, player, name);
|
||||
if(Array.isArray(indexedResult)){
|
||||
indexedResult.forEach(indexedData => {
|
||||
list.push({
|
||||
skill: skill,
|
||||
player: this.player,
|
||||
priority: get.priority(skill),
|
||||
indexedData,
|
||||
})
|
||||
});
|
||||
}
|
||||
else if (typeof indexedResult === 'number' && indexedResult>0){
|
||||
for(let i = 0; i < indexedResult; i++){
|
||||
list.push({
|
||||
skill: skill,
|
||||
player: this.player,
|
||||
priority: get.priority(skill),
|
||||
indexedData: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
list.push({
|
||||
skill: skill,
|
||||
player: this.player,
|
||||
priority: get.priority(skill),
|
||||
});
|
||||
}
|
||||
if (typeof list.player == 'string') list.sort((a, b) => (b.priority - a.priority) || (playerMap.indexOf(a) - playerMap.indexOf(b)));
|
||||
else list.sort((a, b) => b.priority - a.priority);
|
||||
allbool = true;
|
||||
|
|
|
@ -9830,7 +9830,7 @@ export class Library extends Uninstantable {
|
|||
* @param {string} skill
|
||||
* @returns {boolean}
|
||||
*/
|
||||
filterTrigger: function (event, player, triggername, skill) {
|
||||
filterTrigger: function (event, player, triggername, skill, indexedData) {
|
||||
if (player._hookTrigger && player._hookTrigger.some(i => {
|
||||
const info = lib.skill[i].hookTrigger;
|
||||
return info && info.block && info.block(event, player, triggername, skill);
|
||||
|
@ -9853,7 +9853,7 @@ export class Library extends Uninstantable {
|
|||
if (Array.isArray(info.trigger[role])) return info.trigger[role].includes(triggername);
|
||||
return info.trigger[role] == triggername;
|
||||
})) return false;
|
||||
if (info.filter && !info.filter(event, player, triggername)) return false;
|
||||
if (info.filter && !info.filter(event, player, triggername, indexedData)) return false;
|
||||
if (event._notrigger.includes(player) && !lib.skill.global.includes(skill)) return false;
|
||||
if (typeof info.usable == 'number' && player.hasSkill('counttrigger') &&
|
||||
player.storage.counttrigger && player.storage.counttrigger[skill] >= info.usable) return false;
|
||||
|
@ -10396,7 +10396,7 @@ export class Library extends Uninstantable {
|
|||
return (Math.random() - 0.5);
|
||||
},
|
||||
seat: function (a, b) {
|
||||
var player = lib.tempSortSeat || _status.event.player;
|
||||
var player = lib.tempSortSeat || _status.event.player || game.me || game.players[0];
|
||||
var delta = get.distance(player, a, 'absolute') - get.distance(player, b, 'absolute');
|
||||
if (delta) return delta;
|
||||
delta = parseInt(a.dataset.position) - parseInt(b.dataset.position);
|
||||
|
|
Loading…
Reference in New Issue