diff --git a/character/clan.js b/character/clan.js index 6a998d880..0890a31a8 100644 --- a/character/clan.js +++ b/character/clan.js @@ -441,9 +441,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ else event.goto(2); 'step 1' if(result.bool){ - player.removeSkill('clanbaozu'); - player.popup('保族'); - game.log(player,'失去了技能','#g【保族】'); + player.removeSkills('clanbaozu'); } else player.loseHp(); 'step 2' @@ -1542,7 +1540,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return player.getStorage('clanfangzhen_remove').includes(game.roundNumber); }, content(){ - player.removeSkill('clanfangzhen'); + player.removeSkills('clanfangzhen'); } } } @@ -1812,9 +1810,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ event.finish(); } 'step 6' - player.removeSkill(result.control); - player.popup(result.control); - game.log(player,'失去了技能','#g【'+get.translation(result.control)+'】'); + player.removeSkills(result.control); }, ai:{ expose:0.1, @@ -2392,9 +2388,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }); 'step 1' if(result.control!='cancel2'){ - player.removeSkill(result.control); - player.popup(result.control); - game.log(player,'失去了技能','#g【'+get.translation(result.control)+'】'); + player.removeSkills(result.control); } else{ player.loseHp(); diff --git a/character/collab.js b/character/collab.js index b1bc7f330..0d5ed1258 100644 --- a/character/collab.js +++ b/character/collab.js @@ -618,7 +618,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.addMark('dcbianzhuang',1,false); if(player.countMark('dcbianzhuang')>2){ player.storage.dcbianzhuang_inited=true; - player.reinit('zhutiexiong','wu_zhutiexiong'); + player.reinitCharacter('zhutiexiong','wu_zhutiexiong'); } } }, diff --git a/character/ddd.js b/character/ddd.js index 367321da4..02b9bf9da 100644 --- a/character/ddd.js +++ b/character/ddd.js @@ -2812,8 +2812,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }); } else{ - game.log(player,'失去了技能','#g【齐策】'); - player.removeSkill('dddqice'); + player.removeSkills('dddqice'); event.finish(); } 'step 1' @@ -3165,8 +3164,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ else{ if(!targets.includes(player)) player.loseMaxHp(); if(targets.length==1){ - player.removeSkill('dddxiaheng'); - game.log(player,'失去了技能','#g【侠横】'); + player.removeSkills('dddxiaheng'); } } 'step 5' @@ -3272,8 +3270,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }).setContent('gaincardMultiple'); if(!lose) event.finish(); 'step 5' - player.removeSkill('dddfengzheng'); - game.log(player,'失去了技能','#g【丰政】'); + player.removeSkills('dddfengzheng'); }, subSkill:{ global:{ @@ -4435,8 +4432,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ // return event.source&&event.source.isIn()&&event.source.getEquips(1).length>0; // }, content(){ - player.removeSkill('dddxiaoxing'); - game.log(player,'失去了技能','#g【枭行】'); + player.removeSkills('dddxiaoxing'); }, content_old(){ 'step 0' @@ -4448,8 +4444,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ trigger.source.logSkill('dddxiaoxing',player); trigger.source.disableEquip(1); - player.removeSkill('dddxiaoxing'); - game.log(player,'失去了技能','#g【枭行】'); + player.removeSkills('dddxiaoxing'); } } } @@ -4541,8 +4536,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.gain(cards,'log'); } 'step 5' - player.removeSkill('dddlangzhi'); - game.log(player,'失去了技能','#g【狼志】'); + player.removeSkills('dddlangzhi'); event.finish(); 'step 6' game.broadcastAll('closeDialog',event.videoId); @@ -4610,7 +4604,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ else event.finish(); 'step 2' var skill=result.control; - player.addSkillLog(skill); + player.addSkills(skill); }, content_old(){ 'step 0' @@ -4648,14 +4642,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.draw(3); } else event.finish(); - for(var i of skills){ - player.addSkillLog(i); - } + player.addSkills(skills); } else event.finish(); 'step 2' - player.removeSkill('dddfuyi'); - game.log(player,'失去了技能','#g【附义】'); + player.removeSkills('dddfuyi'); }, subSkill:{ sha:{ @@ -5290,8 +5281,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ else event.finish(); 'step 3' if(target.isIn()){event.finish(); return}; - player.removeSkill('dddbailei'); - game.log(player,'失去了技能','#g【拜泪】'); + player.removeSkills('dddbailei'); }, subSkill:{ animate:{ diff --git a/character/diy.js b/character/diy.js index 786e0c931..e5baa65b7 100755 --- a/character/diy.js +++ b/character/diy.js @@ -1774,12 +1774,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('tomoyo_zhengfeng'); player.loseMaxHp(); 'step 1' - player.removeSkill('tomoyo_wuwei'); + player.removeSkills('tomoyo_wuwei'); 'step 2' player.draw(2); player.recover(); 'step 3' - player.addSkill('tomoyo_changshi'); + player.addSkills('tomoyo_changshi'); }, }, }, @@ -2195,12 +2195,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ multiline:true, line:{color:[253, 153, 182]}, content(){ - game.countPlayer(function(current){ + game.filterPlayer().sortBySeat().forEach(function(current){ if(!targets.includes(current)){ - current.removeSkill('seira_yinyuan'); + current.removeSkills('seira_yinyuan'); } else{ - current.addSkillLog('seira_yinyuan'); + current.addSkills('seira_yinyuan'); } }); game.delayx(); @@ -2350,7 +2350,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.draw(2); player.markAuto('nsxingyun',[lib.skill.nsxingyun.getSixiang(trigger.card)]); 'step 1' - if(player.getStorage('nsxingyun').length>=4) player.addSkillLog('bazhen'); + if(player.getStorage('nsxingyun').length>=4) player.addSkills('bazhen'); }, }, round:{ @@ -3416,8 +3416,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(owner&&owner!=player) owner.give(card,player); 'step 1' if(player.hp{ + player.addAdditionalSkill('junkyuheng',skills); + game.log(player,'获得了以下技能:','#g'+get.translation(skills)); + }); } }, group:'junkyuheng_remove', @@ -17664,22 +17656,25 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return player.additionalSkills.junkyuheng&&player.additionalSkills.junkyuheng.length>0; }, content(){ - player.draw(player.additionalSkills.junkyuheng.length); - game.log(player,'失去了以下技能:','#g'+get.translation(player.additionalSkills.junkyuheng)); - player.removeAdditionalSkill('junkyuheng'); + const skills = player.additionalSkills.junkyuheng; + player.draw(skills.length); + player.changeSkills([],skills).set('$handle',(player,addSkills,removeSkills)=>{ + game.log(player,'失去了以下技能:','#g'+get.translation(removeSkills)); + for(let skill of removeSkills) player.removeAdditionalSkill('junkyuheng',skill); + }); }, }, }, }, junkdili:{ audio:'dili', - trigger:{player:'logSkill'}, + trigger:{player:'changeSkillsAfter'}, forced:true, juexingji:true, skillAnimation:true, animationColor:'wood', filter(event,player){ - if(event.skill!='junkyuheng') return false; + if(!event.addSkill.length) return false; var skills=player.getSkills(null,false,false).filter(function(i){ var info=get.info(i); return info&&!info.charlotte; @@ -17734,12 +17729,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ var skills=result.links; game.log(player,'失去了以下技能:','#g'+get.translation(skills)); - player.removeSkill(skills.slice(0)); + player.removeSkills(skills.slice(0)); } var list=lib.skill.junkdili.derivation; - for(var i=0;i东吴命运线·改中随机获得等量的技能。②回合结束时,你失去所有因〖驭衡①〗获得的技能,然后摸等量的牌。', junkdili:'帝力', - junkdili_info:'觉醒技。当你发动〖驭衡①〗后,若你拥有的技能数大于你的体力上限,则你减1点体力上限,选择失去任意个其他技能,然后获得以下技能中的前等量个:〖圣质〗/〖权道〗/〖持纲〗。', + junkdili_info:'觉醒技。当你获得技能后,若你拥有的技能数大于你的体力上限,则你减1点体力上限,选择失去任意个其他技能,然后获得以下技能中的前等量个:〖圣质〗/〖权道〗/〖持纲〗。', junkshengzhi:'圣质', junkshengzhi_info:'锁定技。当你发动非锁定技后,你令你本回合使用的下一张牌无距离和次数限制。', junkquandao:'权道', diff --git a/character/extra.js b/character/extra.js index aff821eed..31f1e8275 100755 --- a/character/extra.js +++ b/character/extra.js @@ -998,12 +998,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var target=trigger.player; player.awakenSkill('jxzhaoluan'); trigger.cancel(); - target.getSkills(null,false,false).forEach(skill=>{ + const skills = target.getSkills(null,false,false).filter(skill=>{ var info=get.info(skill); if(info&&!info.charlotte&&!get.is.locked(skill)){ - target.removeSkill(skill); + return true; } }); + if(skills.length) yield target.removeSkills(skills); yield target.gainMaxHp(3); var num=3-target.getHp(true); if(num>0) yield target.recover(num); @@ -1630,7 +1631,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 0' player.awakenSkill('dcqijing'); player.loseMaxHp(); - player.addSkillLog('dccuixin'); + player.addSkills('dccuixin'); 'step 1' if(game.countPlayer()>2){ if(player==trigger.player&&!trigger.skill){ @@ -3199,7 +3200,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return info&&!info.charlotte&&!get.is.locked(i); }); if(skills.length){ - for(var i of skills) player.removeSkill(i); + player.removeSkills(skills); } //初始化技能库 var list1=['dili_shengzhi','dili_chigang','dili_qionglan','dili_quandao','dili_jiaohui','dili_yuanlv']; @@ -3251,7 +3252,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ skills.add(fullskills.randomRemove(1)[0]); } for(var i of skills){ - player.addSkillLog(i); + player.addSkills(i); } player.markAuto('yuheng',skills); }, @@ -3440,10 +3441,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ },'请选择火【杀】的目标('+(event.num==9?'⑨':event.num)+'/9)',false); 'step 2' if(result.bool&&event.num<9) event.goto(1); - else{ - player.removeSkill('jiufa'); - player.addSkill('pingxiang_effect'); - } + else player.removeSkills('jiufa'); + 'step 3' + player.addSkill('pingxiang_effect'); }, ai:{ order(){ @@ -4109,7 +4109,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content(){ game.log(player,'成功完成使命'); player.awakenSkill('tspowei'); - player.addSkillLog('shenzhu'); + player.addSkills('shenzhu'); }, }, fail:{ @@ -4351,7 +4351,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var target=result.targets[0]; player.line(target,'green'); target.storage.zuoxing=player; - target.addSkill('zuoxing'); + target.addSkills('zuoxing'); } }, derivation:'zuoxing', @@ -4772,7 +4772,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(lib.character[target.name]) list.addArray(lib.character[target.name][3]); if(lib.character[target.name1]) list.addArray(lib.character[target.name1][3]); if(lib.character[target.name2]) list.addArray(lib.character[target.name2][3]); - player.addSkill(list); + player.addSkills(list); game.broadcastAll(function(list){ lib.character.key_shiki[3].addArray(list); game.expandSkills(list); @@ -5095,8 +5095,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content(){ player.awakenSkill(event.name); - player.addSkill('tianxing'); - player.addSkill('new_rejianxiong'); + player.addSkills(['tianxing','new_rejianxiong']); player.loseMaxHp(); player.gain(player.getExpansions('chuyuan'),'gain2','fromStorage'); }, @@ -5118,7 +5117,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.loseMaxHp(); player.gain(player.getExpansions('chuyuan'),'gain2','fromStorage'); "step 1" - player.removeSkill('chuyuan'); + player.removeSkills('chuyuan'); player.chooseControl('rerende','rezhiheng','olluanji','caopi_xingdong').set('prompt','选择获得一个技能').set('ai',function(){ var player=_status.event.player; if(!player.hasSkill('luanji')&&!player.hasSkill('olluanji')&&player.getUseValue({name:'wanjian'})>4) return 'olluanji'; @@ -5127,7 +5126,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 'rerende'; }); 'step 2' - player.addSkillLog(result.control); + player.addSkills(result.control); }, }, olzhiti:{ @@ -5902,9 +5901,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return player.countMark('renjie')>=4; }, content(){ - player.loseMaxHp(); - player.addSkill('jilue'); player.awakenSkill('sbaiyin'); + player.loseMaxHp(); + player.addSkills('jilue'); }, derivation:['jilue','reguicai','fangzhu','rejizhi','rezhiheng','rewansha'], }, @@ -7534,7 +7533,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, popup:false, content(){ - player.removeSkill(player.storage.drlt_duorui[0]); + player.removeSkills(player.storage.drlt_duorui[0]); delete player.storage.drlt_duorui_player; player.storage.drlt_duorui=[]; }, diff --git a/character/huicui.js b/character/huicui.js index 5c9f6cabb..f521de96d 100644 --- a/character/huicui.js +++ b/character/huicui.js @@ -246,7 +246,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(get.type(name)==='delay') return false; const card=new lib.element.VCard({name:name}); return get.tag(card,'damage')&&!player.getStorage('dcdehua').includes(name); - })) player.removeSkillLog('dcdehua'); + })) player.removeSkills('dcdehua'); }, mod:{ maxHandcard(player,num){ @@ -527,12 +527,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ var num=Math.min(cards.length,4-player.countMark('dcmanwang')); - if(num>=1) player.addSkill('dcpanqin'); + if(num>=1) player.addSkills('dcpanqin'); if(num>=2) player.draw(); if(num>=3) player.recover(); if(num>=4){ player.draw(2); - player.removeSkill('dcpanqin'); + player.removeSkills('dcpanqin'); } }, ai:{ @@ -578,7 +578,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ switch(player.countMark('dcmanwang')){ case 1: player.draw(2); - player.removeSkill('dcpanqin'); + player.removeSkills('dcpanqin'); break; case 2: player.recover(); @@ -587,7 +587,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.draw(); break; case 4: - player.addSkill('dcpanqin'); + player.addSkills('dcpanqin'); break; } 'step 1' @@ -3337,11 +3337,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ 'step 0' player.awakenSkill('dcchongxu'); + player.removeSkills('dchuiling'); player.gainMaxHp(Math.min(game.countPlayer(),player.countMark('dchuiling'))); - player.removeSkill('dchuiling'); 'step 1' - player.addSkillLog('dctaji'); - player.addSkillLog('dcqinghuang'); + player.addSkills(['dctaji','dcqinghuang']); }, ai:{ order:function(itemp,player){ @@ -7643,7 +7642,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ else event.goto(3); 'step 2' game.broadcastAll('closeDialog',event.videoId); - target.addSkillLog(result.control); + target.addSkills(result.control); 'step 3' var storage=player.storage.dunshi; if(event.links.includes(1)){ @@ -10030,8 +10029,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(player.maxHp>player.hp) player.recover(player.maxHp-player.hp); 'step 2' player.drawTo(Math.min(5,player.maxHp)); - player.addSkillLog('llqshenwei'); - player.addSkillLog('wushuang'); + player.addSkills(['llqshenwei','wushuang']); }, }, llqshenwei:{ diff --git a/character/jsrg.js b/character/jsrg.js index 898a66ee5..abf0b210a 100644 --- a/character/jsrg.js +++ b/character/jsrg.js @@ -1204,7 +1204,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(bool){ player.logSkill('jsrgfangjie'); await player.discard(links); - player.removeSkillLog('jsrgfangjie'); + player.removeSkills('jsrgfangjie'); } } }, @@ -3965,9 +3965,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ player.awakenSkill('jsrgzhasi'); trigger.cancel(); - player.removeSkill('jsrgzhiheng'); - game.log(player,'失去了技能','#g【猘横】'); - player.addSkillLog('rezhiheng'); + player.changeSkills(['rezhiheng'],['jsrgzhiheng']); player.addSkill('jsrgzhasi_undist'); }, derivation:'rezhiheng', @@ -6272,8 +6270,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger.targets.forEach(i=>i.removeSkill('huogong2')); } else{ - player.removeSkill('jsrgguanhuo'); - game.log(player,'失去了技能','#g【观火】'); + player.removeSkills('jsrgguanhuo'); } }, ai:{ @@ -7652,8 +7649,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('jsrghuilie'); player.loseMaxHp(); 'step 1' - player.addSkillLog('jsrgpingrong'); - player.addSkillLog('feiying'); + player.addSkills(['jsrgpingrong','feiying']); } }, jsrgpingrong:{ diff --git a/character/mobile.js b/character/mobile.js index 8d02ff03d..57e9c1aaf 100644 --- a/character/mobile.js +++ b/character/mobile.js @@ -5907,7 +5907,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ var es=target.getCards('e'); target.give(es,player,'give'); - player.removeSkill('mobileyanzhu'); + player.removeSkills('mobileyanzhu'); player.storage.mobileyanzhu=true; player.popup('兴学'); game.log(player,'修改了技能','#g【兴学】'); @@ -6783,7 +6783,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ player.awakenSkill('moucuan'); player.loseMaxHp(); - player.addSkill('binghuo'); + player.addSkills('binghuo'); }, ai:{combo:'jibing'}, }, @@ -9783,10 +9783,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ event.skills=skills; player.chooseControl(skills).set('dialog',['选择令'+get.translation(target)+'获得一个技能',[chara,'character']]); 'step 2' - target.addSkillLog(result.control); + target.addSkills(result.control); target.setAvatarQueue(target.name1||target.name,[event.chara[event.skills.indexOf(result.control)]]); - 'step 3' - if(target.isZhu2()) event.trigger('zhuUpdate'); }, }, hongyi:{ @@ -9898,13 +9896,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ player.awakenSkill('requanfeng'); - player.removeSkill('hongyi'); + player.removeSkills('hongyi'); var skills=trigger.player.getStockSkills('仲村由理','天下第一').filter(function(skill){ var info=get.info(skill); return info&&!info.hiddenSkill&&!info.zhuSkill&&!info.charlotte; }); if(skills.length){ - for(var i of skills) player.addSkillLog(i); + player.addSkills(skills); game.broadcastAll(function(list){ game.expandSkills(list); for(var i of list){ @@ -9945,7 +9943,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return list.randomGet(); }); 'step 1' - player.addSkillLog(result.control); + player.addSkills(result.control); game.broadcastAll(function(skill){ var list=[skill];game.expandSkills(list); for(var i of list){ @@ -11586,8 +11584,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.gain(gains,'gain2'); } 'step 3' - player.addSkill('reqingce'); - game.log(player,'获得了技能','#g【清侧】'); + player.addSkills('reqingce'); player.loseMaxHp(); }, }, @@ -12962,8 +12959,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 1' if(result.bool){ player.line(trigger.source,'fire'); - trigger.source.addSkillLog('new_rewusheng'); - trigger.source.addSkillLog('redangxian'); + trigger.source.addSkills(['new_rewusheng','redangxian']); } }, }, @@ -13112,8 +13108,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ animationColor:'thunder', content:function(){ player.awakenSkill('remoucheng'); - player.removeSkill('relianji'); - player.addSkill('jingong'); + player.changeSkills(['jingong','relianji']); player.gainMaxHp(); player.recover(); }, diff --git a/character/offline.js b/character/offline.js index 66475b875..c0522a719 100644 --- a/character/offline.js +++ b/character/offline.js @@ -1075,7 +1075,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('pksanchen'); player.gainMaxHp(); player.recover(); - player.addSkillLog('pkmiewu'); + player.addSkills('pkmiewu'); }, ai:{ combo:'wuku', @@ -5324,7 +5324,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.storage.suiren=true; player.awakenSkill('suiren'); player.logSkill('suiren',result.targets); - player.removeSkill('reyicong'); + player.removeSkills('reyicong'); player.gainMaxHp(); player.recover(); result.targets[0].draw(3); diff --git a/character/old.js b/character/old.js index 9544cadbc..def28bd53 100755 --- a/character/old.js +++ b/character/old.js @@ -200,7 +200,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 1' if(result.bool){ player.logSkill('junkguixin'); - player.addSkillLog(result.links[0]); + player.addSkills(result.links[0]); } }, content_修改势力:function(){ diff --git a/character/onlyOL.js b/character/onlyOL.js index 0a6943813..65a2856f0 100644 --- a/character/onlyOL.js +++ b/character/onlyOL.js @@ -519,11 +519,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var trigger=map.trigger; player.awakenSkill('olsbranji'); var num=lib.skill.olsbranji.getNum(trigger,player); + const skills = []; if(num>=player.getHp()){ - player.addSkillLog('kunfen'); + skills.push('kunfen'); player.storage.kunfen=true; } - if(num<=player.getHp()) player.addSkillLog('zhaxiang'); + if(num<=player.getHp()) skills.push('zhaxiang'); + player.addSkills(skills); if(player.countCards('h')!=player.getHandcardLimit()||player.isDamaged()){ var result,num1=player.countCards('h')-player.getHandcardLimit(); if(!num1) result={index:1}; diff --git a/character/refresh.js b/character/refresh.js index 6c946cd4e..ec9947263 100755 --- a/character/refresh.js +++ b/character/refresh.js @@ -559,8 +559,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 1' player.drawTo(player.maxHp); 'step 2' - player.addSkillLog('benghuai'); - player.addSkillLog('reweizhong'); + player.addSkills(['benghuai','reweizhong']); } }, reweizhong:{ @@ -3861,7 +3860,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ player.awakenSkill('xsqianxin'); player.loseMaxHp(); - player.addSkill('rejianyan'); + player.addSkills('rejianyan'); }, derivation:'rejianyan', }, @@ -5588,7 +5587,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.recover(); player.draw(2); player.loseMaxHp(); - player.addSkill('xinpaiyi'); + player.addSkills('xinpaiyi'); }, }, xinpaiyi:{ @@ -6102,8 +6101,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.chooseDrawRecover(2,true); "step 1" player.loseMaxHp(); - player.storage.olzhiji=true; - player.addSkill('reguanxing'); + player.addSkills('reguanxing'); } }, //界郭图张嶷 @@ -7733,7 +7731,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ player.awakenSkill('olzaoxian'); player.loseMaxHp(); - player.addSkill('jixi'); + player.addSkills('jixi'); player.insertPhase(); } }, @@ -9603,7 +9601,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return ['olhuoji','bazhen'].randomGet(); }; 'step 6' - player.addSkillLog(result.control); + player.addSkills(result.control); }, derivation:['bazhen','olhuoji','olkanpo'], ai:{ @@ -10115,10 +10113,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.gainMaxHp(); 'step 1' if(player.hp<3) player.recover(3-player.hp); - player.addSkillLog('sishu'); - player.addSkillLog('rejijiang'); - 'step 2' - if(player.isZhu2()) event.trigger('zhuUpdate'); + player.addSkills(['sishu', 'rejijiang']); } }, olfangquan:{ @@ -10276,14 +10271,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audioname:['re_sunyi'], inherit:'hunzi', content:function(){ + player.awakenSkill(event.name); player.loseMaxHp(); //player.recover(); - player.addSkill('reyingzi'); - player.addSkill('gzyinghun'); + player.addSkills(['reyingzi','gzyinghun']); player.addTempSkill('olhunzi_effect'); - game.log(player,'获得了技能','#g【英姿】','和','#g【英魂】'); - player.awakenSkill(event.name); - player.storage[event.name]=true; }, subSkill:{ effect:{ @@ -11038,7 +11030,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 1' if(!result.bool) target.loseHp(); 'step 2' - target.addSkillLog('rechanyuan'); + target.addSkills('rechanyuan'); if(targets.length) event.goto(0); }, }, @@ -13158,7 +13150,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('qinxue'); player.loseMaxHp(); player.chooseDrawRecover(2,true); - player.addSkill('gongxin'); + player.addSkills('gongxin'); } }, qingjian:{ @@ -14028,7 +14020,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ player.awakenSkill('qianxin'); - player.addSkill('jianyan'); + player.addSkills('jianyan'); player.loseMaxHp(); } }, diff --git a/character/sb.js b/character/sb.js index 1ced4584f..dedf6de5a 100644 --- a/character/sb.js +++ b/character/sb.js @@ -552,8 +552,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ game.log(player,'选择了',target2); const skills=target2.getStockSkills(true,true); const skills2=player.getStockSkills(true,true); - player.addSkillLog(skills); - player.removeSkillLog(skills2); + player.changeSkills(skills,skills2); } } }, @@ -782,7 +781,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ animationColor:'thunder', async content(event,trigger,player){ player.awakenSkill('sbsongwei_delete'); - event.target.removeSkillLog(event.target.getStockSkills(false,true)); + event.target.removeSkills(event.target.getStockSkills(false,true)); }, ai:{ order:13, @@ -1245,17 +1244,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){ locked:false, skillAnimation:true, animationColor:'fire', - content:function(){ + async content(event,trigger,player){ player.awakenSkill('sbhuoji'); game.log(player,'成功完成使命'); - var list=[]; - if(player.name&&get.character(player.name)[3].includes('sbhuoji')) list.add(player.name); - if(player.name1&&get.character(player.name1)[3].includes('sbhuoji')) list.add(player.name1); - if(player.name2&&get.character(player.name2)[3].includes('sbhuoji')) list.add(player.name2); - if(list.length) list.forEach(name=>player.reinit(name,'sb_zhugeliang')); + if (get.character(player.name1)[3].includes('sbhuoji')) { + player.reinitCharacter(player.name1, 'sb_zhugeliang', false); + } + else if (player.name2&&get.character(player.name2)[3].includes('sbhuoji')) { + player.reinitCharacter(player.name2, 'sb_zhugeliang', false); + } else{ - player.removeSkill(['sbhuoji','sbkanpo']); - player.addSkill(['sbguanxing','sbkongcheng']); + player.changeSKills(['sbguanxing','sbkongcheng'],['sbhuoji','sbkanpo']); } }, }, @@ -2302,8 +2301,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 2' player.draw(3); 'step 3' - player.addSkillLog('sbyingzi'); - player.addSkillLog('gzyinghun'); + player.addSkills(['sbyingzi','gzyinghun']); }, ai:{ threaten:function(player,target){ @@ -3655,8 +3653,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 0' player.recover(3); 'step 1' - player.removeSkill('sbrende'); - game.log(player,'失去了技能','#g【'+get.translation('sbrende')+'】'); + player.removeSkills('sbrende'); game.delayx(); }, ai:{ @@ -5914,7 +5911,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ player.awakenSkill('sbdujiang'); - player.addSkillLog('sbduojing'); + player.addSkills('sbduojing'); player.storage.sbkeji=true; } }, diff --git a/character/shenhua.js b/character/shenhua.js index 40575d637..ffc7ce0a6 100755 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -667,7 +667,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.gain(gains,'gain2','log'); } 'step 2' - player.addSkill('qingce'); + player.addSkills('qingce'); game.log(player,'获得了技能','#g【清侧】'); player.loseMaxHp(); }, @@ -808,7 +808,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.gain(gains,'gain2','log'); } 'step 2' - player.addSkillLog('drlt_qingce'); + player.addSkills('drlt_qingce'); player.loseMaxHp(); }, }, @@ -1209,8 +1209,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ "step 1" var num=player.maxHp-player.countCards('h'); if(num>0) player.draw(num); - player.removeSkill('drlt_jueyan'); - player.addSkill('drlt_huairou'); + player.changeSkills(['drlt_huairou'],['drlt_jueyan']); }, }, "drlt_huairou":{ @@ -2648,13 +2647,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, }, - "nzry_shenshi1":{ + nzry_shenshi1:{ audio:2, trigger:{ global:'phaseJieshuBegin', }, forced:true, popup:false, + charlotte:true, filter:function(event,player){ return player.storage.nzry_shenshi1!=undefined&&player.storage.nzry_shenshi2!=undefined; }, @@ -3345,10 +3345,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.chooseDrawRecover(2,true); "step 1" player.loseMaxHp(); - player.storage.zhiji=true; - if(player.hp>player.maxHp) player.hp=player.maxHp; - player.update(); - player.addSkill('reguanxing'); + player.addSkills('reguanxing'); } }, xiangle:{ @@ -3498,9 +3495,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.gainMaxHp(); player.recover(); 'step 1' - player.addSkillLog('rejijiang'); - 'step 2' - if(player.isZhu2()) event.trigger('zhuUpdate'); + player.addSkills('rejijiang'); } }, qiaobian:{ @@ -3726,7 +3721,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ player.awakenSkill('zaoxian'); player.loseMaxHp(); - player.addSkill('jixi'); + player.addSkills('jixi'); } }, jixi:{ @@ -3820,12 +3815,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, //priority:3, content:function(){ - player.loseMaxHp(); - player.addSkill('reyingzi'); - player.addSkill('gzyinghun'); - game.log(player,'获得了技能','#g【英姿】和【英魂】') player.awakenSkill(event.name); - player.storage[event.name]=true; + player.loseMaxHp(); + player.addSkills(['reyingzi','gzyinghun']); }, ai:{ threaten:function(player,target){ @@ -7652,7 +7644,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } else{ event.betrayer.popup('质疑错误','fire'); - event.betrayer.addSkillLog('chanyuan'); + event.betrayer.addSkills('chanyuan'); } 'step 7' game.delay(2); diff --git a/character/shiji.js b/character/shiji.js index da6e942c0..4f52c48b4 100644 --- a/character/shiji.js +++ b/character/shiji.js @@ -2168,8 +2168,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('rechuhai'); game.log(player,'成功完成使命'); if(player.isDamaged()) player.recover(player.maxHp-player.hp); - player.removeSkill('xianghai'); - player.addSkill('zhangming'); + player.changeSkills(['zhangming'],['xianghai']); }, }, fail:{ @@ -2741,7 +2740,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } if(cards.length) player.gain(cards,'gain2'); 'step 1' - player.addSkill('xinmouli'); + player.addSkills('xinmouli'); }, group:['mibei_fail','mibei_silent'], derivation:'xinmouli', @@ -3179,7 +3178,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ game.log(player,'成功完成使命'); player.awakenSkill('qingyu'); - player.addSkillLog('xuancun'); + player.addSkills('xuancun'); }, }, fail:{ @@ -5767,7 +5766,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('spsanchen'); player.gainMaxHp(); player.recover(); - player.addSkillLog('spmiewu'); + player.addSkills('spmiewu'); }, ai:{ combo:'wuku', diff --git a/character/sp.js b/character/sp.js index b83ed8e7b..a22549190 100755 --- a/character/sp.js +++ b/character/sp.js @@ -1852,8 +1852,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ var target=result.targets[0]; event.target=target; - var num=target.maxHp; - event.num=num; player.logSkill('skill_zhangji_B',target); var list=[]; for(var i=0;i<_status.characterlist.length;i++){ @@ -1872,10 +1870,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 2' if(result.bool){ event.character=result.links[0]; - if(target.name2!=undefined) target.chooseControl(target.name,target.name2).set('prompt','请选择要更换的武将牌').set('ai',function(){ + if(target.name2!=undefined) target.chooseControl(target.name1,target.name2).set('prompt','请选择要更换的武将牌').set('ai',function(){ return lib.skill.skill_zhangji_B.getNum(target.name)0) player.chooseToDiscard('h',num,true); @@ -10293,12 +10286,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ var num=Math.min(cards.length,4-player.countMark('spmanwang')); - if(num>=1) player.addSkill('sppanqin'); + if(num>=1) player.addSkills('sppanqin'); if(num>=2) player.draw(); if(num>=3) player.recover(); if(num>=4){ player.draw(2); - player.removeSkill('sppanqin'); + player.removeSkills('sppanqin'); } }, intro:{content:'已经移去过#个选项'}, @@ -10385,7 +10378,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ switch(player.countMark('spmanwang')){ case 1: player.draw(2); - player.removeSkill('sppanqin'); + player.removeSkills('sppanqin'); break; case 2: player.recover(); @@ -10394,7 +10387,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.draw(); break; case 4: - player.addSkill('sppanqin'); + player.addSkills('sppanqin'); break; } }, @@ -10482,7 +10475,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ for(var i of lib.skill.rebaobian.derivation){ if(!player.hasSkill(i,null,null,false)){ - player.addSkillLog(i); + player.addSkills(i); break; } } @@ -11220,7 +11213,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ target.gainMaxHp(); target.recover(); target.draw(3); - target.addSkill('olzaowang2'); + target.addSkills('olzaowang2'); }, ai:{ order:2, @@ -11950,7 +11943,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } else event.finish(); 'step 2' - target.addSkillLog(result.control); + target.addSkills(result.control); }, }, //邓芝 @@ -12582,7 +12575,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ 'step 0' player.awakenSkill('olxushen'); - player.addSkill('olzhennan'); + player.addSkills('olzhennan'); player.recover(1-player.hp); 'step 1' if(!player.isDying()&&!game.hasPlayer(function(current){ @@ -12613,12 +12606,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } else event.finish(); 'step 4' - target.reinit(result.control,'guansuo'); - if(target.name=='guansuo'&&target.group!='shu') target.changeGroup('shu'); - if(_status.characterlist){ - _status.characterlist.add(result.control); - _status.characterlist.remove('guansuo'); - } + target.reinitCharacter(result.control,'guansuo'); }, }, olzhennan:{ @@ -13677,7 +13665,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return list.randomGet(); }); 'step 1' - player.addSkillLog(result.control); + player.addSkills(result.control); game.broadcastAll(function(skill){ var list=[skill];game.expandSkills(list); for(var i of list){ @@ -13740,7 +13728,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(player.storage.retuogu) player.removeSkill(player.storage.retuogu); player.storage.retuogu=result.control; player.markSkill('retuogu'); - player.addSkillLog(result.control); + player.addSkills(result.control); game.broadcastAll(function(skill){ var list=[skill]; game.expandSkills(list); @@ -14074,8 +14062,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ player.awakenSkill('xinmoucheng'); - player.addSkill('xinjingong'); - player.removeSkill('xinlianji'); + player.changeSkills(['xinjingong'],['xinlianji']); }, }, xinjingong:{ @@ -16276,9 +16263,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ animationColor:'gray', content:function(){ player.awakenSkill('moucheng'); - player.removeSkill('wylianji'); game.log(player,'失去了技能','#g【连计】'); - player.addSkillLog('jingong'); + player.changeSkills(['jingong'],['wylianji']); } } } @@ -17532,11 +17518,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('fuhan'); 'step 1' event.num=Math.min(event.num,8); - player.reinit('zhaoxiang',result.links[0],false); - if(_status.characterlist){ - _status.characterlist.add('zhaoxiang'); - _status.characterlist.remove(result.links[0]); - } + player.reinitCharacter('zhaoxiang',result.links[0]); 'step 2' var num=event.num-player.maxHp; if(num>0) player.gainMaxHp(num); @@ -17681,7 +17663,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 2' var map=event.result||result; if(map&&map.skills&&map.skills.length){ - for(var i of map.skills) player.addSkillLog(i); + player.addSkils(map.skills); } game.broadcastAll(function(list){ game.expandSkills(list); @@ -17689,7 +17671,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var info=lib.skill[i]; if(!info) continue; if(!info.audioname2) info.audioname2={}; - info.audioname2.old_yuanshu='weidi'; + info.audioname2.zhaoxiang='fuhan'; } },map.skills); 'step 3' @@ -17906,12 +17888,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }).set('choiceList',['获得技能〖妄尊〗',str]).set('choice',choice); 'step 2' if(result.control=='选项一'){ - player.addSkillLog('rewangzun'); + player.addSkills('rewangzun'); } else{ player.draw(2); if(event.list){ - for(var i of event.list) player.addSkillLog(event.list); + player.addSkills(event.list); game.broadcastAll(function(list){ game.expandSkills(list); for(var i of list){ @@ -18535,16 +18517,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ charlotte:true, }, weidi:{ - trigger:{global:['gameStart','zhuUpdate']}, - forced:true, - audio:2, - filter:function(event,player){ - var mode=get.mode(); - return (mode=='identity'||(mode=='versus'&&_status.mode=='four')); - }, - content:function(){ - var list=[]; - var zhu=get.zhu(player); + init(player){ + const list=[]; + const zhu=get.zhu(player); if(zhu&&zhu!=player&&zhu.skills){ for(var i=0;i { + return lib.skill[skill] && lib.skill[skill].zhuSkill; + }) || event.addSkill.some(skill => { + return lib.skill[skill] && lib.skill[skill].zhuSkill; + })); + }, + async content (event, trigger, player) { + lib.skill.weidi.init(player); + }, }, zhenlue:{ audio:2, @@ -18694,9 +18687,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return info&&info.zhuSkill; }); if(skills.length){ - for(var i of skills) target.addSkillLog(i); + target.addSkills(skills); } - if(target.isZhu2()) event.trigger('zhuUpdate'); } }, ai:{expose:0.2}, @@ -19409,9 +19401,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }); 'step 2' if(result.control=='xindangxian') player.storage.xinfuli=true; - player.addSkill(result.control); - player.popup(result.control); - game.log(player,'获得了技能','#g【'+get.translation(result.control)+'】'); + player.addSkills(result.control); }, ai:{threaten:2.5}, intro:{ @@ -19439,8 +19429,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ else event.finish(); 'step 2' if(result.control){ - player.addSkillLog(result.control); - player.popup(result.control); + player.addSkills(result.control); } }, ai:{threaten:2}, @@ -20277,10 +20266,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return player.getExpansions('fentian').length>=3; }, content:function(){ - player.loseMaxHp(); - player.addSkill('xintan'); - player.storage.zhiri=true; player.awakenSkill('zhiri'); + player.loseMaxHp(); + player.storage.zhiri=true; } }, xintan:{ @@ -20329,11 +20317,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return !player.storage.danji&&player.countCards('h')>player.hp; }, content:function(){ - player.storage.danji=true; - player.loseMaxHp(); - player.addSkill('mashu'); - player.addSkill('nuzhan'); player.awakenSkill('danji'); + player.loseMaxHp(); + player.addSkills(['mashu','nuzhan']); }, ai:{ maixie:true, @@ -21717,15 +21703,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ "step 0" + player.awakenSkill('fengliang'); player.loseMaxHp(); "step 1" if(player.hp<2){ player.recover(2-player.hp); } "step 2" - player.addSkill('oltiaoxin'); - player.storage.kunfen=true; - player.awakenSkill('fengliang'); + player.addSkills('oltiaoxin'); }, }, zhuiji:{ @@ -22482,12 +22467,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, forced:true, content:function(){ - player.storage.fanxiang=true; + player.awakenSkill('fanxiang'); player.gainMaxHp(); player.recover(); - player.removeSkill('liangzhu'); - player.addSkill('xiaoji'); - player.awakenSkill('fanxiang'); + player.changeSkills(['xiaoji'],['liangzhu']); }, }, mingshi:{ @@ -23062,11 +23045,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('cunsi'); var cards=player.getCards('h'); player.give(cards,target); - player.storage.cunsi=true; - game.delay(); - target.addSkill('yongjue'); - target.markSkillCharacter('yongjue',player,'存嗣','
【勇决】
每当其他角色于回合内使用一张杀,若目标不是你,你可以获得之,每回合限一次
'); "step 1" + target.addSkills('yongjue'); + "step 2" + target.markSkillCharacter('yongjue',player,'存嗣','
【勇决】
每当其他角色于回合内使用一张杀,若目标不是你,你可以获得之,每回合限一次
'); player.turnOver(); }, intro:{ @@ -23559,7 +23541,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ "step 0" - player.removeSkill('huxiao'); + player.removeSkills('huxiao'); player.gainMaxHp(); "step 1" player.recover(); @@ -23646,7 +23628,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ animationColor:'orange', content:function(){ 'step 0' - player.removeSkill('oldhuxiao'); + player.removeSkills('oldhuxiao'); player.gainMaxHp(); 'step 1' player.recover(); @@ -24679,11 +24661,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ unique:true, juexingji:true, content:function(){ - player.draw(player.maxHp); - player.addSkill('benghuai'); - player.addSkill('weizhong'); - player.storage.juyi=true; player.awakenSkill('juyi'); + player.draw(player.maxHp); + player.addSkills(['benghuai','weizhong']); } }, weizhong:{ @@ -25526,18 +25506,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('xinfu_xushen'); player.logSkill('xinfu_xushen',trigger.source); if(trigger.source.name2!=undefined){ - trigger.source.chooseControl(trigger.source.name,trigger.source.name2).set('prompt','请选择要更换的武将牌'); - }else event._result={control:trigger.source.name}; + trigger.source.chooseControl(trigger.source.name1,trigger.source.name2).set('prompt','请选择要更换的武将牌'); + }else event._result={control:trigger.source.name1}; } else event.finish(); "step 2" - trigger.source.reinit(result.control,'guansuo'); - if(_status.characterlist){ - _status.characterlist.add(result.control); - _status.characterlist.remove('guansuo'); - } + trigger.source.reinitCharacter(result.control,'guansuo'); player.recover(); - player.addSkill('xinfu_zhennan'); + player.addSkills('xinfu_zhennan'); }, mark:true, intro:{ diff --git a/character/sp2.js b/character/sp2.js index b6ad45b78..e7f24f227 100644 --- a/character/sp2.js +++ b/character/sp2.js @@ -921,7 +921,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if (result.bool) { var target = result.targets[0]; player.line(target, 'thunder'); - target.addSkillLog('dccanyun'); + target.addSkills('dccanyun'); } }, }, @@ -1174,14 +1174,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return player.countCards('h')>player.hp; }, - content:function(){ - 'step 0' - player.loseMaxHp(); - 'step 1' - player.recover(player.maxHp-player.hp); - player.addSkill('mashu'); - player.addSkill('dcnuchen'); + async content(event, trigger, player){ player.awakenSkill('dcdanji'); + await player.loseMaxHp(); + await player.recover(player.maxHp-player.hp); + await player.addSkills(['mashu','dcnuchen']); }, ai:{ maixie:true, @@ -1877,9 +1874,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ event.num2=target.countCards('e'); if(event.num2==4&&num!=4){ player.trySkillAnimate('dccuichuan_animate','dccuichuan_animate',player.checkShow('dccuichuan')); - player.removeSkill('dccuichuan'); - game.log(player,'失去了技能','#g【榱椽】'); - player.addSkillLog('dczuojian'); + //player.removeSkill('dccuichuan'); + //game.log(player,'失去了技能','#g【榱椽】'); + player.changeSkills(['dczuojian'],['dccuichuan']); target.insertPhase(); game.delayx(); } @@ -4164,12 +4161,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var target=result.targets[0]; player.awakenSkill('chuanshu'); player.logSkill('chuanshu',target); - target.addSkillLog('chaofeng'); + target.addSkills('chaofeng'); if(player.isDead()) event.finish(); } else event.finish(); 'step 2' - for(var i of lib.skill.chuanshu.derivation) player.addSkillLog(i); + player.addSkills(lib.skill.chuanshu.derivation); }, derivation:['ollongdan','drlt_congjian','chuanyun'], }, @@ -5661,8 +5658,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.recover(num); } 'step 2' - player.removeSkill('mouni'); - player.addSkill('zhangu'); + //player.removeSkill('mouni'); + player.changeSkills(['zhangu'],['mouni']); }, }, zhangu:{ @@ -6443,7 +6440,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ var target=result.targets[0]; player.logSkill('cixiao',target); - target.addSkill('panshi'); + target.addSkills('panshi'); } event.finish(); 'step 2' @@ -6479,11 +6476,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.discard(result.cards).delay=false; player.line2(game.filterPlayer(function(current){ if(current.hasSkill('panshi')){ - current.removeSkill('panshi'); + current.removeSkills('panshi'); return true; } }).concat(result.targets),'green'); - target.addSkill('panshi'); + target.addSkills('panshi'); } else event.finish(); 'step 4' @@ -6573,7 +6570,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ player.awakenSkill('decadexushen'); - player.addSkill('decadezhennan'); + player.addSkills('decadezhennan'); player.addTempSkill('decadexushen2'); trigger.decadexushen=true; player.recover(); @@ -6608,16 +6605,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(target.name2!=undefined){ target.chooseControl(target.name1,target.name2).set('prompt','请选择要更换的武将牌'); } - else event._result={control:target.name}; + else event._result={control:target.name1}; } else event.goto(4); 'step 3' - target.reinit(result.control,'dc_guansuo'); - if(target.name=='dc_guansuo'&&target.group!='shu') target.changeGroup('shu'); - if(_status.characterlist){ - _status.characterlist.add(result.control); - _status.characterlist.remove('dc_guansuo'); - } + target.reinitCharacter(result.control,'dc_guansuo'); 'step 4' target.draw(3); }, @@ -6697,35 +6689,29 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, yujuex:{ audio:'yujue', - content:function(){ - 'step 0' - player.disableEquip(lib.skill.yujue_backup.position); - 'step 1' + async content(event,trigger,player){ + await player.disableEquip(lib.skill.yujue_backup.position); if(player.isIn()&&game.hasPlayer(function(current){ return current!=player&¤t.countCards('h'); })){ - player.chooseTarget(true,'选择一名角色交给你一张牌并获得技能〖执笏〗',function(card,player,target){ + const result = await player.chooseTarget(true,'选择一名角色交给你一张牌并获得技能〖执笏〗',function(card,player,target){ if(player==target) return false; return target.countCards('h')>0; }).set('ai',function(target){ return get.attitude(_status.event.player,target)*target.countCards('h'); - }); - } - else event.finish(); - 'step 2' - if(result.bool){ - var target=result.targets[0]; - event.target=target; - player.line(target); - target.chooseCard('h',true,'交给'+get.translation(player)+'一张手牌'); - } - else event.finish(); - 'step 3' - if(result.bool&&result.cards&&result.cards.length){ - target.give(result.cards,player); - target.storage.zhihu_mark=player; - target.addSkill('zhihu'); - target.addSkill('zhihu_mark'); + }).forResult(); + if(result.bool){ + var target=result.targets[0]; + event.target=target; + player.line(target); + const result2 = await target.chooseCard('h',true,'交给'+get.translation(player)+'一张手牌').forResult(); + if(result2.bool&&result2.cards&&result2.cards.length){ + await target.give(result2.cards,player); + target.storage.zhihu_mark=player; + await target.addSkills('zhihu'); + target.addSkill('zhihu_mark'); + } + } } }, }, @@ -6747,7 +6733,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, onremove:function(player){ delete player.storage.zhihu_mark; - player.removeSkill('zhihu'); + player.removeSkills('zhihu'); }, trigger:{global:'phaseBeginStart'}, firstDo:true, @@ -9431,8 +9417,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.line(list[i],'green'); } } - player.removeSkill('guju'); - player.addSkill('bmcanshi'); + //player.removeSkill('guju'); + player.changeSkills(['bmcanshi'],['guju']); } }, bmcanshi:{ diff --git a/character/standard.js b/character/standard.js index d3ce39f25..a3524e995 100755 --- a/character/standard.js +++ b/character/standard.js @@ -2103,8 +2103,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ const cards=player.getEquips(1); if(cards.length) player.discard(cards); player.loseMaxHp(); - player.addSkill('mashu'); - player.addSkill('shenji'); + player.addSkills(['mashu','shenji']); }, derivation:['mashu','shenji'], }, diff --git a/character/tw.js b/character/tw.js index 6828c01a2..def2009cc 100644 --- a/character/tw.js +++ b/character/tw.js @@ -1096,7 +1096,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var list=['cancel2']; var choiceList=[ '令此【杀】可以额外指定一个目标', - '弃置其一张手牌,若此【杀】造成伤害,则你摸一张牌且本阶段可以额外使用一张【杀】', + '弃置'+get.translation(target)+'一张手牌,若此【杀】造成伤害,则你摸一张牌且本阶段可以额外使用一张【杀】', ]; if(target.countCards('h')) list.unshift('其弃置'); else choiceList[1]=''+choiceList[1]+''; @@ -1129,10 +1129,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } if(d1) return get.damageEffect(player,player,player)>0; return false; - }()); + }()).set('prompt','护众:是否摸一张牌并执行其中一项?'); 'step 1' if(result.control!='cancel2'){ player.logSkill('twhuzhong',target); + player.draw(); if(result.control=='其弃置'){ player.discardPlayerCard(target,'h',true); player.when('useCardAfter').filter(evt=>evt==trigger.getParent()).then(()=>{ @@ -1144,19 +1145,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }); event.finish(); } - else{ - player.chooseTarget('请选择'+get.translation(trigger.card)+'的额外目标',function(card,player,target){ - var trigger=_status.event.getTrigger(); - return !trigger.targets.includes(target)&&player.canUse(trigger.card,target); - }).set('ai',function(target){ - var player=_status.event.player; - var trigger=_status.event.getTrigger(); - return get.effect(target,trigger.card,player,player); - }); - } } else event.finish(); 'step 2' + player.chooseTarget('请选择'+get.translation(trigger.card)+'的额外目标',function(card,player,target){ + var trigger=_status.event.getTrigger(); + return !trigger.targets.includes(target)&&player.canUse(trigger.card,target); + }).set('ai',function(target){ + var player=_status.event.player; + var trigger=_status.event.getTrigger(); + return get.effect(target,trigger.card,player,player); + }); + 'step 3' if(result.bool){ player.line(result.targets); trigger.getParent().targets.addArray(result.targets); @@ -1180,7 +1180,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{source:'damageBegin2',player:'damageBegin4'}, filter:function(event,player,name){ if(name=='damageBegin2'){ - return !event.hasNature()&&player.countCards('h')>event.player.countCards('h'); + return !event.hasNature()&&player.countCards('h')>=event.player.countCards('h'); } return event.hasNature(); }, @@ -2592,7 +2592,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return info&&!info.hiddenSkill&&!info.zhuSkill&&!info.charlotte; }); if(skills.length){ - for(var i of skills) player.addSkillLog(i); + //for(var i of skills) player.addSkillLog(i); + player.addSkills(skills); player.markAuto('twduoren',skills); game.broadcastAll(function(list){ game.expandSkills(list); @@ -2616,10 +2617,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, locked:false, content:function(){ - for(var i of player.getStorage('twduoren')){ - player.removeSkill(i); - game.log(player,'失去了技能','#g【'+get.translation(i)+'】'); - } + player.removeSkills(player.getStorage('twduoren')); delete player.storage.twduoren; } } @@ -3258,7 +3256,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ var target=result.targets[0]; player.logSkill('twjuntun',target); - target.addSkillLog('twxiongjun'); + target.addSkills('twxiongjun'); if(target!=player) player.addExpose(0.25); } }, @@ -4336,7 +4334,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('twmibei'); player.logSkill('twmibei_achieve'); game.log(player,'成功完成使命'); - player.addSkillLog('twmouli'); + player.addSkils('twmouli'); }, intro:{content:'已使用牌名:$'}, subSkill:{ @@ -5347,8 +5345,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ 'step 0' player.awakenSkill('twneirao'); - player.removeSkill('twjiekuang'); - game.log(player,'失去了技能','#g【竭匡】'); + player.removeSkills('twjiekuang'); 'step 1' var num=player.countCards('he'),cards=[]; player.discard(player.getCards('he')); @@ -5360,7 +5357,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } if(cards.length) player.gain(cards,'gain2'); 'step 2' - player.addSkillLog('twluanlve'); + player.addSkills('twluanlve'); }, }, twluanlve:{ @@ -6853,12 +6850,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.gain(gains,'gain2'); } 'step 3' - player.addSkillLog('twqingce'); + player.addSkills('twqingce'); player.chooseBool('是否减1点体力上限并获得〖扫讨〗?').set('ai',()=>_status.event.bool).set('bool',player.isDamaged()&&player.countCards('h')>=3?(Math.random()<0.5?true:false):false); 'step 4' if(result.bool){ player.loseMaxHp(); - player.addSkillLog('twsaotao'); + player.addSkills('twsaotao'); game.delayx(); } }, @@ -8602,12 +8599,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ multiline:true, content:function(){ 'step 0' - game.countPlayer(function(current){ - current.removeSkill('twgonghuan'); + game.filterPlayer().sortBySeat().forEach(function(current){ + current.removeSkills('twgonghuan'); }); 'step 1' targets.sortBySeat(); - for(var i of targets) i.addSkillLog('twgonghuan'); + for(var i of targets) i.addSkills('twgonghuan'); }, derivation:'twgonghuan', ai:{ @@ -11557,10 +11554,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ logTarget:()=>game.filterPlayer().sortBySeat(), content:function(){ 'step 0' - game.countPlayer(function(current){ - current.addSkill('twfeifu'); + game.filterPlayer().sortBySeat().forEach(function(current){ + current.addSkills('twfeifu'); }); - game.log(player,'令所有其他角色获得了技能','#g【非服】') + //game.log(player,'令所有其他角色获得了技能','#g【非服】') game.delayx(); 'step 1' player.chooseTarget('是否减1点体力上限,并令一名其他角色获得技能【复纂】?',lib.filter.notMe).set('ai',function(target){ @@ -11574,7 +11571,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.loseMaxHp(); var target=result.targets[0]; player.line(target,'fire'); - target.addSkillLog('twfuzuan'); + target.addSkills('twfuzuan'); game.delayx(); } }, @@ -12064,7 +12061,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }).set('choice',skills.sort((a,b)=>(map[b](target,player)||0.5)-(map[a](target,player)||0.5))[0]); 'step 1' var skill=result.control; - player.addSkillLog(skill); + player.addSkills(skill); event.twbudao_skill=skill; player.chooseTarget(lib.filter.notMe,'是否令一名其他角色也获得【'+get.translation(skill)+'】?').set('ai',function(target){ var player=_status.event.player; @@ -12076,7 +12073,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var target=result.targets[0]; event.target=target; player.line(target,'green'); - target.addSkillLog(event.twbudao_skill); + target.addSkills(event.twbudao_skill); var cards=target.getCards('he'); if(!cards.length) event.finish(); else if(cards.length==1) event._result={bool:true,cards:cards}; @@ -12594,9 +12591,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ break; default: player.logSkill('twlingfa'); - player.removeSkill('twlingfa'); - game.log(player,'失去了技能','#g【令法】'); - player.addSkillLog('twzhian'); + player.addSkills(['twzhian'],['twlingfa']); break; } } @@ -13099,7 +13094,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var info=get.info(skill); return info&&info.zhuSkill; }); - for(var i of skills) target.addSkillLog(i); + target.addSkills(skills); + //for(var i of skills) target.addSkillLog(i); } }, }, @@ -13493,7 +13489,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ target.disableJudge(); player.markAuto('twjuezhu_restore',[[target,result.control]]); player.addSkill('twjuezhu_restore'); - target.addSkill('feiying'); + target.addSkills('feiying'); }, subSkill:{ restore:{ @@ -13954,7 +13950,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var name=result.links[0]; player.flashAvatar('twhuashen',name); game.log(player,'获得了','#y'+get.translation(name),'的所有技能'); - player.addSkill(lib.character[name][3]) + player.addSkills(lib.character[name][3]) } 'step 2' var num=event.num-player.maxHp; @@ -15999,9 +15995,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ twdanlie_info:'①出牌阶段限一次。你可以与至多三名其他角色共同拼点。若你赢,你对没赢的角色依次造成1点伤害;若你没赢,你失去1点体力。②你的拼点牌点数+X(X为你已损失的体力值)。', xia_zhangwei:'张葳', twhuzhong:'护众', - twhuzhong_info:'当你于出牌阶段使用无属性【杀】指定唯一目标角色时,你可以选择一项:①为此牌额外选择一个目标;②弃置其一张手牌,此牌结算完毕后,若此牌造成过伤害,则你摸一张牌且本阶段可以额外使用一张【杀】。', + twhuzhong_info:'当你于出牌阶段使用无属性【杀】指定唯一目标角色时,你可以摸一张牌并选择一项:①为此牌额外选择一个目标;②弃置其一张手牌,此牌结算完毕后,若此牌造成过伤害,则你摸一张牌且本阶段可以额外使用一张【杀】。', twfenwang:'焚亡', - twfenwang_info:'锁定技。①当你受到属性伤害时,你须弃置一张牌或令此伤害+1。②当你对其他角色造成非属性伤害时,若你的手牌数大于其,则此伤害+1。', + twfenwang_info:'锁定技。①当你受到属性伤害时,你须弃置一张牌或令此伤害+1。②当你对其他角色造成非属性伤害时,若你的手牌数大于等于其,则此伤害+1。', xia_xiahousone:'夏侯子萼', twchengxi:'承袭', twchengxi_info:'出牌阶段每名角色限一次,你可以摸一张牌并与一名其他角色拼点。若你赢,你使用的下一张基本牌或非延时锦囊牌结算完毕后,你视为对原目标使用一张无次数限制的同名牌;若你没赢,其视为对你使用一张无距离限制的【杀】。', diff --git a/character/xianding.js b/character/xianding.js index 72627c7f4..94b2c7d96 100644 --- a/character/xianding.js +++ b/character/xianding.js @@ -3208,9 +3208,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!_status.characterlist){ lib.skill.pingjian.initList(); } - _status.characterlist.remove(character); - _status.characterlist.add('ganfurenmifuren'); - player.reinit('ganfurenmifuren',character,false); + player.reinitCharacter('ganfurenmifuren',character); 'step 2' player.recover(1-player.hp); player.addTempSkill('dcxunbie_muteki',{player:'phaseAfter'}); @@ -6029,9 +6027,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ player.awakenSkill('dcmoucheng'); - player.removeSkill('dclianji'); - game.log(player,'失去了技能','#g【连计】'); - player.addSkillLog('xinjingong'); + player.changeSkills(['xinjingong'],['dclianji']); }, }, //周宣 @@ -6462,8 +6458,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ var target=result.targets[0]; player.logSkill('dclianzhi_reproach',target); - player.addSkillLog('dcshouze'); - target.addSkillLog('dcshouze'); + player.addSkills('dcshouze'); + target.addSkills('dcshouze'); target.addMark('dclingfang',Math.max(1,player.countMark('dclingfang'))); } }, @@ -7494,7 +7490,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ var targets=lib.skill.dcyaoyi.logTarget().sortBySeat(); - for(var target of targets) target.addSkill('dcshoutan'); + for(var target of targets) target.addSkills('dcshoutan'); game.delayx(); }, global:'dcyaoyi_blocker', @@ -8122,7 +8118,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.gainMaxHp(); player.recover(); 'step 1' - player.removeSkill('dcyishu'); + player.removeSkills('dcyishu'); 'step 2' var list; if(_status.characterlist){ @@ -8247,8 +8243,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 3' var map=event.result||result; if(map.skills&&map.skills.length){ - player.removeSkill('dchuishu'); - for(var i of map.skills) player.addSkillLog(i); + //player.removeSkill('dchuishu'); + //for(var i of map.skills) player.addSkillLog(i); + player.changeSkills(map.skills, ['dchuishu']); player.markAuto('zhuSkill_dcligong',map.skills); } else{ @@ -9377,8 +9374,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ targets.sortBySeat(); player.logSkill('dcpijing',targets); game.countPlayer(function(current){ - if(!targets.includes(current)) current.removeSkill('dczimu'); - else current.addSkill('dczimu'); + if(!targets.includes(current)) current.removeSkills('dczimu'); + else current.addSkills('dczimu'); }); game.delayx(); } @@ -9408,7 +9405,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } } 'step 1' - player.removeSkill('dczimu'); + player.removeSkills('dczimu'); if(event.delay) game.delayx(); }, marktext:'牧', @@ -9580,9 +9577,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return info&&!info.charlotte; }); if(skills.length){ - for(var i of skills) player.addSkillLog(i); + //for(var i of skills) player.addSkillLog(i); + player.addSkills(skills); } - player.removeSkill('xiaowu'); + player.removeSkills('xiaowu'); var num=player.countMark('shawu'); if(num>0){ player.removeMark('shawu',num); @@ -9611,7 +9609,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var target=result.targets[0]; player.awakenSkill('huaping'); player.logSkill('huaping_give',target); - target.addSkill('shawu'); + target.addSkills('shawu'); var num=player.countMark('shawu'); if(num>0){ player.removeMark('shawu',num); @@ -10426,37 +10424,25 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(player!=event.dying) return false; return true; }, - content:function(){ + async content(event,trigger,player){ 'step 0' player.awakenSkill('syxiongyi'); if(!_status.characterlist){ lib.skill.pingjian.initList(); } - event.hp=1-player.hp; if(_status.characterlist.includes('xushi')){ - if(player.name1=='re_sunyi'||player.name2=='re_sunyi') event._result={control:'re_sunyi'}; - else if(player.name2!=undefined){ - player.chooseControl(player.name1,player.name2).set('prompt','请选择要更换的武将牌'); + if (player.name2&&get.character(player.name2)[3].includes('syxiongyi')) { + await player.reinitCharacter(player.name2, 'xushi'); } - else event._result={control:player.name1}; - hp+=2; - _status.characterlist.remove('xushi'); - _status.characterlist.add('re_sunyi'); - player.reinit('re_sunyi','xushi',false); + else { + await player.reinitCharacter(player.name1, 'xushi'); + } + if(player.hp<3) await player.recover(3-player.hp); } else{ - player.addSkillLog('olhunzi'); - event.goto(2); + await player.addSkills('olhunzi'); + if(player.hp<1) await player.recover(1-player.hp); } - 'step 1' - event.hp+=2; - var name=result.control; - _status.characterlist.remove('xushi'); - _status.characterlist.add(name); - player.reinit(name,'xushi',false); - 'step 2' - var hp=event.hp; - if(hp>0) player.recover(hp); }, ai:{ order:1, @@ -10689,8 +10675,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('mengqing'); player.gainMaxHp(3); player.recover(3); - player.removeSkill('zhukou'); - player.addSkill('yuyun'); + //player.removeSkill('zhukou'); + //player.addSkill('yuyun'); + player.changeSkills(['yuyun'],['zhukou']); }, derivation:'yuyun', }, @@ -12065,7 +12052,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var target=result.targets[0]; player.logSkill('dushi',target); target.markSkill('dushi'); - target.addSkillLog('dushi'); + target.addSkills('dushi'); } }, intro:{content:'您已经获得弘农王的诅咒'}, @@ -12403,7 +12390,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('choujue'); player.storage.choujue=true; player.loseMaxHp(); - player.addSkill('beishui'); + player.addSkills('beishui'); }, }, beishui:{ @@ -12425,7 +12412,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.awakenSkill('beishui'); player.storage.beishui=true; player.loseMaxHp(); - player.addSkill('qingjiao'); + player.addSkills('qingjiao'); }, }, qingjiao:{ @@ -12699,9 +12686,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ var target=result.targets[0]; player.line(target,'fire'); - player.addSkill('hmxili'); - target.addSkill('hmxili'); - player.removeSkill('mansi'); + player.addSkills(['hmxili'],['mansi']); + target.addSkills('hmxili'); } }, }, diff --git a/character/xinghuoliaoyuan.js b/character/xinghuoliaoyuan.js index eea499d80..684e8addc 100755 --- a/character/xinghuoliaoyuan.js +++ b/character/xinghuoliaoyuan.js @@ -217,13 +217,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ derivation:"xinfu_zhanji", trigger:{global:"dieAfter"}, logTarget:'player', - content:function (){ + async content(e,t,player){ player.awakenSkill('xinfu_songsang'); if(player.isDamaged()){ player.recover(); } else player.gainMaxHp(); - player.addSkill('xinfu_zhanji'); + player.addSkills('xinfu_zhanji'); }, }, "xinfu_jixu":{ diff --git a/character/yijiang.js b/character/yijiang.js index 96042b2ce..ae80bebf0 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -3026,7 +3026,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var target=result.targets[0]; event.target=target; player.line(target,'thunder'); - target.addSkill('new_canyun'); + target.addSkills('new_canyun'); target.discardPlayerCard('是否弃置自己区域内的一张梅花牌,获得技能〖绝响〗?',target,'hej').set('ai',function(card){ if(get.position(card)=='j') return 100+get.value(card); return 100-get.value(card); @@ -3036,7 +3036,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } else event.finish(); "step 3" - if(result.bool) target.addSkill('new_juexiang'); + if(result.bool) target.addSkills('new_juexiang'); }, }, "new_canyun":{ @@ -3590,7 +3590,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } 'step 3' if(result.bool&&result.autochoose&&result.cards.length==result.rawcards.length){ - player.removeSkill('jiexun'); + player.removeSkills('jiexun'); player.addSkill('funan_jiexun'); } } @@ -4013,7 +4013,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ var target=result.targets[0] player.logSkill('juexiang',target); - target.addSkill(lib.skill.juexiang.derivation.randomGet()); + target.addSkills(lib.skill.juexiang.derivation.randomGet()); target.addTempSkill('juexiang_club',{player:'phaseZhunbeiBegin'}); } }, @@ -8142,7 +8142,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ var es=target.getCards('e'); target.give(es,player,'give'); - player.removeSkill('yanzhu'); + player.removeSkills('yanzhu'); } else{ target.chooseToDiscard(true,'he'); @@ -10927,14 +10927,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ "step 0" + player.awakenSkill('zili'); player.chooseDrawRecover(2,true,function(event,player){ if(player.hp==1&&player.isDamaged()) return 'recover_hp'; return 'draw_card'; }); "step 1" player.loseMaxHp(); - player.addSkill('paiyi'); - player.awakenSkill('zili'); + player.addSkills('paiyi'); } }, paiyi:{ @@ -13718,11 +13718,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ player.awakenSkill('zbaijiang'); player.gainMaxHp(); - player.removeSkill('zquanji'); - player.removeSkill('zzhenggong'); - game.log(player,'失去了技能','#g【权计】、【争功】'); - player.addSkillLog('zyexin'); - player.addSkillLog('zzili'); + player.changeSkills(['zyexin','zzili'],['zquanji','zzhenggong']); } }, zyexin:{ @@ -13780,10 +13776,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return player.getExpansions('zyexin').length>=4; }, forced:true, - content:function(){ + async content(e,t,player){ player.awakenSkill('zzili'); player.loseMaxHp(); - player.addSkill('zpaiyi'); + player.addSkills('zpaiyi'); }, // intro:{ // content:'limited' diff --git a/character/yingbian.js b/character/yingbian.js index c34f80c35..5d1d58ed5 100644 --- a/character/yingbian.js +++ b/character/yingbian.js @@ -867,7 +867,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ player.awakenSkill('dezhang'); player.loseMaxHp(); - player.addSkill('weishu'); + player.addSkills('weishu'); }, }, weishu:{ @@ -3445,7 +3445,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ player.awakenSkill('zhaotao'); player.loseMaxHp(); - player.addSkillLog('pozhu'); + player.addSkills('pozhu'); }, derivation:'pozhu', }, diff --git a/mode/guozhan.js b/mode/guozhan.js index 7ca75e0b6..c64b62a4f 100644 --- a/mode/guozhan.js +++ b/mode/guozhan.js @@ -2169,7 +2169,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ event.finish(); } else{ - target.addSkillLog(result.control); + target.addSkills(result.control); target.line(player); player.recover(player.maxHp-player.hp); } @@ -3914,7 +3914,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ if(result.bool){ var target=result.targets[0]; player.logSkill('gzlianyou',target); - target.addSkillLog('gzxinghuo'); + target.addSkills('gzxinghuo'); game.delayx(); } }, @@ -10828,8 +10828,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ if(list.length){ player.gain(list,'gain2'); if(list.length>=3&&player.hasStockSkill('lianzi')){ - player.removeSkill('lianzi'); - player.addSkill('gzzhiheng'); + player.changeSkills(['gzzhiheng'],['lianzi']); } } }, @@ -11997,9 +11996,8 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ player.recover(2-player.hp); } 'step 2' - player.removeSkill('shouyue'); player.removeSkill('wuhujiangdaqi'); - player.addSkill('rerende'); + player.changeSkills(['rerende'],['shouyue']); }, ai:{ order:1, @@ -12420,7 +12418,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ player.removeCharacter(1); } 'step 1' - target.addSkill('gzyongjue'); + target.addSkills('gzyongjue'); if(target!=player){ target.draw(2); } @@ -12504,11 +12502,11 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ 'step 0' player.removeCharacter(1); 'step 1' - player.removeSkill('baoling'); + player.removeSkills('baoling'); player.gainMaxHp(3,true); 'step 2' player.recover(3); - player.addSkill('benghuai'); + player.addSkills('benghuai'); }, derivation:'benghuai' }, @@ -15523,7 +15521,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ if(event.hidden) game.log(player,'替换了副将','#g'+get.translation(player.name2)); else game.log(player,'将副将从','#g'+get.translation(player.name2),'变更为','#g'+get.translation(name)); player.viceChanged=true; - player.reinit(player.name2,name,false); + player.reinitCharacter(player.name2,name,false); }, changeVice:function(){ 'step 0' @@ -15579,7 +15577,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ if(event.hidden) game.log(player,'替换了副将','#g'+get.translation(player.name2)); else game.log(player,'将副将从','#g'+get.translation(player.name2),'变更为','#g'+get.translation(name)); player.viceChanged=true; - player.reinit(player.name2,name,false); + player.reinitCharacter(player.name2,name,false); }, /*----分界线----*/ mayChangeVice:function(){ diff --git a/mode/identity.js b/mode/identity.js index 6420f0c03..c1a68d4bf 100644 --- a/mode/identity.js +++ b/mode/identity.js @@ -2785,7 +2785,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ return info&&info.zhuSkill; }); if(skills.length){ - for(var i of skills) player.addSkillLog(i); + player.addSkills(skills); } game.zhu.node.identity.classList.remove('guessing'); if(lib.config.animation&&!lib.config.low_performance) game.zhu.$legend(); @@ -2800,7 +2800,6 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ },game.zhu); game.delay(2); game.zhu.playerfocus(1000); - _status.event.trigger('zhuUpdate'); } if(!_status.over){ @@ -3875,12 +3874,13 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ 'step 2' player.recover(); player.draw(); - player.getStockSkills(true,true).forEach(stockSkill=>{ + const skills = player.getStockSkills(true,true).forEach(stockSkill=>{ if(player.hasSkill(stockSkill)) return; var info=get.info(stockSkill); if(!info||!info.zhuSkill) return; - player.addSkillLog(stockSkill); + return true; }); + if(skills.length) player.addSkills(skills) } }, stratagem_revitalization:{ diff --git a/noname/game/index.js b/noname/game/index.js index 9e2405a4f..da1ea9656 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -1644,7 +1644,7 @@ export class Game extends Uninstantable { return; } } - const audio = lib.card[card.name].audio; + const audio = get.dynamicVariable(lib.card[card.name].audio,card,sex); if (typeof audio == 'string') { const audioInfo = audio.split(':'); if (audio.startsWith('db:')) game.playAudio(`${audioInfo[0]}:${audioInfo[1]}`, audioInfo[2], `${card.name}_${sex}.${audioInfo[3] || 'mp3'}`); diff --git a/noname/library/element/content.js b/noname/library/element/content.js index 1465f69f8..0e3b60436 100644 --- a/noname/library/element/content.js +++ b/noname/library/element/content.js @@ -11,6 +11,114 @@ export const Content = { emptyEvent: () => { event.trigger(event.name); }, + //变更武将牌 + async changeCharacter(event,trigger,player) { + const rawPairs = [player.name1]; + if (player.name2 && lib.character[player.name2]) rawPairs.push(player.name2); + event.rawPairs = rawPairs; + const newPairs = event.newPairs; + for(let name of newPairs){ + if(!lib.character[name]){ + console.warn(`警告:Player[${player.name}]试图将武将牌变更为不存在的武将:`,name); + return; + } + } + const removeSkills = [], addSkills = []; + //进行Log + if(event.log !== false) { + //变更前后数量相同的情况 + if (rawPairs.length == newPairs.length){ + for (let i = 0; i { + removeSkills.addArray(lib.character[name][3]); + }) + newPairs.forEach(name => { + addSkills.addArray(lib.character[name][3].filter(skill => { + const info = get.info(skill); + if (!info || (info.zhuSkill && !player.isZhu2())) return false; + return true; + })); + }) + //实际变更武将牌 + player.reinit2(newPairs); + //操作武将牌堆 + if (_status.characterlist) { + _status.characterlist.removeArray(newPairs); + _status.characterlist.addArray(rawPairs); + } + //变更一下获得前后的技能 + await player.changeSkills(addSkills, removeSkills); + //变更角色的所属势力。如果新将是双势力,重选一下势力。 + if(event.changeGroup !== false){ + let newGroups = []; + if (!player.isUnseen(1)) { + newGroups = (get.is.double(player.name1, true) || [get.character(player.name1, 1)]); + } + else if (player.name2 && !player.isUnseen(2)) { + newGroups = (get.is.double(player.name2, true) || [get.character(player.name2, 1)]); + } + if (newGroups.length > 1) { + const newGroup = await player.chooseControl(newGroups).set('prompt','请选择一个新的势力').forResult('control'); + if (newGroup != player.group) { + await player.changeGroup(newGroup); + } + } + else if(newGroups.length == 1 && newGroups[0] != player.group){ + await player.changeGroup(newGroups[0]); + } + } + }, + //变更技能 + async changeSkills (event,trigger,player) { + //去重检查 + event.addSkill.unique(); + event.removeSkill.unique(); + const duplicatedSkills = event.addSkill.filter(skill => event.removeSkill.includes(skill)); + if (duplicatedSkills.length) { + event.addSkill.removeArray(duplicatedSkills); + event.removeSkill.removeArray(duplicatedSkills); + } + if (!event.addSkill.length&&!event.removeSkill.length) return; + //手动触发时机 + await event.trigger('changeSkillsBefore'); + await event.trigger('changeSkillsBegin'); + //处理失去和获得的技能 + if (event.$handle) { + event.$handle(player, event.addSkill, event.removeSkill, event); + } + else { + if(event.addSkill.length){ + player.addSkill(event.addSkill); + game.log(player, '获得了技能', ...event.addSkill.map(i => { + return '#g【' + get.translation(i) + '】'; + })); + } + if(event.removeSkill.length){ + player.removeSkill(event.removeSkill); + game.log(player, '失去了技能', ...event.removeSkill.map(i => { + return '#g【' + get.translation(i) + '】'; + })); + } + } + //手动触发时机 + await event.trigger('changeSkillsEnd'); + await event.trigger('changeSkillsAfter'); + }, //增加明置手牌 addShownCards: () => { const hs = player.getCards('h'), showingCards = event._cards.filter(showingCard => hs.includes(showingCard)), shown = player.getShownCards(); diff --git a/noname/library/element/gameEvent.js b/noname/library/element/gameEvent.js index b46b7d9ea..2eddf8f6e 100644 --- a/noname/library/element/gameEvent.js +++ b/noname/library/element/gameEvent.js @@ -731,8 +731,8 @@ export class GameEvent { } } trigger(name) { - if (_status.video) return this; - if ((this.name === 'gain' || this.name === 'lose') && !_status.gameDrawed) return this; + if (_status.video) return; + if ((this.name === 'gain' || this.name === 'lose') && !_status.gameDrawed) return; if (name === 'gameDrawEnd') _status.gameDrawed = true; if (name === 'gameStart') { lib.announce.publish('gameStart', {}); @@ -741,11 +741,11 @@ export class GameEvent { _status.gameStarted = true; game.showHistory(); } - if (!lib.hookmap[name] && !lib.config.compatiblemode) return this; - if (!game.players || !game.players.length) return this; + if (!lib.hookmap[name] && !lib.config.compatiblemode) return; + if (!game.players || !game.players.length) return; const event = this; let start = [_status.currentPhase, event.source, event.player, game.me, game.players[0]].find(i => get.itemtype(i) == 'player'); - if (!start) return this; + if (!start) return; if (!game.players.includes(start) && !game.dead.includes(start)) start = game.findNext(start); const firstDo = { player: "firstDo", @@ -836,8 +836,9 @@ export class GameEvent { next.triggername = name; next.playerMap = playerMap; event._triggering = next; + return next; } - return this; + return null; } untrigger(all = true, player) { const evt = this._triggering; diff --git a/noname/library/element/player.js b/noname/library/element/player.js index 1ce7fb6b7..258f974c0 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -1555,6 +1555,44 @@ export class Player extends HTMLDivElement { if (typeof savable == 'function') savable = savable(card, this, target); return savable; } + /** + * @param { String } from + * @param { String } to + * @returns { GameEventPromise } + */ + reinitCharacter(from, to, log = true){ + const rawPairs = [this.name1]; + if (this.name2) rawPairs.push(this.name2); + for (let i=0; i { + player.reinit2(newPairs); + }, this, newPairs); + const rawPairs = [this.name1]; + if (this.name2 && lib.character[this.name2]) rawPairs.push(this.name2); + //单将变单将 & 双将变双将 + if (rawPairs.length == newPairs.length){ + for (let i = 0; i { + import('../../../../../game/codemirror.js').then(() => { lib.codeMirrorReady(node, editor); }); lib.init.css(lib.assetURL + 'layout/default', 'codemirror'); @@ -1989,7 +1989,7 @@ export const extensionMenu = function (connectMenu) { } else { if (!window.CodeMirror) { - import('../../game/codemirror.js').then(() => { + import('../../../../../game/codemirror.js').then(() => { lib.codeMirrorReady(node, editor); }); lib.init.css(lib.assetURL + 'layout/default', 'codemirror'); @@ -2369,7 +2369,7 @@ export const extensionMenu = function (connectMenu) { } else { if (!window.CodeMirror) { - import('../../game/codemirror.js').then(() => { + import('../../../../../game/codemirror.js').then(() => { lib.codeMirrorReady(node, this.editor); }); lib.init.css(lib.assetURL + 'layout/default', 'codemirror'); diff --git a/noname/ui/create/menu/pages/optionsMenu.js b/noname/ui/create/menu/pages/optionsMenu.js index 1b9114d03..01a087f92 100644 --- a/noname/ui/create/menu/pages/optionsMenu.js +++ b/noname/ui/create/menu/pages/optionsMenu.js @@ -16,7 +16,7 @@ import { createMenu, createConfig } from "../index.js"; -import { ui, game, get, lib, _status } from "../../../../../noname.js"; +import { ui, game, get, ai, lib, _status } from "../../../../../noname.js"; import { nonameInitialized } from "../../../../util/index.js"; export const optionsMenu = function (connectMenu) { diff --git a/noname/ui/create/menu/pages/startMenu.js b/noname/ui/create/menu/pages/startMenu.js index 1a826f99e..189aac62c 100644 --- a/noname/ui/create/menu/pages/startMenu.js +++ b/noname/ui/create/menu/pages/startMenu.js @@ -16,7 +16,7 @@ import { createMenu, createConfig } from "../index.js"; -import { ui, game, get, lib, _status } from "../../../../../noname.js"; +import { ui, game, get, ai, lib, _status } from "../../../../../noname.js"; export const startMenu = function (connectMenu) { /**