战棋boss

This commit is contained in:
libccy 2015-05-13 18:26:54 +08:00
parent c0de77e02f
commit 9b6867aa77
8 changed files with 584 additions and 231 deletions

View File

@ -302,6 +302,8 @@ window.play={};
qun:'群', qun:'群',
male:'男', male:'男',
female:'女', female:'女',
mad:'混乱',
mad_bg:'疯',
draw_card:'摸牌', draw_card:'摸牌',
discard_card:'弃牌', discard_card:'弃牌',
reset_character:'重置武将牌', reset_character:'重置武将牌',
@ -1508,96 +1510,41 @@ window.play={};
if(lib.config.reverse_sort) sort=-sort; if(lib.config.reverse_sort) sort=-sort;
cards[num].fix(); cards[num].fix();
cards[num].animate('start'); cards[num].animate('start');
if(lib.config.strict_sort){
j=0; if(game.singleHandcard||sort>0) frag1.appendChild(cards[num]);
if(game.singleHandcard){ else frag2.appendChild(cards[num]);
position=sort>0?player.node.handcards1:player.node.handcards2;
}
else{
position=player.node.handcards1;
}
for(j=0;j<position.childNodes.length;j++){
if(lib.config.reverse_sort){
if(sort<lib.config.sort_card(position.childNodes[j])) break;
}
else{
if(sort>lib.config.sort_card(position.childNodes[j])) break;
}
}
if(event.animate=='draw'){
player.$draw();
(function(card,position){
setTimeout(function(){
position.insertBefore(card,position.childNodes[j]);
},500);
}(cards[num],position))
}
else if(event.animate=='draw2'){
player.$draw(cards[num]);
(function(card,position){
setTimeout(function(){
position.insertBefore(card,position.childNodes[j]);
},500);
}(cards[num],position))
}
else if(event.animate=='gain'){
player.$gain(cards[num]);
(function(card,position){
setTimeout(function(){
position.insertBefore(card,position.childNodes[j]);
},700);
}(cards[num],position))
}
else if(event.animate=='gain2'){
player.$gain2(cards[num]);
(function(card,position){
setTimeout(function(){
position.insertBefore(card,position.childNodes[j]);
},500);
}(cards[num],position))
}
else{
position.insertBefore(cards[num],position.childNodes[j]);
}
}
else{
if(game.singleHandcard||sort>0) frag1.appendChild(cards[num]);
else frag2.appendChild(cards[num]);
}
} }
if(!lib.config.strict_sort){ if(event.animate=='draw'){
if(event.animate=='draw'){ player.$draw(cards.length);
player.$draw(cards.length); game.delay(1,500);
game.delay(1,500); setTimeout(function(){
setTimeout(function(){
player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild);
player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild);
player.update();
},500);
}
else if(event.animate=='gain'){
player.$gain(cards);
game.delay(1,700);
setTimeout(function(){
player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild);
player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild);
player.update();
},700);
}
else if(event.animate=='gain2'||event.animate=='draw2'){
player.$gain2(cards);
game.delay(1,500);
setTimeout(function(){
player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild);
player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild);
player.update();
},500);
}
else{
player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild); player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild);
player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild); player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild);
player.update(); player.update();
} },500);
}
else if(event.animate=='gain'){
player.$gain(cards);
game.delay(1,700);
setTimeout(function(){
player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild);
player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild);
player.update();
},700);
}
else if(event.animate=='gain2'||event.animate=='draw2'){
player.$gain2(cards);
game.delay(1,500);
setTimeout(function(){
player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild);
player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild);
player.update();
},500);
}
else{
player.node.handcards1.insertBefore(frag1,player.node.handcards1.firstChild);
player.node.handcards2.insertBefore(frag2,player.node.handcards2.firstChild);
player.update();
} }
}, },
lose:function(){ lose:function(){
@ -3160,6 +3107,19 @@ window.play={};
} }
next.content=lib.element.playerproto.respond; next.content=lib.element.playerproto.respond;
}, },
directgain:function(cards){
for(var i=0;i<cards.length;i++){
var sort=lib.config.sort_card(cards[i]);
if(game.singleHandcard||sort>0){
this.node.handcards1.appendChild(cards[i].animate('start'));
}
else{
this.node.handcards2.appendChild(cards[i].animate('start'));
}
}
this.update();
return this;
},
gain:function(){ gain:function(){
var next=game.createEvent('gain'); var next=game.createEvent('gain');
next.player=this; next.player=this;
@ -3365,6 +3325,17 @@ window.play={};
} }
} }
}, },
isMad:function(){
return this.skills.contains('mad');
},
goMad:function(){
this.addSkill('mad');
game.log(get.translation(this)+'进入混乱状态');
},
unMad:function(){
this.removeSkill('mad');
game.log(get.translation(this)+'解除混乱状态');
},
equip:function(card){ equip:function(card){
var next=game.createEvent('equip'); var next=game.createEvent('equip');
next.card=card; next.card=card;
@ -3826,15 +3797,12 @@ window.play={};
}, },
isUnderControl:function(){ isUnderControl:function(){
if(this===game.me) return false; if(this===game.me) return false;
if(this.isMad()) return false;
if(lib.config.mode=='versus'){ if(lib.config.mode=='versus'){
return ui.autoreplace&&ui.autoreplace.classList.contains('on')&& return ui.autoreplace&&ui.autoreplace.classList.contains('on')&&
this.side==game.me.side; this.side==game.me.side;
} }
else if(lib.config.mode=='chess'){ else if(lib.config.mode=='chess'||lib.config.mode=='boss'){
return this.side==game.me.side;
}
else if(lib.config.mode=='boss'){
if(this.gonemad) return false;
return this.side==game.me.side; return this.side==game.me.side;
} }
return false; return false;
@ -4393,7 +4361,7 @@ window.play={};
delete this.skill; delete this.skill;
}, },
isMine:function(){ isMine:function(){
return (this.player&&this.player==game.me&&!_status.auto); return (this.player&&this.player==game.me&&!_status.auto&&!this.player.isMad());
}, },
trigger:function(name){ trigger:function(name){
var event=this; var event=this;
@ -4829,6 +4797,13 @@ window.play={};
global:[], global:[],
storage:{}, storage:{},
unequip:{}, unequip:{},
mad:{
mark:true,
intro:{
content:'已进入混乱状态',
name:'混乱'
}
},
_recoverCheck:{ _recoverCheck:{
trigger:{player:'recoverBefore'}, trigger:{player:'recoverBefore'},
forced:true, forced:true,
@ -4972,11 +4947,20 @@ window.play={};
} }
} }
}, },
_ismin:{
mod:{
cardEnabled:function(card,player){
if(player.isMin()){
if(get.type(card)=='equip') return false;
}
}
}
},
_chongzhu:{ _chongzhu:{
enable:'phaseUse', enable:'phaseUse',
prompt:'弃置要重铸的牌并摸一张牌', prompt:'弃置要重铸的牌并摸一张牌',
filter:function(event,player){ filter:function(event,player){
if(player.isMin()) return false; if(player.isMin()&&lib.config.mode=='stone') return false;
return (player.get('h',function(card){ return (player.get('h',function(card){
return get.info(card).chongzhu; return get.info(card).chongzhu;
}).length); }).length);
@ -6008,7 +5992,7 @@ window.play={};
"step 0" "step 0"
var end=player; var end=player;
do{ do{
player.draw(num,false).log=false; player.directgain(get.cards(4));
if(player.singleHp===true&&!player.classList.contains('unseen')&&!player.classList.contains('unseen2')){ if(player.singleHp===true&&!player.classList.contains('unseen')&&!player.classList.contains('unseen2')){
player.doubleDraw(); player.doubleDraw();
} }
@ -7858,8 +7842,14 @@ window.play={};
intro:ui.create.div('.intro',node), intro:ui.create.div('.intro',node),
group:ui.create.div('.identity',node) group:ui.create.div('.identity',node)
} }
for(var i =0;i<lib.character[item][2];i++){ if(lib.character[item][2]>14){
ui.create.div('',node.node.hp); node.node.hp.innerHTML=lib.character[item][2];
node.node.hp.classList.add('text');
}
else{
for(var i =0;i<lib.character[item][2];i++){
ui.create.div('',node.node.hp);
}
} }
if(!lib.config.show_name){ if(!lib.config.show_name){
node.node.name.style.display='none'; node.node.name.style.display='none';
@ -8590,6 +8580,7 @@ window.play={};
} }
}, },
window:function(){ window:function(){
var clicked=_status.clicked;
if(_status.dragged) return; if(_status.dragged) return;
if(_status.reloading) return; if(_status.reloading) return;
if(_status.clicked){ if(_status.clicked){
@ -8629,9 +8620,6 @@ window.play={};
game.uncheck(); game.uncheck();
game.check(); game.check();
} }
if(_status.event.custom.add.window){
_status.event.custom.add.window();
}
} }
} }
} }
@ -8648,7 +8636,7 @@ window.play={};
} }
} }
if(_status.event.custom.add.window){ if(_status.event.custom.add.window){
_status.event.custom.add.window(); _status.event.custom.add.window(clicked);
} }
}, },
toggle:function(){ toggle:function(){
@ -8713,6 +8701,7 @@ window.play={};
button:function(){ button:function(){
if(_status.dragged) return; if(_status.dragged) return;
if(_status.clicked) return; if(_status.clicked) return;
if(this.classList.contains('noclick')) return;
_status.clicked=true; _status.clicked=true;
var custom=_status.event.custom; var custom=_status.event.custom;
if(custom.replace.button){ if(custom.replace.button){

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

@ -183,6 +183,13 @@ margin-bottom: 5px;
.button.character,.button.card{width: 90px;height: 90px;position: relative;margin: 6px;} .button.character,.button.card{width: 90px;height: 90px;position: relative;margin: 6px;}
.button.character>.name{left:5px;top:22px;} .button.character>.name{left:5px;top:22px;}
.button.character>.hp{left:5px;top:2px;} .button.character>.hp{left:5px;top:2px;}
.button.character>.hp.text{
top:8px;
left:6px;
font-family:'huangcao';
font-size:20px;
letter-spacing:3px;
}
.button.character>.intro{top:71px;left:0;} .button.character>.intro{top:71px;left:0;}
.button.character>.identity{top:-6px;left:72px;} .button.character>.identity{top:-6px;left:72px;}
/*--------确认--------*/ /*--------确认--------*/

View File

@ -126,3 +126,6 @@
.chessscroll.right{ .chessscroll.right{
right:0; right:0;
} }
.button.forbidden{
opacity:0.6
}

View File

@ -10,25 +10,6 @@ mode.boss={
game.checkResult(); game.checkResult();
} }
}, },
goMad:function(){
this.mark('乱',{
name:'混乱',
content:'已进入混乱状态'
});
this.gonemad=true;
if(this==game.me){
if(this.next.side==this.side){
game.modeSwapPlayer(this.next);
}
else if(this.previous.side==this.side){
game.modeSwapPlayer(this.previous);
}
else{
this.die();
}
}
game.log(get.translation(this)+'进入混乱状态');
}
} }
}, },
game:{ game:{
@ -58,6 +39,8 @@ mode.boss={
"step 1" "step 1"
var bosslist=ui.create.div('#bosslist.hidden'); var bosslist=ui.create.div('#bosslist.hidden');
event.bosslist=bosslist; event.bosslist=bosslist;
bosslist.ontouchmove = ui.click.touchScroll;
bosslist.style.WebkitOverflowScrolling='touch';
if(!lib.config.touchscreen&&lib.config.mousewheel){ if(!lib.config.touchscreen&&lib.config.mousewheel){
bosslist._scrollspeed=30; bosslist._scrollspeed=30;
bosslist._scrollnum=10; bosslist._scrollnum=10;
@ -408,22 +391,6 @@ mode.boss={
game.uncheck(); game.uncheck();
game.check(); game.check();
}; };
event.asboss=ui.create.control('应战',function(){
event.boss=true;
event.enemy=[];
for(var i=0;i<ui.selected.buttons.length;i++){
event.enemy.push(ui.selected.buttons[i].link);
event.list.remove(ui.selected.buttons[i].link);
}
while(event.enemy.length<3){
event.enemy.push(event.list.randomRemove());
}
game.uncheck();
if(ui.confirm){
ui.confirm.close();
}
game.resume();
});
ui.create.cheat=function(){ ui.create.cheat=function(){
ui.cheat=ui.create.control('更换',event.changeDialog); ui.cheat=ui.create.control('更换',event.changeDialog);
}; };
@ -459,6 +426,23 @@ mode.boss={
ui.create.cheat(); ui.create.cheat();
if(!ui.cheat2&&get.config('free_choose')) if(!ui.cheat2&&get.config('free_choose'))
ui.create.cheat2(); ui.create.cheat2();
event.asboss=ui.create.control('应战',function(){
event.boss=true;
event.enemy=[];
for(var i=0;i<ui.selected.buttons.length;i++){
event.enemy.push(ui.selected.buttons[i].link);
event.list.remove(ui.selected.buttons[i].link);
}
while(event.enemy.length<3){
event.enemy.push(event.list.randomRemove());
}
game.uncheck();
if(ui.confirm){
ui.confirm.close();
}
game.resume();
});
"step 1" "step 1"
if(ui.cheat){ if(ui.cheat){
ui.cheat.close(); ui.cheat.close();
@ -545,6 +529,7 @@ mode.boss={
boss_qiangzheng:{ boss_qiangzheng:{
trigger:{player:'phaseEnd'}, trigger:{player:'phaseEnd'},
forced:true, forced:true,
unique:true,
filter:function(event,player){ filter:function(event,player){
for(var i=0;i<game.players.length;i++){ for(var i=0;i<game.players.length;i++){
if(game.players[i]!=player&&game.players[i].num('h')) return true; if(game.players[i]!=player&&game.players[i].num('h')) return true;
@ -627,10 +612,8 @@ mode.boss={
content:function(){ content:function(){
var players=game.players.concat(game.dead); var players=game.players.concat(game.dead);
for(var i=0;i<players.length;i++){ for(var i=0;i<players.length;i++){
if(players[i].gonemad){ if(players[i].isMad()){
delete players[i].gonemad; players[i].unMad();
players[i].unmark('乱');
game.log(get.translation(players[i])+'解除混乱状态');
} }
} }
} }
@ -709,7 +692,7 @@ mode.boss={
player.hp=player.maxHp; player.hp=player.maxHp;
player.update(); player.update();
}, },
group:['huanhua2','huanhua3','huanhua4'], group:['huanhua3','huanhua4'],
ai:{ ai:{
threaten:0.8, threaten:0.8,
effect:{ effect:{
@ -987,7 +970,6 @@ mode.boss={
"step 0" "step 0"
event.players=get.players(player); event.players=get.players(player);
event.players.remove(player); event.players.remove(player);
event.num=0;
player.draw(2); player.draw(2);
"step 1" "step 1"
if(event.players.length){ if(event.players.length){
@ -1039,16 +1021,6 @@ mode.boss={
game.players[i].forcemin=true; game.players[i].forcemin=true;
} }
} }
},
global:'boss_gongshen2'
},
boss_gongshen2:{
mod:{
cardEnabled:function(card,player){
if(player.isMin()){
if(get.type(card)=='equip') return false;
}
}
} }
}, },
fanghua:{ fanghua:{
@ -1268,7 +1240,7 @@ mode.boss={
boss_wange:'笙歌', boss_wange:'笙歌',
huanhua:'幻化', huanhua:'幻化',
huanhua_info:'锁定技,游戏开始时,你获得其他角色的所有技能,体力上限变为其他角色之和;你没有摸牌阶段,其他角色于摸牌摸牌,或于弃牌阶段弃牌时,你摸或弃等量的牌', huanhua_info:'锁定技,游戏开始时,你获得其他角色的所有技能,体力上限变为其他角色之和;其他角色于摸牌摸牌时,你摸等量的牌;其他角色于弃牌阶段弃牌时,你弃置等量的手牌',
jidian:'亟电', jidian:'亟电',
jidian_info:'每当你造成一次伤害可以指定距离受伤害角色1以内的一名其他角色进行判定若结果为红色该角色受到一点雷电伤害', jidian_info:'每当你造成一次伤害可以指定距离受伤害角色1以内的一名其他角色进行判定若结果为红色该角色受到一点雷电伤害',
@ -1296,7 +1268,7 @@ mode.boss={
boss_guiyin:'归隐', boss_guiyin:'归隐',
boss_guiyin_info:'锁定技,体力值比你多的角色无法在回合内对你使用卡牌', boss_guiyin_info:'锁定技,体力值比你多的角色无法在回合内对你使用卡牌',
boss_gongshen:'工神', boss_gongshen:'工神',
boss_gongshen_info:'锁定技,除你之外的角色没有装备区,也不能重铸卡牌', boss_gongshen_info:'锁定技,除你之外的角色没有装备区',
fanghua:'芳华', fanghua:'芳华',
fanghua_info:'回合结束阶段,你可以令所有已翻面角色流失一点体力', fanghua_info:'回合结束阶段,你可以令所有已翻面角色流失一点体力',
@ -1342,10 +1314,10 @@ mode.boss={
get:{ get:{
attitude:function(from,to){ attitude:function(from,to){
var t=(from.side===to.side?1:-1); var t=(from.side===to.side?1:-1);
if(from.gonemad){ if(from.isMad()){
t=-t; t=-t;
} }
else if(to.gonemad){ else if(to.isMad()){
t=0; t=0;
} }
return 6*t; return 6*t;

View File

@ -601,18 +601,24 @@ mode.chess={
} }
} }
} }
if(get.config('chess_character')){
delete lib.character.swd_linyue;
for(var i in lib.chess_character){
lib.character[i]=lib.chess_character[i];
}
}
delete lib.chess_character;
lib.init.css('layout/mode','chess'); lib.init.css('layout/mode','chess');
ui.chesssheet=document.createElement('style'); ui.chesssheet=document.createElement('style');
document.head.appendChild(ui.chesssheet); document.head.appendChild(ui.chesssheet);
ui.create.arena(); ui.create.arena();
ui.create.cards();
game.finishCards();
if(get.config('chess_character')){
delete lib.character.swd_linyue;
for(var i in lib.chess_character){
lib.character[i]=lib.chess_character[i];
if(!lib.character[i][4]){
lib.character[i][4]=[];
}
}
}
ui.chessContainer=ui.create.div('#chess-container',ui.arena); ui.chessContainer=ui.create.div('#chess-container',ui.arena);
ui.chessContainer.ontouchmove = ui.click.touchScroll;
ui.chessContainer.style.WebkitOverflowScrolling='touch';
ui.chess=ui.create.div('#chess',ui.chessContainer); ui.chess=ui.create.div('#chess',ui.chessContainer);
ui.canvas2=document.createElement('canvas'); ui.canvas2=document.createElement('canvas');
ui.chess.appendChild(ui.canvas2); ui.chess.appendChild(ui.canvas2);
@ -621,8 +627,7 @@ mode.chess={
game.chooseCharacter(); game.chooseCharacter();
"step 1" "step 1"
ui.arena.classList.add('chess'); ui.arena.classList.add('chess');
var num=get.config('battle_number'); var num=Math.round((_status.mylist.length+_status.enemylist.length)/2);
var double=get.config('double_character');
var friend,enemy; var friend,enemy;
var side=Math.random()<0.5; var side=Math.random()<0.5;
switch(num){ switch(num){
@ -709,43 +714,35 @@ mode.chess={
for(var i=0;i<gridnum;i++){ for(var i=0;i<gridnum;i++){
grids.push(i); grids.push(i);
} }
for(var i=0;i<num;i++){ while(_status.mylist.length){
friend=ui.create.player().animate('start'); friend=ui.create.player().animate('start');
enemy=ui.create.player().animate('start'); friend.init(_status.mylist.shift());
if(double){
friend.init(_status.mylist.shift(),_status.mylist.shift());
enemy.init(_status.enemylist.shift(),_status.enemylist.shift());
}
else{
friend.init(_status.mylist.shift());
enemy.init(_status.enemylist.shift());
}
friend.side=side; friend.side=side;
enemy.side=!side;
friend.setIdentity('friend'); friend.setIdentity('friend');
enemy.setIdentity('enemy');
friend.node.identity.dataset.color=get.translation(side+'Color'); friend.node.identity.dataset.color=get.translation(side+'Color');
enemy.node.identity.dataset.color=get.translation(!side+'Color');
game.players.push(friend); game.players.push(friend);
game.players.push(enemy);
ui.chess.appendChild(friend); ui.chess.appendChild(friend);
ui.chess.appendChild(enemy);
friend.dataset.position=grids.randomRemove(); friend.dataset.position=grids.randomRemove();
enemy.dataset.position=grids.randomRemove();
lib.posmap[friend.dataset.position]=friend; lib.posmap[friend.dataset.position]=friend;
}
while(_status.enemylist.length){
enemy=ui.create.player().animate('start');
enemy.init(_status.enemylist.shift());
enemy.side=!side;
enemy.setIdentity('enemy');
enemy.node.identity.dataset.color=get.translation(!side+'Color');
game.players.push(enemy);
ui.chess.appendChild(enemy);
enemy.dataset.position=grids.randomRemove();
lib.posmap[enemy.dataset.position]=enemy; lib.posmap[enemy.dataset.position]=enemy;
} }
lib.setPopped(ui.create.system('查看手牌',null,true),function(){ lib.setPopped(ui.create.system('查看手牌',null,true),function(){
var uiintro=ui.create.dialog('hidden'); var uiintro=ui.create.dialog('hidden');
var added=false;
for(var i=0;i<game.players.length;i++){ for(var i=0;i<game.players.length;i++){
if(game.players[i].side==game.me.side&&game.players[i]!=game.me){ if(game.players[i].side==game.me.side&&game.players[i]!=game.me){
added=true;
uiintro.add(get.translation(game.players[i])); uiintro.add(get.translation(game.players[i]));
var cards=game.players[i].get('h'); var cards=game.players[i].get('h');
if(cards.length){ if(cards.length){
@ -756,6 +753,9 @@ mode.chess={
} }
} }
} }
if(!added){
uiintro.add('无队友');
}
return uiintro; return uiintro;
}); });
@ -773,11 +773,11 @@ mode.chess={
ui.create.me(); ui.create.me();
ui.create.fakeme(); ui.create.fakeme();
ui.create.cards();
ui.chessinfo=ui.create.div('.fakeme.player',ui.me); ui.chessinfo=ui.create.div('.fakeme.player',ui.me);
ui.chessinfo.ontouchmove = ui.click.touchScroll;
ui.chessinfo.style.WebkitOverflowScrolling='touch';
game.finishCards();
game.arrangePlayers(); game.arrangePlayers();
"step 2" "step 2"
ui.control.style.display=''; ui.control.style.display='';
@ -839,47 +839,127 @@ mode.chess={
"step 0" "step 0"
var i; var i;
var list=[]; var list=[];
var bosslist=[];
event.list=list; event.list=list;
for(i in lib.character){ for(i in lib.character){
if(lib.character[i][4]&&lib.character[i][4].contains('minskin')) continue; if(lib.character[i][4].contains('minskin')) continue;
if(lib.config.forbidai.contains(i)) continue; if(lib.config.forbidai.contains(i)) continue;
if(lib.config.forbidall.contains(i)) continue; if(lib.config.forbidall.contains(i)) continue;
if(lib.config.forbidchess.contains(i)) continue; if(lib.config.forbidchess.contains(i)) continue;
if(!get.config('double_character')&&get.config('ban_weak')&&lib.config.forbidsingle.contains(i)) continue; if(get.config('ban_weak')&&lib.config.forbidsingle.contains(i)) continue;
list.push(i); if(lib.character[i][4].contains('boss')){
bosslist.push(i);
}
else{
list.push(i);
}
} }
list.randomSort(); list.randomSort();
var dialog=ui.create.dialog('选择出场角色'+(get.config('double_character')?'(双将)':'')); var bosses=ui.create.div('.buttons');
event.bosses=bosses;
var bossbuttons=ui.create.buttons(bosslist,'character',bosses);
var addToButton=function(){
if(ui.cheat2&&ui.cheat2.backup) return;
_status.event.dialog.content.childNodes[1].innerHTML=
ui.selected.buttons.length+'/'+_status.event.selectButton();
};
var clickedBoss=false;
var clickBoss=function(){
clickedBoss=true;
var num=bosses.querySelectorAll('.glow').length;
if(this.classList.contains('glow')){
this.classList.remove('glow');
num--;
}
else{
if(num<4){
this.classList.add('glow');
num++;
}
}
for(var i=0;i<bosses.childElementCount;i++){
if(num>=4&&!bosses.childNodes[i].classList.contains('glow')){
bosses.childNodes[i].classList.add('forbidden');
}
else{
bosses.childNodes[i].classList.remove('forbidden');
}
}
if(num){
if(!event.asboss){
event.asboss=ui.create.control('应战',function(){
_status.boss=true;
ui.click.ok();
});
}
}
else{
if(event.asboss){
event.asboss.close();
delete event.asboss;
}
}
addToButton();
};
for(var i=0;i<bossbuttons.length;i++){
bossbuttons[i].classList.add('noclick');
bossbuttons[i].listen(clickBoss);
}
var dialog=ui.create.dialog('选择出场角色');
dialog.classList.add('fullwidth'); dialog.classList.add('fullwidth');
dialog.classList.add('fullheight'); dialog.classList.add('fullheight');
dialog.add('0/'+(get.config('double_character')?2:1)*get.config('battle_number')); dialog.add('0/'+get.config('battle_number'));
dialog.add([list.slice(0,get.config('battle_number')*4+5),'character']); dialog.add([list.slice(0,get.config('battle_number')*4+5),'character']);
if(bossbuttons.length){
dialog.add('挑战魔王');
dialog.add(bosses);
}
ui.control.style.transition='all 0s'; ui.control.style.transition='all 0s';
ui.control.style.top='calc(100% - 30px)'; ui.control.style.top='calc(100% - 30px)';
var next=game.me.chooseButton(dialog,true); var next=game.me.chooseButton(dialog,true);
next._triggered=null; next._triggered=null;
next.selectButton=function(){ next.selectButton=function(){
return (get.config('double_character')?2:1)*get.config('battle_number'); var bossnum=bosses.querySelectorAll('.glow').length;
}; if(bossnum){
next.custom.add.button=function(){ return 3*bossnum;
if(ui.cheat2&&ui.cheat2.backup) return; }
_status.event.dialog.content.childNodes[0].innerHTML= return get.config('battle_number');
'选择出场角色'+(get.config('double_character')?'(双将)':'');
_status.event.dialog.content.childNodes[1].innerHTML=
ui.selected.buttons.length+'/'+_status.event.selectButton();
}; };
next.custom.add.button=addToButton;
next.custom.add.window=function(clicked){
if(clicked) return;
if(clickedBoss){
clickedBoss=false;
}
else{
for(var i=0;i<bosses.childElementCount;i++){
bosses.childNodes[i].classList.remove('forbidden');
bosses.childNodes[i].classList.remove('glow');
}
if(event.asboss){
event.asboss.close();
delete event.asboss;
}
}
addToButton();
}
event.changeDialog=function(){ event.changeDialog=function(){
if(ui.cheat2&&ui.cheat2.dialog==_status.event.dialog){ if(ui.cheat2&&ui.cheat2.dialog==_status.event.dialog){
return; return;
} }
list.randomSort(); list.randomSort();
_status.event.dialog.close(); _status.event.dialog.close();
_status.event.dialog=ui.create.dialog('选择出场角色'+(get.config('double_character')?'(双将)':'')); var dialog=ui.create.dialog('选择出场角色');
_status.event.dialog.classList.add('fullwidth'); _status.event.dialog=dialog;
_status.event.dialog.classList.add('fullheight'); dialog.classList.add('fullwidth');
_status.event.dialog.add('0/'+(get.config('double_character')?2:1)*get.config('battle_number')); dialog.classList.add('fullheight');
_status.event.dialog.add([list.slice(0,get.config('battle_number')*4+5),'character']); dialog.add('0/'+_status.event.selectButton());
dialog.add([list.slice(0,get.config('battle_number')*4+5),'character']);
if(bossbuttons.length){
dialog.add('挑战魔王');
dialog.add(bosses);
}
game.uncheck(); game.uncheck();
game.check(); game.check();
}; };
@ -932,17 +1012,39 @@ mode.chess={
ui.cheat2x.close(); ui.cheat2x.close();
delete ui.cheat2x; delete ui.cheat2x;
} }
if(event.asboss){
event.asboss.close();
delete ui.asboss;
}
ui.control.style.display='none'; ui.control.style.display='none';
ui.control.style.top=''; ui.control.style.top='';
ui.control.style.transition=''; ui.control.style.transition='';
_status.mylist=result.links.slice(0); _status.mylist=result.links.slice(0);
for(var i=0;i<result.links.length;i++){ for(var i=0;i<result.links.length;i++){
event.list.remove(result.links[i]); event.list.remove(result.links[i]);
} }
event.list.randomSort(); var glows=event.bosses.querySelectorAll('.glow');
_status.enemylist=event.list.slice(0,result.links.length); if(glows.length){
_status.double_character=get.config('double_character'); _status.enemylist=[];
for(var i=0;i<glows.length;i++){
_status.enemylist.push(glows[i].link);
}
if(_status.boss){
var temp=_status.mylist;
_status.mylist=_status.enemylist;
_status.enemylist=temp;
for(var i=_status.enemylist.length;i<_status.mylist.length*3;i++){
_status.enemylist.push(event.list.randomRemove());
}
}
}
else{
event.list.randomSort();
_status.enemylist=event.list.slice(0,result.links.length);
}
} }
}, },
modeSwapPlayer:function(player){ modeSwapPlayer:function(player){
@ -953,6 +1055,124 @@ mode.chess={
} }
}, },
skill:{ skill:{
cangming:{
enable:'phaseUse',
usable:1,
unique:true,
filter:function(event,player){
if(player.isTurnedOver()) return false;
var suits=[];
var hs=player.get('h');
for(var i=0;i<hs.length;i++){
suits.add(get.suit(hs[i]));
if(suits.length>=4) return true;
}
return false;
},
filterCard:function(card){
var suit=get.suit(card);
for(var i=0;i<ui.selected.cards.length;i++){
if(suit==get.suit(ui.selected.cards[i])) return false;
}
return true;
},
selectCard:4,
check:function(card){
return 10-ai.get.value(card);
},
filterTarget:function(card,player,target){
return player!=target;
},
selectTarget:-1,
content:function(){
target.goMad();
if(!player.isTurnedOver()){
player.turnOver();
}
player.addSkill('cangming2');
},
ai:{
order:10,
effect:{
player:function(card,player){
var num=0;
for(var i=0;i<game.players.length;i++){
if(ai.get.attitude(player,game.players[i])<0){
num++;
if(num>1) break;
}
}
if(num<=1) return;
if(_status.currentPhase==player&&player.num('h')<player.hp&&player.hp>=6){
if(typeof card=='string') return;
if(card.name=='wuzhong') return;
if(card.name=='shunshou') return;
if(card.name=='yuanjiao') return;
if(card.name=='yiyi') return;
if(!player.skills.contains('cangming2')) return [0,0,0,0];
}
}
},
result:{
target:-10
}
},
},
cangming2:{
trigger:{player:'phaseBegin'},
forced:true,
popup:false,
content:function(){
for(var i=0;i<game.players.length;i++){
game.players[i].unMad();
}
player.removeSkill('cangming2');
}
},
boss_moyan:{
trigger:{player:'phaseEnd'},
forced:true,
unique:true,
content:function(){
"step 0"
event.players=get.players(player);
"step 1"
if(event.players.length){
event.players.shift().damage('fire');
event.redo();
}
},
},
boss_baolin:{
inherit:'juece',
},
boss_qiangzheng:{
trigger:{player:'phaseEnd'},
forced:true,
unique:true,
filter:function(event,player){
for(var i=0;i<game.players.length;i++){
if(game.players[i]!=player&&game.players[i].num('h')) return true;
}
return false;
},
content:function(){
"step 0"
var players=get.players(player);
players.remove(player);
event.players=players;
"step 1"
if(event.players.length){
var current=event.players.shift();
var hs=current.get('h')
if(hs.length){
player.gain(hs.randomGet());
current.$give(1,player);
}
event.redo();
}
}
},
guanchuan:{ guanchuan:{
trigger:{player:'shaBefore'}, trigger:{player:'shaBefore'},
getTargets:function(player,target){ getTargets:function(player,target){
@ -1117,7 +1337,7 @@ mode.chess={
}, },
content:function(){ content:function(){
"step 0" "step 0"
player.chooseToMove(get.cardCount('sha',player),'是否发动【灵动】?'); player.chooseToMove(get.cardCount('sha',player),'是否发动【移动射击】?');
"step 1" "step 1"
if(result.bool){ if(result.bool){
player.logSkill('lingdong'); player.logSkill('lingdong');
@ -1160,6 +1380,11 @@ mode.chess={
direct:true, direct:true,
delay:false, delay:false,
preservecancel:true, preservecancel:true,
filter:function(event,player){
var move=player.skills.contains('noactpunish')?2:1;
move=game.checkMod(player,move,'chessMove',player.get('s'));
return move>0;
},
content:function(){ content:function(){
"step 0" "step 0"
var move=player.skills.contains('noactpunish')?2:1; var move=player.skills.contains('noactpunish')?2:1;
@ -1173,8 +1398,7 @@ mode.chess={
ai:{ ai:{
order:5, order:5,
result:{ result:{
player:function(player){ playerx:function(player){
var range=get.attackRange(player)>1;
var nh=player.num('h'); var nh=player.num('h');
if(!player.num('h','sha')&& if(!player.num('h','sha')&&
!player.num('h','shunshou')&& !player.num('h','shunshou')&&
@ -1186,21 +1410,30 @@ mode.chess={
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){
return range?1:0; if(get.distance(player,neighbour,'attack')<1) return 1;
return 0;
} }
neighbour=player.getNeighbour(0,-1); neighbour=player.getNeighbour(0,-1);
if(neighbour&&neighbour.side!=player.side){ if(neighbour&&neighbour.side!=player.side){
return range?1:0; if(get.distance(player,neighbour,'attack')<1) return 1;
return 0;
} }
neighbour=player.getNeighbour(1,0); neighbour=player.getNeighbour(1,0);
if(neighbour&&neighbour.side!=player.side){ if(neighbour&&neighbour.side!=player.side){
return range?1:0; if(get.distance(player,neighbour,'attack')<1) return 1;
return 0;
} }
neighbour=player.getNeighbour(-1,0); neighbour=player.getNeighbour(-1,0);
if(neighbour&&neighbour.side!=player.side){ if(neighbour&&neighbour.side!=player.side){
return range?1:0; if(get.distance(player,neighbour,'attack')<1) return 1;
return 0;
} }
return 1; return 1;
},
player:function(player){
var x=lib.skill._chessmove.ai.result.playerx(player);
if(player.isMad()) return -x;
return x;
} }
} }
} }
@ -1230,6 +1463,129 @@ mode.chess={
player.chessFocus(); player.chessFocus();
}, },
}, },
boss_fengxing:{
mod:{
chessMove:function(player,current){
return current+2;
},
attackFrom:function(from,to,current){
return current-2;
},
},
trigger:{player:'phaseDrawBegin'},
forced:true,
content:function(){
trigger.num+=2;
}
},
boss_chiyu:{
enable:'phaseUse',
usable:1,
filterCard:{color:'red'},
nodelay:true,
check:function(card){return 8-ai.get.value(card);},
filterTarget:function(card,player,target){
return get.distance(player,target)<=5&&player!=target;
},
filter:function(event,player){
return player.num('h',{color:'red'})>0;
},
selectTarget:-1,
content:function(){
target.damage('fire');
},
line:'fire',
ai:{
order:1,
result:{
target:function(player,target){
return ai.get.damageEffect(target,player,target,'fire');
}
}
}
},
boss_tenglong:{
enable:'phaseUse',
usable:1,
position:'he',
filterCard:{type:'equip'},
init:function(player){
player.forcemin=true;
},
check:function(card){
var player=_status.currentPhase;
if(player.num('he',{subtype:get.subtype(card)})>1){
return 12-ai.get.equipValue(card);
}
return 8-ai.get.equipValue(card);
},
filter:function(event,player){
return player.num('he',{type:'equip'});
},
filterTarget:function(card,player,target){
return player!=target&&get.distance(player,target)<=2;
},
content:function(){
target.damage(3,'fire');
},
ai:{
order:9,
result:{
target:function(player,target){
return ai.get.damageEffect(target,player,target,'fire');
}
}
}
},
boss_wuying:{
mod:{
globalTo:function(from,to,distance){
return distance+2;
},
chessMove:function(player,current){
return current-1;
}
}
},
boss_wushang:{
trigger:{player:'phaseBegin'},
forced:true,
filter:function(event,player){
for(var i=0;i<game.players.length;i++){
if(game.players[i]!=player&&game.players[i].num('h')&&
get.distance(player,game.players[i])<=5){
return true;
}
}
return false;
},
content:function(){
"step 0"
var players=[];
for(var i=0;i<game.players.length;i++){
if(game.players[i]!=player&&game.players[i].num('h')&&
get.distance(player,game.players[i])<=5){
players.push(game.players[i]);
}
}
players.sort(lib.sort.seat);
event.players=players;
"step 1"
if(event.players.length){
event.current=event.players.shift();
event.current.chooseCard('无上:交给'+get.translation(player)+'一张手牌',true);
}
else{
event.finish();
}
"step 2"
if(result.cards.length){
player.gain(result.cards);
event.current.$give(1,player);
event.goto(1);
}
}
}
}, },
translate:{ translate:{
friend:'友', friend:'友',
@ -1276,22 +1632,42 @@ mode.chess={
chess_menghuo:'孟获', chess_menghuo:'孟获',
chess_dongzhuo:'董卓', chess_dongzhuo:'董卓',
chess_xingtian:'刑天',
chess_jinchidiao:'金翅雕', chess_jinchidiao:'金翅雕',
chess_beimingjukun:'北溟巨鲲', chess_beimingjukun:'北溟巨鲲',
chess_wuzhaojinlong:'五爪金龙', chess_wuzhaojinlong:'五爪金龙',
pianyi:'翩仪', pianyi:'翩仪',
pianyi_info:'回合结束阶段,若你没有于本回合内造成伤害,你获得一次移动机会', pianyi_info:'回合结束阶段,若你没有于本回合内造成伤害,你获得一次移动机会',
lingdong:'灵动', lingdong:'移动射击',
lingdong_info:'回合结束阶段你可以移动X个格X为你回合内出杀的次数', lingdong_info:'回合结束阶段你可以移动X个格X为你回合内出杀的次数',
lianshe:'连射', lianshe:'连',
lianshe_info:'你的攻击范围+1回合内你回合内每当你使用一张不是杀的牌你可以额外使用一张杀', lianshe_info:'你的攻击范围+1回合内你回合内每当你使用一张不是杀的牌你可以额外使用一张杀',
zhiming:'致命', zhiming:'致命射击',
zhiming_info:'锁定技,当你使用杀造成伤害时,若你不在目标的攻击范围内,此伤害+1', zhiming_info:'锁定技,当你使用杀造成伤害时,若你不在目标的攻击范围内,此伤害+1',
sanjiansheji:'散箭', sanjiansheji:'散箭射击',
sanjiansheji_info:'你可以将两张杀当杀使用此杀可以指定距离你5格以内任意名目标', sanjiansheji_info:'你可以将两张杀当杀使用此杀可以指定距离你5格以内任意名目标',
guanchuan:'贯穿', guanchuan:'贯穿射击',
guanchuan_info:'当你使用杀指定惟一的目标后,可将攻击射线内的其他角色也加入目标', guanchuan_info:'当你使用杀指定惟一的目标后,可将攻击射线内的其他角色也加入目标',
boss_qiangzheng:'强征',
boss_qiangzheng_info:'锁定技,回合结束阶段,你获得每个敌方角色的一张手牌',
boss_baolin:'暴凌',
boss_moyan:'魔焰',
boss_moyan_info:'锁定技,回合结束阶段,你对场上所有角色造成一点火焰伤害',
cangming:'颠动沧溟',
cangming_info:'出牌阶段限一次,你可弃置四张花色不同的手牌并将武将牌翻至背面,然后令所有其他角色进入混乱状态直到你的下一回合开始',
boss_fengxing:'风行',
boss_fengxing_info:'锁定技,你摸牌阶段摸牌数+2你的攻击范围+2你回合内的移动距离+2',
boss_chiyu:'炽羽',
boss_chiyu_info:'出牌阶段限一次你可以弃置一张红色牌对距离5以内的所有其他角色造成一点火焰伤害',
boss_tenglong:'腾龙八齐',
boss_tenglong_info:'你没有装备区出牌阶段限一次你可以弃置一张装备牌对一名距离你2以内的其他角色造成3点火焰伤害',
boss_wushang:'神天并地',
boss_wushang_info:'锁定技回合开始阶段距离你5以内的所有其他角色需交给你一张手牌',
boss_wuying:'无影',
boss_wuying_info:'锁定技,你回合内的移动距离-1计算其他角色与你的距离时始终+2',
}, },
ui:{ ui:{
create:{ create:{
@ -1331,7 +1707,14 @@ mode.chess={
ai:{ ai:{
get:{ get:{
attitude:function(from,to){ attitude:function(from,to){
return (from.side==to.side?1:-1)*5; var t=(from.side===to.side?1:-1);
if(from.isMad()){
t=-t;
}
else if(to.isMad()){
t=0;
}
return 6*t;
} }
} }
}, },
@ -1370,11 +1753,11 @@ mode.chess={
// chess_zhangjiao:['male','qun',3,['']], // chess_zhangjiao:['male','qun',3,['']],
// chess_menghuo:['male','qun',3,['']], // chess_menghuo:['male','qun',3,['']],
// //
// chess_dongzhuo:['male','qun',3,['']], chess_jinchidiao:['male','qun',15,['boss_fengxing','boss_chiyu'],['boss']],
// chess_xingtian:['male','qun',3,['']], chess_beimingjukun:['male','qun',25,['boss_wuying','cangming'],['boss']],
// chess_jinchidiao:['male','qun',3,['']], chess_wuzhaojinlong:['male','qun',30,['boss_tenglong','boss_wushang'],['boss']],
// chess_beimingjukun:['male','qun',3,['']], chess_dongzhuo:['male','qun',20,['jiuchi','boss_qiangzheng','boss_baolin'],['boss']],
// chess_wuzhaojinlong:['male','qun',3,['']], chess_xingtian:['male','qun',99,['boss_moyan','wushuang'],['boss']],
}, },
posmap:{}, posmap:{},
help:{ help:{
@ -1387,7 +1770,7 @@ mode.chess={
function(game,lib,get,ui){ function(game,lib,get,ui){
var current=get.config('chess_character'); var current=get.config('chess_character');
if(typeof current!=='boolean'){ if(typeof current!=='boolean'){
game.saveConfig('chess_character',true); game.saveConfig('chess_character',true,true);
current=true; current=true;
} }
return ui.create.switcher('chess_character',current,ui.click.sidebar.local2); return ui.create.switcher('chess_character',current,ui.click.sidebar.local2);

View File

@ -1249,7 +1249,6 @@ mode.stone={
mod:{ mod:{
cardEnabled:function(card,player){ cardEnabled:function(card,player){
if(player.isMin()){ if(player.isMin()){
if(get.type(card)=='equip') return false;
return; return;
} }
if(_status.currentPhase!=player) return; if(_status.currentPhase!=player) return;

View File

@ -15,6 +15,8 @@ mode.versus={
if(lib.storage.number==undefined) game.save('number',3); if(lib.storage.number==undefined) game.save('number',3);
if(lib.storage.replace_number==undefined) game.save('replace_number',3); if(lib.storage.replace_number==undefined) game.save('replace_number',3);
ui.create.arena(); ui.create.arena();
ui.create.cards();
game.finishCards();
ui.auto.hide(); ui.auto.hide();
ui.wuxie.hide(); ui.wuxie.hide();
game.delay(); game.delay();
@ -326,8 +328,6 @@ mode.versus={
ui.fakemebg=ui.create.div('.avatar',ui.fakeme).hide(); ui.fakemebg=ui.create.div('.avatar',ui.fakeme).hide();
} }
ui.create.me(); ui.create.me();
ui.create.cards();
game.finishCards();
var position,i; var position,i;
if(lib.storage.zhu&&lib.storage.only_zhu) position=Math.ceil(num/2)-1; if(lib.storage.zhu&&lib.storage.only_zhu) position=Math.ceil(num/2)-1;
else position=Math.floor(Math.random()*num) else position=Math.floor(Math.random()*num)