This commit is contained in:
libccy 2015-05-08 21:37:34 +08:00
parent 7cbd9ec9ec
commit 8dc643b600
6 changed files with 150 additions and 37 deletions

View File

@ -293,7 +293,7 @@ card.qimou={
var mod=game.checkMod(card,player,'unchanged','cardEnabled',player.get('s')); var mod=game.checkMod(card,player,'unchanged','cardEnabled',player.get('s'));
if(mod!='unchanged') return mod; if(mod!='unchanged') return mod;
return true; return true;
},trigger.player,-1).ai; },trigger.player,-1).targetRequired=true;
} }
}, },
}, },

View File

@ -797,7 +797,9 @@ card.standard={
}, },
content:function(){ content:function(){
"step 0" "step 0"
targets[0].chooseToUse('对'+get.translation(targets[1])+'使用一张杀,或令'+get.translation(player)+'获得你的武器牌',{name:'sha'},targets[1],-1); targets[0].chooseToUse(
'对'+get.translation(targets[1])+'使用一张杀,或令'+get.translation(player)+'获得你的武器牌',
{name:'sha'},targets[1],-1).targetRequired=true;
"step 1" "step 1"
if(result.bool==false){ if(result.bool==false){
player.gain(targets[0].get('e',{subtype:'equip1'})); player.gain(targets[0].get('e',{subtype:'equip1'}));
@ -1140,11 +1142,7 @@ card.standard={
event.card=trigger.card; event.card=trigger.card;
"step 1" "step 1"
if(ui.wuxie.classList.contains('glow')&&!_status.auto){ if(ui.wuxie.classList.contains('glow')&&!_status.auto){
if(event.current==game.me){ if(event.current==game.me||event.current.isUnderControl()){
event._result={bool:false};
return;
}
if(lib.config.mode=='versus'&&lib.storage.single_control&&event.current.side==game.me.side){
event._result={bool:false}; event._result={bool:false};
return; return;
} }
@ -1231,11 +1229,7 @@ card.standard={
event.card=trigger.card; event.card=trigger.card;
"step 1" "step 1"
if(ui.wuxie.classList.contains('glow')&&!_status.auto){ if(ui.wuxie.classList.contains('glow')&&!_status.auto){
if(event.current==game.me){ if(event.current==game.me||event.current.isUnderControl()){
event._result={bool:false};
return;
}
if(lib.config.mode=='versus'&&lib.storage.single_control&&event.current.side==game.me.side){
event._result={bool:false}; event._result={bool:false};
return; return;
} }

View File

@ -274,7 +274,7 @@ character.yxs={
priority:11, priority:11,
filter:function(event,player){ filter:function(event,player){
if(player.skills.contains('bolehuiyan4')) return false; if(player.skills.contains('bolehuiyan4')) return false;
if(lib.config.mode=='versus'&&lib.storage.single_control&&event.target.side==player.side) return false; if(event.target.isUnderControl()) return false;
return event.player!=player&&event.target!=player&&event.target.num('h')>0; return event.player!=player&&event.target!=player&&event.target.num('h')>0;
}, },
group:['bolehuiyan2','bolehuiyan3'], group:['bolehuiyan2','bolehuiyan3'],

View File

@ -4928,6 +4928,7 @@ window.play={};
ai1:function(){return 1;}, ai1:function(){return 1;},
ai2:ai.get.effect, ai2:ai.get.effect,
type:'dying', type:'dying',
targetRequired:true,
dying:event.dying dying:event.dying
}); });
} }
@ -5683,6 +5684,9 @@ window.play={};
ok=false; ok=false;
if(event.complexSelect) ok=false; if(event.complexSelect) ok=false;
} }
if(range[1]==-1&&ui.selected.targets.length==0&&event.targetRequired){
ok=false;
}
} }
if(custom.add.target){ if(custom.add.target){
custom.add.target(); custom.add.target();
@ -5759,6 +5763,14 @@ window.play={};
}, },
uncheck:function(){ uncheck:function(){
var i,j; var i,j;
if(false){
if(lib.config.mode=='chess'){
var shadows=ui.chessContainer.getElementsByClassName('playergrid temp');
while(shadows.length){
shadows[0].remove();
}
}
}
if(arguments.length==0){ if(arguments.length==0){
while(document.getElementsByClassName('selectable').length>0){ while(document.getElementsByClassName('selectable').length>0){
document.getElementsByClassName('selectable')[0].classList.remove('selectable'); document.getElementsByClassName('selectable')[0].classList.remove('selectable');
@ -8689,6 +8701,21 @@ window.play={};
ui.selected.cards.add(this); ui.selected.cards.add(this);
} }
this.classList.toggle('selected'); this.classList.toggle('selected');
if(false){
if(lib.config.mode=='chess'&&!_status.event.skill&&this.classList.contains('selected')&&
_status.event.isMine()&&_status.event.name=='chooseToUse'){
var player=_status.event.player;
var range=get.info(this).range;
if(range){
if(typeof range.attack==='number'){
player.createRangeShadow(get.attackRange(player)+range.attack-1);
}
else if(typeof range.global==='number'){
player.createRangeShadow(get.globalFrom(player)+range.global);
}
}
}
}
if(custom.add.card){ if(custom.add.card){
custom.add.card(); custom.add.card();
} }

View File

@ -98,3 +98,6 @@
box-shadow: rgba(0, 0, 0, 0.3) 0 0 0 1px; box-shadow: rgba(0, 0, 0, 0.3) 0 0 0 1px;
border-radius:8px; border-radius:8px;
} }
.playergrid.temp{
opacity:0.3;
}

View File

@ -27,6 +27,27 @@ mode.chess={
}, },
}, },
player:{ player:{
createRangeShadow:function(num,move){
num++;
var shadows=this.parentNode.getElementsByClassName('playergrid');
while(shadows.length){
shadows[0].remove();
}
for(var i=1-num;i<num;i++){
for(var j=1-num+Math.abs(i);j<num-Math.abs(i);j++){
if(this.movable(i,j)){
var grid=ui.create.playergrid(this,i,j);
if(move){
grid.listen(ui.click.playergrid);
ui.movegrids.push(grid);
}
else{
grid.classList.add('temp');
}
}
}
}
},
chooseToMove:function(num){ chooseToMove:function(num){
var next=game.createEvent('chooseToMove'); var next=game.createEvent('chooseToMove');
next.num=num||1; next.num=num||1;
@ -147,7 +168,7 @@ mode.chess={
} }
return false; return false;
}, },
dieAfter:function(){ dieAfter:function(source){
var player=this; var player=this;
delete lib.posmap[player.dataset.position]; delete lib.posmap[player.dataset.position];
setTimeout(function(){ setTimeout(function(){
@ -155,13 +176,16 @@ mode.chess={
},500); },500);
for(var i=0;i<ui.phasequeue.length;i++){ for(var i=0;i<ui.phasequeue.length;i++){
if(ui.phasequeue[i].link==player){ if(ui.phasequeue[i].link==player){
ui.phasequeue[i].classList.remove('glow2'); ui.phasequeue[i].remove();
ui.phasequeue[i].classList.add('dead'); ui.phasequeue.splice(i,1);
break; break;
} }
} }
for(var i=1;i<game.players.length;i++){ for(var i=1;i<game.players.length;i++){
if(game.players[i].side!=game.players[0].side){ if(game.players[i].side!=game.players[0].side){
if(source&&source.side!=player.side){
source.draw();
}
return; return;
} }
} }
@ -432,16 +456,18 @@ mode.chess={
} }
}; };
if(event.isMine()){ if(event.isMine()){
game.pause(); event.control=ui.create.control('取消',function(){
ui.movegrids=[]; if(ui.movegrids){
num++; while(ui.movegrids.length){
for(var i=1-num;i<num;i++){ ui.movegrids.shift().delete();
for(var j=1-num+Math.abs(i);j<num-Math.abs(i);j++){
if(player.movable(i,j)){
ui.movegrids.push(ui.create.playergrid(player,i,j));
} }
} }
} event.result='cancelled';
game.resume();
});
game.pause();
ui.movegrids=[];
player.createRangeShadow(num,true);
for(var i=0;i<ui.movegrids.length;i++){ for(var i=0;i<ui.movegrids.length;i++){
var grid=ui.movegrids[i]; var grid=ui.movegrids[i];
if(game.isChessNeighbour(grid,player)) continue; if(game.isChessNeighbour(grid,player)) continue;
@ -458,6 +484,10 @@ mode.chess={
if(event.moved){ if(event.moved){
game.delay(); game.delay();
} }
if(event.control){
event.control.close();
}
ui.create.confirm();
} }
} }
}, },
@ -592,7 +622,9 @@ mode.chess={
this._chessdrag=null; this._chessdrag=null;
}); });
ui.chess.addEventListener('mouseup',function(e){ ui.chess.addEventListener('mouseup',function(e){
this._chessdrag=null; if(this._chessdrag){
this._chessdrag=null;
}
}); });
ui.chess.addEventListener('mousemove',function(e){ ui.chess.addEventListener('mousemove',function(e){
if(this._chessdrag){ if(this._chessdrag){
@ -681,13 +713,31 @@ mode.chess={
return uiintro; return uiintro;
}); });
var clearPrompt=function(){
for(var i=0;i<game.players.length;i++){
game.players[i].unprompt();
}
};
ui.create.system('显示距离',function(){
if(!game.me.isAlive()) return;
for(var i=0;i<game.players.length;i++){
if(game.players[i]!=game.me){
var dist=get.distance(game.me,game.players[i],'pure');
if(dist>7){
game.players[i].popup('距离:'+dist,'thunder');
}
else{
game.players[i].popup('距离:'+dist);
}
}
}
},true);
ui.create.me(); ui.create.me();
ui.create.fakeme(); ui.create.fakeme();
ui.create.cards(); ui.create.cards();
ui.chessinfo=ui.create.div('.fakeme.player',ui.me); ui.chessinfo=ui.create.div('.fakeme.player',ui.me);
ui.phasequeue=[];
game.finishCards(); game.finishCards();
game.arrangePlayers(); game.arrangePlayers();
@ -701,13 +751,28 @@ mode.chess={
} }
game.gameDraw(p); game.gameDraw(p);
game.phaseLoop(p); game.phaseLoop(p);
for(var i=0;i<game.players.length;i++){ game.setChessInfo(p);
var node=ui.create.div('.avatar',ui.chessinfo); }
node.style.backgroundImage=p.node.avatar.style.backgroundImage; },
node.link=p; setChessInfo:function(p){
ui.phasequeue.push(node); ui.chessinfo.innerHTML='';
p=p.next; ui.phasequeue=[];
for(var i=0;i<game.players.length;i++){
var node=ui.create.div('.avatar',ui.chessinfo);
node.style.backgroundImage=p.node.avatar.style.backgroundImage;
node.link=p;
node.listen(game.clickChessInfo);
if(_status.currentPhase==p){
node.classList.add('glow2');
} }
ui.phasequeue.push(node);
p=p.next;
}
},
clickChessInfo:function(e){
if(this.link.isAlive()){
this.link.chessFocus();
e.stopPropagation();
} }
}, },
chooseCharacter:function(){ chooseCharacter:function(){
@ -838,6 +903,18 @@ mode.chess={
} }
}, },
skill:{ skill:{
_noactpunish:{
trigger:{player:'useCard'},
filter:function(event,player){
return _status.currentPhase==player&&event.targets&&(event.targets.length>1||event.targets[0]!=player);
},
forced:true,
popup:false,
content:function(){
player.addTempSkill('noactpunish','phaseAfter');
}
},
noactpunish:{},
_phasequeue:{ _phasequeue:{
trigger:{player:'phaseBegin'}, trigger:{player:'phaseBegin'},
forced:true, forced:true,
@ -862,7 +939,12 @@ mode.chess={
direct:true, direct:true,
delay:false, delay:false,
content:function(){ content:function(){
player.chooseToMove(2); "step 0"
player.chooseToMove(player.skills.contains('noactpunish')?2:1);
"step 1"
if(result=='cancelled'){
player.getStat().skill._chessmove--;
}
}, },
ai:{ ai:{
order:5, order:5,
@ -870,11 +952,13 @@ mode.chess={
player:function(player){ player:function(player){
var range=get.attackRange(player)>1; var range=get.attackRange(player)>1;
var nh=player.num('h'); var nh=player.num('h');
if(nh<=Math.min(3,player.hp)) return Math.random()-0.3;
else if(nh<=Math.min(3,player.hp)) return Math.random()-0.4;
if(!player.num('h','sha')&& if(!player.num('h','sha')&&
!player.num('h','shunshou')&& !player.num('h','shunshou')&&
!player.num('h','bingliang')) return Math.random()-0.5; !player.num('h','bingliang')){
if(nh<=Math.min(3,player.hp)) return Math.random()-0.3;
else if(nh<=Math.min(2,player.hp)) return Math.random()-0.4;
return Math.random()-0.5;
}
var neighbour; var neighbour;
neighbour=player.getNeighbour(0,1); neighbour=player.getNeighbour(0,1);
if(neighbour&&neighbour.side!=player.side){ if(neighbour&&neighbour.side!=player.side){
@ -934,7 +1018,6 @@ mode.chess={
create:{ create:{
playergrid:function(player,x,y){ playergrid:function(player,x,y){
var node=ui.create.div('.player.minskin.playergrid',player.parentNode); var node=ui.create.div('.player.minskin.playergrid',player.parentNode);
node.listen(ui.click.playergrid);
node.link=player; node.link=player;
node.dataset.position=player.getDataPos(x,y); node.dataset.position=player.getDataPos(x,y);
return node; return node;
@ -970,5 +1053,11 @@ mode.chess={
} }
}, },
posmap:{}, posmap:{},
help:{
'战棋模式':'<ul><li>n人对战n人的模式由单人控制开始游戏后随机分配位置与出牌顺序<li>'+
'每人在出牌阶段有一次移动的机会若一名角色在移动之前使用过指定其他角色为目标的牌该回合可移动的最大距离为2否则最大距离为1<li>'+
'任何卡牌或技能无法指定位置相隔8个格以上的角色为目标<li>'+
'杀死对方阵营的角色可摸一张牌,杀死本方阵营无惩罚'
},
config:['battle_number','ban_weak','free_choose','change_choice'], config:['battle_number','ban_weak','free_choose','change_choice'],
} }