This commit is contained in:
libccy 2017-02-12 10:13:41 +08:00
parent 3793cf2305
commit 4f9500af24
3 changed files with 63 additions and 104 deletions

View File

@ -23,7 +23,7 @@ character.extra={
// event.count=trigger.cards.length-1; // event.count=trigger.cards.length-1;
event.count=1; event.count=1;
} }
var recover=0,lose=0,players=game.filterPlayer; var recover=0,lose=0,players=game.filterPlayer();
for(var i=0;i<players.length;i++){ for(var i=0;i<players.length;i++){
if(players[i].hp<players[i].maxHp){ if(players[i].hp<players[i].maxHp){
if(ai.get.attitude(player,players[i])>0){ if(ai.get.attitude(player,players[i])>0){

View File

@ -184,7 +184,7 @@ character.ow={
filter:function(event,player){ filter:function(event,player){
if(player.storage.qinru){ if(player.storage.qinru){
for(var i=0;i<player.storage.qinru.length;i++){ for(var i=0;i<player.storage.qinru.length;i++){
if(player.storage.qinru[i].isAlive()&&player.storage.qinru[i].num('he')) return true; if(player.storage.qinru[i].isIn()&&player.storage.qinru[i].num('he')) return true;
} }
} }
}, },
@ -192,7 +192,7 @@ character.ow={
var list=[]; var list=[];
if(player.storage.qinru){ if(player.storage.qinru){
for(var i=0;i<player.storage.qinru.length;i++){ for(var i=0;i<player.storage.qinru.length;i++){
if(player.storage.qinru[i].isAlive()&&player.storage.qinru[i].num('he')){ if(player.storage.qinru[i].isIn()&&player.storage.qinru[i].num('he')){
list.push(player.storage.qinru[i]); list.push(player.storage.qinru[i]);
} }
} }
@ -204,7 +204,7 @@ character.ow={
var list=[]; var list=[];
if(player.storage.qinru){ if(player.storage.qinru){
for(var i=0;i<player.storage.qinru.length;i++){ for(var i=0;i<player.storage.qinru.length;i++){
if(player.storage.qinru[i].isAlive()&&player.storage.qinru[i].num('he')){ if(player.storage.qinru[i].In()&&player.storage.qinru[i].num('he')){
list.push(player.storage.qinru[i]); list.push(player.storage.qinru[i]);
} }
} }
@ -776,25 +776,17 @@ character.ow={
}, },
ai:{ ai:{
order:function(skill,player){ order:function(skill,player){
var num=0; var num=game.countPlayer(function(current){
var nh=player.num('h',{color:'black'}); return ai.get.attitude(player,current)<0;
for(var i=0;i<game.players.length;i++){ });
if(ai.get.attitude(player,game.players[i])<0){ var nh=player.num('he',{color:'black'});
num++;
}
}
if(nh==1&&num>1) return 0; if(nh==1&&num>1) return 0;
if(nh>num) return 1; if(nh>num) return 1;
return 11; return 11;
}, },
result:{ result:{
target:function(player,target){ target:function(player,target){
var mode=get.mode(); if(player.hasUnknown()) return 0;
if(mode=='identity'||mode=='guozhan'){
for(var i=0;i<game.players.length;i++){
if(game.players[i].ai.shown<=0) return 0;
}
}
return -1; return -1;
} }
} }
@ -976,13 +968,13 @@ character.ow={
if(target.num('h')<=1&&get.distance(player,target,'attack')<=1) return 0; if(target.num('h')<=1&&get.distance(player,target,'attack')<=1) return 0;
var min=[]; var min=[];
var num=0; var num=0;
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++){
player.canUse('sha',game.players[i],false)){ if(players[i]!=player&&player.canUse('sha',players[i],false)){
var eff=ai.get.effect(target,{name:'sha'},player,player); var eff=ai.get.effect(players[i],{name:'sha'},player,player);
if(eff>num){ if(eff>num){
min.length=0; min.length=0;
min.push(game.players[i]); min.push(players[i]);
num=eff; num=eff;
} }
} }
@ -1190,10 +1182,10 @@ 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; var max=0,min=0,players=game.filterPlayer;
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(!lib.skill.bingqiang.filterTarget(null,player,game.players[i])) continue; if(!lib.skill.bingqiang.filterTarget(null,player,players[i])) continue;
var num=lib.skill.bingqiang.ai.result.playerx(player,game.players[i]); var num=lib.skill.bingqiang.ai.result.playerx(player,players[i]);
if(num>max){ if(num>max){
max=num; max=num;
} }
@ -1485,9 +1477,9 @@ character.ow={
unique:true, unique:true,
filter:function(event,player){ filter:function(event,player){
if(player.storage.jijia>0){ if(player.storage.jijia>0){
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(get.distance(player,game.players[i])>1) return true; return get.distance(player,current)>1
} });
} }
return false; return false;
}, },
@ -1607,13 +1599,14 @@ character.ow={
result:{ result:{
player:function(player){ player:function(player){
var num=0; var num=0;
for(var i=0;i<game.players.length;i++){ var players=game.filterPlayer();
if(game.players[i]==player||game.players[i].hasSkillTag('nofire')||get.distance(player,game.players[i])>2) continue; for(var i=0;i<players.length;i++){
var nh=game.players[i].num('h'); if(players[i]==player||players[i].hasSkillTag('nofire')||get.distance(player,players[i])>2) continue;
var att=ai.get.attitude(player,game.players[i]); var nh=players[i].num('h');
var att=ai.get.attitude(player,players[i]);
if(nh<player.storage.jijia){ if(nh<player.storage.jijia){
if(att<0){ if(att<0){
if(game.players[i].hp<=2){ if(players[i].hp<=2){
num+=2; num+=2;
} }
else{ else{
@ -1621,7 +1614,7 @@ character.ow={
} }
} }
else if(att>0){ else if(att>0){
if(game.players[i].hp<=2){ if(players[i].hp<=2){
num-=2; num-=2;
} }
else{ else{
@ -1909,7 +1902,7 @@ character.ow={
if(get.suit(event.card)!='spade') return false; if(get.suit(event.card)!='spade') return false;
var card=game.createCard(event.card.name,event.card.suit,event.card.number,event.card.nature); var card=game.createCard(event.card.name,event.card.suit,event.card.number,event.card.nature);
for(var i=0;i<event.targets.length;i++){ for(var i=0;i<event.targets.length;i++){
if(!event.targets[i].isAlive()) return false; if(!event.targets[i].isIn()) return false;
if(!player.canUse({name:event.card.name},event.targets[i],false,false)){ if(!player.canUse({name:event.card.name},event.targets[i],false,false)){
return false; return false;
} }
@ -2194,13 +2187,13 @@ character.ow={
var eff=ai.get.recoverEffect(target,player,target); var eff=ai.get.recoverEffect(target,player,target);
if(player.hp==1) return eff; if(player.hp==1) return eff;
if(player.hasUnknown()) return 0; if(player.hasUnknown()) return 0;
var num1=0,num2=0,num3=0; var num1=0,num2=0,num3=0,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(ai.get.attitude(player,game.players[i])>0){ if(ai.get.attitude(player,players[i])>0){
num1++; num1++;
if(game.players[i].isDamaged()){ if(players[i].isDamaged()){
num2++; num2++;
if(game.players[i].hp<=1){ if(players[i].hp<=1){
num3++; num3++;
} }
} }
@ -2230,41 +2223,6 @@ character.ow={
} }
} }
}, },
xiandan_old:{
mod:{
selectTarget:function(card,player,range){
if(card.name=='sha'&&range[1]!=-1){
var num=0;
var attack=false;
for(var i=0;i<game.players.length;i++){
if(player!=game.players[i]){
if(get.distance(player,game.players[i])<=1){
num++;
}
else if(get.distance(player,game.players[i],'attack')<=1){
attack=true;
}
}
}
if(!attack){
num--;
}
if(num>0){
range[1]+=num;
}
}
},
playerEnabled:function(card,player,target){
if(card.name=='sha'&&get.distance(player,target)>1){
for(var i=0;i<ui.selected.targets.length;i++){
if(get.distance(player,ui.selected.targets[i])>1){
return false;
}
}
}
}
}
},
yihun:{ yihun:{
trigger:{player:'phaseEnd'}, trigger:{player:'phaseEnd'},
direct:true, direct:true,
@ -2316,7 +2274,7 @@ character.ow={
return event.player==player.storage.yihun2; return event.player==player.storage.yihun2;
}, },
content:function(){ content:function(){
if(player.storage.yihun2.isAlive()){ if(player.storage.yihun2.isIn()){
player.useCard({name:'sha'},player.storage.yihun2); player.useCard({name:'sha'},player.storage.yihun2);
} }
player.removeSkill('yihun2'); player.removeSkill('yihun2');
@ -2387,23 +2345,21 @@ character.ow={
if(player.num('he')==0) return false; if(player.num('he')==0) return false;
if(!event.card) return false; if(!event.card) return false;
if(event.card.name!='sha') return false; if(event.card.name!='sha') return false;
for(var i=0;i<game.players.length;i++){ return game.hasPlayer(function(current){
if(game.players[i]!=event.player&&get.distance(event.player,game.players[i])<=1) return true; return current!=event.player&&get.distance(event.player,current)<=1
} });
return false;
}, },
content:function(){ content:function(){
"step 0" "step 0"
var eff=0; var eff=0;
var targets=[]; var targets=game.filterPlayer(function(current){
if(current!=trigger.player&&get.distance(trigger.player,current)<=1){
eff+=ai.get.damageEffect(current,player,player);
return true;
}
});
event.targets=targets; event.targets=targets;
for(var i=0;i<game.players.length;i++){ player.chooseToDiscard(get.prompt('feidan',targets)).set('ai',function(card){
if(game.players[i]!=trigger.player&&get.distance(trigger.player,game.players[i])<=1){
eff+=ai.get.damageEffect(game.players[i],player,player);
targets.push(game.players[i]);
}
}
player.chooseToDiscard(get.prompt('feidan')).set('ai',function(card){
if(eff>0) return 7-ai.get.value(card); if(eff>0) return 7-ai.get.value(card);
return 0; return 0;
}).set('logSkill',['feidan',targets]); }).set('logSkill',['feidan',targets]);
@ -2484,13 +2440,13 @@ character.ow={
order:10.2, order:10.2,
result:{ result:{
player:function(player){ player:function(player){
var num1=0,num2=0; var num1=0,num2=0,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(ai.get.attitude(player,game.players[i])>0){ if(ai.get.attitude(player,players[i])>0){
num2++; num2++;
if(game.players[i].hp<=2&&game.players[i].maxHp>2){ if(players[i].hp<=2&&players[i].maxHp>2){
num1++; num1++;
if(game.players[i].hp==1){ if(players[i].hp==1){
num1++; num1++;
} }
} }
@ -2519,11 +2475,11 @@ character.ow={
}, },
check:function(card){ check:function(card){
var player=_status.event.player; var player=_status.event.player;
var num1=0,num2=0; var num1=0,num2=0,players=game.filterPlayer();
for(var i=0;i<game.players.length;i++){ for(var i=0;i<players.length;i++){
if(ai.get.attitude(player,game.players[i])>0){ if(ai.get.attitude(player,players[i])>0){
num2++; num2++;
if(game.players[i].hp<=2&&game.players[i].maxHp>2){ if(players[i].hp<=2&&players[i].maxHp>2){
num1++; num1++;
} }
} }
@ -2580,11 +2536,9 @@ character.ow={
var player=_status.event.player; var player=_status.event.player;
var suit=get.suit(card); var suit=get.suit(card);
if(suit=='heart'){ if(suit=='heart'){
for(var i=0;i<game.players.length;i++){ if(game.hasPlayer(function(current){
if(game.players[i].hp==1&&ai.get.attitude(player,game.players[i])>0){ return current.hp==1&&ai.get.attitude(player,current)>0
return 8-ai.get.value(card); }));
}
}
} }
else if(suit=='spade'){ else if(suit=='spade'){
return 7-ai.get.value(card); return 7-ai.get.value(card);

View File

@ -34155,7 +34155,7 @@
player:function(){ player:function(){
return _status.event.player; return _status.event.player;
}, },
players:function(sort,dead){ players:function(sort,dead,out){
var players=game.players.slice(0); var players=game.players.slice(0);
if(sort!=false){ if(sort!=false){
if(typeof sort=='function'){ if(typeof sort=='function'){
@ -34170,6 +34170,11 @@
} }
} }
if(dead) players=players.concat(game.dead); if(dead) players=players.concat(game.dead);
if(!out){
for(var i=0;i<players.length;i++){
if(players[i].isOut()) players.splice(i--,1);
}
}
return players; return players;
}, },
position:function(card){ position:function(card){