This commit is contained in:
libccy 2017-11-13 06:15:04 +08:00
parent b4ba1f72ae
commit 8d3aeb9cda
7 changed files with 253 additions and 26 deletions

View File

@ -235,12 +235,12 @@ game.import('card',function(lib,game,ui,get,ai,_status){
result:{ result:{
target:function(player,target){ target:function(player,target){
if(target.isLinked()) return 1; if(target.isLinked()) return 1;
if(get.attitude(player,target)>=0) return -1; if(get.attitude(player,target)>=0) return -0.9;
if(ui.selected.targets.length) return -1; if(ui.selected.targets.length) return -0.9;
if(game.hasPlayer(function(current){ if(game.hasPlayer(function(current){
return get.attitude(player,current)<=-1&&current!=target&&!current.isLinked(); return get.attitude(player,current)<=-1&&current!=target&&!current.isLinked();
})){ })){
return -1; return -0.9;
} }
return 0; return 0;
} }

View File

@ -90,7 +90,24 @@ game.import('card',function(lib,game,ui,get,ai,_status){
if(evt&&evt.name=='phaseUse'){ if(evt&&evt.name=='phaseUse'){
evt.skipped=true; evt.skipped=true;
} }
target.addSkill('xietianzi'); target.insertEvent('xietianzi',lib.card.xietianzi.content_phase);
// target.addSkill('xietianzi');
},
content_phase:function(){
"step 0"
player.removeSkill('xietianzi');
if(player.countCards('he')>0){
player.chooseToDiscard('he','是否弃置一张牌并获得一个额外回合?').set('ai',function(card){
return 10-get.value(card);
});
}
else{
event.finish();
}
"step 1"
if(result.bool){
player.insertPhase();
}
}, },
ai:{ ai:{
order:0.5, order:0.5,

View File

@ -60,10 +60,155 @@ game.import('character',function(lib,game,ui,get,ai,_status){
nstaiping:{ nstaiping:{
trigger:{player:'damageEnd'}, trigger:{player:'damageEnd'},
filter:function(event,player){ filter:function(event,player){
return player.storage.nshuanxian_damage&&player.getSubPlayers('nshuanxian').length; return !event.nshuanxian&&player.getSubPlayers('nshuanxian').length;
}, },
direct:true,
priority:-0.1,
ai:{
maixie:true,
maixie_hp:true
},
content:function(){
'step 0'
event.num=trigger.num;
'step 1'
var left=player.storage.nshuanxian_left;
var right=player.storage.nshuanxian_right;
var list=[];
var choice=0;
var hpleft=0;
var maxleft=0;
if(left&&player.hasSkill(left)){
if(player.storage[left].hp<player.storage[left].maxHp){
list.push('令幻身·左回复一点体力');
hpleft=player.storage[left].hp;
}
list.push('令幻身·左增加一点体力上限');
maxleft=player.storage[left].hp;
}
if(left&&player.hasSkill(right)){
if(player.storage[right].hp<player.storage[right].maxHp){
list.push('令幻身·右回复一点体力');
if(!hpleft||player.storage[right].hp<hpleft||
(player.storage[right].hp==hpleft&&Math.random()<0.5)){
choice=list.length-1;
}
}
list.push('令幻身·右增加一点体力上限');
if(!hpleft&&maxleft&&choice==0){
if(player.storage[right].maxHp<maxleft||
(player.storage[right].maxHp==maxleft&&Math.random()<0.5)){
choice=list.length-1;
}
}
}
if(!list.length){
event.finish();
return;
}
event.map={};
for(var i=0;i<list.length;i++){
event.map['选项'+get.cnNumber(i+1,true)]=list[i];
}
player.chooseControlList(list,function(){
return _status.event.choice;
}).set('prompt',get.prompt('nstaiping')).set('choice',choice);
'step 2'
var left=player.storage.nshuanxian_left;
var right=player.storage.nshuanxian_right;
if(result.control!='cancel2'){
player.logSkill('nstaiping');
switch(event.map[result.control]){
case '令幻身·左回复一点体力':player.storage[left].hp++;break;
case '令幻身·左增加一点体力上限':player.storage[left].maxHp++;break;
case '令幻身·右回复一点体力':player.storage[right].hp++;break;
case '令幻身·右增加一点体力上限':player.storage[right].maxHp++;break;
}
game.log(player,event.map[result.control].replace(/一/,'了一'));
}
'step 3'
if(event.num>1){
event.num--;
event.goto(1);
}
}
},
nsshoudao:{
group:['nsshoudao_gain','nsshoudao_die'],
subSkill:{
gain:{
trigger:{player:'subPlayerDie'},
forced:true,
filter:function(event,player){
var left=player.storage.nshuanxian_left;
if(left&&player.hasSkill(left)) return false;
var right=player.storage.nshuanxian_right;
if(right&&player.hasSkill(right)) return false;
if(!player.storage.nshuanxian_damage) return false;
return true;
},
content:function(){
player.addSkill('releiji');
player.addSkill('guidao');
}
},
die:{
trigger:{player:'dieBegin'},
direct:true,
filter:function(event,player){
if(game.countPlayer()<=2) return false;
var left=player.storage.nshuanxian_left;
if(left&&player.hasSkill(left)) return true;
var right=player.storage.nshuanxian_right;
if(right&&player.hasSkill(right)) return true;
return false;
},
content:function(){
'step 0'
var str;
var left=player.storage.nshuanxian_left;
var right=player.storage.nshuanxian_right;
if(left&&player.hasSkill(left)&&right&&player.hasSkill(right)){
str='令一名其他角色获得技能【雷击】和【鬼道】';
}
else{
str='令一名其他角色获得技能【雷击】或【鬼道】';
}
if(trigger.source){
str+=''+get.translation(trigger.source)+'除外)';
}
player.chooseTarget(function(card,player,target){
return target!=player&&target!=_status.event.source;
},get.prompt('nsshoudao')).set('ai',function(target){
if(target.hasSkill('releiji')) return 0;
return get.attitude(_status.event.player,target);
}).set('source',trigger.source).set('prompt2',str);
'step 1'
var goon=false;
if(result.bool){
var target=result.targets[0];
player.logSkill('nsshoudao',target);
var left=player.storage.nshuanxian_left;
var right=player.storage.nshuanxian_right;
if(left&&player.hasSkill(left)&&right&&player.hasSkill(right)){
target.addSkillLog('releiji');
target.addSkillLog('guidao');
}
else{
event.target=target;
player.chooseControl('releiji','guidao').set('prompt','令'+get.translation(target)+'获得一项技能');
goon=true;
}
}
if(!goon){
event.finish();
}
'step 2'
event.target.addSkillLog(result.control);
}
}
}
}, },
nsshoudao:{},
nshuanxian:{ nshuanxian:{
trigger:{global:'gameStart',player:'enterGame'}, trigger:{global:'gameStart',player:'enterGame'},
forced:true, forced:true,
@ -86,12 +231,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}); });
}, },
ai:{ ai:{
maixie:true,
effect:{ effect:{
target:function(card,player,target){ target:function(card,player,target){
if(get.tag(card,'damage')){ if(get.tag(card,'damage')){
if(!target.hasFriend()) return; if(!target.hasFriend()) return;
if(!target.storage.nshuanxian_damage) return [0.5,1]; if(!target.storage.nshuanxian_damage){
if(get.attitude(player,target)<=0) return [0.5,1];
return [1,1];
}
} }
} }
} }
@ -184,6 +331,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
delete player.storage.nshuanxian_left; delete player.storage.nshuanxian_left;
} }
}); });
trigger.nshuanxian=true;
} }
}, },
draw:{ draw:{
@ -200,7 +348,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{player:'phaseBefore'}, trigger:{player:'phaseBefore'},
forced:true, forced:true,
popup:false, popup:false,
priority:50, priority:40,
filter:function(event,player){ filter:function(event,player){
if(event.skill=='nshuanxian_middle') return false; if(event.skill=='nshuanxian_middle') return false;
if(event.skill=='nshuanxian_right') return false; if(event.skill=='nshuanxian_right') return false;
@ -233,21 +381,21 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{player:['phaseAfter','phaseCancelled']}, trigger:{player:['phaseAfter','phaseCancelled']},
forced:true, forced:true,
popup:false, popup:false,
priority:-50, priority:-40,
filter:function(event,player){ filter:function(event,player){
if(player.hasSkill('nshuanxian_chosen')) return false; if(player.hasSkill('nshuanxian_chosen')) return false;
return true; return true;
}, },
content:function(){ content:function(){
player.exitSubPlayer(); player.exitSubPlayer();
player.insertPhase(); player.insertPhase(null,true);
} }
}, },
right:{ right:{
trigger:{player:['phaseAfter','phaseCancelled']}, trigger:{player:['phaseAfter','phaseCancelled']},
forced:true, forced:true,
popup:false, popup:false,
priority:-50, priority:-40,
filter:function(event,player){ filter:function(event,player){
if(player.hasSkill('nshuanxian_chosen')) return false; if(player.hasSkill('nshuanxian_chosen')) return false;
if(player.hasSkill('subplayer')) return false; if(player.hasSkill('subplayer')) return false;
@ -257,7 +405,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
content:function(){ content:function(){
player.callSubPlayer(player.storage.nshuanxian_right); player.callSubPlayer(player.storage.nshuanxian_right);
player.insertPhase(); player.insertPhase(null,true);
player.addTempSkill('nshuanxian_chosen',['phaseBegin','phaseCancelled']); player.addTempSkill('nshuanxian_chosen',['phaseBegin','phaseCancelled']);
} }
}, },
@ -265,7 +413,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{player:['phaseAfter','phaseCancelled']}, trigger:{player:['phaseAfter','phaseCancelled']},
forced:true, forced:true,
popup:false, popup:false,
priority:-50, priority:-40,
filter:function(event,player){ filter:function(event,player){
if(player.hasSkill('nshuanxian_chosen')) return false; if(player.hasSkill('nshuanxian_chosen')) return false;
return true; return true;

View File

@ -956,9 +956,19 @@ game.import('character',function(lib,game,ui,get,ai,_status){
effect:function(card,player,target){ effect:function(card,player,target){
if(get.tag(card,'damage')){ if(get.tag(card,'damage')){
if(player.hasSkillTag('jueqing',false,target)) return [1,-2]; if(player.hasSkillTag('jueqing',false,target)) return [1,-2];
if(player.hp>=4) return [1,get.tag(card,'damage')*2]; if(!target.hasFriend()) return;
if(target.hp==3) return [1,get.tag(card,'damage')*1.5]; var num=1;
if(target.hp==2) return [1,get.tag(card,'damage')*0.5]; if(get.attitude(player,target)>0){
if(player.needsToDiscard()){
num=0.7;
}
else{
num=0.5;
}
}
if(player.hp>=4) return [1,num*2];
if(target.hp==3) return [1,num*1.5];
if(target.hp==2) return [1,num*0.5];
} }
} }
}, },

View File

@ -333,15 +333,22 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(player.storage.choulve){ if(player.storage.choulve){
str+='若其如此做,视为你使用'+get.translation(player.storage.choulve); str+='若其如此做,视为你使用'+get.translation(player.storage.choulve);
} }
var goon=true;
if(player.storage.choulve){
goon=game.hasPlayer(function(current){
return player.canUse(player.storage.choulve,current)&&get.effect(current,player.storage.choulve,player,player)>0;
});
}
player.chooseTarget(get.prompt('choulve'),str,function(card,player,target){ player.chooseTarget(get.prompt('choulve'),str,function(card,player,target){
return target!=player&&target.countCards('he'); return target!=player&&target.countCards('he');
}).set('ai',function(target){ }).set('ai',function(target){
if(!_status.event.goon) return 0;
var player=_status.event.player; var player=_status.event.player;
if(get.attitude(player,target)>=0&&get.attitude(target,player)>=0){ if(get.attitude(player,target)>=0&&get.attitude(target,player)>=0){
return Math.sqrt(target.countCards('he')); return Math.sqrt(target.countCards('he'));
} }
return 0; return 0;
}); }).set('goon',goon);
'step 1' 'step 1'
if(result.bool){ if(result.bool){
var target=result.targets[0]; var target=result.targets[0];

View File

@ -408,9 +408,19 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(get.tag(card,'damage')){ if(get.tag(card,'damage')){
if(player.hasSkillTag('jueqing',false,target)) return [1,-2]; if(player.hasSkillTag('jueqing',false,target)) return [1,-2];
if(!target.hasFriend()) return; if(!target.hasFriend()) return;
if(target.hp>=4) return [1,get.tag(card,'damage')*2]; var num=1;
if(target.hp==3) return [1,get.tag(card,'damage')*1.5]; if(get.attitude(player,target)>0){
if(target.hp==2) return [1,get.tag(card,'damage')*0.5]; if(player.needsToDiscard()){
num=0.7;
}
else{
num=0.5;
}
}
console.log(num);
if(target.hp>=4) return [1,num*2];
if(target.hp==3) return [1,num*1.5];
if(target.hp==2) return [1,num*0.5];
} }
} }
} }

View File

@ -9083,7 +9083,7 @@
player.removeSkill('subplayer'); player.removeSkill('subplayer');
'step 2' 'step 2'
if(event.remove){ if(event.remove){
event.trigger('removeSubPlayer'); event.trigger('subPlayerDie');
} }
}, },
callSubPlayer:function(){ callSubPlayer:function(){
@ -14591,15 +14591,25 @@
this.node.identity.dataset.color=identity; this.node.identity.dataset.color=identity;
return this; return this;
}, },
insertPhase:function(skill){ insertPhase:function(skill,insert){
var evt=_status.event.getParent('phase'); var evt=_status.event.getParent('phase');
var next; var next;
if(evt&&evt.parent&&evt.parent.next){ if(evt&&evt.parent&&evt.parent.next){
next=game.createEvent('phase',null,evt.parent); evt=evt.parent;
next=game.createEvent('phase',null,evt);
}
else if(_status.event.parent&&_status.event.parent.next){
evt=_status.event.parent;
next=game.createEvent('phase',null,evt);
} }
else{ else{
evt=null;
next=game.createEvent('phase'); next=game.createEvent('phase');
} }
if(evt&&insert&&evt.next.contains(next)){
evt.next.remove(next);
evt.next.unshift(next);
}
next.player=this; next.player=this;
next.skill=skill||_status.event.name; next.skill=skill||_status.event.name;
next.setContent('phase'); next.setContent('phase');
@ -14617,6 +14627,7 @@
for(var i in arg){ for(var i in arg){
next[i]=arg[i]; next[i]=arg[i];
} }
next.player=this;
next.setContent(content); next.setContent(content);
return next; return next;
}, },
@ -16758,7 +16769,8 @@
player.marks[id]._name=target; player.marks[id]._name=target;
player.marks[id].info={ player.marks[id].info={
name:name, name:name,
content:content content:content,
id:id
}; };
player.marks[id].setBackground(target,'character'); player.marks[id].setBackground(target,'character');
game.addVideo('changeMarkCharacter',player,{ game.addVideo('changeMarkCharacter',player,{
@ -16771,7 +16783,8 @@
else{ else{
player.marks[id]=player.markCharacter(target,{ player.marks[id]=player.markCharacter(target,{
name:name, name:name,
content:content content:content,
id:id
}); });
player.marks[id]._name=target; player.marks[id]._name=target;
game.addVideo('markCharacter',player,{ game.addVideo('markCharacter',player,{
@ -17086,6 +17099,11 @@
} }
return this; return this;
}, },
addSkillLog:function(skill){
this.addSkill(skill);
this.popup(skill);
game.log(this,'获得了技能','【'+get.translation(skill)+'】');
},
addSkill:function(skill,checkConflict,nobroadcast){ addSkill:function(skill,checkConflict,nobroadcast){
if(Array.isArray(skill)){ if(Array.isArray(skill)){
for(var i=0;i<skill.length;i++){ for(var i=0;i<skill.length;i++){
@ -20919,6 +20937,10 @@
}, },
content:function(){ content:function(){
trigger.cancel(); trigger.cancel();
var evt=trigger.getParent('damage');
if(evt.player==player){
evt.untrigger(false,player);
}
player.exitSubPlayer(true); player.exitSubPlayer(true);
}, },
ai:{ ai:{
@ -44006,6 +44028,19 @@
else if(info.name!==false){ else if(info.name!==false){
uiintro.add(get.translation(node.skill)); uiintro.add(get.translation(node.skill));
} }
if(typeof info.id=='string'&&info.id.indexOf('subplayer')==0&&
player.isUnderControl(true)&&player.storage[info.id]&&!_status.video){
var storage=player.storage[info.id];
uiintro.addText('当前体力:'+storage.hp+'/'+storage.maxHp);
if(storage.hs.length){
uiintro.addText('手牌区');
uiintro.addSmall(storage.hs);
}
if(storage.es.length){
uiintro.addText('装备区');
uiintro.addSmall(storage.es);
}
}
if(typeof info.mark=='function'){ if(typeof info.mark=='function'){
var stint=info.mark(uiintro,player.storage[node.skill],player); var stint=info.mark(uiintro,player.storage[node.skill],player);
if(stint){ if(stint){