Fix Yingbian and sbtongye AI.
This commit is contained in:
parent
18cebfb44e
commit
b06e462f03
|
@ -434,10 +434,9 @@ game.import('card',function(lib,game,ui,get,ai,_status){
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
_yingbian:{
|
_yingbian:{
|
||||||
trigger:{player:'useCard1'},
|
trigger:{player:'yingbian'},
|
||||||
forced:true,
|
forced:true,
|
||||||
popup:false,
|
popup:false,
|
||||||
firstDo:true,
|
|
||||||
ruleSkill:true,
|
ruleSkill:true,
|
||||||
forceLoad:true,
|
forceLoad:true,
|
||||||
filter:(event,player)=>{
|
filter:(event,player)=>{
|
||||||
|
|
|
@ -4262,9 +4262,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
asara_yingwei:{
|
asara_yingwei:{
|
||||||
trigger:{player:'useCardBegin'},
|
trigger:{player:'yingbian'},
|
||||||
forced:true,
|
forced:true,
|
||||||
filter:event=>event.card.isCard&&event.cards.some(value=>value.hasGaintag('asara_yingwei')),
|
filter:(event,player)=>event.card.isCard&&player.hasHistory('lose',evt=>evt.getParent()==event&&Object.values(evt.gaintag_map).some(value=>value.includes('asara_yingwei'))),
|
||||||
content:()=>{
|
content:()=>{
|
||||||
trigger.forceYingbian=true;
|
trigger.forceYingbian=true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2341,9 +2341,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
group:'hina_shenshi_yingbian',
|
group:'hina_shenshi_yingbian',
|
||||||
},
|
},
|
||||||
hina_shenshi_yingbian:{
|
hina_shenshi_yingbian:{
|
||||||
trigger:{player:'useCardBegin'},
|
trigger:{player:'yingbian'},
|
||||||
forced:true,
|
forced:true,
|
||||||
filter:event=>event.card.isCard&&event.cards.some(value=>value.hasGaintag('hina_shenshi')),
|
filter:(event,player)=>event.card.isCard&&player.hasHistory('lose',evt=>evt.getParent()==event&&Object.values(evt.gaintag_map).some(value=>value.includes('hina_shenshi'))),
|
||||||
content:()=>{
|
content:()=>{
|
||||||
if(!Array.isArray(trigger.temporaryYingbian)) trigger.temporaryYingbian=[];
|
if(!Array.isArray(trigger.temporaryYingbian)) trigger.temporaryYingbian=[];
|
||||||
trigger.temporaryYingbian.add('force');
|
trigger.temporaryYingbian.add('force');
|
||||||
|
@ -2352,11 +2352,20 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
},
|
},
|
||||||
hina_xingzhi:{
|
hina_xingzhi:{
|
||||||
groupSkill:true,
|
groupSkill:true,
|
||||||
trigger:{player:'useCard1'},
|
trigger:{player:'yingbian'},
|
||||||
usable:1,
|
usable:1,
|
||||||
filter:(event,player)=>player.group=='key'&&!event.card.yingbian&&lib.yingbian.condition.complex.has('zhuzhan'),
|
filter:(event,player)=>player.group=='key'&&!event.card.yingbian&&lib.yingbian.condition.complex.has('zhuzhan'),
|
||||||
content:()=>{
|
content:()=>{
|
||||||
'step 0'
|
'step 0'
|
||||||
|
trigger.yingbianZhuzhanAI=(player,card,source,targets)=>cardx=>{
|
||||||
|
if(get.attitude(player,source)<=0) return 0;
|
||||||
|
var info=get.info(card),num=0;
|
||||||
|
if(info&&info.ai&&info.ai.yingbian){
|
||||||
|
var ai=info.ai.yingbian(card,source,targets,player);
|
||||||
|
if(ai) num=ai;
|
||||||
|
}
|
||||||
|
return Math.max(num,6)-get.value(cardx);
|
||||||
|
};
|
||||||
trigger.afterYingbianZhuzhan=event=>event.zhuzhanresult.draw(2);
|
trigger.afterYingbianZhuzhan=event=>event.zhuzhanresult.draw(2);
|
||||||
lib.yingbian.condition.complex.get('zhuzhan')(trigger);
|
lib.yingbian.condition.complex.get('zhuzhan')(trigger);
|
||||||
'step 1'
|
'step 1'
|
||||||
|
|
|
@ -3610,7 +3610,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
onremove:true,
|
onremove:true,
|
||||||
content:function(){
|
content:function(){
|
||||||
'step 0'
|
'step 0'
|
||||||
player.chooseControl('变化','不变').set('prompt','统业:猜测场上装备数是否于你下回合准备阶段前发生变化').set('ai',()=>(game.countPlayer()<=4?Math.random():1)<0.4);
|
player.chooseControl('变化','不变').set('prompt','统业:猜测场上装备数是否于你下回合准备阶段前发生变化').set('ai',()=>Number((game.countPlayer()<=4?Math.random():1)<0.4));
|
||||||
'step 1'
|
'step 1'
|
||||||
if(result.control=='变化'){
|
if(result.control=='变化'){
|
||||||
player.addSkill('sbtongye_change',1);
|
player.addSkill('sbtongye_change',1);
|
||||||
|
|
167
character/tw.js
167
character/tw.js
|
@ -7447,7 +7447,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
'step 2'
|
'step 2'
|
||||||
player.chooseToCompare(targets,function(card){
|
player.chooseToCompare(targets,function(card){
|
||||||
return get.number(card);
|
return get.number(card);
|
||||||
}).setContent(lib.skill.twchaofeng.chooseToCompareMeanwhile);
|
}).setContent('chooseToCompareMeanwhile');
|
||||||
'step 3'
|
'step 3'
|
||||||
if(result.winner&&result.winner==player){
|
if(result.winner&&result.winner==player){
|
||||||
event.targets.remove(result.winner);
|
event.targets.remove(result.winner);
|
||||||
|
@ -7685,7 +7685,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
if(result.bool){
|
if(result.bool){
|
||||||
event.targets=result.targets;
|
event.targets=result.targets;
|
||||||
player.logSkill('twchaofeng_compare',event.targets);
|
player.logSkill('twchaofeng_compare',event.targets);
|
||||||
player.chooseToCompare(event.targets).setContent(lib.skill.twchaofeng.chooseToCompareMeanwhile);
|
player.chooseToCompare(event.targets).setContent('chooseToCompareMeanwhile');
|
||||||
}
|
}
|
||||||
'step 2'
|
'step 2'
|
||||||
if(result.winner){
|
if(result.winner){
|
||||||
|
@ -7699,169 +7699,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
chooseToCompareMeanwhile:function(){
|
|
||||||
'step 0'
|
|
||||||
if(player.countCards('h')==0){
|
|
||||||
event.result={cancelled:true,bool:false}
|
|
||||||
event.finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for(var i=0; i<targets.length; i++){
|
|
||||||
if(targets[i].countCards('h')==0){
|
|
||||||
event.result={cancelled:true,bool:false}
|
|
||||||
event.finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!event.multitarget){
|
|
||||||
targets.sort(lib.sort.seat);
|
|
||||||
}
|
|
||||||
game.log(player,'对',targets,'发起了共同拼点');
|
|
||||||
event.compareMeanwhile=true;
|
|
||||||
'step 1'
|
|
||||||
event._result=[];
|
|
||||||
event.list=targets.filter(function(current){
|
|
||||||
return !event.fixedResult||!event.fixedResult[current.playerid];
|
|
||||||
});
|
|
||||||
if(event.list.length||!event.fixedResult||!event.fixedResult[player.playerid]){
|
|
||||||
if(!event.fixedResult||!event.fixedResult[player.playerid]) event.list.unshift(player);
|
|
||||||
player.chooseCardOL(event.list,'请选择拼点牌',true).set('type','compare').set('ai',event.ai).set('source',player).aiCard=function(target){
|
|
||||||
var hs=target.getCards('h');
|
|
||||||
var event=_status.event;
|
|
||||||
event.player=target;
|
|
||||||
hs.sort(function(a,b){
|
|
||||||
return event.ai(b)-event.ai(a);
|
|
||||||
});
|
|
||||||
delete event.player;
|
|
||||||
return {bool:true,cards:[hs[0]]};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
'step 2'
|
|
||||||
var cards=[];
|
|
||||||
var lose_list=[];
|
|
||||||
if(event.fixedResult&&event.fixedResult[player.playerid]){
|
|
||||||
event.list.unshift(player);
|
|
||||||
result.unshift({bool:true,cards:[event.fixedResult[player.playerid]]});
|
|
||||||
lose_list.push([player,[event.fixedResult[player.playerid]]]);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(result[0].skill&&lib.skill[result[0].skill]&&lib.skill[result[0].skill].onCompare){
|
|
||||||
player.logSkill(result[0].skill);
|
|
||||||
result[0].cards=lib.skill[result[0].skill].onCompare(player)
|
|
||||||
}
|
|
||||||
else lose_list.push([player,result[0].cards]);
|
|
||||||
};
|
|
||||||
for(var j=0; j<targets.length; j++){
|
|
||||||
if(event.list.contains(targets[j])){
|
|
||||||
var i=event.list.indexOf(targets[j]);
|
|
||||||
if(result[i].skill&&lib.skill[result[i].skill]&&lib.skill[result[i].skill].onCompare){
|
|
||||||
event.list[i].logSkill(result[i].skill);
|
|
||||||
result[i].cards=lib.skill[result[i].skill].onCompare(event.list[i]);
|
|
||||||
}
|
|
||||||
else lose_list.push([targets[j],result[i].cards]);
|
|
||||||
cards.push(result[i].cards[0]);
|
|
||||||
}
|
|
||||||
else if(event.fixedResult&&event.fixedResult[targets[j].playerid]){
|
|
||||||
cards.push(event.fixedResult[targets[j].playerid]);
|
|
||||||
lose_list.push([targets[j],[event.fixedResult[targets[j].playerid]]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(lose_list.length){
|
|
||||||
game.loseAsync({
|
|
||||||
lose_list:lose_list,
|
|
||||||
}).setContent('chooseToCompareLose');
|
|
||||||
}
|
|
||||||
event.lose_list=lose_list;
|
|
||||||
event.getNum=function(card){
|
|
||||||
for(var i of event.lose_list){
|
|
||||||
if(i[1].contains&&i[1].contains(card)) return get.number(card,i[0]);
|
|
||||||
}
|
|
||||||
return get.number(card,false);
|
|
||||||
}
|
|
||||||
event.cardlist=cards;
|
|
||||||
event.cards=cards;
|
|
||||||
event.card1=result[0].cards[0];
|
|
||||||
event.num1=event.getNum(event.card1);
|
|
||||||
event.iwhile=0;
|
|
||||||
event.winner=null;
|
|
||||||
event.maxNum=-1;
|
|
||||||
event.tempplayer=event.player;
|
|
||||||
event.result={
|
|
||||||
winner:null,
|
|
||||||
player:event.card1,
|
|
||||||
targets:event.cardlist.slice(0),
|
|
||||||
num1:[],
|
|
||||||
num2:[],
|
|
||||||
};
|
|
||||||
player.$compareMultiple(event.card1,targets,cards);
|
|
||||||
game.log(player,'的拼点牌为',event.card1);
|
|
||||||
player.animate('target');
|
|
||||||
game.delay(0,1000);
|
|
||||||
'step 3'
|
|
||||||
event.target=null;
|
|
||||||
event.trigger('compare');
|
|
||||||
'step 4'
|
|
||||||
if(event.iwhile<targets.length){
|
|
||||||
event.target=targets[event.iwhile];
|
|
||||||
event.target.animate('target');
|
|
||||||
event.card2=event.cardlist[event.iwhile];
|
|
||||||
event.num2=event.getNum(event.card2);
|
|
||||||
game.log(event.target,'的拼点牌为',event.card2);
|
|
||||||
//event.tempplayer.line(event.target);
|
|
||||||
delete event.player;
|
|
||||||
event.trigger('compare');
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
game.delay(0,1000);
|
|
||||||
event.goto(7);
|
|
||||||
}
|
|
||||||
'step 5'
|
|
||||||
event.result.num1[event.iwhile]=event.num1;
|
|
||||||
event.result.num2[event.iwhile]=event.num2;
|
|
||||||
var list=[[event.tempplayer,event.num1],[event.target,event.num2]];
|
|
||||||
for(var i of list){
|
|
||||||
if(i[1]>event.maxNum){
|
|
||||||
event.maxNum=i[1];
|
|
||||||
event.winner=i[0];
|
|
||||||
}
|
|
||||||
else if(event.winner&&i[1]==event.maxNum&&i[0]!=event.winner){
|
|
||||||
event.winner=null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'step 6'
|
|
||||||
event.iwhile++;
|
|
||||||
event.goto(4);
|
|
||||||
'step 7'
|
|
||||||
var player=event.tempplayer;
|
|
||||||
event.player=player;
|
|
||||||
delete event.tempplayer;
|
|
||||||
var str='无人拼点成功';
|
|
||||||
if(event.winner){
|
|
||||||
event.result.winner=event.winner;
|
|
||||||
str=get.translation(event.winner)+'拼点成功';
|
|
||||||
game.log(event.winner,'拼点成功');
|
|
||||||
event.winner.popup('胜');
|
|
||||||
} else game.log('#b无人','拼点成功');
|
|
||||||
var list=[player].addArray(targets);
|
|
||||||
list.remove(event.winner);
|
|
||||||
for(var i of list){
|
|
||||||
i.popup('负');
|
|
||||||
}
|
|
||||||
if(str){
|
|
||||||
game.broadcastAll(function(str){
|
|
||||||
var dialog=ui.create.dialog(str);
|
|
||||||
dialog.classList.add('center');
|
|
||||||
setTimeout(function(){
|
|
||||||
dialog.close();
|
|
||||||
},1000);
|
|
||||||
},str);
|
|
||||||
}
|
|
||||||
game.delay(3);
|
|
||||||
'step 8'
|
|
||||||
game.broadcastAll(ui.clear);
|
|
||||||
'step 9'
|
|
||||||
event.cards.add(event.card1);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
twchuanshu:{
|
twchuanshu:{
|
||||||
|
|
|
@ -6443,7 +6443,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
target.gain(cards,'draw');
|
target.gain(cards,'draw');
|
||||||
event.goto(4);
|
event.goto(4);
|
||||||
},
|
},
|
||||||
group:'dcgeyuan_qyubee',
|
group:'dcgeyuan_kyubey',
|
||||||
filterNumber:function(player,num){
|
filterNumber:function(player,num){
|
||||||
var list1=player.getStorage('dcgeyuan');
|
var list1=player.getStorage('dcgeyuan');
|
||||||
var list2=player.getStorage('dcgeyuan_homura');
|
var list2=player.getStorage('dcgeyuan_homura');
|
||||||
|
@ -6459,7 +6459,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
subSkill:{
|
subSkill:{
|
||||||
qyubee:{
|
kyubey:{
|
||||||
audio:'dcgeyuan',
|
audio:'dcgeyuan',
|
||||||
trigger:{
|
trigger:{
|
||||||
global:'phaseBefore',
|
global:'phaseBefore',
|
||||||
|
@ -6494,7 +6494,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
if(!storage||!storage.length) return '(圆环之理尚不存在)';
|
if(!storage||!storage.length) return '(圆环之理尚不存在)';
|
||||||
var list2=player.getStorage('dcgeyuan_homura');
|
var list2=player.getStorage('dcgeyuan_homura');
|
||||||
var core=document.createElement('div');
|
var core=document.createElement('div');
|
||||||
var centerX=-10,centerY=80,radius=80;
|
core.style.width='0';
|
||||||
|
var centerX=-15,centerY=80,radius=80;
|
||||||
var radian=Math.PI*2/list.length;
|
var radian=Math.PI*2/list.length;
|
||||||
var fulllist=['A','2','3','4','5','6','7','8','9','10','J','Q','K'];
|
var fulllist=['A','2','3','4','5','6','7','8','9','10','J','Q','K'];
|
||||||
for(var i=0;i<list.length;i++){
|
for(var i=0;i<list.length;i++){
|
||||||
|
|
284
game/game.js
284
game/game.js
|
@ -111,6 +111,7 @@
|
||||||
skill:{},
|
skill:{},
|
||||||
card:{},
|
card:{},
|
||||||
},
|
},
|
||||||
|
onload:[],
|
||||||
arenaReady:[],
|
arenaReady:[],
|
||||||
onfree:[],
|
onfree:[],
|
||||||
inpile:[],
|
inpile:[],
|
||||||
|
@ -165,11 +166,12 @@
|
||||||
yingbianZhuzhan.player=event.player;
|
yingbianZhuzhan.player=event.player;
|
||||||
yingbianZhuzhan.card=event.card;
|
yingbianZhuzhan.card=event.card;
|
||||||
yingbianZhuzhan._trigger=event;
|
yingbianZhuzhan._trigger=event;
|
||||||
|
yingbianZhuzhan.yingbianZhuzhanAI=event.yingbianZhuzhanAI;
|
||||||
yingbianZhuzhan.afterYingbianZhuzhan=event.afterYingbianZhuzhan;
|
yingbianZhuzhan.afterYingbianZhuzhan=event.afterYingbianZhuzhan;
|
||||||
yingbianZhuzhan.setContent(()=>{
|
yingbianZhuzhan.setContent(()=>{
|
||||||
'step 0'
|
'step 0'
|
||||||
event._global_waiting=true;
|
event._global_waiting=true;
|
||||||
event.send=(player,card,source,targets,id,id2,skillState)=>{
|
event.send=(player,card,source,targets,id,id2,yingbianZhuzhanAI,skillState)=>{
|
||||||
if(skillState) player.applySkills(skillState);
|
if(skillState) player.applySkills(skillState);
|
||||||
var type=get.type2(card),str=get.translation(source);
|
var type=get.type2(card),str=get.translation(source);
|
||||||
if(targets&&targets.length) str+=`对${get.translation(targets)}`;
|
if(targets&&targets.length) str+=`对${get.translation(targets)}`;
|
||||||
|
@ -181,7 +183,7 @@
|
||||||
_global_waiting:true,
|
_global_waiting:true,
|
||||||
id:id,
|
id:id,
|
||||||
id2:id2,
|
id2:id2,
|
||||||
ai:cardx=>{
|
ai:typeof yingbianZhuzhanAI=='function'?yingbianZhuzhanAI(player,card,source,targets):cardx=>{
|
||||||
var info=get.info(card);
|
var info=get.info(card);
|
||||||
if(info&&info.ai&&info.ai.yingbian){
|
if(info&&info.ai&&info.ai.yingbian){
|
||||||
var ai=info.ai.yingbian(card,source,targets,player);
|
var ai=info.ai.yingbian(card,source,targets,player);
|
||||||
|
@ -203,7 +205,7 @@
|
||||||
'step 2'
|
'step 2'
|
||||||
if(!event.list.length) event.finish();
|
if(!event.list.length) event.finish();
|
||||||
else if(_status.connectMode&&(event.list[0].isOnline()||event.list[0]==game.me)) event.goto(4);
|
else if(_status.connectMode&&(event.list[0].isOnline()||event.list[0]==game.me)) event.goto(4);
|
||||||
else event.send(event.current=event.list.shift(),event.card,player,trigger.targets,event.id,trigger.parent.id);
|
else event.send(event.current=event.list.shift(),event.card,player,trigger.targets,event.id,trigger.parent.id,trigger.yingbianZhuzhanAI);
|
||||||
'step 3'
|
'step 3'
|
||||||
if(result.bool){
|
if(result.bool){
|
||||||
event.zhuzhanresult=event.current;
|
event.zhuzhanresult=event.current;
|
||||||
|
@ -231,12 +233,12 @@
|
||||||
if(current.isOnline()){
|
if(current.isOnline()){
|
||||||
withol=true;
|
withol=true;
|
||||||
current.wait(sendback);
|
current.wait(sendback);
|
||||||
current.send(event.send,current,event.card,player,trigger.targets,event.id,trigger.parent.id,get.skillState(current));
|
current.send(event.send,current,event.card,player,trigger.targets,event.id,trigger.parent.id,trigger.yingbianZhuzhanAI,get.skillState(current));
|
||||||
list.splice(i--,1);
|
list.splice(i--,1);
|
||||||
}
|
}
|
||||||
else if(current==game.me){
|
else if(current==game.me){
|
||||||
withme=true;
|
withme=true;
|
||||||
event.send(current,event.card,player,trigger.targets,event.id,trigger.parent.id);
|
event.send(current,event.card,player,trigger.targets,event.id,trigger.parent.id,trigger.yingbianZhuzhanAI);
|
||||||
list.splice(i--,1);
|
list.splice(i--,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8790,6 +8792,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onload:function(){
|
onload:function(){
|
||||||
|
const libOnload=lib.onload;
|
||||||
|
delete lib.onload;
|
||||||
|
while(libOnload.length){
|
||||||
|
libOnload.shift()();
|
||||||
|
}
|
||||||
ui.updated();
|
ui.updated();
|
||||||
game.documentZoom=game.deviceZoom;
|
game.documentZoom=game.deviceZoom;
|
||||||
if(game.documentZoom!=1){
|
if(game.documentZoom!=1){
|
||||||
|
@ -9664,55 +9671,36 @@
|
||||||
name:name
|
name:name
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
js:function(path,file,onload,onerror){
|
js:(path,file,onload,onerror)=>{
|
||||||
if(path[path.length-1]=='/'){
|
if(path[path.length-1]=='/') path=path.slice(0,path.length-1);
|
||||||
path=path.slice(0,path.length-1);
|
if(path==`${lib.assetURL}mode`&&lib.config.all.stockmode.indexOf(file)==-1){
|
||||||
}
|
lib.init[`setMode_${file}`]();
|
||||||
if(path==lib.assetURL+'mode'&&lib.config.all.stockmode.indexOf(file)==-1){
|
|
||||||
lib.init['setMode_'+file]();
|
|
||||||
onload();
|
onload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(Array.isArray(file)){
|
if(Array.isArray(file)){
|
||||||
for(var i=0;i<file.length;i++){
|
file.forEach(value=>lib.init.js(path,value,onload,onerror));
|
||||||
lib.init.js(path,file[i],onload,onerror);
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{
|
let script_src;
|
||||||
var script_src;
|
if(!file) script_src=path;
|
||||||
if(!file){
|
else script_src=`${path}/${file}.js`;
|
||||||
script_src = path;
|
if(path.indexOf('http')==0) script_src+=`?rand=${get.id()}`;
|
||||||
}
|
else if(game.readFile&&lib.config.fuck_sojson&&script_src.includes('extension')!=-1&&script_src.indexOf(lib.assetURL)==0){
|
||||||
else{
|
const path_to_read=script_src.slice(lib.assetURL.length);
|
||||||
script_src = path+'/'+file+".js";
|
game.readFileAsText(path_to_read,result=>{
|
||||||
}
|
if(result.includes('sojson')||result.includes('jsjiami')||result.includes('var _0x')) alert(`检测到您安装了使用免费版sojson进行加密的扩展。请谨慎使用这些扩展,避免游戏数据遭到破坏。\n扩展文件:${path_to_read}`);
|
||||||
if(path.indexOf('http')==0){
|
},()=>void 0);
|
||||||
script_src+='?rand='+get.id();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(game.readFile&&lib.config.fuck_sojson&&script_src.includes('extension')!=-1&&script_src.indexOf(lib.assetURL)==0){
|
|
||||||
var path_to_read=script_src.slice(lib.assetURL.length);
|
|
||||||
game.readFileAsText(path_to_read,function(result){
|
|
||||||
if(result.includes('sojson')||result.includes('jsjiami')||result.includes('var _0x')) alert('检测到您安装了使用免费版sojson进行加密的扩展。请谨慎使用这些扩展,避免游戏数据遭到破坏。\n扩展文件:'+path_to_read);
|
|
||||||
},function(){
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var script=document.createElement('script');
|
|
||||||
script.src=script_src;
|
|
||||||
if(path.indexOf('http')==0){
|
|
||||||
script.addEventListener('load',function(){
|
|
||||||
script.remove();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
document.head.appendChild(script);
|
|
||||||
if(typeof onload=='function'){
|
|
||||||
script.addEventListener('load',onload);
|
|
||||||
script.addEventListener('error',onerror);
|
|
||||||
}
|
|
||||||
return script;
|
|
||||||
}
|
}
|
||||||
|
const script=document.createElement('script');
|
||||||
|
script.src=script_src;
|
||||||
|
if(path.indexOf('http')==0) script.addEventListener('load',()=>script.remove());
|
||||||
|
document.head.appendChild(script);
|
||||||
|
if(typeof onload=='function'){
|
||||||
|
script.addEventListener('load',onload);
|
||||||
|
script.addEventListener('error',onerror);
|
||||||
|
}
|
||||||
|
return script;
|
||||||
},
|
},
|
||||||
req:function(str,onload,onerror,master){
|
req:function(str,onload,onerror,master){
|
||||||
var sScriptURL;
|
var sScriptURL;
|
||||||
|
@ -14218,6 +14206,172 @@
|
||||||
next.getlx=false;
|
next.getlx=false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
chooseToCompareMeanwhile:function(){
|
||||||
|
'step 0'
|
||||||
|
if(player.countCards('h')==0){
|
||||||
|
event.result={cancelled:true,bool:false}
|
||||||
|
event.finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(var i=0; i<targets.length; i++){
|
||||||
|
if(targets[i].countCards('h')==0){
|
||||||
|
event.result={cancelled:true,bool:false}
|
||||||
|
event.finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!event.multitarget){
|
||||||
|
targets.sort(lib.sort.seat);
|
||||||
|
}
|
||||||
|
game.log(player,'对',targets,'发起了共同拼点');
|
||||||
|
event.compareMeanwhile=true;
|
||||||
|
'step 1'
|
||||||
|
event._result=[];
|
||||||
|
event.list=targets.filter(function(current){
|
||||||
|
return !event.fixedResult||!event.fixedResult[current.playerid];
|
||||||
|
});
|
||||||
|
if(event.list.length||!event.fixedResult||!event.fixedResult[player.playerid]){
|
||||||
|
if(!event.fixedResult||!event.fixedResult[player.playerid]) event.list.unshift(player);
|
||||||
|
player.chooseCardOL(event.list,'请选择拼点牌',true).set('type','compare').set('ai',event.ai).set('source',player).aiCard=function(target){
|
||||||
|
var hs=target.getCards('h');
|
||||||
|
var event=_status.event;
|
||||||
|
event.player=target;
|
||||||
|
hs.sort(function(a,b){
|
||||||
|
return event.ai(b)-event.ai(a);
|
||||||
|
});
|
||||||
|
delete event.player;
|
||||||
|
return {bool:true,cards:[hs[0]]};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'step 2'
|
||||||
|
var cards=[];
|
||||||
|
var lose_list=[];
|
||||||
|
if(event.fixedResult&&event.fixedResult[player.playerid]){
|
||||||
|
event.list.unshift(player);
|
||||||
|
result.unshift({bool:true,cards:[event.fixedResult[player.playerid]]});
|
||||||
|
lose_list.push([player,[event.fixedResult[player.playerid]]]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(result[0].skill&&lib.skill[result[0].skill]&&lib.skill[result[0].skill].onCompare){
|
||||||
|
player.logSkill(result[0].skill);
|
||||||
|
result[0].cards=lib.skill[result[0].skill].onCompare(player)
|
||||||
|
}
|
||||||
|
else lose_list.push([player,result[0].cards]);
|
||||||
|
};
|
||||||
|
for(var j=0; j<targets.length; j++){
|
||||||
|
if(event.list.contains(targets[j])){
|
||||||
|
var i=event.list.indexOf(targets[j]);
|
||||||
|
if(result[i].skill&&lib.skill[result[i].skill]&&lib.skill[result[i].skill].onCompare){
|
||||||
|
event.list[i].logSkill(result[i].skill);
|
||||||
|
result[i].cards=lib.skill[result[i].skill].onCompare(event.list[i]);
|
||||||
|
}
|
||||||
|
else lose_list.push([targets[j],result[i].cards]);
|
||||||
|
cards.push(result[i].cards[0]);
|
||||||
|
}
|
||||||
|
else if(event.fixedResult&&event.fixedResult[targets[j].playerid]){
|
||||||
|
cards.push(event.fixedResult[targets[j].playerid]);
|
||||||
|
lose_list.push([targets[j],[event.fixedResult[targets[j].playerid]]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(lose_list.length){
|
||||||
|
game.loseAsync({
|
||||||
|
lose_list:lose_list,
|
||||||
|
}).setContent('chooseToCompareLose');
|
||||||
|
}
|
||||||
|
event.lose_list=lose_list;
|
||||||
|
event.getNum=function(card){
|
||||||
|
for(var i of event.lose_list){
|
||||||
|
if(i[1].contains&&i[1].contains(card)) return get.number(card,i[0]);
|
||||||
|
}
|
||||||
|
return get.number(card,false);
|
||||||
|
}
|
||||||
|
event.cardlist=cards;
|
||||||
|
event.cards=cards;
|
||||||
|
event.card1=result[0].cards[0];
|
||||||
|
event.num1=event.getNum(event.card1);
|
||||||
|
event.iwhile=0;
|
||||||
|
event.winner=null;
|
||||||
|
event.maxNum=-1;
|
||||||
|
event.tempplayer=event.player;
|
||||||
|
event.result={
|
||||||
|
winner:null,
|
||||||
|
player:event.card1,
|
||||||
|
targets:event.cardlist.slice(0),
|
||||||
|
num1:[],
|
||||||
|
num2:[],
|
||||||
|
};
|
||||||
|
'step 3'
|
||||||
|
event.trigger('compareCardShowBefore');
|
||||||
|
'step 4'
|
||||||
|
player.$compareMultiple(event.card1,targets,cards);
|
||||||
|
game.log(player,'的拼点牌为',event.card1);
|
||||||
|
player.animate('target');
|
||||||
|
game.delay(0,1000);
|
||||||
|
'step 5'
|
||||||
|
event.target=null;
|
||||||
|
event.trigger('compare');
|
||||||
|
'step 6'
|
||||||
|
if(event.iwhile<targets.length){
|
||||||
|
event.target=targets[event.iwhile];
|
||||||
|
event.target.animate('target');
|
||||||
|
event.card2=event.cardlist[event.iwhile];
|
||||||
|
event.num2=event.getNum(event.card2);
|
||||||
|
game.log(event.target,'的拼点牌为',event.card2);
|
||||||
|
//event.tempplayer.line(event.target);
|
||||||
|
delete event.player;
|
||||||
|
event.trigger('compare');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
game.delay(0,1000);
|
||||||
|
event.goto(9);
|
||||||
|
}
|
||||||
|
'step 7'
|
||||||
|
event.result.num1[event.iwhile]=event.num1;
|
||||||
|
event.result.num2[event.iwhile]=event.num2;
|
||||||
|
var list=[[event.tempplayer,event.num1],[event.target,event.num2]];
|
||||||
|
for(var i of list){
|
||||||
|
if(i[1]>event.maxNum){
|
||||||
|
event.maxNum=i[1];
|
||||||
|
event.winner=i[0];
|
||||||
|
}
|
||||||
|
else if(event.winner&&i[1]==event.maxNum&&i[0]!=event.winner){
|
||||||
|
event.winner=null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'step 8'
|
||||||
|
event.iwhile++;
|
||||||
|
event.goto(6);
|
||||||
|
'step 9'
|
||||||
|
var player=event.tempplayer;
|
||||||
|
event.player=player;
|
||||||
|
delete event.tempplayer;
|
||||||
|
var str='无人拼点成功';
|
||||||
|
if(event.winner){
|
||||||
|
event.result.winner=event.winner;
|
||||||
|
str=get.translation(event.winner)+'拼点成功';
|
||||||
|
game.log(event.winner,'拼点成功');
|
||||||
|
event.winner.popup('胜');
|
||||||
|
} else game.log('#b无人','拼点成功');
|
||||||
|
var list=[player].addArray(targets);
|
||||||
|
list.remove(event.winner);
|
||||||
|
for(var i of list){
|
||||||
|
i.popup('负');
|
||||||
|
}
|
||||||
|
if(str){
|
||||||
|
game.broadcastAll(function(str){
|
||||||
|
var dialog=ui.create.dialog(str);
|
||||||
|
dialog.classList.add('center');
|
||||||
|
setTimeout(function(){
|
||||||
|
dialog.close();
|
||||||
|
},1000);
|
||||||
|
},str);
|
||||||
|
}
|
||||||
|
game.delay(3);
|
||||||
|
'step 10'
|
||||||
|
game.broadcastAll(ui.clear);
|
||||||
|
'step 11'
|
||||||
|
event.cards.add(event.card1);
|
||||||
|
},
|
||||||
chooseToCompareMultiple:function(){
|
chooseToCompareMultiple:function(){
|
||||||
"step 0"
|
"step 0"
|
||||||
if(player.countCards('h')==0){
|
if(player.countCards('h')==0){
|
||||||
|
@ -16346,8 +16500,10 @@
|
||||||
}
|
}
|
||||||
event.trigger('useCard1');
|
event.trigger('useCard1');
|
||||||
"step 1"
|
"step 1"
|
||||||
event.trigger('useCard2');
|
event.trigger('yingbian');
|
||||||
"step 2"
|
"step 2"
|
||||||
|
event.trigger('useCard2');
|
||||||
|
"step 3"
|
||||||
event.trigger('useCard');
|
event.trigger('useCard');
|
||||||
event._oncancel=function(){
|
event._oncancel=function(){
|
||||||
game.broadcastAll(function(id){
|
game.broadcastAll(function(id){
|
||||||
|
@ -16357,7 +16513,7 @@
|
||||||
}
|
}
|
||||||
},event.id);
|
},event.id);
|
||||||
};
|
};
|
||||||
"step 3"
|
"step 4"
|
||||||
event.sortTarget=function(animate,sort){
|
event.sortTarget=function(animate,sort){
|
||||||
var info=get.info(card,false);
|
var info=get.info(card,false);
|
||||||
if(num==0&&targets.length>1){
|
if(num==0&&targets.length>1){
|
||||||
|
@ -16384,7 +16540,7 @@
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
"step 4"
|
"step 5"
|
||||||
if(event.all_excluded) return;
|
if(event.all_excluded) return;
|
||||||
if(!event.triggeredTargets1) event.triggeredTargets1=[];
|
if(!event.triggeredTargets1) event.triggeredTargets1=[];
|
||||||
var target=event.getTriggerTarget(targets,event.triggeredTargets1);
|
var target=event.getTriggerTarget(targets,event.triggeredTargets1);
|
||||||
|
@ -16408,7 +16564,7 @@
|
||||||
if(event.forceDie) next.forceDie=true;
|
if(event.forceDie) next.forceDie=true;
|
||||||
event.redo();
|
event.redo();
|
||||||
}
|
}
|
||||||
"step 5"
|
"step 6"
|
||||||
if(event.all_excluded) return;
|
if(event.all_excluded) return;
|
||||||
if(!event.triggeredTargets2) event.triggeredTargets2=[];
|
if(!event.triggeredTargets2) event.triggeredTargets2=[];
|
||||||
var target=event.getTriggerTarget(targets,event.triggeredTargets2);
|
var target=event.getTriggerTarget(targets,event.triggeredTargets2);
|
||||||
|
@ -16432,7 +16588,7 @@
|
||||||
if(event.forceDie) next.forceDie=true;
|
if(event.forceDie) next.forceDie=true;
|
||||||
event.redo();
|
event.redo();
|
||||||
}
|
}
|
||||||
"step 6"
|
"step 7"
|
||||||
var info=get.info(card,false);
|
var info=get.info(card,false);
|
||||||
if(!info.nodelay&&event.animate!=false){
|
if(!info.nodelay&&event.animate!=false){
|
||||||
if(event.delayx!==false){
|
if(event.delayx!==false){
|
||||||
|
@ -16445,7 +16601,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"step 7"
|
"step 8"
|
||||||
if(event.all_excluded) return;
|
if(event.all_excluded) return;
|
||||||
if(!event.triggeredTargets3) event.triggeredTargets3=[];
|
if(!event.triggeredTargets3) event.triggeredTargets3=[];
|
||||||
var target=event.getTriggerTarget(targets,event.triggeredTargets3);
|
var target=event.getTriggerTarget(targets,event.triggeredTargets3);
|
||||||
|
@ -16469,7 +16625,7 @@
|
||||||
if(event.forceDie) next.forceDie=true;
|
if(event.forceDie) next.forceDie=true;
|
||||||
event.redo();
|
event.redo();
|
||||||
}
|
}
|
||||||
"step 8"
|
"step 9"
|
||||||
if(event.all_excluded) return;
|
if(event.all_excluded) return;
|
||||||
if(!event.triggeredTargets4) event.triggeredTargets4=[];
|
if(!event.triggeredTargets4) event.triggeredTargets4=[];
|
||||||
var target=event.getTriggerTarget(targets,event.triggeredTargets4);
|
var target=event.getTriggerTarget(targets,event.triggeredTargets4);
|
||||||
|
@ -16496,7 +16652,7 @@
|
||||||
}
|
}
|
||||||
event.redo();
|
event.redo();
|
||||||
}
|
}
|
||||||
"step 9"
|
"step 10"
|
||||||
if(event.all_excluded) return;
|
if(event.all_excluded) return;
|
||||||
event.effectedCount++;
|
event.effectedCount++;
|
||||||
event.num=0;
|
event.num=0;
|
||||||
|
@ -16537,7 +16693,7 @@
|
||||||
next.addedTargets=event.addedTargets;
|
next.addedTargets=event.addedTargets;
|
||||||
if(event.forceDie) next.forceDie=true;
|
if(event.forceDie) next.forceDie=true;
|
||||||
}
|
}
|
||||||
"step 10"
|
"step 11"
|
||||||
if(event.all_excluded) return;
|
if(event.all_excluded) return;
|
||||||
var info=get.info(card,false);
|
var info=get.info(card,false);
|
||||||
if(num==0&&targets.length>1){
|
if(num==0&&targets.length>1){
|
||||||
|
@ -16601,13 +16757,13 @@
|
||||||
game.delayx(0.5);
|
game.delayx(0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"step 11"
|
"step 12"
|
||||||
if(event.all_excluded) return;
|
if(event.all_excluded) return;
|
||||||
if(!get.info(event.card,false).multitarget&&num<targets.length-1&&!event.cancelled){
|
if(!get.info(event.card,false).multitarget&&num<targets.length-1&&!event.cancelled){
|
||||||
event.num++;
|
event.num++;
|
||||||
event.goto(10);
|
event.goto(11);
|
||||||
}
|
}
|
||||||
"step 12"
|
"step 13"
|
||||||
if(event.all_excluded) return;
|
if(event.all_excluded) return;
|
||||||
if(get.info(card,false).contentAfter){
|
if(get.info(card,false).contentAfter){
|
||||||
var next=game.createEvent(card.name+'ContentAfter');
|
var next=game.createEvent(card.name+'ContentAfter');
|
||||||
|
@ -16621,15 +16777,15 @@
|
||||||
next.type='postcard';
|
next.type='postcard';
|
||||||
if(event.forceDie) next.forceDie=true;
|
if(event.forceDie) next.forceDie=true;
|
||||||
}
|
}
|
||||||
"step 13"
|
"step 14"
|
||||||
if(event.all_excluded) return;
|
if(event.all_excluded) return;
|
||||||
if(event.effectedCount<event.effectCount){
|
if(event.effectedCount<event.effectCount){
|
||||||
if(document.getElementsByClassName('thrown').length){
|
if(document.getElementsByClassName('thrown').length){
|
||||||
if(event.delayx!==false&&get.info(event.card,false).finalDelay!==false) game.delayx();
|
if(event.delayx!==false&&get.info(event.card,false).finalDelay!==false) game.delayx();
|
||||||
}
|
}
|
||||||
event.goto(9);
|
event.goto(10);
|
||||||
}
|
}
|
||||||
"step 14"
|
"step 15"
|
||||||
if(event.postAi){
|
if(event.postAi){
|
||||||
event.player.logAi(event.targets,event.card);
|
event.player.logAi(event.targets,event.card);
|
||||||
}
|
}
|
||||||
|
@ -16643,7 +16799,7 @@
|
||||||
else{
|
else{
|
||||||
event.finish();
|
event.finish();
|
||||||
}
|
}
|
||||||
"step 15"
|
"step 16"
|
||||||
event._oncancel();
|
event._oncancel();
|
||||||
},
|
},
|
||||||
useSkill:function(){
|
useSkill:function(){
|
||||||
|
|
Loading…
Reference in New Issue