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'));
if(mod!='unchanged') return mod;
return true;
},trigger.player,-1).ai;
},trigger.player,-1).targetRequired=true;
}
},
},

View File

@ -797,7 +797,9 @@ card.standard={
},
content:function(){
"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"
if(result.bool==false){
player.gain(targets[0].get('e',{subtype:'equip1'}));
@ -1140,11 +1142,7 @@ card.standard={
event.card=trigger.card;
"step 1"
if(ui.wuxie.classList.contains('glow')&&!_status.auto){
if(event.current==game.me){
event._result={bool:false};
return;
}
if(lib.config.mode=='versus'&&lib.storage.single_control&&event.current.side==game.me.side){
if(event.current==game.me||event.current.isUnderControl()){
event._result={bool:false};
return;
}
@ -1231,11 +1229,7 @@ card.standard={
event.card=trigger.card;
"step 1"
if(ui.wuxie.classList.contains('glow')&&!_status.auto){
if(event.current==game.me){
event._result={bool:false};
return;
}
if(lib.config.mode=='versus'&&lib.storage.single_control&&event.current.side==game.me.side){
if(event.current==game.me||event.current.isUnderControl()){
event._result={bool:false};
return;
}

View File

@ -274,7 +274,7 @@ character.yxs={
priority:11,
filter:function(event,player){
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;
},
group:['bolehuiyan2','bolehuiyan3'],

View File

@ -4928,6 +4928,7 @@ window.play={};
ai1:function(){return 1;},
ai2:ai.get.effect,
type:'dying',
targetRequired:true,
dying:event.dying
});
}
@ -5683,6 +5684,9 @@ window.play={};
ok=false;
if(event.complexSelect) ok=false;
}
if(range[1]==-1&&ui.selected.targets.length==0&&event.targetRequired){
ok=false;
}
}
if(custom.add.target){
custom.add.target();
@ -5759,6 +5763,14 @@ window.play={};
},
uncheck:function(){
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){
while(document.getElementsByClassName('selectable').length>0){
document.getElementsByClassName('selectable')[0].classList.remove('selectable');
@ -8689,6 +8701,21 @@ window.play={};
ui.selected.cards.add(this);
}
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){
custom.add.card();
}

View File

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

View File

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