一大堆bugfix

This commit is contained in:
Spmario233 2023-10-16 00:12:04 +08:00
parent 6ecf98a6fd
commit 9c2a6a5fdb
12 changed files with 84 additions and 42 deletions

View File

@ -1640,7 +1640,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
names.push(namex); names.push(namex);
} }
list.sort((a,b)=>{ list.sort((a,b)=>{
return 100*(lib.inpile.indexOf(a[2])-lib.inpile.indexOf(b[2]))+lib.inpile_nature.indexOf(a[3][0])-lib.inpile_nature.indexOf(b[3][0]); var del1=lib.inpile.indexOf(a[2])-lib.inpile.indexOf(b[2]);
if(del1!=0) return del1;
var a1=0,a2=0;
if(a.length>3) a1=(lib.nature.get(a)||0);
if(b.length>3) b1=(lib.nature.get(b)||0);
return a1-b1;
}) })
player.chooseButton(['是否将'+get.cnNumber(cards.length)+'张牌当下列一张牌使用?',[list,'vcard']]).set('ai',function(button){ player.chooseButton(['是否将'+get.cnNumber(cards.length)+'张牌当下列一张牌使用?',[list,'vcard']]).set('ai',function(button){
return _status.event.player.getUseValue({name:button.link[2],nature:button.link[3]}); return _status.event.player.getUseValue({name:button.link[2],nature:button.link[3]});

View File

@ -2627,7 +2627,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var cards=trigger.cards.filterInD(); var cards=trigger.cards.filterInD();
if(cards.length>0) player.gain(cards,'gain2'); if(cards.length>0) player.gain(cards,'gain2');
} }
}) });
} }
}, },
}, },

View File

@ -2168,14 +2168,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){
prompt2:'你可以获得其他所有群势力角色的各一张牌', prompt2:'你可以获得其他所有群势力角色的各一张牌',
logTarget:function(event,player){ logTarget:function(event,player){
return game.filterPlayer(current=>{ return game.filterPlayer(current=>{
return current.group=='qun'&&current.countGainableCards(player,'h')>0&&current!=player; return current.group=='qun'&&current.countGainableCards(player,'he')>0&&current!=player;
}) })
}, },
content:function(){ content:function(){
game.filterPlayer(current=>{ game.filterPlayer(current=>{
return current.group=='qun'&&current!=player; return current.group=='qun'&&current!=player;
}).sortBySeat().forEach(i=>{ }).sortBySeat().forEach(i=>{
player.gainPlayerCard(i,'h',true); player.gainPlayerCard(i,'he',true);
}); });
}, },
group:'jsrgjulian_draw', group:'jsrgjulian_draw',

View File

@ -5723,9 +5723,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 1' 'step 1'
if(result.number<7){ if(result.number<7){
var source=trigger.source; var source=trigger.source;
if(source&&source.isIn()&&source.countCards('h')>0){ if(source&&source.isIn()&&source.countCards('he')>0){
player.line(source); player.line(source);
source.chooseToDiscard('h',true); source.chooseToDiscard('he',true);
} }
} }
}, },

View File

@ -88,14 +88,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
init:function(){ init:function(){
if(!_status.junkguixin){ if(!_status.junkguixin){
_status.junkguixin=[]; _status.junkguixin=[];
for(var name in lib.character){ if(!_status.characterlist){
lib.skill.pingjian.initList();
}
for(const name of _status.characterlist){
if(!lib.character[name][3]) continue; if(!lib.character[name][3]) continue;
if(game.players.some(target=>{
if(target.name&&target.name==name) return true;
if(target.name1&&target.name1==name) return true;
if(target.name2&&target.name2==name) return true;
return false;
})) continue;
_status.junkguixin.addArray(lib.character[name][3].filter(skill=>{ _status.junkguixin.addArray(lib.character[name][3].filter(skill=>{
var info=get.info(skill); var info=get.info(skill);
return info&&info.zhuSkill&&(!info.ai||!info.ai.combo); return info&&info.zhuSkill&&(!info.ai||!info.ai.combo);

View File

@ -22248,19 +22248,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
if(get.mode()=='guozhan'){ if(get.mode()=='guozhan'){
if(player==target) return true; if(player==target) return true;
if(player.identity=='ye') return false;
if(player.identity=='unknown'){ if(player.identity=='unknown'){
if(_status.yeidentity.contains(player._group)){ if(!player.wontYe('qun')) return false;
return false; return target.identity=='qun';
}
else if(get.zhu(player)||get.population(player._group)+1<=get.population()/2){
return player._group==target.identity;
}
else{
return false;
}
} }
return player.identity==target.identity; return target.isFriendOf(player);
} }
else{ else{
return true; return true;
@ -25598,7 +25590,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
retuogu:'托孤', retuogu:'托孤',
retuogu_info:'一名角色死亡时,你可以令其选择其武将牌上的一个技能(主公技,限定技,觉醒技,隐匿技、使命技等特殊技能除外),然后你获得其选择的技能并失去上次因〖托孤〗获得的技能。', retuogu_info:'一名角色死亡时,你可以令其选择其武将牌上的一个技能(主公技,限定技,觉醒技,隐匿技、使命技等特殊技能除外),然后你获得其选择的技能并失去上次因〖托孤〗获得的技能。',
shanzhuan:'擅专', shanzhuan:'擅专',
shanzhuan_info:'当你对其他角色造成伤害后,若其判定区没有牌,则你可以将其的一张牌置于其的判定区。若此牌不为延时锦囊牌且此牌为:红色,此牌视为【乐不思蜀】;黑色,此牌视为【兵粮寸断】。回合结束时,若你本回合内未造成伤害,你可摸一张牌。', shanzhuan_info:'当你对其他角色造成伤害后,若其判定区没有牌,则你可以将其的一张牌置于其的判定区。若此牌不为延时锦囊牌且此牌为:红色,此牌视为【乐不思蜀】;黑色,此牌视为【兵粮寸断】。回合结束时,若你本回合内未造成伤害,你可摸一张牌。',
spniluan:'逆乱', spniluan:'逆乱',
spniluan_info:'出牌阶段,你可以将一张黑色牌当做【杀】使用。此【杀】使用结算完成后,若你未因此【杀】造成过伤害,则你令此【杀】不计入使用次数。', spniluan_info:'出牌阶段,你可以将一张黑色牌当做【杀】使用。此【杀】使用结算完成后,若你未因此【杀】造成过伤害,则你令此【杀】不计入使用次数。',
spweiwu:'违忤', spweiwu:'违忤',

View File

@ -13534,7 +13534,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
effect:{ effect:{
target:function(card,player,target,current){ target:function(card,player,target,current){
if(target.countCards('h')) return; if(target.countCards('h')) return;
if(get.tag(card,'natureDamage')) return 'zerotarget'; if(get.tag(card,'natureDamage')) return 'zeroplayertarget';
if(get.type(card)=='trick'&&get.tag(card,'damage')){ if(get.type(card)=='trick'&&get.tag(card,'damage')){
return 'zeroplayertarget'; return 'zeroplayertarget';
} }

View File

@ -10633,14 +10633,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
list.add(get.suit(card,false)); list.add(get.suit(card,false));
} }
game.getGlobalHistory('cardMove',function(evt){ game.getGlobalHistory('cardMove',function(evt){
if(evt==event||evt.getParent()==event||(evt.name!='lose'&&evt.name!='cardsDiscard')) return false; if(evt.name!='lose'&&evt.name!='cardsDiscard') return false;
if(evt.name=='lose'&&evt.position!=ui.discardPile) return false; if(evt.name=='lose'&&evt.position!=ui.discardPile) return false;
if(evt==event||evt.getParent()==event) return false;
num+=evt.cards.length; num+=evt.cards.length;
for(var i=0;i<evt.cards.length;i++){ for(var i=0;i<evt.cards.length;i++){
var card=evt.cards[i]; var card=evt.cards[i];
list.remove(get.suit(card,false)); list.remove(get.suit(card,(evt.cards2&&evt.cards2.contains(card))?evt.player:false));
} }
},event); });
player.storage.refenyin_mark2=num; player.storage.refenyin_mark2=num;
return list.length>0; return list.length>0;
}, },
@ -10650,20 +10651,21 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var cards=trigger.getd(); var cards=trigger.getd();
for(var i=0;i<cards.length;i++){ for(var i=0;i<cards.length;i++){
var card=cards[i]; var card=cards[i];
var suit=get.suit(card,(trigger.cards2&&trigger.cards2.contains(card))?trigger.player:false); var suit=get.suit(card,false);
list.add(suit); list.add(suit);
list2.add(suit); list2.add(suit);
} }
game.getGlobalHistory('cardMove',function(evt){ game.getGlobalHistory('cardMove',function(evt){
if(evt==trigger||evt.getParent()==trigger||(evt.name!='lose'&&evt.name!='cardsDiscard')) return false; if(evt.name!='lose'&&evt.name!='cardsDiscard') return false;
if(evt.name=='lose'&&evt.position!=ui.discardPile) return false; if(evt.name=='lose'&&evt.position!=ui.discardPile) return false;
if(evt==trigger||evt.getParent()==trigger) return false;
for(var i=0;i<evt.cards.length;i++){ for(var i=0;i<evt.cards.length;i++){
var card=evt.cards[i]; var card=evt.cards[i];
var suit=get.suit(card,(evt.cards2&&evt.cards2.contains(card))?evt.player:false); var suit=get.suit(card,false);
list.remove(suit); list.remove(suit);
list2.add(suit); list2.add(suit);
} }
},trigger); });
list2.sort(); list2.sort();
player.draw(list.length); player.draw(list.length);
player.storage.refenyin_mark=list2; player.storage.refenyin_mark=list2;

View File

@ -479,7 +479,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
numx=[0,1].randomGet(); numx=[0,1].randomGet();
} }
if(numx<0) numx=0; if(numx<0) numx=0;
else if(numx>choices.length) numx=choices.length; else if(numx>=choices.length) numx=choices.length-1;
return numx; return numx;
}()); }());
'step 1' 'step 1'

View File

@ -12661,7 +12661,7 @@
"step 4" "step 4"
var info=get.info(card,false); var info=get.info(card,false);
if(get.itemtype(result)=='cards'){ if(get.itemtype(result)=='cards'){
player.lose(result,false,'visible').set('type','equip').set('getlx',false).swapEquip=true; player.lose(result,'visible').set('type','equip').set('getlx',false).swapEquip=true;
if(info.loseThrow){ if(info.loseThrow){
player.$throw(result,1000); player.$throw(result,1000);
} }
@ -26929,6 +26929,7 @@
this.addEquipTrigger(es[i]); this.addEquipTrigger(es[i]);
} }
} }
_status.event.clearStepCache();
return this; return this;
}, },
removeEquipTrigger:function(card){ removeEquipTrigger:function(card){
@ -26954,6 +26955,7 @@
this.removeEquipTrigger(es[i]); this.removeEquipTrigger(es[i]);
} }
} }
_status.event.clearStepCache();
return this; return this;
}, },
removeSkillTrigger:function(skill,triggeronly){ removeSkillTrigger:function(skill,triggeronly){
@ -27013,10 +27015,13 @@
} }
} }
} }
if(_status.event&&_status.event.removeTrigger) _status.event.removeTrigger(skill,this);
_status.event.clearStepCache();
return this; return this;
}, },
removeSkill:function(skill){ removeSkill:function(skill){
if(!skill) return; if(!skill) return;
_status.event.clearStepCache();
if(Array.isArray(skill)){ if(Array.isArray(skill)){
for(var i=0;i<skill.length;i++){ for(var i=0;i<skill.length;i++){
this.removeSkill(skill[i]); this.removeSkill(skill[i]);
@ -30557,13 +30562,13 @@
return !player||player==evt.player; return !player||player==evt.player;
}, },
addTrigger:function(skill,player){ addTrigger:function(skill,player){
if(!player) return; if(!player||!skill) return;
var evt=this; var evt=this;
if(typeof skill=='string') skill=[skill];
game.expandSkills(skill);
while(true){ while(true){
var evt=evt.getParent('arrangeTrigger'); var evt=evt.getParent('arrangeTrigger');
if(!evt||evt.name!='arrangeTrigger'||!evt.map) return; if(!evt||evt.name!='arrangeTrigger'||!evt.map) return;
if(typeof skill=='string') skill=[skill];
game.expandSkills(skill);
var filter=function(content){ var filter=function(content){
if(typeof content=='string') return content==triggername; if(typeof content=='string') return content==triggername;
return content.contains(triggername); return content.contains(triggername);
@ -30605,6 +30610,42 @@
} }
} }
}, },
removeTrigger:function(skill,player){
if(!player||!skill) return;
var evt=this;
if(typeof skill=='string') skill=[skill];
game.expandSkills(skill);
while(true){
var evt=evt.getParent('arrangeTrigger');
if(!evt||evt.name!='arrangeTrigger'||!evt.map) return;
var filter=function(content){
if(typeof content=='string') return content==triggername;
return content.contains(triggername);
};
var trigger=evt._trigger;
var triggername=evt.triggername;
var map=false;
if(evt.doing&&evt.doing.player==player) map=evt.doing;
else{
for(var i=0;i<evt.map.length;i++){
if(evt.map[i].player==player){
map=evt.map[i];
break;
}
}
}
if(!map) return;
var func=function(skillx){
var toremove=map.list.filter(i=>{
return i[0]==skillx&&i[1]==player;
});
if(toremove.length>0) map.list.removeArray(toremove);
}
for(var j=0;j<skill.length;j++){
func(skill[j]);
}
}
},
trigger:function(name){ trigger:function(name){
if(_status.video) return; if(_status.video) return;
if((this.name==='gain'||this.name==='lose')&&!_status.gameDrawed) return; if((this.name==='gain'||this.name==='lose')&&!_status.gameDrawed) return;
@ -31299,6 +31340,7 @@
} }
var fullskills=game.expandSkills(player.getSkills(false).concat(lib.skill.global)); var fullskills=game.expandSkills(player.getSkills(false).concat(lib.skill.global));
var info=get.info(skill); var info=get.info(skill);
if(!info) console.log('缺少info的技能:',skill);
if(((info&&info.noHidden)||get.mode()!='guozhan')&&!fullskills.contains(skill)){ if(((info&&info.noHidden)||get.mode()!='guozhan')&&!fullskills.contains(skill)){
return false; return false;
} }
@ -31539,6 +31581,7 @@
}, },
targetEnabledx:function(card,player,target){ targetEnabledx:function(card,player,target){
if(!card) return false; if(!card) return false;
if(!target||!target.isIn()) return false;
var event=_status.event; var event=_status.event;
if(event._backup&&event._backup.filterCard==lib.filter.filterCard&&(!lib.filter.cardEnabled(card,player,event)||!lib.filter.cardUsable(card,player,event))) return false; if(event._backup&&event._backup.filterCard==lib.filter.filterCard&&(!lib.filter.cardEnabled(card,player,event)||!lib.filter.cardUsable(card,player,event))) return false;
if(event.addCount_extra){ if(event.addCount_extra){
@ -31550,6 +31593,7 @@
}, },
targetEnabled:function(card,player,target){ targetEnabled:function(card,player,target){
if(!card) return false; if(!card) return false;
if(!target||!target.isIn()) return false;
var info=get.info(card); var info=get.info(card);
var filter=info.filterTarget; var filter=info.filterTarget;
if(!info.singleCard||ui.selected.targets.length==0){ if(!info.singleCard||ui.selected.targets.length==0){
@ -31562,8 +31606,9 @@
if(typeof filter=='function') return Boolean(filter(card,player,target)); if(typeof filter=='function') return Boolean(filter(card,player,target));
}, },
targetEnabled2:function(card,player,target){ targetEnabled2:function(card,player,target){
if(lib.filter.targetEnabled(card,player,target)) return true;
if(!card) return false; if(!card) return false;
if(!target||!target.isIn()) return false;
if(lib.filter.targetEnabled(card,player,target)) return true;
if(game.checkMod(card,player,target,'unchanged','playerEnabled',player)==false) return false; if(game.checkMod(card,player,target,'unchanged','playerEnabled',player)==false) return false;
if(game.checkMod(card,player,target,'unchanged','targetEnabled',target)==false) return false; if(game.checkMod(card,player,target,'unchanged','targetEnabled',target)==false) return false;
@ -31575,6 +31620,7 @@
}, },
targetEnabled3:function(card,player,target){ targetEnabled3:function(card,player,target){
if(!card) return false; if(!card) return false;
if(!target||!target.isIn()) return false;
var info=get.info(card); var info=get.info(card);
if(info.filterTarget==true) return true; if(info.filterTarget==true) return true;
@ -57538,7 +57584,7 @@
} }
}, },
round:(num,f)=>{ round:(num,f)=>{
var round=10**f; var round=Math.pow(10,f);
return Math.round(num*round)/round; return Math.round(num*round)/round;
}, },
playerNumber:()=>{ playerNumber:()=>{

View File

@ -2659,7 +2659,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
if(!player.hasEmptySlot('equip2')) return false; if(!player.hasEmptySlot('equip2')) return false;
if(event.card.name=='nanman') return true; if(event.card.name=='nanman') return true;
if(event.card.name=='wanjian') return true; if(event.card.name=='wanjian') return true;
return event.card.name=='sha'&&game.hasNature(event.card); return event.card.name=='sha'&&!game.hasNature(event.card);
}, },
content:function(){ content:function(){
trigger.cancel(); trigger.cancel();

View File

@ -363,7 +363,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
}, },
}); });
for(var i=0;i<game.players.length;i++){ for(var i=0;i<game.players.length;i++){
game.addVideo('markSkill',game.players[i],['mougong_nuqi']); //game.addVideo('markSkill',game.players[i],['mougong_nuqi']);
game.players[i].ai.shown=0; game.players[i].ai.shown=0;
} }
game.neiDoCamouflage(); game.neiDoCamouflage();