background change

This commit is contained in:
Spmario233 2023-08-19 12:40:45 +08:00
parent e7a48b3ddf
commit 25910fb1d9
6 changed files with 100 additions and 46 deletions

View File

@ -700,7 +700,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
game.cardsGotoOrdering(card); game.cardsGotoOrdering(card);
'step 1' 'step 1'
if(player.countCards('he')>0){ 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{ else{
event._result={bool:false}; 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(); if(!lib.skill.oltianhou.derivation.contains(skill)) event.finish();
else{ else{
event.weather_skill=skill; 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' 'step 4'
if(result.bool){ if(result.bool){
@ -729,9 +731,23 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.line(target,'green'); player.line(target,'green');
target.addAdditionalSkill('oltianhou_'+player.playerid,event.weather_skill); target.addAdditionalSkill('oltianhou_'+player.playerid,event.weather_skill);
player.addTempSkill('oltianhou_expire',{player:'phaseZhunbeiBegin'}); 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'], derivation:['oltianhou_spade','oltianhou_heart','oltianhou_club','oltianhou_diamond'],
subSkill:{ subSkill:{
expire:{ expire:{
@ -741,6 +757,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
for(var current of players){ for(var current of players){
current.removeAdditionalSkill(key); current.removeAdditionalSkill(key);
} }
game.broadcastAll(function(){
delete _status.tempBackground;
game.updateBackground();
});
game.addVideo('skill',player,['oltianhou',[false]])
}, },
}, },
spade:{ spade:{
@ -752,7 +773,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{global:'damageEnd'}, trigger:{global:'damageEnd'},
forced:true, forced:true,
filter:function(event){ 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){ logTarget:function(event){
var list=[]; var list=[];
@ -762,11 +783,28 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return list.sortBySeat(); return list.sortBySeat();
}, },
content:function(){ content:function(){
var targets=lib.skill.oltianhou.logTarget(trigger); var targets=lib.skill.oltianhou_spade.logTarget(trigger);
for(var i of targets) i.loseHp(); for(var i of targets) i.loseHp();
game.delayex(); game.delayex();
}, },
group:'oltianhou_miehuo', 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:{ miehuo:{
trigger:{global:'damageBegin2'}, trigger:{global:'damageBegin2'},
@ -788,7 +826,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{global:'phaseJieshuBegin'}, trigger:{global:'phaseJieshuBegin'},
forced:true, forced:true,
filter:function(event,player){ filter:function(event,player){
return event.player.isIn()&&event.player.isMaxHp(); return player!=event.player&&event.player.isIn()&&event.player.isMaxHp();
}, },
logTarget:'player', logTarget:'player',
content:function(){ content:function(){
@ -804,7 +842,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{global:'phaseJieshuBegin'}, trigger:{global:'phaseJieshuBegin'},
forced:true, forced:true,
filter:function(event,player){ filter:function(event,player){
return event.player.isIn()&&event.player.isMinHp(); return player!=event.player&&event.player.isIn()&&event.player.isMinHp();
}, },
logTarget:'player', logTarget:'player',
content:function(){ content:function(){
@ -841,6 +879,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger.untrigger(); 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(){ content:function(){
'step 0' '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' 'step 1'
if(result.bool){ if(result.bool){
player.logSkill('olchenshuo'); player.logSkill('olchenshuo');

View File

@ -1295,46 +1295,9 @@
} }
} }
} }
var animate=lib.config.image_background=='default';
game.saveConfig('image_background',background); game.saveConfig('image_background',background);
lib.init.background(); lib.init.background();
ui.background.delete(); game.updateBackground();
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%';
}, },
}, },
image_background_random:{ image_background_random:{
@ -31207,6 +31170,46 @@
], ],
}; };
var game={ 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))), generateBeatmapTimeleap:(bpm,beats,offset)=>beats.map(value=>Math.round(value*60000/bpm+(offset||0))),
updateRenku:function(){ updateRenku:function(){
game.broadcast(function(renku){ game.broadcast(function(renku){

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 MiB