This commit is contained in:
libccy 2016-04-03 00:05:48 +08:00
parent faf5c55eac
commit b74a45999c
4 changed files with 64 additions and 48 deletions

View File

@ -64,12 +64,12 @@ character.standard={
if((event.current==game.me&&!_status.auto)||( if((event.current==game.me&&!_status.auto)||(
ai.get.attitude(event.current,player)>2)){ ai.get.attitude(event.current,player)>2)){
var next=event.current.chooseToRespond('是否替'+get.translation(player)+'打出一张闪?',{name:'shan'}); var next=event.current.chooseToRespond('是否替'+get.translation(player)+'打出一张闪?',{name:'shan'});
next.ai=function(){ next.set('ai',function(){
var event=_status.event; var event=_status.event;
return (ai.get.attitude(event.player,event.source)-2); return (ai.get.attitude(event.player,event.source)-2);
}; });
next.autochoose=lib.filter.autoRespondShan; next.autochoose=lib.filter.autoRespondShan;
next.source=player; next.set('source',player);
} }
} }
"step 1" "step 1"
@ -147,7 +147,7 @@ character.standard={
content:function(){ content:function(){
"step 0" "step 0"
player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+ player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+
get.translation(trigger.player.judging[0])+',是否发动【鬼才】?').ai=function(card){ get.translation(trigger.player.judging[0])+',是否发动【鬼才】?').set('ai',function(card){
var trigger=_status.event.getParent()._trigger; var trigger=_status.event.getParent()._trigger;
var player=_status.event.player; var player=_status.event.player;
var result=trigger.judge(card)-trigger.judge(trigger.player.judging[0]); var result=trigger.judge(card)-trigger.judge(trigger.player.judging[0]);
@ -159,7 +159,7 @@ character.standard={
else{ else{
return -result-ai.get.value(card)/2; return -result-ai.get.value(card)/2;
} }
}; });
"step 1" "step 1"
if(result.bool){ if(result.bool){
player.respond(result.cards,'highlight'); player.respond(result.cards,'highlight');
@ -206,9 +206,9 @@ character.standard={
if(result.judge<2){ if(result.judge<2){
event.finish();return; event.finish();return;
} }
trigger.source.chooseToDiscard(2).ai=function(card){ trigger.source.chooseToDiscard(2).set('ai',function(card){
return ai.get.unuseful(card)+2.5*(5-get.owner(card).hp); return ai.get.unuseful(card)+2.5*(5-get.owner(card).hp);
}; });
"step 2" "step 2"
if(result.bool==false){ if(result.bool==false){
trigger.source.damage(); trigger.source.damage();
@ -240,11 +240,10 @@ character.standard={
check=(num>=2); check=(num>=2);
player.chooseTarget('是否发动【突袭】?',[1,2],function(card,player,target){ player.chooseTarget('是否发动【突袭】?',[1,2],function(card,player,target){
return target.num('h')>0&&player!=target; return target.num('h')>0&&player!=target;
}, },function(target){
function(target){ if(!_status.event.aicheck) return 0;
if(!check) return 0;
return (1-ai.get.attitude(_status.event.player,target)); return (1-ai.get.attitude(_status.event.player,target));
}); }).set('aicheck',check);
"step 1" "step 1"
if(result.bool){ if(result.bool){
player.logSkill('tuxi',result.targets); player.logSkill('tuxi',result.targets);
@ -549,12 +548,12 @@ character.standard={
else if(event.current.group=='shu'){ else if(event.current.group=='shu'){
player.storage.jijianging=true; player.storage.jijianging=true;
var next=event.current.chooseToRespond('是否替'+get.translation(player)+'打出一张杀?',{name:'sha'}); var next=event.current.chooseToRespond('是否替'+get.translation(player)+'打出一张杀?',{name:'sha'});
next.ai=function(){ next.set('ai',function(){
var event=_status.event; var event=_status.event;
return (ai.get.attitude(event.player,event.source)-2); return (ai.get.attitude(event.player,event.source)-2);
}; });
next.set('source',player);
next.autochoose=lib.filter.autoRespondSha; next.autochoose=lib.filter.autoRespondSha;
next.source=player;
} }
else{ else{
event.current=event.current.next; event.current=event.current.next;
@ -611,14 +610,17 @@ character.standard={
} }
else if(event.current.group=='shu'){ else if(event.current.group=='shu'){
var next=event.current.chooseToRespond('是否替'+get.translation(player)+'对'+get.translation(target)+'使用一张杀', var next=event.current.chooseToRespond('是否替'+get.translation(player)+'对'+get.translation(target)+'使用一张杀',
function(card){return player.canUse(card,target)&&card.name=='sha';}); function(card){
next.ai=function(card){ var evt=_status.event.getParent();
return evt.player.canUse(card,evt.target)&&card.name=='sha';
});
next.set('ai',function(card){
var event=_status.event; var event=_status.event;
return ai.get.effect(event.target,card,event.source,event.player); return ai.get.effect(event.target,card,event.source,event.player);
}; });
next.set('source',player);
next.set('target',target);
next.autochoose=lib.filter.autoRespondSha; next.autochoose=lib.filter.autoRespondSha;
next.source=player;
next.target=target;
} }
else{ else{
event.current=event.current.next; event.current=event.current.next;
@ -1010,14 +1012,13 @@ character.standard={
selectCard:[1,Infinity], selectCard:[1,Infinity],
prompt:'弃置任意张牌并摸等量的牌', prompt:'弃置任意张牌并摸等量的牌',
check:function(card){ check:function(card){
return -1;
return 6-ai.get.value(card) return 6-ai.get.value(card)
}, },
content:function(){ content:function(){
player.draw(cards.length); player.draw(cards.length);
}, },
ai:{ ai:{
order:11, order:1,
result:{ result:{
player:1 player:1
}, },
@ -1111,14 +1112,14 @@ character.standard={
}, },
content:function(){ content:function(){
"step 0" "step 0"
target.chooseControl('heart2','diamond2','club2','spade2').ai=function(event){ target.chooseControl('heart2','diamond2','club2','spade2').set('ai',function(event){
switch(Math.floor(Math.random()*6)){ switch(Math.floor(Math.random()*6)){
case 0:return 'heart2'; case 0:return 'heart2';
case 1:case 4:case 5:return 'diamond2'; case 1:case 4:case 5:return 'diamond2';
case 2:return 'club2'; case 2:return 'club2';
case 3:return 'spade2'; case 3:return 'spade2';
} }
}; });
"step 1" "step 1"
game.log(target,'选择了'+get.translation(result.control)); game.log(target,'选择了'+get.translation(result.control));
event.choice=result.control; event.choice=result.control;
@ -1185,6 +1186,7 @@ character.standard={
var next=player.chooseCardTarget({ var next=player.chooseCardTarget({
position:'he', position:'he',
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
var trigger=_status.event.getParent()._trigger;
if(get.distance(player,target,'attack')<=1&& if(get.distance(player,target,'attack')<=1&&
target!=trigger.player&&target!=player){ target!=trigger.player&&target!=player){
if(player.canUse(trigger.card,target)) return true; if(player.canUse(trigger.card,target)) return true;
@ -1416,12 +1418,12 @@ character.standard={
"step 0" "step 0"
var next=trigger.target.chooseToRespond({name:'shan'}); var next=trigger.target.chooseToRespond({name:'shan'});
next.autochoose=lib.filter.autoRespondShan; next.autochoose=lib.filter.autoRespondShan;
next.ai=function(card){ next.set('ai',function(card){
if(trigger.target.num('h','shan')>1){ if(_status.event.player.num('h','shan')>1){
return ai.get.unuseful2(card); return ai.get.unuseful2(card);
} }
return -1; return -1;
}; });
"step 1" "step 1"
if(result.bool==false){ if(result.bool==false){
trigger.untrigger(); trigger.untrigger();

View File

@ -186,6 +186,8 @@ window.config={
volumn_background:8, volumn_background:8,
volumn_audio:8, volumn_audio:8,
connect_avatar:'caocao',
connect_nickname:'无名玩家',
config_menu:true, config_menu:true,
auto_popped_config:true, auto_popped_config:true,
auto_popped_history:false, auto_popped_history:false,

View File

@ -10968,7 +10968,7 @@
game.broadcast(function(player){ game.broadcast(function(player){
player.setNickname(); player.setNickname();
},player); },player);
this.send('reinit',lib.configOL,get.arenaState(),game.getState?game.getState():{}); this.send('reinit',lib.configOL,get.arenaState(),game.getState?game.getState():{},game.ip);
} }
else{ else{
this.send('denied','offline'); this.send('denied','offline');
@ -11063,8 +11063,9 @@
} }
} }
}, },
reinit:function(config,state,state2){ reinit:function(config,state,state2,ip){
game.online=true; game.online=true;
game.ip=ip;
game.saveConfig('reconnect_info',[_status.ip,game.onlineID]); game.saveConfig('reconnect_info',[_status.ip,game.onlineID]);
_status.connectMode=true; _status.connectMode=true;
lib.configOL=config; lib.configOL=config;
@ -11431,6 +11432,9 @@
if(_status.skillaudio.contains(str)) return; if(_status.skillaudio.contains(str)) return;
_status.skillaudio.add(str); _status.skillaudio.add(str);
game.addVideo('playAudio',null,str); game.addVideo('playAudio',null,str);
game.broadcast(function(str){
game.playAudio(str);
},str);
setTimeout(function(){ setTimeout(function(){
_status.skillaudio.remove(str); _status.skillaudio.remove(str);
},1000); },1000);
@ -11495,6 +11499,9 @@
if(_status.video&&arguments[1]!='video') return; if(_status.video&&arguments[1]!='video') return;
if(_status.skillaudio.contains(name)) return; if(_status.skillaudio.contains(name)) return;
game.addVideo('playSkillAudio',null,name); game.addVideo('playSkillAudio',null,name);
game.broadcast(function(name){
game.playSkillAudio(name);
},name);
if(name.indexOf('|')<name.lastIndexOf('|')){ if(name.indexOf('|')<name.lastIndexOf('|')){
name=name.slice(name.lastIndexOf('|')+1); name=name.slice(name.lastIndexOf('|')+1);
} }

View File

@ -1112,27 +1112,31 @@ mode.identity={
delete _status.clickingidentity; delete _status.clickingidentity;
} }
} }
if(!this.node.dieidentity){ var setIdentity=function(player){
var node=ui.create.div('.damage.dieidentity',get.translation(this.identity+'2'),this); if(!player.node.dieidentity){
var node=ui.create.div('.damage.dieidentity',get.translation(player.identity+'2'),player);
ui.refresh(node); ui.refresh(node);
node.style.opacity=1; node.style.opacity=1;
this.node.dieidentity=node; player.node.dieidentity=node;
} }
var trans=this.style.transform; var trans=player.style.transform;
if(trans){ if(trans){
if(trans.indexOf('rotateY')!=-1){ if(trans.indexOf('rotateY')!=-1){
this.node.dieidentity.style.transform='rotateY(180deg)'; player.node.dieidentity.style.transform='rotateY(180deg)';
} }
else if(trans.indexOf('rotateX')!=-1){ else if(trans.indexOf('rotateX')!=-1){
this.node.dieidentity.style.transform='rotateX(180deg)'; player.node.dieidentity.style.transform='rotateX(180deg)';
} }
else{ else{
this.node.dieidentity.style.transform=''; player.node.dieidentity.style.transform='';
} }
} }
else{ else{
this.node.dieidentity.style.transform=''; player.node.dieidentity.style.transform='';
} }
}
setIdentity(this);
game.broadcast(setIdentity,this);
}, },
logAi:function(targets,card){ logAi:function(targets,card){
if(this.ai.shown==1) return; if(this.ai.shown==1) return;
@ -1256,6 +1260,7 @@ mode.identity={
ai:{ ai:{
get:{ get:{
attitude:function(from,to){ attitude:function(from,to){
if(!from||!to) return 0;
var x=0,num=0,temp,i; var x=0,num=0,temp,i;
if(_status.ai.customAttitude){ if(_status.ai.customAttitude){
for(i=0;i<_status.ai.customAttitude.length;i++){ for(i=0;i<_status.ai.customAttitude.length;i++){