This commit is contained in:
libccy 2017-02-12 18:36:54 +08:00
parent 2a12ca83ce
commit 55e910d12c
3 changed files with 192 additions and 474 deletions

View File

@ -1779,7 +1779,7 @@ 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=[]; var players=game.filterPlayer();
event.targets=[]; event.targets=[];
for(var i=0;i<players.length;i++){ for(var i=0;i<players.length;i++){
if(players[i]!=player&&!players[i].isOut()&& if(players[i]!=player&&!players[i].isOut()&&

View File

@ -851,7 +851,7 @@ character.yijiang={
recover++; recover++;
} }
else if(ai.get.attitude(player,players[i])<0){ else 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;
} }
@ -2042,11 +2042,12 @@ character.yijiang={
if(ai.get.attitude(player,event.player)>=0) return false; if(ai.get.attitude(player,event.player)>=0) return false;
if(event.player.num('e','zhuge')) return false; if(event.player.num('e','zhuge')) return false;
if(event.player.hasSkill('paoxiao')) return false; if(event.player.hasSkill('paoxiao')) return false;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(event.player.canUse('sha',game.players[i])&& for(var i=0;i<players.length;i++){
ai.get.attitude(player,game.players[i])>0) break; if(event.player.canUse('sha',players[i])&&
ai.get.attitude(player,players[i])>0) break;
} }
if(i==game.players.length) return false; if(i==players.length) return false;
var nh=event.player.num('h'); var nh=event.player.num('h');
var nsha=event.player.num('h','sha'); var nsha=event.player.num('h','sha');
if(nh<2) return false; if(nh<2) return false;
@ -2322,10 +2323,10 @@ character.yijiang={
check:function(event,player){ check:function(event,player){
if(ai.get.attitude(player,_status.currentPhase)>0) return true; if(ai.get.attitude(player,_status.currentPhase)>0) return true;
var nh=_status.currentPhase.num('h')+1; var nh=_status.currentPhase.num('h')+1;
var hasshan=(player.num('h','shan')>0); var players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(game.players[i].num('h')>nh){ if(players[i].num('h')>nh){
if(!hasshan||ai.get.attitude(player,game.players[i])<=0) return true; if(!player.hasShan()||ai.get.attitude(player,players[i])<=0) return true;
} }
} }
return false; return false;
@ -2338,15 +2339,16 @@ character.yijiang={
var nh=_status.currentPhase.num('h'); var nh=_status.currentPhase.num('h');
var nmax=nh+1; var nmax=nh+1;
var targets=[]; var targets=[];
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
var nh2=game.players[i].num('h'); for(var i=0;i<players.length;i++){
var nh2=players[i].num('h');
if(nh2>nmax){ if(nh2>nmax){
nmax=nh2; nmax=nh2;
targets.length=0; targets.length=0;
targets.push(game.players[i]); targets.push(players[i]);
} }
else if(nh2==nmax){ else if(nh2==nmax){
targets.push(game.players[i]); targets.push(players[i]);
} }
} }
if(targets.length==1){ if(targets.length==1){
@ -2383,8 +2385,9 @@ character.yijiang={
target:function(card,player,target,current){ target:function(card,player,target,current){
if(get.tag(card,'respondShan')&&current<0){ if(get.tag(card,'respondShan')&&current<0){
var nh=player.num('h'); var nh=player.num('h');
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(game.players[i].num('h')>nh) return 0.4; for(var i=0;i<players.length;i++){
if(players[i].num('h')>nh) return 0.4;
} }
} }
} }
@ -2464,10 +2467,9 @@ character.yijiang={
filter:function(event,player){ filter:function(event,player){
if(player.hasSkill('yaoming2')) return false; if(player.hasSkill('yaoming2')) return false;
var nh=player.num('h'); var nh=player.num('h');
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(game.players[i].num('h')!=nh) return true; return current.num('h')!=nh;
} });
return false;
}, },
content:function(){ content:function(){
'step 0' 'step 0'
@ -2509,9 +2511,9 @@ character.yijiang={
player.choosePlayerCard(target,'e',true); player.choosePlayerCard(target,'e',true);
'step 1' 'step 1'
if(result.links){ if(result.links){
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(get.distance(target,game.players[i],'attack')<=1){ if(get.distance(target,players[i],'attack')<=1){
num++; num++;
} }
} }
@ -2522,9 +2524,9 @@ character.yijiang={
event.finish(); event.finish();
} }
'step 2' 'step 2'
var num2=0; var num2=0,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(get.distance(target,game.players[i],'attack')<=1){ if(get.distance(target,players[i],'attack')<=1){
num2++; num2++;
} }
} }
@ -2553,10 +2555,11 @@ character.yijiang={
mod:{ mod:{
attackTo:function(from,to,distance){ attackTo:function(from,to,distance){
if(from.group!='wu') return; if(from.group!='wu') return;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(from!=game.players[i]&&to!=game.players[i]&& for(var i=0;i<players.length;i++){
game.players[i].hasZhuSkill('zhaofu',from)){ if(from!=players[i]&&to!=players[i]&&
if(get.distance(game.players[i],to)<=1) return distance-100; players[i].hasZhuSkill('zhaofu',from)){
if(get.distance(players[i],to)<=1) return distance-100;
} }
} }
} }
@ -2948,19 +2951,19 @@ character.yijiang={
if(!player.hasZhuSkill('qinwang')) return false; if(!player.hasZhuSkill('qinwang')) return false;
if(!player.num('he')) return false; if(!player.num('he')) return false;
if(event.filterCard({name:'sha'},player,event)==false) return false; if(event.filterCard({name:'sha'},player,event)==false) return false;
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(game.players[i]!=player&&game.players[i].group=='shu') return true; return current!=player&&current.group=='shu';
} });
return false;
}, },
direct:true, direct:true,
content:function(){ content:function(){
"step 0" "step 0"
var yep=false; var yep=false;
if(!player.storage.jijianging){ if(!player.storage.jijianging){
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
var nh=game.players[i].num('h'); for(var i=0;i<players.length;i++){
if(game.players[i].group=='shu'&&ai.get.attitude(game.players[i],player)>1&&(nh>=4||(nh>=3&&game.players[i].num('h','sha')))){ var nh=players[i].num('h');
if(players[i].group=='shu'&&ai.get.attitude(players[i],player)>1&&(nh>=4||(nh>=3&&players[i].num('h','sha')))){
yep=true;break; yep=true;break;
} }
} }
@ -3020,20 +3023,18 @@ character.yijiang={
filter:function(event,player){ filter:function(event,player){
if(event.filterCard&&!event.filterCard({name:'sha'},player,event)) return false; if(event.filterCard&&!event.filterCard({name:'sha'},player,event)) return false;
if(!player.hasZhuSkill('qinwang')) return false; if(!player.hasZhuSkill('qinwang')) return false;
for(var i=0;i<game.players.length;i++){ if(!lib.filter.cardUsable({name:'sha'},player)) return false;
if(game.players[i].group=='shu'&&game.players[i]!=player){ return game.hasPlayer(function(current){
return lib.filter.cardUsable({name:'sha'},player); return current!=player&&current.group=='shu';
} });
}
return false;
}, },
filterCard:true, filterCard:true,
position:'he', position:'he',
check:function(card){ check:function(card){
var player=_status.event.player; var player=_status.event.player,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
var nh=game.players[i].num('h'); var nh=players[i].num('h');
if(game.players[i].group=='shu'&&ai.get.attitude(game.players[i],player)>1&&(nh>=4||(nh>=3&&game.players[i].num('h','sha')))){ if(players[i].group=='shu'&&ai.get.attitude(players[i],player)>1&&(nh>=4||(nh>=3&&players[i].num('h','sha')))){
return 5-ai.get.value(card); return 5-ai.get.value(card);
} }
} }
@ -3363,184 +3364,6 @@ character.yijiang={
save:true, save:true,
}, },
}, },
huomo_sha_old:{
enable:'phaseUse',
discard:false,
prepare:'throw',
filter:function(event,player){
if(!player.storage.huomo) player.storage.huomo={};
if(player.storage.huomo.sha) return false;
if(!lib.filter.filterCard({name:'sha'},player,event)){
return false;
}
var hs=player.get('he',{color:'black'});
for(var i=0;i<hs.length;i++){
if(get.type(hs[i])!='basic'){
break;
}
}
if(i==hs.length) return false;
for(var i=0;i<game.players.length;i++){
if(player.canUse('sha',game.players[i])) return true;
}
return false;
},
position:'he',
filterCard:function(card){
return get.type(card)!='basic'&&get.color(card)=='black';
},
filterTarget:function(card,player,target){
return player.canUse('sha',target);
},
check:function(card){
return 6-ai.get.value(card);
},
content:function(){
game.log(player,'将',cards,'置于牌堆顶');
ui.cardPile.insertBefore(cards[0],ui.cardPile.firstChild);
player.useCard({name:'sha'},targets);
},
ai:{
order:2,
result:{
target:function(player,target){
return ai.get.effect(target,{name:'sha'},player,target);
}
}
}
},
huomo_tao_old:{
enable:'chooseToUse',
discard:false,
prepare:'throw',
filter:function(event,player){
if(!player.storage.huomo) player.storage.huomo={};
if(player.storage.huomo.tao) return false;
var hs=player.get('he',{color:'black'});
for(var i=0;i<hs.length;i++){
if(get.type(hs[i])!='basic'){
break;
}
}
if(i==hs.length) return false;
if(event.type=='dying'){
return event.filterCard({name:'tao'},player);
}
if(event.getParent().name!='phaseUse') return false;
if(!lib.filter.filterCard({name:'tao'},player,event)){
return false;
}
return player.hp<player.maxHp;
},
position:'he',
filterCard:function(card){
return get.type(card)!='basic'&&get.color(card)=='black';
},
filterTarget:function(card,player,target){
if(_status.event.type=='dying'){
return target==_status.event.dying;
}
return player==target;
},
selectTarget:-1,
check:function(card){
return 8-ai.get.value(card);
},
content:function(){
game.log(player,'将',cards,'置于牌堆顶');
ui.cardPile.insertBefore(cards[0],ui.cardPile.firstChild);
player.useCard({name:'tao'},targets).delayx=false;
},
ai:{
skillTagFilter:function(player){
if(!player.storage.huomo) player.storage.huomo={};
if(player.storage.huomo.tao) return false;
var hs=player.get('he',{color:'black'});
for(var i=0;i<hs.length;i++){
if(get.type(hs[i])!='basic'){
return true;
}
}
return false;
},
threaten:1.5,
save:true,
order:9,
result:{
target:function(player,target){
return ai.get.effect(target,{name:'tao'},player,target);
}
}
}
},
huomo_jiu_old:{
enable:'chooseToUse',
discard:false,
prepare:'throw',
filter:function(event,player){
if(!lib.filter.filterCard({name:'jiu'},player,event)){
return false;
}
if(player.storage.huomo.jiu) return false;
var hs=player.get('he',{color:'black'});
for(var i=0;i<hs.length;i++){
if(get.type(hs[i])!='basic'){
break;
}
}
if(i==hs.length) return false;
if(event.type=='dying'){
return event.filterCard({name:'jiu'},player);
}
if(event.getParent().name!='phaseUse') return false;
return true;
},
position:'he',
filterCard:function(card){
return get.type(card)!='basic'&&get.color(card)=='black';
},
filterTarget:function(card,player,target){
if(_status.event.type=='dying'){
return target==_status.event.dying;
}
return player==target;
},
selectTarget:-1,
check:function(card){
if(_status.event.type=='dying'){
return 8-ai.get.value(card);
}
return 6-ai.get.value(card);
},
content:function(){
game.log(player,'将',cards,'置于牌堆顶');
ui.cardPile.insertBefore(cards[0],ui.cardPile.firstChild);
player.useCard({name:'jiu'},targets).delayx=false;
},
ai:{
save:true,
skillTagFilter:function(player){
if(!player.storage.huomo) player.storage.huomo={};
if(player.storage.huomo.jiu) return false;
if(player.hp>0) return false;
var hs=player.get('he',{color:'black'});
for(var i=0;i<hs.length;i++){
if(get.type(hs[i])!='basic'){
return true;
}
}
return false;
},
order:function(){
return lib.card.sha.ai.order+0.2;
},
result:{
target:function(player,target){
return ai.get.effect(target,{name:'jiu'},player,target);
}
}
}
},
taoxi:{ taoxi:{
audio:2, audio:2,
trigger:{player:'useCardToBegin'}, trigger:{player:'useCardToBegin'},
@ -3642,10 +3465,9 @@ character.yijiang={
if(player.storage.xingshuai) return false; if(player.storage.xingshuai) return false;
if(player.hp>0) return false; if(player.hp>0) return false;
if(!player.hasZhuSkill('xingshuai')) return false; if(!player.hasZhuSkill('xingshuai')) return false;
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(game.players[i]!=player&&game.players[i].group=='wei') return true; return current!=player&&current.group=='wei';
} });
return false;
}, },
init:function(player){ init:function(player){
if(player.hasZhuSkill('xingshuai')){ if(player.hasZhuSkill('xingshuai')){
@ -3661,7 +3483,7 @@ character.yijiang={
'step 0' 'step 0'
player.storage.xingshuai=true; player.storage.xingshuai=true;
player.awakenSkill('xingshuai'); player.awakenSkill('xingshuai');
var targets=get.players(); var targets=game.filterPlayer();
targets.remove(player); targets.remove(player);
event.targets=targets; event.targets=targets;
event.damages=[]; event.damages=[];
@ -4128,19 +3950,19 @@ 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-=Math.max(1,game.players[i].num('e')); num-=Math.max(1,players[i].num('e'));
} }
else if(att<0){ else if(att<0){
num+=Math.max(1,game.players[i].num('e')); num+=Math.max(1,players[i].num('e'));
} }
} }
} }
if(game.players.length<5){ if(players.length<5){
return num-1; return num-1;
} }
else{ else{
@ -4272,12 +4094,9 @@ character.yijiang={
"step 0" "step 0"
player.awakenSkill('jiefan'); player.awakenSkill('jiefan');
player.storage.jiefan=true; player.storage.jiefan=true;
event.players=[]; event.players=game.filterPlayer(function(current){
for(var i=0;i<game.players.length;i++){ return current!=target&&get.distance(current,target,'attack')<=1;
if(game.players[i]!=target&&get.distance(game.players[i],target,'attack')<=1){ });
event.players.push(game.players[i]);
}
}
get.sortSeat(event.players,target); get.sortSeat(event.players,target);
"step 1" "step 1"
if(event.players.length){ if(event.players.length){
@ -4311,9 +4130,9 @@ character.yijiang={
if(player.hp>2){ if(player.hp>2){
if(game.phaseNumber<game.players.length*2) return 0; if(game.phaseNumber<game.players.length*2) return 0;
} }
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(game.players[i]!=target&&get.distance(game.players[i],target,'attack')<=1){ if(players[i]!=target&&get.distance(players[i],target,'attack')<=1){
num++; num++;
} }
} }
@ -4444,10 +4263,7 @@ character.yijiang={
enable:'phaseUse', enable:'phaseUse',
usable:1, usable:1,
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
for(var i=0;i<game.players.length;i++){ return target.isHighestHp();
if(game.players[i].hp>target.hp) return false;
}
return true;
}, },
check:function(card){return 7-ai.get.value(card);}, check:function(card){return 7-ai.get.value(card);},
position:'he', position:'he',
@ -4525,8 +4341,9 @@ character.yijiang={
var goon=false; var goon=false;
var info=get.info(trigger.card); var info=get.info(trigger.card);
if(trigger.targets&&!info.multitarget){ if(trigger.targets&&!info.multitarget){
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(lib.filter.targetEnabled2(trigger.card,player,game.players[i])&&!trigger.targets.contains(game.players[i])){ for(var i=0;i<players.length;i++){
if(lib.filter.targetEnabled2(trigger.card,player,players[i])&&!trigger.targets.contains(players[i])){
goon=true;break; goon=true;break;
} }
} }
@ -5095,9 +4912,9 @@ character.yijiang={
result:{ result:{
target:1, target:1,
player:function(player){ player:function(player){
var bool=true; var bool=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&&ai.get.attitude(player,game.players[i])>2&&ai.get.attitude(game.players[i],player)>2 ){ if(players[i]!=player&&ai.get.attitude(player,players[i])>2&&ai.get.attitude(players[i],player)>2){
bool=false;break; bool=false;break;
} }
} }
@ -5224,8 +5041,9 @@ character.yijiang={
effect:{ effect:{
target:function(card,player,target){ target:function(card,player,target){
if(card.name!='sha') return; if(card.name!='sha') return;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
var target2=game.players[i]; for(var i=0;i<players.length;i++){
var target2=players[i];
if(player!=target2&&target!=target2&&player.canUse(card,target2,false)&& if(player!=target2&&target!=target2&&player.canUse(card,target2,false)&&
ai.get.effect(target2,{name:'shacopy',nature:card.nature,suit:card.suit},player,target)<0){ ai.get.effect(target2,{name:'shacopy',nature:card.nature,suit:card.suit},player,target)<0){
if(target.hp==target.maxHp) return [0,1]; if(target.hp==target.maxHp) return [0,1];
@ -5332,8 +5150,9 @@ character.yijiang={
if(ui.selected.targets.length){ if(ui.selected.targets.length){
return num<ui.selected.targets[0].num('h'); return num<ui.selected.targets[0].num('h');
} }
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(num>game.players[i].num('h')) return true; for(var i=0;i<players.length;i++){
if(num>players[i].num('h')) return true;
} }
return false; return false;
}, },
@ -5389,9 +5208,10 @@ character.yijiang={
var att=ai.get.attitude(player,target); var att=ai.get.attitude(player,target);
if(ui.selected.targets.length==0){ if(ui.selected.targets.length==0){
if(att>0) return -1; if(att>0) return -1;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
var num2=game.players[i].num('h'); for(var i=0;i<players.length;i++){
var att2=ai.get.attitude(player,game.players[i]); var num2=players[i].num('h');
var att2=ai.get.attitude(player,players[i]);
if(att2>=0&&num2<num) return -1; if(att2>=0&&num2<num) return -1;
} }
return 0; return 0;
@ -5452,8 +5272,9 @@ character.yijiang={
ai:{ ai:{
result:{ result:{
player:function(player){ player:function(player){
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(game.players[i]!=player&&ai.get.attitude(player,game.players[i])>1&&ai.get.attitude(game.players[i],player)>1){ for(var i=0;i<players.length;i++){
if(players[i]!=player&&ai.get.attitude(player,players[i])>1&&ai.get.attitude(players[i],player)>1){
return 1; return 1;
} }
} }
@ -6070,10 +5891,11 @@ character.yijiang={
if(!player.num('h','sha')) return 0; if(!player.num('h','sha')) return 0;
var targets=[]; var targets=[];
var target; var target;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(ai.get.attitude(player,game.players[i])<0){ for(var i=0;i<players.length;i++){
if(player.canUse('sha',game.players[i],true,true)){ if(ai.get.attitude(player,players[i])<0){
targets.push(game.players[i]); if(player.canUse('sha',players[i],true,true)){
targets.push(players[i]);
} }
} }
} }
@ -6340,20 +6162,20 @@ character.yijiang={
}, },
check:function(button){ check:function(button){
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()){ if(!players[i].isOut()){
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(players[i].hp<2){
lose++; lose++;
recover-=0.5; recover-=0.5;
} }
@ -6362,10 +6184,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++;
} }
} }
@ -6697,15 +6519,16 @@ character.yijiang={
return get.suit(card)=='heart'; return get.suit(card)=='heart';
}, },
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
if(game.players.length==2) return false; if(game.countPlayer()==2) return false;
return player!=target; return player!=target;
}, },
check:function(card){ check:function(card){
var player=get.owner(card); var player=get.owner(card);
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(game.players[i]!=player&&ai.get.attitude(player,game.players[i])>3) break; for(var i=0;i<players.length;i++){
if(players[i]!=player&&ai.get.attitude(player,players[i])>3) break;
} }
if(i==game.players.length) return -1; if(i==players.length) return -1;
return 5-ai.get.value(card); return 5-ai.get.value(card);
}, },
content:function(){ content:function(){
@ -6775,9 +6598,10 @@ character.yijiang={
var list1=[]; var list1=[];
var list2=[]; var list2=[];
var num=player.maxHp-player.hp; var num=player.maxHp-player.hp;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(ai.get.attitude(player,game.players[i])>0) list1.push(game.players[i]); for(var i=0;i<players.length;i++){
else if(ai.get.attitude(player,game.players[i])<0) list2.push(game.players[i]); if(ai.get.attitude(player,players[i])>0) list1.push(players[i]);
else if(ai.get.attitude(player,players[i])<0) list2.push(players[i]);
} }
list1.sort(function(a,b){ list1.sort(function(a,b){
return a.num('e')-b.num('e'); return a.num('e')-b.num('e');
@ -7144,21 +6968,19 @@ character.yijiang={
audio:2, audio:2,
forceaudio:true, forceaudio:true,
filter:function(event,player){ filter:function(event,player){
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(game.players[i].storage.xiansi){ for(var i=0;i<players.length;i++){
return game.players[i].storage.xiansi.length>1&&player.canUse('sha',game.players[i],true,true); if(players[i].storage.xiansi){
return players[i].storage.xiansi.length>1&&player.canUse('sha',players[i],true,true);
} }
} }
return false; return false;
}, },
content:function(){ content:function(){
"step 0" "step 0"
for(var i=0;i<game.players.length;i++){ event.target=game.findPlayer(function(current){
if(game.players[i].storage.xiansi){ return current.storage.xiansi;
event.target=game.players[i]; });
break;
}
}
if(event.target){ if(event.target){
player.chooseCardButton(2,event.target.storage.xiansi).set('ai',function(){ player.chooseCardButton(2,event.target.storage.xiansi).set('ai',function(){
return 1; return 1;
@ -7190,13 +7012,9 @@ character.yijiang={
order:3.1, order:3.1,
result:{ result:{
player:function(player){ player:function(player){
var target; var target=game.findPlayer(function(current){
for(var i=0;i<game.players.length;i++){ return current.storage.xiansi;
if(game.players[i].storage.xiansi){ });
target=game.players[i];
break;
}
}
if(target){ if(target){
return ai.get.effect(target,{name:'sha'},player,player); return ai.get.effect(target,{name:'sha'},player,player);
} }

View File

@ -192,26 +192,23 @@ character.yxs={
fengliu:{ fengliu:{
trigger:{player:'phaseDrawBegin'}, trigger:{player:'phaseDrawBegin'},
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].sex=='female') return true; return current.sex=='female';
} });
return false;
}, },
forced:true, forced:true,
content:function(){ content:function(){
var num=0; var num=game.countPlayer(function(current){
for(var i=0;i<game.players.length;i++){ return current.sex=='female';
if(game.players[i].sex=='female') num++; });
}
if(num>2) num=2; if(num>2) num=2;
trigger.num+=num; trigger.num+=num;
}, },
ai:{ ai:{
threaten:function(){ threaten:function(){
var num=0; var num=game.countPlayer(function(current){
for(var i=0;i<game.players.length;i++){ return current.sex=='female';
if(game.players[i].sex=='female') num++; });
}
switch(num){ switch(num){
case 0:return 1; case 0:return 1;
case 1:return 1.3; case 1:return 1.3;
@ -270,9 +267,9 @@ character.yxs={
direct:true, direct:true,
filter:function(event,player){ filter:function(event,player){
if(event.num>0){ if(event.num>0){
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(game.players[i].group!='qun'&&game.players[i]!=player) return true; return current.group!='qun'&&current!=player;
} });
} }
return false; return false;
}, },
@ -316,10 +313,10 @@ character.yxs={
if(get.tag(card,'damage')){ if(get.tag(card,'damage')){
if(player.hasSkill('jueqing')) return [1,-2]; if(player.hasSkill('jueqing')) return [1,-2];
if(!target.hasFriend()) return; if(!target.hasFriend()) return;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(game.players[i].group!='qun'&& for(var i=0;i<players.length;i++){
ai.get.attitude(player,game.players[i])<=0&& if(players[i].group!='qun'&&
game.players[i]!=player){ ai.get.attitude(player,players[i])<=0&&players[i]!=player){
if(target.hp>=4) return [1,get.tag(card,'damage')*2]; if(target.hp>=4) return [1,get.tag(card,'damage')*2];
if(target.hp==3) return [1,get.tag(card,'damage')*1.5]; if(target.hp==3) return [1,get.tag(card,'damage')*1.5];
if(target.hp==2) return [1,get.tag(card,'damage')*0.5]; if(target.hp==2) return [1,get.tag(card,'damage')*0.5];
@ -570,8 +567,10 @@ character.yxs={
player:function(player,target){ player:function(player,target){
if(!player.hasSkill('xiushen')) return 0; if(!player.hasSkill('xiushen')) return 0;
if(target.isLinked()) return 0; if(target.isLinked()) return 0;
for(var i=0;i<game.players.length;i++){ if(game.hasPlayer(function(current){
if(game.players[i].isLinked()) return 0; return current.isLinked();
})){
return 0;
} }
return 1; return 1;
} }
@ -605,16 +604,15 @@ character.yxs={
trigger:{player:'phaseEnd'}, trigger:{player:'phaseEnd'},
forced:true, forced: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].isLinked()) return true; return current.isLinked();
} });
return false;
}, },
content:function(){ content:function(){
player.draw(2); player.draw(2);
}, },
ai:{ ai:{
threaten:1.4 threaten:1.6
} }
}, },
jiean:{ jiean:{
@ -1103,10 +1101,9 @@ character.yxs={
if(event.player.isDead()) return false; if(event.player.isDead()) return false;
var nh=event.player.num('h'); var nh=event.player.num('h');
if(nh==0) return false; if(nh==0) return false;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(game.players[i]!=player&& for(var i=0;i<players.length;i++){
game.players[i]!=event.player&& if(players[i]!=player&&players[i]!=event.player&&players[i].num('h')<=nh){
game.players[i].num('h')<=nh){
return true; return true;
} }
} }
@ -1401,40 +1398,40 @@ character.yxs={
mod:{ mod:{
cardEnabled:function(card,player){ cardEnabled:function(card,player){
if(player.hasSkill('ducai2')) return; if(player.hasSkill('ducai2')) return;
var suit; var suit,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(game.players[i].hasSkill('ducai2')){ if(players[i].hasSkill('ducai2')){
suit=get.suit(game.players[i].storage.ducai2); suit=get.suit(players[i].storage.ducai2);
} }
} }
if(suit&&get.suit(card)==suit) return false; if(suit&&get.suit(card)==suit) return false;
}, },
cardUsable:function(card,player){ cardUsable:function(card,player){
if(player.hasSkill('ducai2')) return; if(player.hasSkill('ducai2')) return;
var suit; var suit,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(game.players[i].hasSkill('ducai2')){ if(players[i].hasSkill('ducai2')){
suit=get.suit(game.players[i].storage.ducai2); suit=get.suit(players[i].storage.ducai2);
} }
} }
if(suit&&get.suit(card)==suit) return false; if(suit&&get.suit(card)==suit) return false;
}, },
cardRespondable:function(card,player){ cardRespondable:function(card,player){
if(player.hasSkill('ducai2')) return; if(player.hasSkill('ducai2')) return;
var suit; var suit,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(game.players[i].hasSkill('ducai2')){ if(players[i].hasSkill('ducai2')){
suit=get.suit(game.players[i].storage.ducai2); suit=get.suit(players[i].storage.ducai2);
} }
} }
if(suit&&get.suit(card)==suit) return false; if(suit&&get.suit(card)==suit) return false;
}, },
cardSavable:function(card,player){ cardSavable:function(card,player){
if(player.hasSkill('ducai2')) return; if(player.hasSkill('ducai2')) return;
var suit; var suit,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(game.players[i].hasSkill('ducai2')){ if(players[i].hasSkill('ducai2')){
suit=get.suit(game.players[i].storage.ducai2); suit=get.suit(players[i].storage.ducai2);
} }
} }
if(suit&&get.suit(card)==suit) return false; if(suit&&get.suit(card)==suit) return false;
@ -1608,9 +1605,9 @@ character.yxs={
wange:{ wange:{
trigger:{player:'phaseDrawBegin'}, trigger:{player:'phaseDrawBegin'},
check:function(event,player){ check:function(event,player){
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(ai.get.attitude(player,game.players[i])<0) return true; return ai.get.attitude(player,current)<0&&current.num('h');
} });
}, },
content:function(){ content:function(){
trigger.num--; trigger.num--;
@ -1703,17 +1700,18 @@ character.yxs={
order:5, order:5,
result:{ result:{
target:function(player,target){ target:function(player,target){
var players=game.filterPlayer();
if(player.hp>1){ if(player.hp>1){
if(game.phaseNumber<game.players.length) return 0; if(game.phaseNumber<game.players.length) return 0;
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(game.players[i].ai.shown==0) return 0; if(players[i].ai.shown==0) return 0;
if(game.players[i].sex=='unknown') return 0; if(players[i].sex=='unknown') return 0;
} }
} }
var effect=0; var effect=0;
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(game.players[i].sex=='male'&&game.players[i]!=target&&game.players[i]!=player&&game.players[i].num('he')) if(players[i].sex=='male'&&players[i]!=target&&players[i]!=player&&players[i].num('he'))
effect+=ai.get.effect(target,{name:'sha'},game.players[i],target); effect+=ai.get.effect(target,{name:'sha'},players[i],target);
} }
return effect; return effect;
} }
@ -2121,22 +2119,22 @@ character.yxs={
return false; return false;
} }
var num=0; var num=0;
var ef; var eff,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){ if(players[i]!=player){
ef=0; eff=0;
if(game.players[i].hp<game.players[i].maxHp){ if(players[i].hp<players[i].maxHp){
ef++; eff++;
} }
if(game.players[i].hp==1&&game.players[i].maxHp>2){ if(players[i].hp==1&&players[i].maxHp>2){
ef+=0.5; eff+=0.5;
} }
} }
if(ai.get.attitude(player,game.players[i])>0){ if(ai.get.attitude(player,players[i])>0){
num+=ef; num+=eff;
} }
else if(ai.get.attitude(player,game.players[i])<0){ else if(ai.get.attitude(player,players[i])<0){
num-=ef; num-=eff;
} }
} }
return num>0; return num>0;
@ -2180,105 +2178,6 @@ character.yxs={
threaten:1.3 threaten:1.3
} }
}, },
jieyong_old:{
enable:'phaseUse',
usable:1,
group:['jieyong3'],
direct:true,
filter:function(event,player){
return player.num('h',{suit:'heart'})>0;
},
content:function(){
"step 0"
var list=[];
player.getStat('skill').jieyong--;
for(var i in lib.card){
if(lib.card[i].mode&&lib.card[i].mode.contains(lib.config.mode)==false) continue;
if(lib.card[i].type=='trick'||lib.card[i].type=='basic'){
if(lib.filter.filterCard({name:i,suit:'heart'}),player){
var select=get.select(lib.card[i].selectTarget);
if(select[0]==1&&select[1]==1){
list.push(['','',i]);
}
}
}
}
var dialog=ui.create.dialog([list,'vcard']);
player.chooseButton(dialog,function(button){
// if(player.hasSkill('jieyong4')==false){
// for(var i=0;i<game.players.length;i++){
// if(ai.get.attitude(player,game.players[i])<-3&&
// game.players[i].hp==1&&game.players[i].num('h')<=1){
// return (button.link[2]=='juedou')?1:-1
// }
// }
// }
var recover=0,lose=1;
for(var i=0;i<game.players.length;i++){
if(!game.players[i].isOut()){
if(game.players[i].hp<game.players[i].maxHp){
if(ai.get.attitude(player,game.players[i])>0){
if(game.players[i].hp<2){
lose--;
recover+=0.5;
}
lose--;
recover++;
}
else if(ai.get.attitude(player,game.players[i])<0){
if(game.players[i].hp<2){
lose++;
recover-=0.5;
}
lose++;
recover--;
}
}
else{
if(ai.get.attitude(player,game.players[i])>0){
lose--;
}
else if(ai.get.attitude(player,game.players[i])<0){
lose++;
}
}
}
}
if(player.hp<player.num('h')) return (button.link[2]=='wuzhong')?1:-1;
return (button.link[2]=='wuzhong')?1:-1;
});
"step 1"
if(result.bool){
lib.skill.jieyong2.viewAs={name:result.buttons[0].link[2]};
// player.popup(result.buttons[0].link[2]);
event.parent.parent.backup('jieyong2');
event.parent.parent.step=0;
if(event.isMine()){
event.parent.parent.skillDialog='将一张红桃牌当'+get.translation(result.buttons[0].link[2])+'使用';
}
player.addTempSkill('jieyong6','phaseAfter');
}
else{
if(player.hasSkill('jieyong4')){
player.addTempSkill('jieyong5','phaseAfter')
}
else{
player.addTempSkill('jieyong4','phaseAfter')
}
event.finish();
}
},
ai:{
order:9,
result:{
player:function(player){
if(player.hasSkill('jieyong5')||player.hasSkill('jieyong6')) return 0;
return 1;
}
},
threaten:1.6,
}
},
jieyong2:{ jieyong2:{
filterCard:{suit:'heart'}, filterCard:{suit:'heart'},
popname:true, popname:true,
@ -2395,13 +2294,14 @@ character.yxs={
if(ui.selected.targets.length==0){ if(ui.selected.targets.length==0){
if(target.num('j')&&ai.get.attitude(player,target)>0) return 1; if(target.num('j')&&ai.get.attitude(player,target)>0) return 1;
if(ai.get.attitude(player,target)<0){ if(ai.get.attitude(player,target)<0){
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(ai.get.attitude(player,game.players[i])>0){ for(var i=0;i<players.length;i++){
if((target.get('e','1')&&!game.players[i].get('e','1'))|| if(ai.get.attitude(player,players[i])>0){
(target.get('e','2')&&!game.players[i].get('e','2'))|| if((target.get('e','1')&&!players[i].get('e','1'))||
(target.get('e','3')&&!game.players[i].get('e','3'))|| (target.get('e','2')&&!players[i].get('e','2'))||
(target.get('e','4')&&!game.players[i].get('e','4'))|| (target.get('e','3')&&!players[i].get('e','3'))||
(target.get('e','5')&&!game.players[i].get('e','5'))) (target.get('e','4')&&!players[i].get('e','4'))||
(target.get('e','5')&&!players[i].get('e','5')))
return -1; return -1;
} }
} }