标准包yiji技能调整缩进

This commit is contained in:
shijian 2023-12-09 12:38:27 +08:00
parent 1ab5975364
commit 60596cd0c0
1 changed files with 43 additions and 44 deletions

View File

@ -551,68 +551,67 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filter:function(event){ filter:function(event){
return event.num>0; return event.num>0;
}, },
async content(event, trigger, player) { async content(event,trigger,player){
event.count = trigger.num; event.count=trigger.num;
// event.goto -> while // event.goto -> while
while (event.count > 0) { while(event.count>0){
event.count--; event.count--;
const { cards } = await game.cardsGotoOrdering(get.cards(2)).toPromise(); const {cards}=await game.cardsGotoOrdering(get.cards(2)).toPromise();
if (_status.connectMode) game.broadcastAll(function () { _status.noclearcountdown = true }); if(_status.connectMode) game.broadcastAll(function(){_status.noclearcountdown=true});
event.given_map = {}; event.given_map={};
if (!cards.length) return; if(!cards.length) return;
// event.goto -> do while // event.goto -> do while
do { do{
const { result: { bool, links } } = const {result:{bool,links}} =
cards.length == 1 ? cards.length==1?
{ result: { links: cards.slice(0), bool: true } } : {result:{links:cards.slice(0),bool: true}}:
await player.promises.chooseCardButton('遗计:请选择要分配的牌', true, cards, [1, cards.length]) await player.promises.chooseCardButton('遗计:请选择要分配的牌',true,cards,[1,cards.length])
.set('ai', function (button) { .set('ai',button=>{
if (ui.selected.buttons.length == 0) return 1; if(ui.selected.buttons.length==0) return 1;
return 0; return 0;
}); });
if (!bool) return; if(!bool) return;
cards.removeArray(links); cards.removeArray(links);
event.togive = links.slice(0); event.togive=links.slice(0);
const { result: { targets } } = await player.promises.chooseTarget('选择一名角色获得' + get.translation(links), true) const {result:{targets}}=await player.promises.chooseTarget('选择一名角色获得'+get.translation(links),true)
.set('ai', function (target) { .set('ai',target=>{
var att = get.attitude(_status.event.player, target); const att=get.attitude(_status.event.player,target);
if (_status.event.enemy) { if(_status.event.enemy){
return -att; return -att;
} }
else if (att > 0) { else if(att>0){
return att / (1 + target.countCards('h')); return att/(1+target.countCards('h'));
} }
else { else{
return att / 100; return att/100;
} }
}) })
.set('enemy', get.value(event.togive[0], player, 'raw') < 0); .set('enemy',get.value(event.togive[0],player,'raw')<0);
if (targets.length) { if(targets.length){
const id = targets[0].playerid, const id=targets[0].playerid,
map = event.given_map; map=event.given_map;
if (!map[id]) map[id] = []; if(!map[id]) map[id]=[];
map[id].addArray(event.togive); map[id].addArray(event.togive);
} }
} while (cards.length > 0); }while(cards.length>0);
if (_status.connectMode) { if(_status.connectMode){
game.broadcastAll(function () { delete _status.noclearcountdown; game.stopCountChoose() }); game.broadcastAll(function(){delete _status.noclearcountdown;game.stopCountChoose()});
} }
const list = []; const list=[];
for (const i in event.given_map) { for(const i in event.given_map){
const source = (_status.connectMode ? lib.playerOL : game.playerMap)[i]; const source=(_status.connectMode?lib.playerOL:game.playerMap)[i];
player.line(source, 'green'); player.line(source,'green');
list.push([source, event.given_map[i]]); list.push([source, event.given_map[i]]);
} }
await game.loseAsync({ await game.loseAsync({
gain_list: list, gain_list:list,
giver: player, giver:player,
animate: 'draw', animate:'draw',
}).toPromise().setContent('gaincardMultiple'); }).toPromise().setContent('gaincardMultiple');
if (event.count > 0 && player.hasSkill(event.name) && !get.is.blocked(event.name, player)) { 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); const {result:{bool:chooseBoolResultBool}}=await player.promises.chooseBool(get.prompt2(event.name)).set('frequentSkill',event.name);
if (repeat) { if(chooseBoolResultBool) player.logSkill(event.name);
player.logSkill(event.name); else return;
} else return;
} }
else return; else return;
} }