This commit is contained in:
libccy 2017-02-27 01:01:20 +08:00
parent c572a81125
commit b6ca1c972c
4 changed files with 101 additions and 21 deletions

View File

@ -12,7 +12,15 @@ card.guozhan={
distance:{attackFrom:-1}, distance:{attackFrom:-1},
skills:['feilongduofeng','feilongduofeng2'], skills:['feilongduofeng','feilongduofeng2'],
ai:{ ai:{
equipValue:9 equipValue:function(card,player){
if(player.hasSkill('zhangwu')) return 9;
if(game.hasPlayer(function(current){
return current.hasSkill('zhangwu')&&ai.get.attitude(player,current)<=0;
})){
return 1;
}
return 8;
}
} }
}, },
taipingyaoshu:{ taipingyaoshu:{
@ -24,7 +32,15 @@ card.guozhan={
nopower:true, nopower:true,
skills:['taipingyaoshu'], skills:['taipingyaoshu'],
ai:{ ai:{
equipValue:9 equipValue:function(card,player){
if(player.hasSkill('wendao')) return 9;
if(game.hasPlayer(function(current){
return current.hasSkill('wendao')&&ai.get.attitude(player,current)<=0;
})){
return 1;
}
return 6;
}
}, },
onLose:function(){ onLose:function(){
'step 0' 'step 0'
@ -250,15 +266,26 @@ card.guozhan={
target.chooseControl(lib.card.chiling.chooseai).set('prompt','敕令').set('choiceList',choiceList); target.chooseControl(lib.card.chiling.chooseai).set('prompt','敕令').set('choiceList',choiceList);
'step 1' 'step 1'
if(result.control=='选项一'){ if(result.control=='选项一'){
target.showCharacter(2); target.chooseControl('主将','副将',function(){
target.draw(); return Math.floor(Math.random()*2);
}).set('prompt','选择要明置的武将牌');
} }
else if(result.control=='选项二'){ else if(result.control=='选项二'){
target.loseHp(); target.loseHp();
event.finish();
} }
else{ else{
target.chooseToDiscard('he',{type:'equip'},true); target.chooseToDiscard('he',{type:'equip'},true);
event.finish();
} }
'step 2'
if(result.index==0){
target.showCharacter(0);
}
else{
target.showCharacter(1);
}
target.draw();
}, },
ai:{ ai:{
order:6, order:6,
@ -891,7 +918,6 @@ card.guozhan={
if(event.targets.length){ if(event.targets.length){
var target=event.targets.shift(); var target=event.targets.shift();
event.current=target; event.current=target;
var choiceList=['明置一张武将牌,然后摸一张牌','失去1点体力']; var choiceList=['明置一张武将牌,然后摸一张牌','失去1点体力'];
if(target.num('he',{type:'equip'})){ if(target.num('he',{type:'equip'})){
choiceList.push('弃置一张装备牌'); choiceList.push('弃置一张装备牌');
@ -904,16 +930,27 @@ card.guozhan={
'step 2' 'step 2'
var target=event.current; var target=event.current;
if(result.control=='选项一'){ if(result.control=='选项一'){
target.showCharacter(2); target.chooseControl('主将','副将',function(){
target.draw(); return Math.floor(Math.random()*2);
}).set('prompt','选择要明置的武将牌');
} }
else if(result.control=='选项二'){ else if(result.control=='选项二'){
target.loseHp(); target.loseHp();
event.goto(1);
} }
else{ else{
target.chooseToDiscard('he',{type:'equip'},true); target.chooseToDiscard('he',{type:'equip'},true);
event.goto(1);
} }
'step 3' 'step 3'
var target=event.current;
if(result.index==0){
target.showCharacter(0);
}
else{
target.showCharacter(1);
}
target.draw();
event.goto(1); event.goto(1);
} }
}, },

View File

@ -6637,7 +6637,19 @@ character.sp={
}, },
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
if(get.mode()=='guozhan'){ if(get.mode()=='guozhan'){
if(player.identity=='unknown'||player.identity=='ye') return player==target; if(player==target) return true;
if(player.identity=='ye') return false;
if(player.identity=='unknown'){
if(_status.yeidentity.contains(player._group)){
return false;
}
else if(get.zhu(player)||get.population(player._group)+1<=get.population()/2){
return player._group==target.identity;
}
else{
return false;
}
}
return player.identity==target.identity; return player.identity==target.identity;
} }
else{ else{

View File

@ -11064,7 +11064,12 @@
}, },
setIdentity:function(identity){ setIdentity:function(identity){
if(!identity) identity=this.identity; if(!identity) identity=this.identity;
this.node.identity.firstChild.innerHTML=get.translation(identity); if(get.is.jun(this)){
this.node.identity.firstChild.innerHTML='君';
}
else{
this.node.identity.firstChild.innerHTML=get.translation(identity);
}
this.node.identity.dataset.color=identity; this.node.identity.dataset.color=identity;
}, },
phase:function(){ phase:function(){
@ -20527,6 +20532,10 @@
if(!ui.exit){ if(!ui.exit){
ui.exit=ui.create.control('退出联机',ui.click.exit); ui.exit=ui.create.control('退出联机',ui.click.exit);
} }
if(ui.giveup){
ui.giveup.remove();
delete ui.giveup;
}
if(game.servermode){ if(game.servermode){
ui.exit.firstChild.innerHTML='返回房间'; ui.exit.firstChild.innerHTML='返回房间';
setTimeout(function(){ setTimeout(function(){
@ -20973,6 +20982,10 @@
ui.auto.hide(); ui.auto.hide();
} }
if(ui.wuxie) ui.wuxie.hide(); if(ui.wuxie) ui.wuxie.hide();
if(ui.giveup){
ui.giveup.remove();
delete ui.giveup;
}
if(lib.config.test_game&&!_status.connectMode){ if(lib.config.test_game&&!_status.connectMode){
if(lib.config.test_game!='single'){ if(lib.config.test_game!='single'){

View File

@ -297,6 +297,7 @@ mode.guozhan={
_hongfa:{ _hongfa:{
enable:'chooseToUse', enable:'chooseToUse',
filter:function(event,player){ filter:function(event,player){
if(!event.filterCard({name:'sha'},player)) return false;
var zhu=get.zhu(player,'hongfa'); var zhu=get.zhu(player,'hongfa');
if(zhu&&zhu.storage.huangjintianbingfu&&zhu.storage.huangjintianbingfu.length>0){ if(zhu&&zhu.storage.huangjintianbingfu&&zhu.storage.huangjintianbingfu.length>0){
return true; return true;
@ -366,6 +367,9 @@ mode.guozhan={
player.syncStorage('huangjintianbingfu'); player.syncStorage('huangjintianbingfu');
player.updateMarks('huangjintianbingfu'); player.updateMarks('huangjintianbingfu');
}, },
ai:{
threaten:2,
},
group:'hongfa_hp', group:'hongfa_hp',
subSkill:{ subSkill:{
hp:{ hp:{
@ -465,7 +469,14 @@ mode.guozhan={
wuxin:{ wuxin:{
unique:true, unique:true,
trigger:{player:'phaseDrawBegin'}, trigger:{player:'phaseDrawBegin'},
frequent:true, // frequent:'check',
// check:function(event,player){
// var num=get.population('qun');
// if(player.hasSkill('huangjintianbingfu')){
// num+=player.storage.huangjintianbingfu.length;
// }
// return num>event.num;
// },
content:function(){ content:function(){
'step 0' 'step 0'
var num=get.population('qun'); var num=get.population('qun');
@ -487,6 +498,9 @@ mode.guozhan={
zhangwu:{ zhangwu:{
unique:true, unique:true,
forceunique:true, forceunique:true,
ai:{
threaten:2,
},
group:['zhangwu_gain','zhangwu_draw','zhangwu_clear','zhangwu_count'], group:['zhangwu_gain','zhangwu_draw','zhangwu_clear','zhangwu_count'],
subSkill:{ subSkill:{
gain:{ gain:{
@ -768,11 +782,12 @@ mode.guozhan={
"step 1" "step 1"
if(result.bool){ if(result.bool){
var target=result.targets[0]; var target=result.targets[0];
player.logSkill('yuanhu',target); player.logSkill('huyuan',target);
target.equip(result.cards[0]); target.equip(result.cards[0]);
if(target!=player){ if(target!=player){
player.$give(result.cards,target); player.$give(result.cards,target);
} }
game.delay();
player.chooseTarget(true,'弃置一名角色的一张牌',function(card,player,target){ player.chooseTarget(true,'弃置一名角色的一张牌',function(card,player,target){
var source=_status.event.source; var source=_status.event.source;
return get.distance(source,target)<=1&&source!=target&&target.num('he'); return get.distance(source,target)<=1&&source!=target&&target.num('he');
@ -836,7 +851,7 @@ mode.guozhan={
}, },
content:function(){ content:function(){
"step 0" "step 0"
target.viewCards(player+'的手牌',player.get('h')); target.viewCards(get.translation(player)+'的手牌',player.get('h'));
"step 1" "step 1"
if(!target.num('h')){ if(!target.num('h')){
event._result={index:1}; event._result={index:1};
@ -1666,7 +1681,7 @@ mode.guozhan={
return Math.random()<0.5?3:(Math.random()<0.5?2:1); return Math.random()<0.5?3:(Math.random()<0.5?2:1);
} }
if(choice==0) return 0; if(choice==0) return 0;
if(get.population(group)>0&&get.totalPopulation(group)+1<=get.population()/2){ if(get.population(group)>0&&player.wontYe()){
return Math.random()<0.2?(Math.random()<0.5?3:(Math.random()<0.5?2:1)):0; return Math.random()<0.2?(Math.random()<0.5?3:(Math.random()<0.5?2:1)):0;
} }
var nming=0; var nming=0;
@ -1725,7 +1740,7 @@ mode.guozhan={
if(popu>=2||(popu==1&&game.players.length<=4)){ if(popu>=2||(popu==1&&game.players.length<=4)){
return true; return true;
} }
if(get.population(group)>0&&get.totalPopulation(group)+1<=get.population()/2){ if(get.population(group)>0&&player.wontYe()){
return Math.random()<0.2?true:false; return Math.random()<0.2?true:false;
} }
var nming=0; var nming=0;
@ -3200,14 +3215,11 @@ mode.guozhan={
} }
},yelist,this.group); },yelist,this.group);
} }
else if(get.zhu(this)){ else if(this.wontYe()){
this.identity=this.group; this.identity=this.group;
} }
else if(_status.yeidentity.contains(this.group)||get.totalPopulation(this.group)+1>get.population()/2){
this.identity='ye';
}
else{ else{
this.identity=this.group; this.identity='ye';
} }
this.setIdentity(this.identity); this.setIdentity(this.identity);
this.ai.shown=1; this.ai.shown=1;
@ -3294,6 +3306,12 @@ mode.guozhan={
} }
} }
}, },
wontYe:function(){
var group=lib.character[this.name1][1];
if(_status.yeidentity&&_status.yeidentity.contains(group)) return false;
if(get.zhu(this)) return true;
return get.totalPopulation(group)+1<=get.population()/2;
},
perfectPair:function(){ perfectPair:function(){
if(_status.connectMode){ if(_status.connectMode){
if(!lib.configOL.zhulian) return false; if(!lib.configOL.zhulian) return false;
@ -3468,7 +3486,7 @@ mode.guozhan={
return 4+difficulty; return 4+difficulty;
} }
if(from.identity=='unknown'&&lib.character[from.name1][1]==toidentity){ if(from.identity=='unknown'&&lib.character[from.name1][1]==toidentity){
if(get.totalPopulation(toidentity)+1<=get.population()/2) return 4+difficulty; if(from.wontYe()) return 4+difficulty;
} }
var groups=[]; var groups=[];
for(var i=0;i<lib.group.length;i++){ for(var i=0;i<lib.group.length;i++){
@ -3502,7 +3520,7 @@ mode.guozhan={
if(from==to) return 5+difficulty; if(from==to) return 5+difficulty;
if(from.identity==to.identity&&from.identity!='unknown'&&from.identity!='ye') return 5+difficulty; if(from.identity==to.identity&&from.identity!='unknown'&&from.identity!='ye') return 5+difficulty;
if(from.identity=='unknown'&&lib.character[from.name1][1]==to.identity){ if(from.identity=='unknown'&&lib.character[from.name1][1]==to.identity){
if(get.totalPopulation(to.identity)+1<=get.population()/2) return 4+difficulty; if(from.wontYe()) return 4+difficulty;
} }
var toidentity=to.identity; var toidentity=to.identity;
if(toidentity=='unknown'){ if(toidentity=='unknown'){