Merge pull request #1061 from mengxinzxz/PR-Branch

优化changeSkin换肤的流畅感,添加changeSkin的录像回放功能
This commit is contained in:
Spmario233 2024-03-11 15:45:09 +08:00 committed by GitHub
commit 9010db4a60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 55 additions and 26 deletions

View File

@ -200,6 +200,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return 1; return 1;
}, },
async content(player,num=1){ async content(player,num=1){
if(!player.hasCard(lib.filter.cardRecastable,'he')) return;
const {result:{bool,cards}}=await player.chooseCard('重铸'+num+'张牌','he',num,lib.filter.cardRecastable,true).set('ai',lib.skill.zhiheng.check); const {result:{bool,cards}}=await player.chooseCard('重铸'+num+'张牌','he',num,lib.filter.cardRecastable,true).set('ai',lib.skill.zhiheng.check);
if(bool) await player.recast(cards); if(bool) await player.recast(cards);
}, },
@ -304,9 +305,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!player.getStorage('dcjianzhuan').includes(i)) choices.push(i); if(!player.getStorage('dcjianzhuan').includes(i)) choices.push(i);
} }
if(choices.length){ if(choices.length){
const choice=choices.randomGet(); for(const choice of choices){
for(let i=1;i<=3;i++){ for(let i=1;i<=3;i++){
await info[choice].content(player,1); await info[choice].content(player,1);
}
} }
} }
await player.gainMaxHp(2); await player.gainMaxHp(2);
@ -1200,22 +1202,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){
dczixi:{ dczixi:{
init(){ init(){
game.addGlobalSkill('dczixi_judge'); game.addGlobalSkill('dczixi_judge');
game.broadcastAll((list)=>{ game.broadcastAll(()=>lib.skill.dczixi.video());
list.forEach(name=>{ },
const namex='dczixi_'+name; video(){
if(!lib.card[namex]){ const list=lib.skill.dczixi.zixiList;
lib.card[namex]={ for(const name of list){
type:'special_delay', const namex='dczixi_'+name;
fullskin:true, if(!lib.card[namex]){
noEffect:true, lib.card[namex]={
wuxieable:false, type:'special_delay',
}; fullskin:true,
lib.card[namex].cardimage=name; noEffect:true,
lib.translate[namex]=lib.translate[name]+'·姊希'; wuxieable:false,
lib.translate[namex+'_info']='由【姊希】技能创造的无效果【'+lib.translate[name]+'】'; };
} lib.card[namex].cardimage=name;
}); lib.translate[namex]=lib.translate[name]+'·姊希';
},lib.skill.dczixi.zixiList); lib.translate[namex+'_info']='由【姊希】技能创造的无效果【'+lib.translate[name]+'】';
}
}
}, },
audio:2, audio:2,
trigger:{player:['phaseUseBegin','phaseUseEnd']}, trigger:{player:['phaseUseBegin','phaseUseEnd']},
@ -1229,6 +1233,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
zixiList:['lebu','bingliang','shandian'], zixiList:['lebu','bingliang','shandian'],
direct:true, direct:true,
async content(event,trigger,player){ async content(event,trigger,player){
game.addVideo('skill',player,['dczixi',[]]);
const names=lib.skill.dczixi.zixiList.filter(name=>{ const names=lib.skill.dczixi.zixiList.filter(name=>{
return player.countCards('h',card=>{ return player.countCards('h',card=>{
return card.hasGaintag('dcqiqin_tag')&&game.hasPlayer(target=>target.canAddJudge(get.autoViewAs({name:'dczixi_'+name},[card]))); return card.hasGaintag('dcqiqin_tag')&&game.hasPlayer(target=>target.canAddJudge(get.autoViewAs({name:'dczixi_'+name},[card])));

View File

@ -11541,13 +11541,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
return target.getSkills(null,false,false).filter(function(i){ return target.getSkills(null,false,false).filter(function(i){
return get.is.zhuanhuanji(i,current); return get.is.zhuanhuanji(i,target);
}).length>0; }).length>0;
}, },
content:function(){ content:function(){
'step 0' 'step 0'
var list=target.getSkills(null,false,false).filter(function(i){ var list=target.getSkills(null,false,false).filter(function(i){
return get.is.zhuanhuanji(i,current); return get.is.zhuanhuanji(i,target);
}); });
if(list.length==1){ if(list.length==1){
event._result={control:list[0]}; event._result={control:list[0]};

View File

@ -181,8 +181,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
subSkill:{ subSkill:{
true:{ true:{
audio:'dcsbquanmou',
charlotte:true, charlotte:true,
audio:'dcsbquanmou',
audioname:['dc_sb_simayi_shadow'],
trigger:{source:'damageSource'}, trigger:{source:'damageSource'},
forced:true, forced:true,
popup:false, popup:false,
@ -239,8 +240,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
}, },
false:{ false:{
audio:'dcsbquanmou',
charlotte:true, charlotte:true,
audio:'dcsbquanmou',
audioname:['dc_sb_simayi_shadow'],
trigger:{source:'damageBegin2'}, trigger:{source:'damageBegin2'},
forced:true, forced:true,
filter(event,player){ filter(event,player){
@ -288,6 +290,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
dcsbpingliao:{ dcsbpingliao:{
audio:2, audio:2,
audioname:['dc_sb_simayi_shadow'],
trigger:{player:'useCard0'}, trigger:{player:'useCard0'},
forced:true, forced:true,
filter(event,player){ filter(event,player){

View File

@ -2721,6 +2721,18 @@ export class Game extends Uninstantable {
} }
} }
}, },
changeSkin: function (player, map) {
if (!player || !map) return;
player.tempname.remove(map.from);
player.tempname.add(map.to);
player.skin[name] = map.to;
const goon = (!lib.character[map.to]);
if (goon) lib.character[map.to] = ['', '', 0, [], (map.list.find(i => i[0] == map.to) || [map.to, []])[1]];
player.smoothAvatar(map.avatar2);
player.node['avatar' + map.name.slice(4)].setBackground(map.to, 'character');
player.node['avatar' + map.name.slice(4)].show();
if (goon) delete lib.character[map.to];
},
skill: function (player, content) { skill: function (player, content) {
if (typeof content == 'string') { if (typeof content == 'string') {
if (lib.skill[content]) lib.skill[content].video(player); if (lib.skill[content]) lib.skill[content].video(player);

View File

@ -2335,16 +2335,25 @@ export class Player extends HTMLDivElement {
if ((get.character(this[i], 3) || []).includes(skill)) { if ((get.character(this[i], 3) || []).includes(skill)) {
const name = (i == 'name2' ? 'name2' : 'name'); const name = (i == 'name2' ? 'name2' : 'name');
if (this.skin[name] != character) { if (this.skin[name] != character) {
game.broadcastAll((player, name, character, list) => { const origin = this.skin[name];
player.tempname.remove(player.skin[name]); game.broadcastAll((player, name, character, list, origin) => {
player.tempname.remove(origin);
player.tempname.add(character); player.tempname.add(character);
player.skin[name] = character; player.skin[name] = character;
const goon = (!lib.character[character]); const goon = (!lib.character[character]);
if (goon) lib.character[character] = ['', '', 0, [], (list.find(i => i[0] == character) || [character, []])[1]]; if (goon) lib.character[character] = ['', '', 0, [], (list.find(i => i[0] == character) || [character, []])[1]];
player.smoothAvatar(name == 'name2');
player.node['avatar' + name.slice(4)].setBackground(character, 'character'); player.node['avatar' + name.slice(4)].setBackground(character, 'character');
player.node['avatar' + name.slice(4)].show(); player.node['avatar' + name.slice(4)].show();
if (goon) delete lib.character[character]; if (goon) delete lib.character[character];
}, this, name, character, list); }, this, name, character, list, origin);
game.addVideo('changeSkin', this, {
from: origin,
to: character,
name: name,
list: list,
avatar2: name == 'name2',
});
} }
} }
} }