Merge branch 'libccy:PR-Branch' into PR-Branch

This commit is contained in:
157 2023-10-07 12:55:31 +08:00 committed by GitHub
commit 557808dce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 90 additions and 112 deletions

View File

@ -983,9 +983,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
preHidden:true,
filter:function(event,player){
if(get.type(event.card)!='equip') return false;
var gz=get.mode()=='guozhan';
if(gz&&event.player.isFriendOf(player)) return false;
return player.countMark('pkwuku')<(gz?2:3);
return player.countMark('pkwuku')<3;
},
content:function(){
player.addMark('pkwuku',1);

View File

@ -1923,14 +1923,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2,
enable:'phaseUse',
filter:function(event,player){
var hs=player.getCards('h');
const hs=player.getCards('h');
if(!hs.length) return false;
if((player.getStat('skill').reqice||0)>=player.countMark('reqice_mark')+1) return false;
for(var i=0; i<hs.length; i++){
var mod2=game.checkMod(hs[i],player,'unchanged','cardEnabled2',player);
if(mod2===false) return false;
}
return true;
if(hs.some(card=>{
const mod2=game.checkMod(card,player,'unchanged','cardEnabled2',player);
return (mod2===false)
})) return false;
return lib.inpile.some(name=>{
if(get.type(name)!='trick') return false;
const card=get.autoViewAs({name},hs);
return event.filterCard(card,player,event);
});
},
chooseButton:{
dialog:function(event,player){
@ -1941,7 +1945,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return ui.create.dialog(get.translation('reqice'),[list,'vcard']);
},
filter:function(button,player){
return lib.filter.filterCard({name:button.link[2]},player,_status.event.getParent());
const event=_status.event.getParent(),card=get.autoViewAs({
name:button.link[2],
},player.getCards('h'));
return event.filterCard(card,player,event);
},
check:function(button){
var player=_status.event.player;

View File

@ -17929,16 +17929,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){
'step 0'
player.draw(3);
'step 1'
var list=lib.skill.zhengnan.derivation.filter(skill=>!player.hasSkill(skill));
if(list.length==1) event._result={control:list[0]};
else if(list.length){
else if(list.length>0){
player.chooseControl(list).set('prompt','选择获得一项技能').set('ai',function(){
if(_status.event.controls.contains('dangxian')) return 'dangxian';
return _status.event.controls[0];
});
}
else event.finish();
'step 1'
'step 2'
if(result.control){
player.addSkillLog(result.control);
player.popup(result.control);

View File

@ -2420,13 +2420,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var player=_status.event.player;
var target=_status.event.target;
var controls=_status.event.controls.slice();
controls.sort(function(a,b){
return [
get.effect(target,{name:'wuzhong'},player,player)/2,
get.effect(target,{name:'guohe_copy2'},player,player),
get.effect(target,{name:'kaihua'},player,player),
][['摸牌','弃牌','制衡'].indexOf(b)-['摸牌','弃牌','制衡'].indexOf(a)];
});
var map={
'摸牌':get.effect(target,{name:'wuzhong'},player,player)/2,
'弃牌':get.effect(target,{name:'guohe_copy2'},player,player),
'制衡':get.effect(target,{name:'kaihua'},player,player),
};
controls.sort((a,b)=>map[b]-map[a]);
return controls[0];
}).set('target',target);
}
@ -12571,13 +12570,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){
usable:1,
audio:'qice_backup',
filter:function(event,player){
var hs=player.getCards('h');
const hs=player.getCards('h');
if(!hs.length) return false;
for(var i=0;i<hs.length;i++){
var mod2=game.checkMod(hs[i],player,'unchanged','cardEnabled2',player);
if(mod2===false) return false;
}
return true;
if(hs.some(card=>{
const mod2=game.checkMod(card,player,'unchanged','cardEnabled2',player);
return (mod2===false)
})) return false;
return lib.inpile.some(name=>{
if(get.type(name)!='trick') return false;
const card=get.autoViewAs({name},hs);
return event.filterCard(card,player,event);
});
},
chooseButton:{
dialog:function(player){
@ -12588,7 +12591,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return ui.create.dialog(get.translation('qice'),[list,'vcard']);
},
filter:function(button,player){
return lib.filter.filterCard({name:button.link[2]},player,_status.event.getParent());
const event=_status.event.getParent(),card=get.autoViewAs({
name:button.link[2],
},player.getCards('h'));
return event.filterCard(card,player,event);
},
check:function(button){
var player=_status.event.player;

View File

@ -16359,14 +16359,14 @@
},
chooseButtonOL:function(){
'step 0'
ui.arena.classList.add('markhidden');
//ui.arena.classList.add('markhidden');
for(var i=0;i<event.list.length;i++){
var current=event.list[i];
current[0].wait();
if(current[0].isOnline()){
var target=current.shift();
target.send(function(args,callback,switchToAuto,processAI){
ui.arena.classList.add('markhidden');
//ui.arena.classList.add('markhidden');
var next=game.me.chooseButton.apply(game.me,args);
next.callback=callback;
next.switchToAuto=switchToAuto;
@ -16415,9 +16415,9 @@
game.pause();
}
'step 6'
game.broadcastAll(function(){
/*game.broadcastAll(function(){
ui.arena.classList.remove('markhidden');
});
});*/
event.result=event.resultOL;
},
chooseCard:function(){
@ -21433,7 +21433,7 @@
return true;
});
for(var i=0;i<skills.length;i++){
this.addSkill(skills[i]);
this.addSkill(skills[i],null,true);
}
this.checkConflict();
}
@ -21448,7 +21448,7 @@
this._inits[i](this);
}
}
if(update!==false) this.update();
if(update!==false) this.$update();
return this;
},
initOL:function(name,character){
@ -22031,14 +22031,18 @@
update:function(){
if(_status.video&&arguments.length==0) return;
if(this.hp>=this.maxHp) this.hp=this.maxHp;
var hp=this.node.hp;
hp.style.transition='none';
game.broadcast(function(player,hp,maxHp,hujia){
player.hp=hp;
player.maxHp=maxHp;
player.hujia=hujia;
player.update();
player.$update();
},this,this.hp,this.maxHp,this.hujia);
this.$update();
},
$update:function(){
if(this.hp>=this.maxHp) this.hp=this.maxHp;
var hp=this.node.hp;
hp.style.transition='none';
if(!_status.video){
if(this.hujia){
this.markSkill('ghujia');
@ -25697,7 +25701,7 @@
}
return true;
},
markSkill:function(name,info,card){
markSkill:function(name,info,card,nobroadcast){
if(info===true){
this.syncStorage(name);
info=null;
@ -25708,10 +25712,8 @@
else{
game.addVideo('markSkill',this,[name]);
}
game.broadcastAll(function(storage,player,name,info,card){
if(storage!=undefined){
player.storage[name]=storage;
}
const func=function(storage,player,name,info,card){
player.storage[name]=storage;
if(!info){
if(player.marks[name]){
player.updateMarks();
@ -25736,12 +25738,14 @@
}
}
player.updateMarks();
},this.storage[name],this,name,info,card);
};
func(this.storage[name],this,name,info,card);
if(!nobroadcast) game.broadcast(func,this.storage[name],this,name,info,card);
return this;
},
unmarkSkill:function(name){
unmarkSkill:function(name,nobroadcast){
game.addVideo('unmarkSkill',this,name);
game.broadcast(function(player,name){
if(!nobroadcast) game.broadcast(function(player,name){
if(player.marks[name]){
player.marks[name].delete();
player.marks[name].style.transform+=' scale(0.2)';
@ -25755,7 +25759,7 @@
delete this.marks[name];
ui.updatem(this);
var info=lib.skill[name];
if(info&&info.intro&&info.intro.onunmark){
if(!game.online&&info&&info.intro&&info.intro.onunmark){
if(info.intro.onunmark=='throw'){
if(get.itemtype(this.storage[name])=='cards'){
this.$throw(this.storage[name],1000);
@ -25772,11 +25776,11 @@
}
return this;
},
markSkillCharacter:function(id,target,name,content){
markSkillCharacter:function(id,target,name,content,broadcast){
if(typeof target=='object'){
target=target.name;
}
game.broadcastAll(function(player,target,name,content,id){
const func=function(player,target,name,content,id){
if(player.marks[id]){
player.marks[id].name=name+'_charactermark';
player.marks[id]._name=target;
@ -25807,7 +25811,9 @@
target:target
});
}
},this,target,name,content,id);
}
func(this,target,name,content,id);
if(!nobroadcast) game.broadcastAll(func,this,target,name,content,id);
return this;
},
markCharacter:function(name,info,learn,learn2){
@ -26252,14 +26258,14 @@
if(info.mark){
if(info.mark=='card'&&
get.itemtype(this.storage[skill])=='card'){
this.markSkill(skill,null,this.storage[skill]);
this.markSkill(skill,null,this.storage[skill],nobroadcast);
}
else if(info.mark=='card'&&
get.itemtype(this.storage[skill])=='cards'){
this.markSkill(skill,null,this.storage[skill][0]);
this.markSkill(skill,null,this.storage[skill][0],nobroadcast);
}
else if(info.mark=='image'){
this.markSkill(skill,null,ui.create.card(null,'noclick').init([null,null,skill]));
this.markSkill(skill,null,ui.create.card(null,'noclick').init([null,null,skill]),nobroadcast);
}
else if(info.mark=='character'){
var intro=info.intro.content;
@ -26281,10 +26287,10 @@
else{
caption=get.translation(skill);
}
this.markSkillCharacter(skill,this.storage[skill],caption,intro);
this.markSkillCharacter(skill,this.storage[skill],caption,intro,nobroadcast);
}
else{
this.markSkill(skill);
this.markSkill(skill,null,null,nobroadcast);
}
}
}
@ -26747,6 +26753,7 @@
},
hasHistory:function(key,filter,last){
const history=this.getHistory(key);
if(!filter||typeof filter!="function") filter=lib.filter.all;
if(last){
const lastIndex=history.indexOf(last);
return history.some((event,index)=>{

View File

@ -14036,6 +14036,10 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
'step 0'
game.broadcastAll(function(){
ui.arena.classList.add('choose-character');
for(var i=0;i<game.players.length;i++){
game.players[i].classList.add('unseen');
game.players[i].classList.add('unseen2');
}
});
var list=[];
for(var i in lib.characterPack.mode_guozhan){
@ -14207,59 +14211,15 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
'step 2'
if(!result) result={};
var result2=event.result2;
for(var i in result){
if(result[i]&&result[i].links) result[i]=result[i].links[0][2].slice(6);
else if(result[i]=='ai') result[i]=function(){
var player=lib.playerOL[i];
var name1=result2[i][0],name2=result2[i][1];
if(get.is.double(name1,true)) return get.is.double(name2,true).filter(group=>get.is.double(name1,true).contains(group)).randomGet();
if(lib.character[name1][1]=='ye') return get.is.double(name2,true).randomGet();
}();
}
game.broadcast(function(result,result2){
for(var i in result){
if(!lib.playerOL[i].name){
lib.playerOL[i].init(result[i][0],result[i][1],false);
}
if(result2[i]&&result2[i].length) lib.playerOL[i].trueIdentity=result2[i];
}
setTimeout(function(){
ui.arena.classList.remove('choose-character');
},500);
},result2,result);
for(var i in result2){
if(!lib.playerOL[i].name){
lib.playerOL[i].init(result2[i][0],result2[i][1],false);
}
if(result[i]&&result[i].length) lib.playerOL[i].trueIdentity=result[i];
}
for(var i=0;i<game.players.length;i++){
_status.characterlist.remove(game.players[i].name);
_status.characterlist.remove(game.players[i].name2);
game.players[i].hiddenSkills=lib.character[game.players[i].name1][3].slice(0);
var hiddenSkills2=lib.character[game.players[i].name2][3];
for(var j=0;j<hiddenSkills2.length;j++){
game.players[i].hiddenSkills.add(hiddenSkills2[j]);
}
for(var j=0;j<game.players[i].hiddenSkills.length;j++){
if(!lib.skill[game.players[i].hiddenSkills[j]]){
game.players[i].hiddenSkills.splice(j--,1);
}
}
for(var j=0;j<game.players[i].hiddenSkills.length;j++){
game.players[i].name1=game.players[i].name;
game.players[i].addSkillTrigger(game.players[i].hiddenSkills[j],true);
}
}
game.broadcastAll(function(result){
for(var i in result){
if(!lib.playerOL[i].name){
lib.playerOL[i].init(result[i][0],result[i][1],false);
}
}
game.broadcastAll(function(result,result2){
for(var i=0;i<game.players.length;i++){
game.players[i].classList.add('unseen');
game.players[i].classList.add('unseen2');
var current=game.players[i],id=current.playerid;
if(result[id]&&!current.name){
current.init(result[id][0],result[id][1],false);
}
if(result2[id]&&result2[id].length){
current.trueIdentity=result2[id][0][2].slice(6);
}
if(game.players[i]!=game.me){
game.players[i].node.identity.firstChild.innerHTML='猜';
game.players[i].node.identity.dataset.color='unknown';
@ -14286,7 +14246,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
setTimeout(function(){
ui.arena.classList.remove('choose-character');
},500);
},result2);
},result2,result);
});
}
},

View File

@ -753,7 +753,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
player.init(result.links[0]);
player.hp++;
player.maxHp++;
player.update();
player.$update();
}
});
"step 5"
@ -1441,7 +1441,8 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
return list2.randomGets(num).sort(lib.sort.character);
}
var getGroup=function(name){
if(lib.characterReplace[name]) return lib.character[lib.characterReplace[name][0]][1];
var characterReplace = lib.characterReplace[name];
if(characterReplace && characterReplace[0] && lib.character[characterReplace[0]]) return lib.character[characterReplace[0]][1];
return lib.character[name][1];
}
var list2x=list2.slice(0);
@ -1852,6 +1853,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
}
zhu.identityShown=true;
zhu.identity=zhuid;
if(zhuid=='zhu') zhu.isZhu=true;
zhu.setIdentity();
zhu.node.identity.classList.remove('guessing');
me.setIdentity(identity);
@ -1950,14 +1952,11 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
var next=game.zhu.chooseButton(true);
next.set('selectButton',(lib.configOL.double_character?2:1));
next.set('createDialog',['选择角色',[list,'characterx']]);
next.set('callback',function(player,result){
player.init(result.links[0],result.links[1]);
});
next.set('ai',function(button){
return Math.random();
});
"step 1"
if(game.me!=game.zhu){
if(!game.zhu.name){
game.zhu.init(result.links[0],result.links[1])
}
event.list.remove(get.sourceCharacter(game.zhu.name1));
@ -1971,7 +1970,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
game.zhu.update();
}
game.broadcast(function(zhu,name,name2,addMaxHp){
if(game.zhu!=game.me){
if(!zhu.name){
zhu.init(name,name2);
}
if(addMaxHp){