删除部分无用代码
This commit is contained in:
parent
096e7bd964
commit
afbbc3cb32
|
@ -3952,13 +3952,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
if(target.isMin()) return false;
|
||||
return player!=target&&target.canEquip(card);
|
||||
},
|
||||
content2:function(){
|
||||
target.equip(cards[0]);
|
||||
player.draw();
|
||||
},
|
||||
async content(event, trigger, player){
|
||||
await event.target.promises.equip(event.cards[0]);
|
||||
game.log('老子装完了,还没摸牌')
|
||||
await player.promises.draw();
|
||||
},
|
||||
discard:false,
|
||||
|
|
|
@ -588,90 +588,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
filter:function(event){
|
||||
return (event.num>0)
|
||||
},
|
||||
content2:function(){
|
||||
'step 0'
|
||||
event.count=trigger.num;
|
||||
'step 1'
|
||||
event.count--;
|
||||
event.cards=game.cardsGotoOrdering(get.cards(2)).cards;
|
||||
if(_status.connectMode) game.broadcastAll(function(){_status.noclearcountdown=true});
|
||||
event.given_map={};
|
||||
'step 2'
|
||||
if(event.cards.length>1){
|
||||
player.chooseCardButton('遗计:请选择要分配的牌',true,event.cards,[1,event.cards.length]).set('ai',function(button){
|
||||
if(ui.selected.buttons.length==0) return 1;
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
else if(event.cards.length==1){
|
||||
event._result={links:event.cards.slice(0),bool:true};
|
||||
}
|
||||
else{
|
||||
event.finish();
|
||||
}
|
||||
'step 3'
|
||||
if(result.bool){
|
||||
event.cards.removeArray(result.links);
|
||||
event.togive=result.links.slice(0);
|
||||
player.chooseTarget('选择一名角色获得'+get.translation(result.links),true).set('ai',function(target){
|
||||
var 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);
|
||||
}
|
||||
'step 4'
|
||||
if(result.targets.length){
|
||||
var id=result.targets[0].playerid,map=event.given_map;
|
||||
if(!map[id]) map[id]=[];
|
||||
map[id].addArray(event.togive);
|
||||
}
|
||||
if(cards.length>0) event.goto(2);
|
||||
'step 5'
|
||||
if(_status.connectMode){
|
||||
game.broadcastAll(function(){delete _status.noclearcountdown;game.stopCountChoose()});
|
||||
}
|
||||
var list=[];
|
||||
for(var i in event.given_map){
|
||||
var source=(_status.connectMode?lib.playerOL:game.playerMap)[i];
|
||||
player.line(source,'green');
|
||||
list.push([source,event.given_map[i]]);
|
||||
}
|
||||
game.loseAsync({
|
||||
gain_list:list,
|
||||
giver:player,
|
||||
animate:'draw',
|
||||
}).setContent('gaincardMultiple');
|
||||
'step 6'
|
||||
if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){
|
||||
player.chooseBool(get.prompt2(event.name)).set('frequentSkill',event.name);
|
||||
}
|
||||
else event.finish();
|
||||
'step 7'
|
||||
if(result.bool){
|
||||
player.logSkill(event.name);
|
||||
event.goto(1);
|
||||
}
|
||||
},
|
||||
async content(event, trigger, player) {
|
||||
console.log('step 0');
|
||||
event.count = trigger.num;
|
||||
while (event.count > 0) {
|
||||
console.log('step 1');
|
||||
event.count--;
|
||||
const { cards } = await game.cardsGotoOrdering(get.cards(2)).toPromise();
|
||||
if (_status.connectMode) game.broadcastAll(function () { _status.noclearcountdown = true });
|
||||
event.given_map = {};
|
||||
|
||||
if (!cards.length) return event.finish();
|
||||
if (!cards.length) return;
|
||||
do {
|
||||
console.log('step 2');
|
||||
const { result: { bool, links } } =
|
||||
cards.length == 1 ?
|
||||
{ result: { links: cards.slice(0), bool: true } } :
|
||||
|
@ -680,8 +606,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
if (ui.selected.buttons.length == 0) return 1;
|
||||
return 0;
|
||||
});
|
||||
if (!bool) return event.finish();
|
||||
console.log('step 3');
|
||||
if (!bool) return;
|
||||
cards.removeArray(links);
|
||||
event.togive = links.slice(0);
|
||||
const { result: { targets } } = await player.promises.chooseTarget('选择一名角色获得' + get.translation(links), true)
|
||||
|
@ -698,7 +623,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
}
|
||||
})
|
||||
.set('enemy', get.value(event.togive[0], player, 'raw') < 0);
|
||||
console.log('step 4');
|
||||
if (targets.length) {
|
||||
const id = targets[0].playerid,
|
||||
map = event.given_map;
|
||||
|
@ -706,7 +630,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
map[id].addArray(event.togive);
|
||||
}
|
||||
} while (cards.length > 0);
|
||||
console.log('step 5');
|
||||
if (_status.connectMode) {
|
||||
game.broadcastAll(function () { delete _status.noclearcountdown; game.stopCountChoose() });
|
||||
}
|
||||
|
@ -721,15 +644,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
giver: player,
|
||||
animate: 'draw',
|
||||
}).setContent('gaincardMultiple').toPromise();
|
||||
console.log('step 6');
|
||||
if (event.count > 0 && player.hasSkill(event.name) && !get.is.blocked(event.name, player)) {
|
||||
const { result: { bool: repeat } } = await player.promises.chooseBool(get.prompt2(event.name)).set('frequentSkill', event.name);
|
||||
console.log('step 7');
|
||||
if (repeat) {
|
||||
player.logSkill(event.name);
|
||||
}
|
||||
} else return;
|
||||
}
|
||||
else return event.finish();
|
||||
else return;
|
||||
}
|
||||
},
|
||||
ai:{
|
||||
|
|
|
@ -32131,7 +32131,6 @@ new Promise(resolve=>{
|
|||
event.resolve=resolve;
|
||||
//如果父级事件也是一个异步的话,那应该立即执行这个事件的
|
||||
if(_status.event.next.includes(event)&&_status.event.content instanceof AsyncFunction){
|
||||
// console.log(event, '的父级事件也是一个异步,立即执行这个事件');
|
||||
if (_status.event != event) {
|
||||
event.parent = _status.event;
|
||||
_status.event = event;
|
||||
|
@ -41410,13 +41409,6 @@ new Promise(resolve=>{
|
|||
lib.status.dateDelayed+=lib.getUTC(new Date())-lib.getUTC(lib.status.dateDelaying);
|
||||
delete lib.status.dateDelaying;
|
||||
}
|
||||
if (belongAsyncEvent) {
|
||||
console.log('-----------------------');
|
||||
console.log(event);
|
||||
console.log('event.finished', event.finished);
|
||||
console.log('event.after:', [...event.after]);
|
||||
console.log('event.next:', [...event.next]);
|
||||
}
|
||||
if(event.next.length>0){
|
||||
var next=event.next.shift();
|
||||
if(next.player&&next.player.skipList.contains(next.name)){
|
||||
|
|
Loading…
Reference in New Issue