This commit is contained in:
parent
0c69636c36
commit
d37bdf2a4a
136
mode/brawl.js
136
mode/brawl.js
|
@ -1,6 +1,9 @@
|
|||
'use strict';
|
||||
mode.brawl={
|
||||
start:function(){
|
||||
if(!lib.storage.scene){
|
||||
lib.storage.scene={};
|
||||
}
|
||||
var dialog=ui.create.dialog();
|
||||
dialog.classList.add('fixed');
|
||||
dialog.classList.add('scroll1');
|
||||
|
@ -45,6 +48,7 @@ mode.brawl={
|
|||
var createNode=function(name){
|
||||
var info=lib.brawl[name];
|
||||
var node=ui.create.div('.dialogbutton.menubutton.large',info.name,packnode,clickCapt);
|
||||
node.style.transition='all 0s';
|
||||
var caption=get.translation(info.mode)+'模式';
|
||||
if(info.submode){
|
||||
caption+=' - '+info.submode;
|
||||
|
@ -126,9 +130,39 @@ mode.brawl={
|
|||
start.style.fontSize='72px';
|
||||
start.style.zIndex=3;
|
||||
start.style.transition='all 0s';
|
||||
game.addScene=function(name){
|
||||
var scene=lib.storage.scene[name];
|
||||
var brawl={
|
||||
name:name,
|
||||
intro:scene.intro,
|
||||
mode:'identity',
|
||||
};
|
||||
for(var i in lib.brawl.scene.template){
|
||||
brawl[i]=lib.brawl.scene.template[i];
|
||||
}
|
||||
brawl.content.scene=scene;
|
||||
lib.brawl['scene_'+name]=brawl;
|
||||
createNode('scene_'+name);
|
||||
};
|
||||
game.removeScene=function(name){
|
||||
delete lib.storage.scene[name];
|
||||
game.save('scene',lib.storage.scene);
|
||||
for(var i=0;i<packnode.childElementCount;i++){
|
||||
if(packnode.childNodes[i].link=='scene_'+name){
|
||||
if(packnode.childNodes[i].classList.contains('active')){
|
||||
clickCapt.call(packnode.childNodes[i].previousSibling);
|
||||
}
|
||||
packnode.childNodes[i].remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var i in lib.brawl){
|
||||
createNode(i);
|
||||
}
|
||||
for(var i in lib.storage.scene){
|
||||
game.addScene(i);
|
||||
}
|
||||
if(!lib.storage.currentBrawl){
|
||||
clickCapt.call(packnode.firstChild);
|
||||
}
|
||||
|
@ -835,6 +869,44 @@ mode.brawl={
|
|||
},
|
||||
nostart:true,
|
||||
fullshow:true,
|
||||
template:{
|
||||
init:function(){
|
||||
game.saveConfig('player_number',_status.brawl.scene.players.length,'identity');
|
||||
},
|
||||
content:{
|
||||
submode:'normal',
|
||||
chooseCharacterFixed:true,
|
||||
chooseCharacterBefore:function(){
|
||||
var scene=_status.brawl.scene;
|
||||
var playercontrol=[];
|
||||
var withseat=[],withoutseat=[];
|
||||
for(var i=0;i<scene.players.length;i++){
|
||||
if(scene.players[i].playercontrol){
|
||||
playercontrol.push(scene.players[i]);
|
||||
}
|
||||
if(scene.players[i].position=='0'){
|
||||
withoutseat.push(game.players[i]);
|
||||
}
|
||||
else{
|
||||
withseat.push(game.players[i]);
|
||||
}
|
||||
}
|
||||
if(playercontrol.length){
|
||||
game.me.brawlinfo=playercontrol.randomGet();
|
||||
}
|
||||
if(game.me.brawlinfo&&game.me.brawlinfo.position!='0'){
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
},
|
||||
chooseCharacterAi:function(player){
|
||||
var scene=_status.brawl.scene;
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
showcase:function(init){
|
||||
if(init){
|
||||
lib.translate.zhu=lib.translate.zhu||'主';
|
||||
|
@ -909,7 +981,54 @@ mode.brawl={
|
|||
// console.log(1);
|
||||
// },style);
|
||||
var saveButton=ui.create.node('button','保存场景',line1,function(){
|
||||
console.log(1);
|
||||
if(!scenename.value){
|
||||
alert('请填写场景名称');
|
||||
return;
|
||||
}
|
||||
var scene={
|
||||
name:scenename.value,
|
||||
intro:sceneintro.value,
|
||||
players:[],
|
||||
cardPileTop:[],
|
||||
cardPileBottom:[],
|
||||
discardPile:[],
|
||||
};
|
||||
for(var i=0;i<line7.childElementCount;i++){
|
||||
scene.players.push(line7.childNodes[i].info);
|
||||
}
|
||||
if(scene.players.length<2){
|
||||
alert('请添加至少两名角色');
|
||||
return;
|
||||
}
|
||||
if(!_status.currentScene){
|
||||
if(lib.storage.scene[scenename.value]){
|
||||
if(!confirm('场景名与现有场景重复,是否覆盖?')){
|
||||
return;
|
||||
}
|
||||
game.removeScene(scenename.value);
|
||||
}
|
||||
}
|
||||
for(var i=0;i<line6_t.childElementCount;i++){
|
||||
scene.cardPileTop.push(line6_t.childNodes[i].info);
|
||||
}
|
||||
for(var i=0;i<line6_b.childElementCount;i++){
|
||||
scene.cardPileBottom.push(line6_b.childNodes[i].info);
|
||||
}
|
||||
for(var i=0;i<line6_d.childElementCount;i++){
|
||||
scene.discardPile.push(line6_d.childNodes[i].info);
|
||||
}
|
||||
if(replacepile.checked){
|
||||
scene.replacePile=true;
|
||||
}
|
||||
if(turnsresult.value!='none'){
|
||||
scene.turns=[parseInt(turns.value),turnsresult.value]
|
||||
}
|
||||
if(washesresult.value!='none'){
|
||||
scene.washes=[parseInt(washes.value),washesresult.value]
|
||||
}
|
||||
lib.storage.scene[scene.name]=scene;
|
||||
game.save('scene',lib.storage.scene);
|
||||
game.addScene(scene.name);
|
||||
},style);
|
||||
var exportButton=ui.create.node('button','导出扩展',line1,function(){
|
||||
console.log(1);
|
||||
|
@ -932,15 +1051,18 @@ mode.brawl={
|
|||
ui.create.node('span','体力:',line2_t);
|
||||
var hp=ui.create.node('input',line2_t,{width:'40px'});
|
||||
hp.type='text';
|
||||
ui.create.node('span','体力上限:',line2_t,{marginLeft:'15px'});
|
||||
ui.create.node('span','体力上限:',line2_t,{marginLeft:'10px'});
|
||||
var maxHp=ui.create.node('input',line2_t,{width:'40px'});
|
||||
maxHp.type='text';
|
||||
ui.create.node('span','横置 ',line2_t,{marginLeft:'20px'});
|
||||
var linked=ui.create.node('input',line2_t);
|
||||
linked.type='checkbox';
|
||||
ui.create.node('span','翻面 ',line2_t,{marginLeft:'15px'});
|
||||
ui.create.node('span','翻面 ',line2_t,{marginLeft:'10px'});
|
||||
var turnedover=ui.create.node('input',line2_t);
|
||||
turnedover.type='checkbox';
|
||||
ui.create.node('span','玩家 ',line2_t,{marginLeft:'10px'});
|
||||
var playercontrol=ui.create.node('input',line2_t);
|
||||
playercontrol.type='checkbox';
|
||||
|
||||
var list=[];
|
||||
for(var i in lib.character){
|
||||
|
@ -1040,9 +1162,7 @@ mode.brawl={
|
|||
number2='?';
|
||||
}
|
||||
card.init([suit2,number2,name2]);
|
||||
card.name=name;
|
||||
card.suit=suit;
|
||||
card.number=number;
|
||||
card.info=[name,suit,number];
|
||||
if(name=='random'){
|
||||
card.node.name.innerHTML=get.verticalStr('随机卡牌');
|
||||
}
|
||||
|
@ -1202,6 +1322,7 @@ mode.brawl={
|
|||
cardpileaddnumber.value='random';
|
||||
linked.checked=false;
|
||||
turnedover.checked=false;
|
||||
playercontrol.checked=false;
|
||||
};
|
||||
var createCharacter=function(info){
|
||||
var player=ui.create.player(null,true);
|
||||
|
@ -1275,6 +1396,7 @@ mode.brawl={
|
|||
maxHp:parseInt(maxHp.value),
|
||||
linked:linked.checked,
|
||||
turnedover:turnedover.checked,
|
||||
playercontrol:playercontrol.checked,
|
||||
handcards:[],
|
||||
equips:[],
|
||||
judges:[]
|
||||
|
@ -1360,8 +1482,6 @@ mode.brawl={
|
|||
capt_d.style.display='none';
|
||||
}
|
||||
|
||||
|
||||
|
||||
ui.create.div('.menubutton.large','确定',line9,style3,resetStatus);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,9 @@ mode.guozhan={
|
|||
game.players[i].node.name2.hide();
|
||||
game.players[i].getId();
|
||||
}
|
||||
if(_status.brawl&&_status.brawl.chooseCharacterBefore){
|
||||
_status.brawl.chooseCharacterBefore();
|
||||
}
|
||||
game.chooseCharacter();
|
||||
}
|
||||
"step 2"
|
||||
|
|
|
@ -174,6 +174,9 @@ mode.identity={
|
|||
for(var i=0;i<game.players.length;i++){
|
||||
game.players[i].getId();
|
||||
}
|
||||
if(_status.brawl&&_status.brawl.chooseCharacterBefore){
|
||||
_status.brawl.chooseCharacterBefore();
|
||||
}
|
||||
game.chooseCharacter();
|
||||
}
|
||||
"step 5"
|
||||
|
@ -389,6 +392,27 @@ mode.identity={
|
|||
}
|
||||
},
|
||||
checkResult:function(){
|
||||
if(_status.brawl&&_status.brawl.checkResult){
|
||||
_status.brawl.checkResult();
|
||||
return;
|
||||
}
|
||||
if(!game.zhu){
|
||||
if(get.population('fan')==0){
|
||||
switch(game.me.identity){
|
||||
case 'fan':game.over(false);break;
|
||||
case 'zhong':game.over(true);break;
|
||||
default:game.over();break;
|
||||
}
|
||||
}
|
||||
else if(get.population('zhong')==0){
|
||||
switch(game.me.identity){
|
||||
case 'fan':game.over(true);break;
|
||||
case 'zhong':game.over(false);break;
|
||||
default:game.over();break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(game.zhu.isAlive()&&get.population('fan')+get.population('nei')>0) return;
|
||||
if(game.zhong){
|
||||
game.zhong.identity='zhong';
|
||||
|
@ -1165,7 +1189,7 @@ mode.identity={
|
|||
},this);
|
||||
}
|
||||
game.checkResult();
|
||||
if(game.zhu.isZhu){
|
||||
if(game.zhu&&game.zhu.isZhu){
|
||||
if(get.population('zhong')+get.population('nei')==0||
|
||||
get.population('zhong')+get.population('fan')==0){
|
||||
game.broadcastAll(game.showIdentity);
|
||||
|
@ -1175,7 +1199,7 @@ mode.identity={
|
|||
else if(this.identity=='zhong'&&source&&source.identity=='zhu'&&source.isZhu){
|
||||
source.discard(source.get('he'));
|
||||
}
|
||||
if(game.zhu.storage.enhance_zhu&&get.population('fan')<3){
|
||||
if(game.zhu&&game.zhu.storage.enhance_zhu&&get.population('fan')<3){
|
||||
game.zhu.removeSkill(game.zhu.storage.enhance_zhu);
|
||||
delete game.zhu.storage.enhance_zhu;
|
||||
}
|
||||
|
|
|
@ -153,6 +153,9 @@ mode.versus={
|
|||
else{
|
||||
game.chooseCharacter();
|
||||
}
|
||||
if(!_status.connectMode&&_status.brawl&&_status.brawl.chooseCharacterBefore){
|
||||
_status.brawl.chooseCharacterBefore();
|
||||
}
|
||||
"step 3"
|
||||
var players=get.players(lib.sort.position);
|
||||
var info=[];
|
||||
|
|
Loading…
Reference in New Issue