This commit is contained in:
libccy 2016-10-05 14:03:57 +08:00
parent bb674a3b89
commit 2cd6ea8592
3 changed files with 198 additions and 63 deletions

View File

@ -1980,7 +1980,50 @@ character.yxs={
} }
}, },
zhexian:{ zhexian:{
inherit:'niepan', unique:true,
enable:'chooseToUse',
mark:true,
skillAnimation:true,
animationStr:'谪仙',
animationColor:'metal',
init:function(player){
player.storage.zhexian=false;
},
filter:function(event,player){
if(event.type!='dying') return false;
if(player!=event.dying) return false;
if(player.storage.zhexian) return false;
return true;
},
content:function(){
'step 0'
player.hp=Math.min(3,player.maxHp);
player.discard(player.get('hej'));
player.draw(3);
player.unmarkSkill('zhexian');
player.storage.zhexian=true;
'step 1'
if(player.isLinked()) player.link();
'step 2'
if(player.isTurnedOver()) player.turnOver();
},
ai:{
order:1,
skillTagFilter:function(player){
if(player.storage.zhexian) return false;
if(player.hp>0) return false;
},
save:true,
result:{
player:10
},
threaten:function(player,target){
if(!target.storage.zhexian) return 0.6;
}
},
intro:{
content:'limited'
}
}, },
guifu:{ guifu:{
enable:'phaseUse', enable:'phaseUse',

View File

@ -33,6 +33,7 @@ window.noname_update={
// 'character/shenhua.js', // 'character/shenhua.js',
// 'character/ow.js', // 'character/ow.js',
// 'character/yijiang.js', // 'character/yijiang.js',
// 'character/yxs.js',
// 'mode/boss.js', // 'mode/boss.js',
// 'mode/versus.js', // 'mode/versus.js',
// 'mode/brawl.js', // 'mode/brawl.js',

View File

@ -1,9 +1,13 @@
'use strict'; 'use strict';
mode.brawl={ mode.brawl={
start:function(){ start:function(){
ui.auto.hide();
if(!lib.storage.scene){ if(!lib.storage.scene){
lib.storage.scene={}; lib.storage.scene={};
} }
if(!lib.storage.stage){
lib.storage.stage={};
}
var dialog=ui.create.dialog('hidden'); var dialog=ui.create.dialog('hidden');
dialog.classList.add('fixed'); dialog.classList.add('fixed');
dialog.classList.add('scroll1'); dialog.classList.add('scroll1');
@ -63,20 +67,32 @@ mode.brawl={
var node=ui.create.div('.dialogbutton.menubutton.large',info.name,packnode,clickCapt); var node=ui.create.div('.dialogbutton.menubutton.large',info.name,packnode,clickCapt);
node.style.transition='all 0s'; node.style.transition='all 0s';
var caption=info.name; var caption=info.name;
var modeinfo=get.translation(info.mode)+'模式'; var modeinfo='';
if(info.mode){
modeinfo=get.translation(info.mode)+'模式';
}
if(info.submode){ if(info.submode){
modeinfo+=' - '+info.submode; if(modeinfo){
modeinfo+=' - ';
}
modeinfo+=info.submode;
} }
var intro; var intro;
if(Array.isArray(info.intro)){ if(Array.isArray(info.intro)){
intro='<ul style="text-align:left;margin-top:0;width:450px">'; intro='<ul style="text-align:left;margin-top:0;width:450px">';
intro+='<li>'+modeinfo; if(modeinfo){
intro+='<li>'+modeinfo;
}
for(var i=0;i<info.intro.length;i++){ for(var i=0;i<info.intro.length;i++){
intro+='<li>'+info.intro[i]; intro+='<li>'+info.intro[i];
} }
} }
else{ else{
intro=''+modeinfo+''+info.intro; intro='';
if(modeinfo){
intro+=''+modeinfo+'';
}
intro+=info.intro;
} }
var showcase=ui.create.div(); var showcase=ui.create.div();
showcase.style.margin='0px'; showcase.style.margin='0px';
@ -126,6 +142,7 @@ mode.brawl={
uiintro.add(ui.create.div('.placeholder')); uiintro.add(ui.create.div('.placeholder'));
return uiintro; return uiintro;
},250); },250);
ui.auto.show();
_status.brawl=info.content; _status.brawl=info.content;
game.switchMode(info.mode); game.switchMode(info.mode);
if(info.init){ if(info.init){
@ -151,7 +168,6 @@ mode.brawl={
var brawl={ var brawl={
name:name, name:name,
intro:scene.intro, intro:scene.intro,
mode:'identity',
}; };
for(var i in lib.brawl.scene.template){ for(var i in lib.brawl.scene.template){
brawl[i]=get.copy(lib.brawl.scene.template[i]); brawl[i]=get.copy(lib.brawl.scene.template[i]);
@ -168,6 +184,25 @@ mode.brawl={
_status.sceneChanged=true; _status.sceneChanged=true;
} }
}; };
game.addStage=function(name,clear){
var stage=lib.storage.stage[name];
var brawl={
name:name,
intro:stage.intro,
content:{}
};
for(var i in lib.brawl.stage.template){
brawl[i]=get.copy(lib.brawl.stage.template[i]);
}
brawl.content.stage=stage;
lib.brawl['stage_'+name]=brawl;
var node=createNode('stage_'+name);
if(clear){
game.addStageClear();
clickCapt.call(node);
}
}
game.removeScene=function(name){ game.removeScene=function(name){
delete lib.storage.scene[name]; delete lib.storage.scene[name];
game.save('scene',lib.storage.scene); game.save('scene',lib.storage.scene);
@ -175,11 +210,27 @@ mode.brawl={
for(var i=0;i<packnode.childElementCount;i++){ for(var i=0;i<packnode.childElementCount;i++){
if(packnode.childNodes[i].link=='scene_'+name){ if(packnode.childNodes[i].link=='scene_'+name){
if(packnode.childNodes[i].classList.contains('active')){ if(packnode.childNodes[i].classList.contains('active')){
if(packnode.childNodes[i].previousSibling.link=='stage'){ for(var j=0;j<packnode.childElementCount;j++){
clickCapt.call(packnode.childNodes[i].previousSibling.previousSibling); if(packnode.childNodes[j].link=='scene'){
clickCapt.call(packnode.childNodes[j]);
}
} }
else{ }
clickCapt.call(packnode.childNodes[i].previousSibling); packnode.childNodes[i].remove();
break;
}
}
}
game.removeStage=function(name){
delete lib.storage.stage[name];
game.save('stage',lib.storage.stage);
for(var i=0;i<packnode.childElementCount;i++){
if(packnode.childNodes[i].link=='stage_'+name){
if(packnode.childNodes[i].classList.contains('active')){
for(var j=0;j<packnode.childElementCount;j++){
if(packnode.childNodes[j].link=='stage'){
clickCapt.call(packnode.childNodes[j]);
}
} }
} }
packnode.childNodes[i].remove(); packnode.childNodes[i].remove();
@ -205,6 +256,9 @@ mode.brawl={
for(var i in lib.storage.scene){ for(var i in lib.storage.scene){
game.addScene(i); game.addScene(i);
} }
for(var i in lib.storage.stage){
game.addStage(i);
}
if(!lib.storage.currentBrawl){ if(!lib.storage.currentBrawl){
clickCapt.call(packnode.firstChild); clickCapt.call(packnode.firstChild);
} }
@ -1873,7 +1927,27 @@ mode.brawl={
}, },
nostart:true, nostart:true,
fullshow:true, fullshow:true,
template:{}, template:{
showcase:function(init){
if(init){
var name=lib.brawl[this.link].name;
var stage=lib.storage.stage[name];
ui.create.node('button','删除关卡',this,function(){
if(confirm('确定删除'+name+'')){
game.removeStage(name);
}
},{marginLeft:'6px'});
ui.create.node('button','导出扩展',this,function(){
var str='{name:"'+name+'",content:function(){\nif(lib.config.mode=="brawl"){\n'+
'if(!lib.storage.stage) lib.storage.stage={};\n'+
'if(!lib.storage.stage["'+name+'"]) lib.storage.stage["'+name+'"]='+get.stringify(stage)+
'\n}}\n}';
var extension={'extension.js':'game.import("extension",'+str+')'};
game.importExtension(extension,null,name);
},{marginLeft:'6px'});
}
},
},
showcase:function(init){ showcase:function(init){
if(_status.sceneChanged){ if(_status.sceneChanged){
init=true; init=true;
@ -1885,7 +1959,7 @@ mode.brawl={
this.style.height=(this.offsetHeight-10)+'px'; this.style.height=(this.offsetHeight-10)+'px';
this.style.overflow='scroll'; this.style.overflow='scroll';
lib.setScroll(this); lib.setScroll(this);
var style2={position:'relative',display:'block',left:0,top:0,marginBottom:'6px',padding:0,width:'100%'}; var style2={position:'relative',display:'block',left:0,top:0,marginBottom:'8px',padding:0,width:'100%'};
var scenename=ui.create.node('input',ui.create.div(style2,'','关卡名称:',this),{width:'120px'}); var scenename=ui.create.node('input',ui.create.div(style2,'','关卡名称:',this),{width:'120px'});
scenename.type='text'; scenename.type='text';
@ -1895,19 +1969,54 @@ mode.brawl={
sceneintro.style.marginBottom='10px'; sceneintro.style.marginBottom='10px';
var line1=ui.create.div(style2,this); var line1=ui.create.div(style2,this);
var line2=ui.create.div(style2,this);
var scenes=[]; var scenes=[];
for(var i in lib.storage.scene){ for(var i in lib.storage.scene){
scenes.push([i,lib.storage.scene[i].name]); scenes.push([i,i]);
} }
var defaultscene=scenes[0][0];
if(scenes.length<2){ if(scenes.length<2){
alert('请创建至少2个场景'); alert('请创建至少2个场景');
return; return;
} }
ui.create.selectlist(scenes,null,line1); var scenelist=ui.create.selectlist(scenes,null,line1);
var e1=function(){
if(this.nextSibling){
this.parentNode.insertBefore(this,this.nextSibling.nextSibling);
}
}
var e2=function(){
var that=this;
this.movetimeout=setTimeout(function(){
e1.call(that);
},500);
}
var e3=function(){
clearTimeout(this.movetimeout);
delete this.movetimeout;
}
var e4=function(value){
var node=ui.create.node('button',value,line2,{marginLeft:'3px',marginRight:'3px'},function(){
if(confirm('是否移除'+this.innerHTML+'')){
this.remove();
}
});
if(lib.config.touchscreen){
node.ontouchstart=e2;
node.ontouchend=e3;
node.ontouchmove=e3;
}
else{
node.oncontextmenu=e1;
node.onmousedown=e2;
node.onmouseup=e3;
node.onmouseleave=e3;
}
}
var addButton=ui.create.node('button','添加场景',line1,function(){ var addButton=ui.create.node('button','添加场景',line1,function(){
e4(scenelist.value);
},{marginLeft:'6px',marginRight:'12px'}); },{marginLeft:'6px',marginRight:'12px'});
ui.create.selectlist([ var sceneconfig=ui.create.selectlist([
['normal','默认模式'], ['normal','默认模式'],
['sequal','连续闯关'], ['sequal','连续闯关'],
['free','自由选关'] ['free','自由选关']
@ -1917,55 +2026,37 @@ mode.brawl={
alert('请填写关卡名称'); alert('请填写关卡名称');
return; return;
} }
// var scene={ if(line2.childElementCount<2){
// name:scenename.value, alert('请添加至少2个场景');
// intro:sceneintro.value, return;
// players:[], }
// cardPileTop:[], var stage={
// cardPileBottom:[], name:scenename.value,
// discardPile:[], intro:sceneintro.value,
// }; scenes:[],
// for(var i=0;i<line7.childElementCount;i++){ mode:sceneconfig.value
// scene.players.push(line7.childNodes[i].info); };
// } for(var i=0;i<line2.childElementCount;i++){
// if(scene.players.length<2){ stage.scenes.push(line2.childNodes[i].innerHTML);
// alert('请添加至少两名角色'); }
// return; if(lib.storage.stage[scenename.value]){
// } if(!confirm('关卡名与现有关卡重复,是否覆盖?')){
// if(lib.storage.scene[scenename.value]){ return;
// if(_status.currentScene!=scenename.value){ }
// if(!confirm('场景名与现有场景重复,是否覆盖?')){ game.removeStage(scenename.value);
// return; }
// } lib.storage.stage[stage.name]=stage;
// } game.save('stage',lib.storage.stage);
// game.removeScene(scenename.value); game.addStage(stage.name,true);
// }
// 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(gameDraw.checked){
// scene.gameDraw=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,true);
},{marginLeft:'6px'}); },{marginLeft:'6px'});
} }
game.addStageClear=function(){
scenelist.value=defaultscene;
sceneconfig.value='normal';
scenename.value='';
sceneintro.value='';
line2.innerHTML='';
};
} }
} }
}, },