This commit is contained in:
libccy 2016-04-06 11:07:53 +08:00
parent 197528d5c7
commit aab763c685
4 changed files with 100 additions and 270 deletions

View File

@ -1391,7 +1391,7 @@ card.standard={
if(mod!='unchanged') return mod;
return true;
};
event.send=function(player,state,isJudge,card,source,target,targets,id){
event.send=function(player,state,isJudge,card,source,target,targets,id,id2,tempnowuxie){
state=state?1:-1;
var str='';
if(isJudge){
@ -1402,6 +1402,11 @@ card.standard={
str+='对'+get.translation(targets||target);
}
str+='将'+(state>0?'生效':'失效')+',是否无懈?';
if(player.isUnderControl(true)&&!_status.auto&&!ui.tempnowuxie&&tempnowuxie){
ui.tempnowuxie=ui.create.control('不无懈'+get.translation(card.name),ui.click.tempnowuxie);
ui.tempnowuxie._origin=id2;
}
var next=player.chooseToUse({
filterCard:function(card,player){
if(card.name!='wuxie') return false;
@ -1523,6 +1528,7 @@ card.standard={
}
}
};
var tempnowuxie=(trigger.targets&&trigger.targets.length>1&&!trigger.multitarget);
var withme=false;
var withol=false;
@ -1531,12 +1537,14 @@ card.standard={
if(list[i].isOnline()){
withol=true;
list[i].wait(sendback);
list[i].send(event.send,list[i],event.state,event.triggername=='phaseJudge',event.card,event.source,event.target,event.targets,event.id);
list[i].send(event.send,list[i],event.state,event.triggername=='phaseJudge',
event.card,event.source,event.target,event.targets,event.id,trigger.parent.id,tempnowuxie);
list.splice(i--,1);
}
else if(list[i]==game.me){
withme=true;
event.send(list[i],event.state,event.triggername=='phaseJudge',event.card,event.source,event.target,event.targets,event.id);
event.send(list[i],event.state,event.triggername=='phaseJudge',
event.card,event.source,event.target,event.targets,event.id,trigger.parent.id,tempnowuxie);
list.splice(i--,1);
}
}
@ -1595,227 +1603,6 @@ card.standard={
delete event.wuxieresult2;
}
},
wuxie1_old:{
trigger:{player:'useCardToBefore'},
priority:5,
filter:function(event,player){
if(!event.target) return false;
if(get.type(event.card)!='trick') return false;
return true;
},
popup:false,
forced:true,
content:function(){
"step 0"
if(trigger.multitarget){
event.source2=trigger.targets;
}
event.source=trigger.target;
event.current=trigger.player;
event.end=trigger.player;
event.state=true;
event.card=trigger.card;
"step 1"
if((ui.wuxie.classList.contains('glow')||
(ui.tempnowuxie&&ui.tempnowuxie.classList.contains('glow')&&
event.state))&&!_status.auto){
if(event.current==game.me||event.current.isUnderControl()){
event._result={bool:false};
return;
}
}
if(lib.config.wuxie_self&&event.state){
if((event.current==game.me||event.current.isUnderControl())&&
(trigger.player==game.me||trigger.player.isUnderControl())){
if(trigger.targets&&trigger.targets.length==1){
event._result={bool:false};
return;
}
}
}
if(event.current.num('h','wuxie')==0){
var noask=true;
var skills=event.current.get('s',true).concat(lib.skill.global);
game.expandSkills(skills);
for(var i=0;i<skills.length;i++){
var ifo=get.info(skills[i]);
if(ifo.viewAs&&
ifo.viewAs.name=='wuxie'){
if(!ifo.viewAsFilter||ifo.viewAsFilter(event.current)){
noask=false;break;
}
}
else{
var hiddenCard=get.info(skills[i]).hiddenCard;
if(typeof hiddenCard=='function'&&hiddenCard(event.current,'wuxie',event)){
noask=false;break;
}
}
}
if(noask){
if(event.current==game.me&&ui.tempnowuxie){
ui.tempnowuxie.close();
delete ui.tempnowuxie;
}
event._result={bool:false};
return;
}
}
var str=get.translation(event.card.name)+'对'+get.translation(event.source2||event.source)+'将';
if(event.state){
str+='生效';
}
else{
str+='失效';
}
str+=',是否无懈?';
var nevt=event.current.chooseToUse({
filterCard:function(card,player){
if(card.name!='wuxie') return false;
var mod=game.checkMod(card,player,'unchanged','cardEnabled',player.get('s'));
if(mod!='unchanged') return mod;
return true;
},
prompt:str,
ai1:function(card){
var state=event.state?1:-1;
var info=get.info(trigger.card);
if(info.ai&&info.ai.wuxie){
var aiii=info.ai.wuxie(trigger.target,trigger.card,trigger.player,_status.event.player,state);
if(typeof aiii=='number') return aiii;
}
if(info.multitarget){
var eff=0;
for(var i=0;i<trigger.targets.length;i++){
eff+=ai.get.effect(trigger.targets[i],trigger.card,trigger.player,_status.event.player)
}
return -eff*state;
}
if(Math.abs(ai.get.attitude(_status.event.player,trigger.target))<3) return 0;
return -ai.get.effect(trigger.target,trigger.card,trigger.player,_status.event.player)*state;
},
source:event.source,
source2:event.source2
});
if(event.current.isUnderControl(true)&&!_status.auto&&!trigger.multitarget){
if(trigger.targets.length>1&&!ui.tempnowuxie){
ui.tempnowuxie=ui.create.control('不无懈'+get.translation(trigger.card.name),ui.click.tempnowuxie);
ui.tempnowuxie._origin=trigger.parent;
}
}
"step 2"
if(result.bool){
event.end=event.current;
if(event.state) event.state=false;
else event.state=true;
event.goto(1);
}
else if(event.current.next==event.end||event.end.isDead()){
if(event.state==false){
trigger.untrigger();
trigger.finish();
}
}
else{
event.current=event.current.next;
event.goto(1);
}
}
},
wuxie2_old:{
trigger:{player:'phaseJudge'},
priority:5,
popup:false,
forced:true,
content:function(){
"step 0"
event.current=trigger.player;
event.end=trigger.player;
event.state=true;
event.card=trigger.card;
"step 1"
if(ui.wuxie.classList.contains('glow')&&!_status.auto){
if(event.current==game.me||event.current.isUnderControl()){
event._result={bool:false};
return;
}
}
if(event.current.get('h','wuxie')==0){
var noask=true;
var skills=event.current.get('s',true).concat(lib.skill.global);
game.expandSkills(skills);
for(var i=0;i<skills.length;i++){
var ifo=get.info(skills[i]);
if(ifo.viewAs&&
ifo.viewAs.name=='wuxie'){
if(!ifo.viewAsFilter||ifo.viewAsFilter(event.current)){
noask=false;break;
}
}
else{
var hiddenCard=get.info(skills[i]).hiddenCard;
if(typeof hiddenCard=='function'&&hiddenCard(event.current,'wuxie',event)){
noask=false;break;
}
}
}
if(noask) {event._result={bool:false};return;}
}
var str=get.translation(event.card.viewAs||event.card.name)+'对'+get.translation(trigger.player.name)+'将';
if(event.state){
str+='生效';
}
else{
str+='失效';
}
str+=',是否无懈?';
event.current.chooseToUse({
filterCard:function(card,player){
if(card.name!='wuxie') return false;
var mod=game.checkMod(card,player,'unchanged','cardEnabled',player.get('s'));
if(mod!='unchanged') return mod;
return true;
},
prompt:str,
ai1:function(card){
var state=event.state?1:-1;
var info=lib.card[trigger.card.viewAs||trigger.card.name];
if(info&&info.ai&&info.ai.wuxie){
var aiii=info.ai.wuxie(trigger.player,trigger.card,trigger.player,_status.event.player,state);
if(typeof aiii=='number') return aiii;
}
if(Math.abs(ai.get.attitude(_status.event.player,trigger.player))<3) return 0;
if(trigger.player.skills.contains('guanxing')) return 0;
if(trigger.card.name!='lebu'&&trigger.card.name!='bingliang'){
if(trigger.player!=_status.event.player){
return 0;
}
}
var eff=ai.get.effect(trigger.player,trigger.card,trigger.player,player);
if(eff>=0) return 0;
return state*ai.get.attitude(_status.event.player,trigger.player);
},
source:trigger.player
});
"step 2"
if(result.bool){
event.end=event.current;
if(event.state) event.state=false;
else event.state=true;
event.goto(1);
}
else if(event.current.next==event.end||event.end.isDead()){
if(event.state==false){
trigger.untrigger();
trigger.cancelled=true;
}
}
else{
event.current=event.current.next;
event.goto(1);
}
}
},
},
translate:{
sha:'杀',

View File

@ -1519,13 +1519,13 @@ character.shenhua={
player.chooseCardTarget({
selectCard:Math.floor(player.num('h')/2),
filterTarget:function(card,player,target){
return target.num('h')==temp;
return target.num('h')==_status.event.temp;
},
forced:true,
ai2:function(target){
return ai.get.attitude(player,target);
return ai.get.attitude(_status.event.player,target);
}
});
}).set('temp',temp);
"step 1"
if(result.targets&&result.targets[0]){
result.targets[0].gain(result.cards);
@ -1643,7 +1643,8 @@ character.shenhua={
"step 0"
player.chooseTarget('是否发动【英魂】?',function(card,player,target){
return player!=target;
}).ai=function(target){
}).set('ai',function(target){
var player=_status.event.player;
if(player.maxHp-player.hp==1&&target.num('he')==0){
return 0;
}
@ -1654,7 +1655,7 @@ character.shenhua={
return -1;
}
return 1;
}
});
"step 1"
if(result.bool){
player.logSkill('yinghun',result.targets);
@ -1845,7 +1846,7 @@ character.shenhua={
event.current=player.next;
"step 1"
event.current.animate('target');
event.current.chooseToUse({name:'sha'},function(card,player,target){
event.current.chooseToUse('乱舞:使用一张杀或流失一点体力',{name:'sha'},function(card,player,target){
if(player==target) return false;
if(get.distance(player,target)<=1) return true;
for(var i=0;i<game.players.length;i++){
@ -1853,7 +1854,7 @@ character.shenhua={
if(get.distance(player,game.players[i])<get.distance(player,target)) return false;
}
return true;
})
});
"step 2"
if(result.bool==false) event.current.loseHp();
if(event.current.next!=player){
@ -2026,7 +2027,6 @@ character.shenhua={
},
filter:function(event,player){
if(event.type!='dying') return false;
if(player!=_status.dying) return false;
if(player.storage.niepan) return false;
},
content:function(){
@ -2077,10 +2077,18 @@ character.shenhua={
player.chooseToCompare(target);
"step 1"
if(result.bool){
player.chooseTarget(function(card,player,target1){
return target1!=target&&get.distance(target,target1,'attack')<=1;
},true).ai=function(target1){
return ai.get.damageEffect(target1,target,player);
if(game.hasPlayer(function(player){
return player!=target&&get.distance(target,player,'attack')<=1;
})){
player.chooseTarget(function(card,player,target){
var source=_status.event.source;
return target!=source&&get.distance(source,target,'attack')<=1;
},true).set('ai',function(target){
return ai.get.damageEffect(target,_status.event.source,player);
}).set('source',target);
}
else{
event.finish();
}
}
else{
@ -2089,6 +2097,7 @@ character.shenhua={
}
"step 2"
if(result.bool&&result.targets&&result.targets.length){
target.line(result.targets[0],'green');
result.targets[0].damage(target);
}
},
@ -2146,13 +2155,13 @@ character.shenhua={
"step 0"
player.chooseTarget('是否发动【节命】?',[1,trigger.num],function(card,player,target){
return target.num('h')<Math.min(target.maxHp,5);
}).ai=function(target){
}).set('ai',function(target){
var att=ai.get.attitude(_status.event.player,target);
if(att>2){
return Math.min(5,target.maxHp)-target.num('h');
}
return att/3;
}
});
"step 1"
if(result.bool){
player.logSkill('jieming',result.targets);

View File

@ -4094,10 +4094,12 @@
"step 2"
player.phaseUse();
"step 3"
if(ui.tempnowuxie){
ui.tempnowuxie.close();
delete ui.tempnowuxie;
}
game.broadcastAll(function(){
if(ui.tempnowuxie){
ui.tempnowuxie.close();
delete ui.tempnowuxie;
}
});
player.phaseDiscard()
if(!player.noPhaseDelay) game.delayx();
delete player.using;
@ -4156,10 +4158,12 @@
if(result.bool){
event.goto(0);
}
if(ui.tempnowuxie){
ui.tempnowuxie.close();
delete ui.tempnowuxie;
}
game.broadcastAll(function(){
if(ui.tempnowuxie){
ui.tempnowuxie.close();
delete ui.tempnowuxie;
}
});
delete player.using;
},
phaseDiscard:function(){
@ -4188,6 +4192,21 @@
}
return;
}
if(ui.tempnowuxie&&ui.tempnowuxie.classList.contains('glow')){
event.result={
bool:false
}
return;
}
if(!_status.connectMode&&lib.config.wuxie_self){
var tw=event.parent._trigger.parent;
if(tw.player==player&&tw.targets&&tw.targets.length==1){
event.result={
bool:false
}
return;
}
}
}
var ok=game.check();
if(!ok||!lib.config.auto_confirm){
@ -4258,7 +4277,7 @@
event.aiexclude.add(skill);
var info=get.info(skill);
if(info.sourceSkill){
event.sourceSkill.add(info.aiexclude);
event.aiexclude.add(info.sourceSkill);
}
}
else{
@ -4477,25 +4496,32 @@
}
game.log(player,'对',target,'发起拼点');
"step 1"
var sendback=function(){
if(_status.event!=event){
return function(){
event.resultOL=_status.event.resultOL;
};
}
};
if(player.isOnline()){
player.wait();
player.wait(sendback);
event.ol=true;
player.send(function(){
player.send(function(ai){
game.me.chooseCard('请选择拼点牌',true).set('glow_result',true).ai=ai;
game.resume();
},ai);
},event.ai);
}
else{
event.localPlayer=true;
player.chooseCard('请选择拼点牌',true).set('glow_result',true).ai=event.ai;
}
if(target.isOnline()){
target.wait();
target.wait(sendback);
event.ol=true;
target.send(function(){
target.send(function(ai){
game.me.chooseCard('请选择拼点牌',true).set('glow_result',true).ai=ai;
game.resume();
},ai);
},event.ai);
}
else{
event.localTarget=true;
@ -5353,7 +5379,16 @@
});
}
}
event.id=get.id();
event.trigger('useCard');
event._oncancel=function(){
game.broadcastAll(function(id){
if(ui.tempnowuxie&&ui.tempnowuxie._origin==id){
ui.tempnowuxie.close();
delete ui.tempnowuxie;
}
},event.id);
};
if(get.type(card)!='equip'){
var str='';
if(targets.length){
@ -5491,10 +5526,7 @@
if(event.card.name!='wuxie'){
game.broadcastAll(ui.clear);
}
if(ui.tempnowuxie&&ui.tempnowuxie._origin==event){
ui.tempnowuxie.close();
delete ui.tempnowuxie;
}
event._oncancel();
},
useSkill:function(){
"step 0"
@ -6316,10 +6348,6 @@
_status.coin+=10;
}
}
if(ui.tempnowuxie&&ui.tempnowuxie._origin&&ui.tempnowuxie._origin.player==player){
ui.tempnowuxie.close();
delete ui.tempnowuxie;
}
},
equip:function(){
"step 0"
@ -9717,7 +9745,7 @@
this.playerfocus(1500);
var that=this;
setTimeout(function(){
game.broadcastAll(function(that,type,name){
game.broadcastAll(function(that,type,name,color){
if(lib.config.animation&&!lib.config.low_performance){
if(lib.config.mode=='chess'){
that['$'+type+'2'](1200);
@ -9729,7 +9757,7 @@
if(name){
that.$fullscreenpop(name,color);
}
},that,type,name);
},that,type,name,color);
},300);
},
$fire:function(){
@ -14195,6 +14223,10 @@
game.reload();
});
}
if(ui.tempnowuxie){
ui.tempnowuxie.close();
delete ui.tempnowuxie;
}
return;
}
if(lib.config.background_audio){
@ -14690,6 +14722,9 @@
_status.dieClose.shift().close();
}
});
if(event._oncancel){
event._oncancel();
}
event.finish();
}
else if(player&&player.removed&&event.name!='phaseLoop'){
@ -22103,6 +22138,7 @@
custom.replace.button(this);
return;
}
if(!_status.event.isMine()) return;
if(this.classList.contains('selectable')==false) return;
if(this.classList.contains('selected')){
ui.selected.buttons.remove(this);
@ -22545,18 +22581,16 @@
wuxie:function(){
if(this.classList.contains('hidden')) return;
this.classList.toggle('glow');
if(this.classList.contains('glow')&&
(_status.event.getParent().name=='_wuxie1'||_status.event.getParent().name=='_wuxie2')&&
_status.event.isMine()&&ui.confirm){
if(this.classList.contains('glow')&&_status.event.type=='wuxie'&&
_status.event.isMine()&&ui.confirm&&_status.imchoosing){
ui.click.cancel(ui.confirm.lastChild);
}
},
tempnowuxie:function(){
if(this.classList.contains('hidden')) return;
this.classList.toggle('glow');
if(this.classList.contains('glow')&&
(_status.event.getParent().name=='_wuxie1'||_status.event.getParent().name=='_wuxie2')&&
_status.event.isMine()&&ui.confirm){
if(this.classList.contains('glow')&&_status.event.type=='wuxie'&&
_status.event.isMine()&&ui.confirm&&_status.imchoosing){
ui.click.cancel(ui.confirm.lastChild);
}
},

View File

@ -19,7 +19,7 @@ mode.identity={
else{
lib.configOL.number=lib.configOL.player_number;
}
lib.configOL.characterPack=['standard'];
lib.configOL.characterPack=['standard','shenhua'];
lib.configOL.cardPack=['standard','ex','extra','refresh','mingzhong'];
lib.configOL.mode='identity';
var cardPackList=[];