Merge pull request #1061 from mengxinzxz/PR-Branch
优化changeSkin换肤的流畅感,添加changeSkin的录像回放功能
This commit is contained in:
commit
9010db4a60
|
@ -200,6 +200,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
return 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);
|
||||
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(choices.length){
|
||||
const choice=choices.randomGet();
|
||||
for(let i=1;i<=3;i++){
|
||||
await info[choice].content(player,1);
|
||||
for(const choice of choices){
|
||||
for(let i=1;i<=3;i++){
|
||||
await info[choice].content(player,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
await player.gainMaxHp(2);
|
||||
|
@ -1200,22 +1202,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
dczixi:{
|
||||
init(){
|
||||
game.addGlobalSkill('dczixi_judge');
|
||||
game.broadcastAll((list)=>{
|
||||
list.forEach(name=>{
|
||||
const namex='dczixi_'+name;
|
||||
if(!lib.card[namex]){
|
||||
lib.card[namex]={
|
||||
type:'special_delay',
|
||||
fullskin:true,
|
||||
noEffect:true,
|
||||
wuxieable:false,
|
||||
};
|
||||
lib.card[namex].cardimage=name;
|
||||
lib.translate[namex]=lib.translate[name]+'·姊希';
|
||||
lib.translate[namex+'_info']='由【姊希】技能创造的无效果【'+lib.translate[name]+'】';
|
||||
}
|
||||
});
|
||||
},lib.skill.dczixi.zixiList);
|
||||
game.broadcastAll(()=>lib.skill.dczixi.video());
|
||||
},
|
||||
video(){
|
||||
const list=lib.skill.dczixi.zixiList;
|
||||
for(const name of list){
|
||||
const namex='dczixi_'+name;
|
||||
if(!lib.card[namex]){
|
||||
lib.card[namex]={
|
||||
type:'special_delay',
|
||||
fullskin:true,
|
||||
noEffect:true,
|
||||
wuxieable:false,
|
||||
};
|
||||
lib.card[namex].cardimage=name;
|
||||
lib.translate[namex]=lib.translate[name]+'·姊希';
|
||||
lib.translate[namex+'_info']='由【姊希】技能创造的无效果【'+lib.translate[name]+'】';
|
||||
}
|
||||
}
|
||||
},
|
||||
audio:2,
|
||||
trigger:{player:['phaseUseBegin','phaseUseEnd']},
|
||||
|
@ -1229,6 +1233,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
zixiList:['lebu','bingliang','shandian'],
|
||||
direct:true,
|
||||
async content(event,trigger,player){
|
||||
game.addVideo('skill',player,['dczixi',[]]);
|
||||
const names=lib.skill.dczixi.zixiList.filter(name=>{
|
||||
return player.countCards('h',card=>{
|
||||
return card.hasGaintag('dcqiqin_tag')&&game.hasPlayer(target=>target.canAddJudge(get.autoViewAs({name:'dczixi_'+name},[card])));
|
||||
|
|
|
@ -11541,13 +11541,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
},
|
||||
filterTarget:function(card,player,target){
|
||||
return target.getSkills(null,false,false).filter(function(i){
|
||||
return get.is.zhuanhuanji(i,current);
|
||||
return get.is.zhuanhuanji(i,target);
|
||||
}).length>0;
|
||||
},
|
||||
content:function(){
|
||||
'step 0'
|
||||
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){
|
||||
event._result={control:list[0]};
|
||||
|
|
|
@ -181,8 +181,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
},
|
||||
subSkill:{
|
||||
true:{
|
||||
audio:'dcsbquanmou',
|
||||
charlotte:true,
|
||||
audio:'dcsbquanmou',
|
||||
audioname:['dc_sb_simayi_shadow'],
|
||||
trigger:{source:'damageSource'},
|
||||
forced:true,
|
||||
popup:false,
|
||||
|
@ -239,8 +240,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
},
|
||||
},
|
||||
false:{
|
||||
audio:'dcsbquanmou',
|
||||
charlotte:true,
|
||||
audio:'dcsbquanmou',
|
||||
audioname:['dc_sb_simayi_shadow'],
|
||||
trigger:{source:'damageBegin2'},
|
||||
forced:true,
|
||||
filter(event,player){
|
||||
|
@ -288,6 +290,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
},
|
||||
dcsbpingliao:{
|
||||
audio:2,
|
||||
audioname:['dc_sb_simayi_shadow'],
|
||||
trigger:{player:'useCard0'},
|
||||
forced:true,
|
||||
filter(event,player){
|
||||
|
|
|
@ -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) {
|
||||
if (typeof content == 'string') {
|
||||
if (lib.skill[content]) lib.skill[content].video(player);
|
||||
|
|
|
@ -2335,16 +2335,25 @@ export class Player extends HTMLDivElement {
|
|||
if ((get.character(this[i], 3) || []).includes(skill)) {
|
||||
const name = (i == 'name2' ? 'name2' : 'name');
|
||||
if (this.skin[name] != character) {
|
||||
game.broadcastAll((player, name, character, list) => {
|
||||
player.tempname.remove(player.skin[name]);
|
||||
const origin = this.skin[name];
|
||||
game.broadcastAll((player, name, character, list, origin) => {
|
||||
player.tempname.remove(origin);
|
||||
player.tempname.add(character);
|
||||
player.skin[name] = character;
|
||||
const goon = (!lib.character[character]);
|
||||
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)].show();
|
||||
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',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue