This commit is contained in:
libccy 2017-02-12 17:31:40 +08:00
parent a5af682a11
commit 2a12ca83ce
3 changed files with 91 additions and 92 deletions

View File

@ -1182,7 +1182,7 @@ character.ow={
check:function(card){ check:function(card){
if(ui.selected.cards.length) return 0; if(ui.selected.cards.length) return 0;
var player=_status.event.player; var player=_status.event.player;
var max=0,min=0,players=game.filterPlayer; var max=0,min=0,players=game.filterPlayer();
for(var i=0;i<players.length;i++){ for(var i=0;i<players.length;i++){
if(!lib.skill.bingqiang.filterTarget(null,player,players[i])) continue; if(!lib.skill.bingqiang.filterTarget(null,player,players[i])) continue;
var num=lib.skill.bingqiang.ai.result.playerx(player,players[i]); var num=lib.skill.bingqiang.ai.result.playerx(player,players[i]);

View File

@ -34,7 +34,7 @@ character.xianjian={
pal_xiahoujinxuan:['male','shu',3,['xuanmo','danqing']], pal_xiahoujinxuan:['male','shu',3,['xuanmo','danqing']],
pal_muchanglan:['female','wu',3,['feixia','lueying']], pal_muchanglan:['female','wu',3,['feixia','lueying']],
// pal_xia:['male','wei',4,[]], pal_xia:['male','wei',4,[]],
// pal_jiangcheng:['male','qun',4,['yanzhan','fenshi']], // pal_jiangcheng:['male','qun',4,['yanzhan','fenshi']],
}, },
skill:{ skill:{
@ -95,12 +95,9 @@ character.xianjian={
trigger:{player:'shaBegin'}, trigger:{player:'shaBegin'},
filter:function(event,player){ filter:function(event,player){
if(event.target.num('he')>0){ if(event.target.num('he')>0){
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(game.players[i]!=player&&game.players[i]!=event.target&& return current!=player&&current!=event.target&&current.num('he');
game.players[i].num('he')){ });
return true;
}
}
} }
return false; return false;
}, },
@ -117,7 +114,9 @@ character.xianjian={
trigger.target.$giveAuto(card,player); trigger.target.$giveAuto(card,player);
} }
'step 1' 'step 1'
if(game.players.length>2){ if(game.hasPlayer(function(current){
return current!=player&&current!=trigger.target&&current.num('he');
})){
trigger.target.chooseTarget(function(card,player,target){ trigger.target.chooseTarget(function(card,player,target){
return target!=player&&target!=_status.event.parent.player&&target.num('he')>0; return target!=player&&target!=_status.event.parent.player&&target.num('he')>0;
},'选择一名角色并令'+get.translation(player)+'弃置其一张牌').ai=function(target){ },'选择一名角色并令'+get.translation(player)+'弃置其一张牌').ai=function(target){
@ -963,12 +962,9 @@ character.xianjian={
trigger:{player:'phaseEnd'}, trigger:{player:'phaseEnd'},
direct:true, direct:true,
filter:function(event,player){ filter:function(event,player){
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(game.players[i]!=player&&game.players[i].hp<game.players[i].maxHp){ return current!=player&&current.isDamaged();
return true; });
}
}
return false;
}, },
content:function(){ content:function(){
'step 0' 'step 0'
@ -1148,9 +1144,10 @@ character.xianjian={
check:function(card){ check:function(card){
var num=0; var num=0;
var player=_status.event.player; var player=_status.event.player;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(lib.filter.targetEnabled({name:'sha'},player,game.players[i])&& for(var i=0;i<players.length;i++){
ai.get.effect(game.players[i],{name:'sha'},player)>0){ if(lib.filter.targetEnabled({name:'sha'},player,players[i])&&
ai.get.effect(players[i],{name:'sha'},player)>0){
num++; num++;
if(num>1) return 8-ai.get.value(card); if(num>1) return 8-ai.get.value(card);
} }
@ -1203,9 +1200,10 @@ character.xianjian={
if(card.name=='sha'&&player.num('h','sha')<2&&player.num('h')<=player.hp){ if(card.name=='sha'&&player.num('h','sha')<2&&player.num('h')<=player.hp){
var num=0; var num=0;
var player=_status.event.player; var player=_status.event.player;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(lib.filter.targetEnabled({name:'sha'},player,game.players[i])&& for(var i=0;i<players.length;i++){
ai.get.attitude(player,game.players[i])<0){ if(lib.filter.targetEnabled({name:'sha'},player,players[i])&&
ai.get.attitude(player,players[i])<0){
num++; num++;
if(num>1) return [0,0,0,0]; if(num>1) return [0,0,0,0];
} }
@ -1420,21 +1418,21 @@ character.xianjian={
filter:function(event,player){ filter:function(event,player){
if(!player.num('he')) return false; if(!player.num('he')) return false;
if(player==event.player) return false; if(player==event.player) return false;
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(game.players[i].hasSkill('wangyou3')) return true; return current.hasSkill('wangyou3');
} });
return false;
}, },
content:function(){ content:function(){
"step 0" "step 0"
var targets=[]; var targets=[];
var num=0; var num=0;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(game.players[i].hasSkill('wangyou3')){ for(var i=0;i<players.length;i++){
var att=ai.get.attitude(player,game.players[i]); if(players[i].hasSkill('wangyou3')){
var att=ai.get.attitude(player,players[i]);
if(att>0) num++; if(att>0) num++;
else if(att<0) num--; else if(att<0) num--;
targets.push(game.players[i]); targets.push(players[i]);
} }
} }
event.targets=targets; event.targets=targets;
@ -1625,9 +1623,10 @@ character.xianjian={
effect:{ effect:{
target:function(card,player,target,current){ target:function(card,player,target,current){
if(get.type(card)=='equip'){ if(get.type(card)=='equip'){
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(player!=game.players[i]&&get.distance(player,game.players[i])<=1&& for(var i=0;i<players.length;i++){
ai.get.damageEffect(game.players[i],player,player)>0){ if(player!=players[i]&&get.distance(player,players[i])<=1&&
ai.get.damageEffect(players[i],player,player)>0){
return [1,3]; return [1,3];
} }
} }
@ -1780,12 +1779,13 @@ character.xianjian={
"step 0" "step 0"
var ainum=0; var ainum=0;
var num=3-player.storage.xuanning; var num=3-player.storage.xuanning;
var players=[];
event.targets=[]; event.targets=[];
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(game.players[i]!=player&&!game.players[i].isOut()&& if(players[i]!=player&&!players[i].isOut()&&
lib.filter.targetEnabled({name:'wanjian'},player,game.players[i])){ lib.filter.targetEnabled({name:'wanjian'},player,players[i])){
ainum+=ai.get.effect(game.players[i],{name:'wanjian'}); ainum+=ai.get.effect(players[i],{name:'wanjian'});
event.targets.push(game.players[i]); event.targets.push(players[i]);
} }
} }
if(num){ if(num){
@ -2079,11 +2079,9 @@ character.xianjian={
direct:true, direct:true,
filter:function(event){ filter:function(event){
if(get.suit(event.card)=='heart'){ if(get.suit(event.card)=='heart'){
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(game.players[i].hp<game.players[i].maxHp){ return current.isDamaged();
return true; });
}
}
} }
return false; return false;
}, },

View File

@ -253,6 +253,7 @@ character.yijiang={
}, },
check:function(button){ check:function(button){
var player=_status.event.player; var player=_status.event.player;
var players=game.filterPlayer();
if(player.num('h',button.link)) return 0; if(player.num('h',button.link)) return 0;
if(button.link=='wuzhong'){ if(button.link=='wuzhong'){
if(player.num('h')<player.hp){ if(player.num('h')<player.hp){
@ -273,8 +274,8 @@ character.yijiang={
return 2+Math.random(); return 2+Math.random();
} }
if(button.link=='shunshou'){ if(button.link=='shunshou'){
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(player.canUse('shunshou',game.players[i])&&ai.get.attitude(player,game.players[i])<0){ if(player.canUse('shunshou',players[i])&&ai.get.attitude(player,players[i])<0){
return 2+Math.random(); return 2+Math.random();
} }
} }
@ -291,9 +292,9 @@ character.yijiang={
} }
if(button.link=='nanman'||button.link=='wanjian'||button.link=='taoyuan'||button.link=='wugu'){ if(button.link=='nanman'||button.link=='wanjian'||button.link=='taoyuan'||button.link=='wugu'){
var eff=0; var eff=0;
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(game.players[i]!=player){ if(players[i]!=player){
eff+=ai.get.effect(game.players[i],{name:button.link},player,player); eff+=ai.get.effect(players[i],{name:button.link},player,player);
} }
} }
if(eff>0){ if(eff>0){
@ -323,12 +324,12 @@ character.yijiang={
order:4, order:4,
result:{ result:{
player:function(player){ player:function(player){
var allshown=true; var allshown=true,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(game.players[i].ai.shown==0){ if(players[i].ai.shown==0){
allshown=false; allshown=false;
} }
if(game.players[i]!=player&&game.players[i].num('h')&&ai.get.attitude(player,game.players[i])>0){ if(players[i]!=player&&players[i].num('h')&&ai.get.attitude(player,players[i])>0){
return 1; return 1;
} }
} }
@ -396,9 +397,9 @@ character.yijiang={
return true; return true;
}, },
check:function(event,player){ check:function(event,player){
var allshown=true; var allshown=true,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(game.players[i]!=player&&game.players[i].num('h')>1&&ai.get.attitude(player,game.players[i])>0){ if(players[i]!=player&&players[i].num('h')>1&&ai.get.attitude(player,players[i])>0){
return 1; return 1;
} }
} }
@ -478,20 +479,15 @@ character.yijiang={
direct:true, direct:true,
filter:function(event,player){ filter:function(event,player){
if(player.num('h')) return false; if(player.num('h')) return false;
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(!game.players[i].isLinked()){ return !current.isLinked();
return true; });
}
}
}, },
content:function(){ content:function(){
"step 0" "step 0"
var num=0; var num=game.countPlayer(function(current){
for(var i=0;i<game.players.length;i++){ return !current.isLinked();
if(!game.players[i].isLinked()){ });
num++;
}
}
player.chooseTarget(get.prompt('jishe'),[1,Math.min(num,player.hp)],function(card,player,target){ player.chooseTarget(get.prompt('jishe'),[1,Math.min(num,player.hp)],function(card,player,target){
return !target.isLinked(); return !target.isLinked();
}).set('ai',function(target){ }).set('ai',function(target){
@ -617,10 +613,12 @@ character.yijiang={
trigger:{player:'phaseEnd'}, trigger:{player:'phaseEnd'},
direct:true, direct:true,
filter:function(event,player){ filter:function(event,player){
if(!game.zhu||!game.zhu.isZhu) return false; var zhu=get.zhu(player);
for(var i=0;i<game.players.length;i++){ if(!zhu||!zhu.isZhu) return false;
if(game.players[i]==game.zhu||game.players[i]==player) continue; var players=game.filterPlayer();
if(get.distance(game.players[i],game.zhu,'attack')<=1&&game.players[i].num('he')){ for(var i=0;i<players.length;i++){
if(players[i]==zhu||players[i]==player) continue;
if(get.distance(players[i],zhu,'attack')<=1&&players[i].num('he')){
return true; return true;
} }
} }
@ -629,8 +627,8 @@ character.yijiang={
content:function(){ content:function(){
'step 0' 'step 0'
player.chooseTarget(get.prompt('qinqing'),function(card,player,target){ player.chooseTarget(get.prompt('qinqing'),function(card,player,target){
if(target==player||target==game.zhu) return false; if(target==player||target==get.zhu(player)) return false;
return get.distance(target,game.zhu,'attack')<=1&&target.num('he')>0; return get.distance(target,get.zhu(player),'attack')<=1&&target.num('he')>0;
}).set('ai',function(target){ }).set('ai',function(target){
var player=_status.event.player; var player=_status.event.player;
var zhu=_status.event.zhu; var zhu=_status.event.zhu;
@ -640,7 +638,7 @@ character.yijiang={
if(nh>nh2) return 2; if(nh>nh2) return 2;
if(nh==nh2&&target.num('e')) return 1.5; if(nh==nh2&&target.num('e')) return 1.5;
return 1; return 1;
}).set('zhu',game.zhu); }).set('zhu',get.zhu(player));
'step 1' 'step 1'
if(result.bool){ if(result.bool){
event.target=result.targets[0]; event.target=result.targets[0];
@ -653,7 +651,7 @@ character.yijiang={
'step 2' 'step 2'
event.target.draw(); event.target.draw();
'step 3' 'step 3'
if(event.target.num('h')>game.zhu.num('h')){ if(event.target.num('h')>get.zhu(player).num('h')){
player.draw(); player.draw();
} }
}, },
@ -840,19 +838,19 @@ character.yijiang={
return button.link=='sha'?1:0; return button.link=='sha'?1:0;
} }
var player=_status.event.player; var player=_status.event.player;
var recover=0,lose=1; var recover=0,lose=1,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(!game.players[i].isOut()&&game.players[i]!=player){ if(!players[i].isOut()&&players[i]!=player){
if(game.players[i].hp<game.players[i].maxHp){ if(players[i].hp<players[i].maxHp){
if(ai.get.attitude(player,game.players[i])>0){ if(ai.get.attitude(player,players[i])>0){
if(game.players[i].hp<2){ if(players[i].hp<2){
lose--; lose--;
recover+=0.5; recover+=0.5;
} }
lose--; lose--;
recover++; recover++;
} }
else if(ai.get.attitude(player,game.players[i])<0){ else if(ai.get.attitude(player,players[i])<0){
if(game.players[i].hp<2){ if(game.players[i].hp<2){
lose++; lose++;
recover-=0.5; recover-=0.5;
@ -862,10 +860,10 @@ character.yijiang={
} }
} }
else{ else{
if(ai.get.attitude(player,game.players[i])>0){ if(ai.get.attitude(player,players[i])>0){
lose--; lose--;
} }
else if(ai.get.attitude(player,game.players[i])<0){ else if(ai.get.attitude(player,players[i])<0){
lose++; lose++;
} }
} }
@ -1298,10 +1296,10 @@ character.yijiang={
order:1, order:1,
result:{ result:{
player:function(player){ player:function(player){
var num=0; var num=0,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(player!=game.players[i]&&ai.get.damageEffect(game.players[i],player,game.players[i],'fire')<0){ if(player!=players[i]&&ai.get.damageEffect(players[i],player,players[i],'fire')<0){
var att=ai.get.attitude(player,game.players[i]); var att=ai.get.attitude(player,players[i]);
if(att>0){ if(att>0){
num--; num--;
} }
@ -1946,8 +1944,9 @@ character.yijiang={
return _status.currentPhase==player; return _status.currentPhase==player;
}, },
content:function(){ content:function(){
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(get.distance(player,game.players[i])>1){ for(var i=0;i<players.length;i++){
if(get.distance(player,players[i])>1){
player.removeSkill('unequip'); player.removeSkill('unequip');
return; return;
} }
@ -1964,8 +1963,9 @@ character.yijiang={
selectTarget:function(card,player,range){ selectTarget:function(card,player,range){
if(_status.currentPhase==player){ if(_status.currentPhase==player){
if(card.name=='sha'&&range[1]!=-1){ if(card.name=='sha'&&range[1]!=-1){
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(get.distance(player,game.players[i])>1) return; for(var i=0;i<players.length;i++){
if(get.distance(player,players[i])>1) return;
} }
range[1]++; range[1]++;
} }
@ -1985,8 +1985,9 @@ character.yijiang={
content:function(){ content:function(){
player.storage.benxi=!player.hasSkill('unequip'); player.storage.benxi=!player.hasSkill('unequip');
if(player.storage.benxi){ if(player.storage.benxi){
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(get.distance(player,game.players[i])>1){ for(var i=0;i<players.length;i++){
if(get.distance(player,players[i])>1){
return; return;
} }
} }