diff --git a/character/sp.js b/character/sp.js index 18c653707..0580e165d 100755 --- a/character/sp.js +++ b/character/sp.js @@ -700,7 +700,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ game.cardsGotoOrdering(card); 'step 1' if(player.countCards('he')>0){ - player.chooseCard('he','天候:是否用一张牌交换牌堆顶的'+get.translation(card)+'?').set('promptx',[[card]]) + player.chooseCard('he','天候:是否用一张牌交换牌堆顶的'+get.translation(card)+'?').set('promptx',[[card]]).set('ai',()=>-1) } else{ event._result={bool:false}; @@ -721,7 +721,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!lib.skill.oltianhou.derivation.contains(skill)) event.finish(); else{ event.weather_skill=skill; - player.chooseTarget(true,'令一名角色获得技能【'+get.translation(skill)+'】'); + player.chooseTarget(true,'令一名角色获得技能【'+get.translation(skill)+'】').set('ai',function(target){ + return get.attitude(_status.event.player,target); + }); } 'step 4' if(result.bool){ @@ -729,9 +731,23 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.line(target,'green'); target.addAdditionalSkill('oltianhou_'+player.playerid,event.weather_skill); player.addTempSkill('oltianhou_expire',{player:'phaseZhunbeiBegin'}); - game.log(target,'获得了天气技能','#g【'+get.translation(event.weather_skill)+'】') + game.log(target,'获得了天气技能','#g【'+get.translation(event.weather_skill)+'】'); + game.broadcastAll(function(bg){ + _status.tempBackground=bg; + game.updateBackground(); + },event.weather_skill+'_bg'); + game.addVideo('skill',player,['oltianhou',[true,event.weather_skill+'_bg']]) } }, + video:function(player,info){ + if(info[0]){ + _status.tempBackground=info[1]; + } + else{ + delete _status.tempBackground; + } + game.updateBackground(); + }, derivation:['oltianhou_spade','oltianhou_heart','oltianhou_club','oltianhou_diamond'], subSkill:{ expire:{ @@ -741,6 +757,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ for(var current of players){ current.removeAdditionalSkill(key); } + game.broadcastAll(function(){ + delete _status.tempBackground; + game.updateBackground(); + }); + game.addVideo('skill',player,['oltianhou',[false]]) }, }, spade:{ @@ -752,7 +773,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{global:'damageEnd'}, forced:true, filter:function(event){ - return lib.skill.oltianhou.logTarget(event).length>0; + return event.nature=='thunder'&&lib.skill.oltianhou_spade.logTarget(event).length>0; }, logTarget:function(event){ var list=[]; @@ -762,11 +783,28 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return list.sortBySeat(); }, content:function(){ - var targets=lib.skill.oltianhou.logTarget(trigger); + var targets=lib.skill.oltianhou_spade.logTarget(trigger); for(var i of targets) i.loseHp(); game.delayex(); }, group:'oltianhou_miehuo', + global:'oltianhou_spade_ai', + }, + spade_ai:{ + effect:{ + player:function(card,player,target,current){ + if(get.tag(card,'fireDamage')&&!player.hasSkill('oltianhou_spade')){ + return 'zerotarget'; + } + else if(get.tag(card,'thunderDamage')){ + var list=lib.skill.oltianhou_spade.logTarget({player:target}); + var eff=list.reduce(function(eff,current){ + eff+=get.effect(current,{name:'losehp'},player,player) + },0); + return [1,eff]; + } + }, + }, }, miehuo:{ trigger:{global:'damageBegin2'}, @@ -788,7 +826,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{global:'phaseJieshuBegin'}, forced:true, filter:function(event,player){ - return event.player.isIn()&&event.player.isMaxHp(); + return player!=event.player&&event.player.isIn()&&event.player.isMaxHp(); }, logTarget:'player', content:function(){ @@ -804,7 +842,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{global:'phaseJieshuBegin'}, forced:true, filter:function(event,player){ - return event.player.isIn()&&event.player.isMinHp(); + return player!=event.player&&event.player.isIn()&&event.player.isMinHp(); }, logTarget:'player', content:function(){ @@ -841,6 +879,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger.untrigger(); } }, + global:'oltianhou_diamond_ai', + }, + diamond_ai:{ + effect:{ + target:function(card,player,target,current){ + if(card.name=='sha'&&!player.hasSkill('oltianhou_diamond')){ + if(target!=player.getNext()&&target!=player.getPrevious()) return 0.7; + } + }, + }, }, } }, @@ -859,7 +907,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ 'step 0' - player.chooseCard('h',get.prompt('olchenshuo'),'展示一张手牌,然后展示并获得牌堆顶的牌'); + player.chooseCard('h',get.prompt('olchenshuo'),'展示一张手牌,然后展示并获得牌堆顶的牌').set('ai',function(card){ + if(get.type(card)=='basic') return 1+Math.random(); + return Math.random(); + }) 'step 1' if(result.bool){ player.logSkill('olchenshuo'); diff --git a/game/game.js b/game/game.js index 937c57028..45f26ca09 100644 --- a/game/game.js +++ b/game/game.js @@ -1295,46 +1295,9 @@ } } } - var animate=lib.config.image_background=='default'; game.saveConfig('image_background',background); lib.init.background(); - ui.background.delete(); - ui.background=ui.create.div('.background'); - - if(lib.config.image_background_blur){ - ui.background.style.filter='blur(8px)'; - ui.background.style.webkitFilter='blur(8px)'; - ui.background.style.transform='scale(1.05)'; - } - else{ - ui.background.style.filter=''; - ui.background.style.webkitFilter=''; - ui.background.style.transform=''; - } - - document.body.insertBefore(ui.background,document.body.firstChild); - if(animate) ui.background.animate('start'); - if(lib.config.image_background=='default'){ - ui.background.style.backgroundImage="none"; - } - else if(lib.config.image_background.indexOf('custom_')==0){ - ui.background.style.backgroundImage="none"; - game.getDB('image',lib.config.image_background,function(fileToLoad){ - if(!fileToLoad) return; - var fileReader = new FileReader(); - fileReader.onload = function(fileLoadedEvent) - { - var data = fileLoadedEvent.target.result; - ui.background.style.backgroundImage='url('+data+')'; - }; - fileReader.readAsDataURL(fileToLoad, "UTF-8"); - }); - } - else{ - ui.background.setBackgroundImage('image/background/'+lib.config.image_background+'.jpg'); - } - ui.background.style.backgroundSize='cover'; - ui.background.style.backgroundPosition='50% 50%'; + game.updateBackground(); }, }, image_background_random:{ @@ -31207,6 +31170,46 @@ ], }; var game={ + updateBackground:function(){ + var background=(_status.tempBackground||lib.config.image_background); + ui.background.delete(); + ui.background=ui.create.div('.background'); + + if(lib.config.image_background_blur){ + ui.background.style.filter='blur(8px)'; + ui.background.style.webkitFilter='blur(8px)'; + ui.background.style.transform='scale(1.05)'; + } + else{ + ui.background.style.filter=''; + ui.background.style.webkitFilter=''; + ui.background.style.transform=''; + } + + document.body.insertBefore(ui.background,document.body.firstChild); + if(background=='default'){ + ui.background.animate('start'); + ui.background.style.backgroundImage="none"; + } + else if(background.indexOf('custom_')==0){ + ui.background.style.backgroundImage="none"; + game.getDB('image',background,function(fileToLoad){ + if(!fileToLoad) return; + var fileReader = new FileReader(); + fileReader.onload = function(fileLoadedEvent) + { + var data = fileLoadedEvent.target.result; + ui.background.style.backgroundImage='url('+data+')'; + }; + fileReader.readAsDataURL(fileToLoad, "UTF-8"); + }); + } + else{ + ui.background.setBackgroundImage('image/background/'+background+'.jpg'); + } + ui.background.style.backgroundSize='cover'; + ui.background.style.backgroundPosition='50% 50%'; + }, generateBeatmapTimeleap:(bpm,beats,offset)=>beats.map(value=>Math.round(value*60000/bpm+(offset||0))), updateRenku:function(){ game.broadcast(function(renku){ diff --git a/image/background/oltianhou_club_bg.jpg b/image/background/oltianhou_club_bg.jpg new file mode 100644 index 000000000..dfa0215f2 Binary files /dev/null and b/image/background/oltianhou_club_bg.jpg differ diff --git a/image/background/oltianhou_diamond_bg.jpg b/image/background/oltianhou_diamond_bg.jpg new file mode 100644 index 000000000..70cd19843 Binary files /dev/null and b/image/background/oltianhou_diamond_bg.jpg differ diff --git a/image/background/oltianhou_heart_bg.jpg b/image/background/oltianhou_heart_bg.jpg new file mode 100644 index 000000000..cbe260c4f Binary files /dev/null and b/image/background/oltianhou_heart_bg.jpg differ diff --git a/image/background/oltianhou_spade_bg.jpg b/image/background/oltianhou_spade_bg.jpg new file mode 100644 index 000000000..a838c6645 Binary files /dev/null and b/image/background/oltianhou_spade_bg.jpg differ