diff --git a/character/refresh.js b/character/refresh.js index 2522c00c1..d2a52ec5a 100755 --- a/character/refresh.js +++ b/character/refresh.js @@ -10374,11 +10374,26 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, olzhiba3:{}, rehuashen:{ - audio:2, unique:true, + audio:2, + trigger:{ + global:'phaseBefore', + player:['enterGame','phaseBegin','phaseEnd','rehuashen'], + }, + filter:function(event,player,name){ + if(event.name!='phase') return true; + if(name=='phaseBefore') return game.phaseNumber==0; + return player.storage.rehuashen&&player.storage.rehuashen.character.length>0; + }, direct:true, content:function(){ "step 0" + var name=event.triggername; + if(trigger.name!='phase'||(name=='phaseBefore'&&game.phaseNumber==0)){ + player.logSkill('rehuashen'); + lib.skill.rehuashen.addHuashens(player,3); + event.logged=true; + } _status.noclearcountdown=true; event.videoId=lib.status.videoId++; var cards=player.storage.rehuashen.character.slice(0); @@ -10400,16 +10415,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(event.aiChoice==player.storage.rehuashen.current2||get.skillRank(event.aiChoice,cond)<1) choice='弃置化身'; if(player.isOnline2()){ player.send(function(cards,id){ - var dialog=ui.create.dialog('是否发动【化身】?',[cards,'character']); + var dialog=ui.create.dialog('是否发动【化身】?',[cards,(item,type,position,noclick,node)=>lib.skill.rehuashen.$createButton(item,type,position,noclick,node)]); dialog.videoId=id; },cards,event.videoId); } - event.dialog=ui.create.dialog(get.prompt('rehuashen'),[cards,'character']); + event.dialog=ui.create.dialog(get.prompt('rehuashen'),[cards,(item,type,position,noclick,node)=>lib.skill.rehuashen.$createButton(item,type,position,noclick,node)]); event.dialog.videoId=event.videoId; if(!event.isMine()){ event.dialog.style.display='none'; } - if(event.triggername=='rehuashen') event._result={control:'更换技能'}; + if(event.logged) event._result={control:'更换技能'}; else player.chooseControl('弃置化身','更换技能','cancel2').set('ai',function(){ return _status.event.choice; }).set('choice',choice); @@ -10541,13 +10556,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ map:{}, } }, - group:'rehuashen_init', - trigger:{ - player:['phaseBegin','phaseEnd','rehuashen'], - }, - filter:function(event,player,name){ - return player.storage.rehuashen&&player.storage.rehuashen.character.length>0; - }, banned:['lisu','sp_xiahoudun','xushao','zhoutai','old_zhoutai','shixie'], bannedType:['Charlotte','主公技','觉醒技','限定技','隐匿技','使命技'], addHuashen:function(player){ @@ -10578,7 +10586,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(name) list.push(name); } if(list.length){ - game.log(player,'获得了',get.cnNumber(list.length)+'张','#g化身') + player.syncStorage('rehuashen'); + player.updateMarks('rehuashen'); + game.log(player,'获得了',get.cnNumber(list.length)+'张','#g化身'); lib.skill.rehuashen.drawCharacter(player,list); } }, @@ -10604,6 +10614,55 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } },player,list); }, + $createButton:function(item,type,position,noclick,node){ + node=ui.create.buttonPresets.character(item,'character',position,noclick); + const info=lib.character[item]; + const skills=info[3].filter(function(skill){ + const categories=get.skillCategoriesOf(skill); + return !categories.some(type=>lib.skill.rehuashen.bannedType.includes(type)); + }); + if(skills.length){ + const skillstr=skills.map(i=>`[${get.translation(i)}]`).join('
'); + const skillnode=ui.create.caption( + `
${skillstr}
`,node); + skillnode.style.left='2px'; + skillnode.style.bottom='2px'; + } + node._customintro=function(uiintro,evt){ + const character=node.link,characterInfo=get.character(node.link); + let capt=get.translation(character); + if(characterInfo){ + capt+=`  ${get.translation(characterInfo[0])}`; + let charactergroup; + const charactergroups=get.is.double(character,true); + if(charactergroups) charactergroup=charactergroups.map(i=>get.translation(i)).join('/'); + else charactergroup=get.translation(characterInfo[1]); + capt+=`  ${charactergroup}`; + } + uiintro.add(capt); + + if(lib.characterTitle[node.link]){ + uiintro.addText(get.colorspan(lib.characterTitle[node.link])); + } + for(let i=0;i
'+get.translation(skills[i])+'
'+get.skillInfoTranslation(skills[i])+'
'); + } + else{ + uiintro.add('
【'+translation+'】
'+get.skillInfoTranslation(skills[i])+'
'); + } + if(lib.translate[skills[i]+'_append']){ + uiintro._place_text=uiintro.add('
'+lib.translate[skills[i]+'_append']+'
') + } + } + } + } + return node; + }, mark:true, intro:{ onunmark:function(storage,player){ @@ -10611,11 +10670,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ storage.character=[]; }, mark:function(dialog,storage,player){ - if(storage&&storage.current) dialog.addSmall([[storage.current],'character']); + if(storage&&storage.current) dialog.addSmall([[storage.current],(item,type,position,noclick,node)=>lib.skill.rehuashen.$createButton(item,type,position,noclick,node)]); if(storage&&storage.current2) dialog.add('
【'+get.translation(lib.translate[storage.current2+'_ab']||get.translation(storage.current2).slice(0,2))+'】
'+get.skillInfoTranslation(storage.current2,player)+'
'); if(storage&&storage.character.length){ if(player.isUnderControl(true)){ - dialog.addSmall([storage.character,'character']); + dialog.addSmall([storage.character,(item,type,position,noclick,node)=>lib.skill.rehuashen.$createButton(item,type,position,noclick,node)]); } else{ dialog.addText('共有'+get.cnNumber(storage.character.length)+'张“化身”'); @@ -10634,36 +10693,26 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, }, - rehuashen_init:{ - trigger:{ - global:'phaseBefore', - player:'enterGame', - }, - forced:true, - popup:false, - filter:function(event,player){ - return (event.name!='phase'||game.phaseNumber==0); - }, - content:function(){ - lib.skill.rehuashen.addHuashens(player,3); - player.syncStorage('rehuashen'); - player.markSkill('rehuashen'); - var next=game.createEvent('rehuashen'); - next.player=player; - next._trigger=trigger; - next.triggername='rehuashen'; - next.setContent(lib.skill.rehuashen.content); - }, - }, rexinsheng:{ unique:true, audio:2, trigger:{player:'damageEnd'}, frequent:true, content:function(){ - lib.skill.rehuashen.addHuashens(player,trigger.num); - player.syncStorage('rehuashen'); - player.updateMarks('rehuashen'); + 'step 0' + event.num=trigger.num; + 'step 1' + lib.skill.rehuashen.addHuashens(player,1); + 'step 2' + if(--event.num>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){ + player.chooseBool(get.prompt2('rexinsheng')).set('frequentSkill',event.name); + } + else event.finish(); + 'step 3' + if(result.bool&&player.hasSkill('rexinsheng')){ + player.logSkill('rexinsheng'); + event.goto(1); + } }, }, reguhuo:{ diff --git a/character/shenhua.js b/character/shenhua.js index 33d156ba3..e6316e16f 100755 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -4163,12 +4163,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:'huashen2', unique:true, init:function(player){ - player.storage.huashen={ - shown:[], - owned:{} + if(!player.storage.huashen){ + player.storage.huashen={ + shown:[], + owned:{} + }; } }, - group:['huashen1','huashen2'], intro:{ content:function(storage,player){ var str=''; @@ -4196,7 +4197,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ list.push(i); } if(list.length){ - dialog.addSmall([list,'character']); + dialog.addSmall([list,(item,type,position,noclick,node)=>lib.skill.rehuashen.$createButton(item,type,position,noclick,node)]); } for(var i=0;ilib.skill.rehuashen.$createButton(item,type,position,noclick,node)]); event.dialog=dialog; event.forceMine=true; event.button=null; @@ -4425,10 +4408,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ game.countChoose(); }; if(event.isMine()){ - chooseButton(player,cards,event.triggername=='huashen'); + chooseButton(player,cards,event.logged); } else if(event.isOnline()){ - event.player.send(chooseButton,event.player,cards,event.triggername=='huashen'); + event.player.send(chooseButton,event.player,cards,event.logged); event.player.wait(); game.pause(); } @@ -4480,6 +4463,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } } }, + huashen2:{audio:2}, xinsheng:{ audio:2, unique:true, @@ -4490,8 +4474,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ event.num=trigger.num; 'step 1' lib.skill.huashen.addHuashens(player,1); - player.syncStorage('huashen'); - player.updateMarks('huashen'); 'step 2' if(--event.num>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){ player.chooseBool(get.prompt2('xinsheng')).set('frequentSkill',event.name); @@ -7901,8 +7883,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ duanchang:'断肠', // fushen:'附身', huashen:'化身', - huashen1:'化身', - huashen2:'化身', xinsheng:'新生', qimou:'奇谋', xinqiangxi:'强袭',