边缘滚动
This commit is contained in:
parent
8dc643b600
commit
fd3167ef02
|
@ -2600,6 +2600,7 @@ character.sp={
|
||||||
},
|
},
|
||||||
mark:true,
|
mark:true,
|
||||||
direct:true,
|
direct:true,
|
||||||
|
unique:true,
|
||||||
content:function(){
|
content:function(){
|
||||||
"step 0"
|
"step 0"
|
||||||
var check=(player.hp==1||(player.hp==2&&player.num('h')<=1));
|
var check=(player.hp==1||(player.hp==2&&player.num('h')<=1));
|
||||||
|
|
|
@ -1456,15 +1456,13 @@ character.swd={
|
||||||
trigger:{player:'phaseBegin'},
|
trigger:{player:'phaseBegin'},
|
||||||
group:'huanxing2',
|
group:'huanxing2',
|
||||||
direct:true,
|
direct:true,
|
||||||
filter:function(event,player){
|
|
||||||
return player.num('he')>0;
|
|
||||||
},
|
|
||||||
content:function(){
|
content:function(){
|
||||||
"step 0"
|
"step 0"
|
||||||
player.unmark(player.storage.huanxing+'_charactermark');
|
player.unmark(player.storage.huanxing+'_charactermark');
|
||||||
delete player.storage.huanxing;
|
delete player.storage.huanxing;
|
||||||
delete player.additionalSkills.huanxing;
|
delete player.additionalSkills.huanxing;
|
||||||
player.checkMarks();
|
player.checkMarks();
|
||||||
|
if(player.num('he')){
|
||||||
player.chooseCardTarget({
|
player.chooseCardTarget({
|
||||||
prompt:'是否发动【幻形】?',
|
prompt:'是否发动【幻形】?',
|
||||||
filterCard:true,
|
filterCard:true,
|
||||||
|
@ -1490,9 +1488,14 @@ character.swd={
|
||||||
return 7-ai.get.value(card);
|
return 7-ai.get.value(card);
|
||||||
},
|
},
|
||||||
ai2:function(target){
|
ai2:function(target){
|
||||||
|
if(target.isMin()) return 0;
|
||||||
return 6-target.maxHp;
|
return 6-target.maxHp;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
event.finish();
|
||||||
|
}
|
||||||
"step 1"
|
"step 1"
|
||||||
if(result.bool){
|
if(result.bool){
|
||||||
player.discard(result.cards);
|
player.discard(result.cards);
|
||||||
|
@ -5133,10 +5136,9 @@ character.swd={
|
||||||
unique:true,
|
unique:true,
|
||||||
enable:'phaseUse',
|
enable:'phaseUse',
|
||||||
priority:-9,
|
priority:-9,
|
||||||
group:'tianshu2',
|
|
||||||
filterCard:{type:['trick','delay']},
|
filterCard:{type:['trick','delay']},
|
||||||
filter:function(event,player){
|
filter:function(event,player){
|
||||||
return player.num('h',{type:'trick'})>0;
|
return player.num('h',{type:['trick','delay']})>0;
|
||||||
},
|
},
|
||||||
filterTarget:function(card,player,target){
|
filterTarget:function(card,player,target){
|
||||||
var names=[];
|
var names=[];
|
||||||
|
@ -5158,7 +5160,7 @@ character.swd={
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createDialog:function(player,target){
|
createDialog:function(player,target,onlylist){
|
||||||
var names=[];
|
var names=[];
|
||||||
var list=[];
|
var list=[];
|
||||||
if(target.name&&!target.classList.contains('unseen')) names.add(target.name);
|
if(target.name&&!target.classList.contains('unseen')) names.add(target.name);
|
||||||
|
@ -5178,8 +5180,10 @@ character.swd={
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(onlylist) return list;
|
||||||
var dialog=ui.create.dialog();
|
var dialog=ui.create.dialog();
|
||||||
dialog.add('选择获得一项技能');
|
dialog.add('选择获得一项技能');
|
||||||
|
_status.event.list=list;
|
||||||
var clickItem=function(){
|
var clickItem=function(){
|
||||||
_status.event._result=this.link;
|
_status.event._result=this.link;
|
||||||
game.resume();
|
game.resume();
|
||||||
|
@ -5189,24 +5193,39 @@ character.swd={
|
||||||
var translation=get.translation(list[i])[0]+get.translation(list[i])[1];
|
var translation=get.translation(list[i])[0]+get.translation(list[i])[1];
|
||||||
var item=dialog.add('<div class="popup" style="width:50%;display:inline-block"><div class="skill">【'+
|
var item=dialog.add('<div class="popup" style="width:50%;display:inline-block"><div class="skill">【'+
|
||||||
translation+'】</div><div>'+lib.translate[list[i]+'_info']+'</div></div>');
|
translation+'】</div><div>'+lib.translate[list[i]+'_info']+'</div></div>');
|
||||||
item.addEventListener('click',clickItem);
|
item.firstChild.addEventListener('click',clickItem);
|
||||||
item.link=list[i];
|
item.firstChild.link=list[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dialog.add(ui.create.div('.placeholder'));
|
dialog.add(ui.create.div('.placeholder'));
|
||||||
return dialog;
|
return dialog;
|
||||||
},
|
},
|
||||||
|
check:function(card){
|
||||||
|
return 5-ai.get.value(card);
|
||||||
|
},
|
||||||
content:function(){
|
content:function(){
|
||||||
"step 0"
|
"step 0"
|
||||||
ui.auto.hide();
|
event.skillai=function(list){
|
||||||
|
return list.randomGet();
|
||||||
|
};
|
||||||
|
if(event.isMine()){
|
||||||
event.dialog=lib.skill.tianshu.createDialog(player,target);
|
event.dialog=lib.skill.tianshu.createDialog(player,target);
|
||||||
|
event.switchToAuto=function(){
|
||||||
|
event._result=event.skillai(event.list);
|
||||||
|
game.resume();
|
||||||
|
};
|
||||||
game.pause();
|
game.pause();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
event._result=event.skillai(lib.skill.tianshu.createDialog(player,target,true));
|
||||||
|
}
|
||||||
"step 1"
|
"step 1"
|
||||||
if(player.storage.tianshu){
|
if(player.storage.tianshu){
|
||||||
player.unmark(player.storage.tianshu+'_charactermark');
|
player.unmark(player.storage.tianshu+'_charactermark');
|
||||||
}
|
}
|
||||||
ui.auto.show();
|
if(event.dialog){
|
||||||
event.dialog.close();
|
event.dialog.close();
|
||||||
|
}
|
||||||
var link=result;
|
var link=result;
|
||||||
player.addSkill(link);
|
player.addSkill(link);
|
||||||
player.skills.remove(link);
|
player.skills.remove(link);
|
||||||
|
@ -5218,8 +5237,20 @@ character.swd={
|
||||||
});
|
});
|
||||||
player.storage.tianshu=target.name;
|
player.storage.tianshu=target.name;
|
||||||
player.checkMarks();
|
player.checkMarks();
|
||||||
|
player.addTempSkill('tianshu_ai','phaseAfter');
|
||||||
},
|
},
|
||||||
|
ai:{
|
||||||
|
order:1,
|
||||||
|
result:{
|
||||||
|
player:function(player){
|
||||||
|
if(player.skills.contains('tianshu_ai')) return 0;
|
||||||
|
if(player.num('h')>player.hp) return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
tianshu_ai:{},
|
||||||
tianshu2:{
|
tianshu2:{
|
||||||
trigger:{player:'phaseBegin'},
|
trigger:{player:'phaseBegin'},
|
||||||
direct:true,
|
direct:true,
|
||||||
|
@ -7932,7 +7963,7 @@ character.swd={
|
||||||
tanlin_info:'出牌阶段限一次,你可以与一名其他角色进行拼点,若你赢,你获得双方拼点牌、对该角色使用卡牌无视距离且可以额外使用一张杀直到回合结束,若你没赢,你受到该角色的一点伤害。',
|
tanlin_info:'出牌阶段限一次,你可以与一名其他角色进行拼点,若你赢,你获得双方拼点牌、对该角色使用卡牌无视距离且可以额外使用一张杀直到回合结束,若你没赢,你受到该角色的一点伤害。',
|
||||||
pozhen_info:'每当你受到一次伤害,若你的手牌数大于伤害来源,你可以弃置X张手牌对其造成一点伤害;若你的手牌数小于伤害来源,你可以弃置其X张手牌。X为你与伤害来源的手牌数之差。',
|
pozhen_info:'每当你受到一次伤害,若你的手牌数大于伤害来源,你可以弃置X张手牌对其造成一点伤害;若你的手牌数小于伤害来源,你可以弃置其X张手牌。X为你与伤害来源的手牌数之差。',
|
||||||
yunchou_info:'出牌阶段限一次,你可以弃置任意张手牌,并弃置一张其他角色的手牌,你弃置的手牌中每有一张与此牌的颜色相同,你摸一张牌,否则对方摸一张牌',
|
yunchou_info:'出牌阶段限一次,你可以弃置任意张手牌,并弃置一张其他角色的手牌,你弃置的手牌中每有一张与此牌的颜色相同,你摸一张牌,否则对方摸一张牌',
|
||||||
tianshu_info:'回合开始阶段,你可以获得场上一名存活角色的一项技能;出牌阶段,你可以弃置一张锦囊牌,然后更换一项技能',
|
tianshu_info:'出牌阶段,你可以弃置一张锦囊牌,并获得场上一名存活角色的一项技能(再使用则会替换前一次获得的技能)',
|
||||||
luomei_info:'每当你使用或打出一张梅花花色的牌,你可以摸一张牌',
|
luomei_info:'每当你使用或打出一张梅花花色的牌,你可以摸一张牌',
|
||||||
xingdian_info:'出牌阶段限一次,你可以弃置一张手牌,然后指定至多两名角色令其各弃置一张牌',
|
xingdian_info:'出牌阶段限一次,你可以弃置一张手牌,然后指定至多两名角色令其各弃置一张牌',
|
||||||
yulin_info:'每当你即将受到伤害,你可以弃置一张装备牌抵消此伤害',
|
yulin_info:'每当你即将受到伤害,你可以弃置一张装备牌抵消此伤害',
|
||||||
|
|
29
game/game.js
29
game/game.js
|
@ -628,6 +628,7 @@ window.play={};
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
event.dialog=ui.create.dialog(get.translation(player.name)+'拼点成功');
|
event.dialog=ui.create.dialog(get.translation(player.name)+'拼点成功');
|
||||||
|
event.dialog.classList.add('center');
|
||||||
player.popup('胜');
|
player.popup('胜');
|
||||||
target.popup('负');
|
target.popup('负');
|
||||||
game.resume();
|
game.resume();
|
||||||
|
@ -639,6 +640,7 @@ window.play={};
|
||||||
event.result.tie=true;
|
event.result.tie=true;
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
event.dialog=ui.create.dialog(get.translation(player.name)+'拼点失败');
|
event.dialog=ui.create.dialog(get.translation(player.name)+'拼点失败');
|
||||||
|
event.dialog.classList.add('center');
|
||||||
player.popup('平');
|
player.popup('平');
|
||||||
target.popup('平');
|
target.popup('平');
|
||||||
game.resume();
|
game.resume();
|
||||||
|
@ -647,6 +649,7 @@ window.play={};
|
||||||
else{
|
else{
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
event.dialog=ui.create.dialog(get.translation(player.name)+'拼点失败');
|
event.dialog=ui.create.dialog(get.translation(player.name)+'拼点失败');
|
||||||
|
event.dialog.classList.add('center');
|
||||||
player.popup('负');
|
player.popup('负');
|
||||||
target.popup('胜');
|
target.popup('胜');
|
||||||
game.resume();
|
game.resume();
|
||||||
|
@ -1934,6 +1937,7 @@ window.play={};
|
||||||
player.judging=get.cards()[0];
|
player.judging=get.cards()[0];
|
||||||
event.node=player.judging.copy('thrown','center',ui.arena).animate('start');
|
event.node=player.judging.copy('thrown','center',ui.arena).animate('start');
|
||||||
event.dialog=ui.create.dialog(get.translation(player)+'的'+event.judgestr+'判定');
|
event.dialog=ui.create.dialog(get.translation(player)+'的'+event.judgestr+'判定');
|
||||||
|
event.dialog.classList.add('center');
|
||||||
game.log(get.translation(player)+'进行'+event.judgestr+'判定,亮出的判定牌为'+get.translation(player.judging));
|
game.log(get.translation(player)+'进行'+event.judgestr+'判定,亮出的判定牌为'+get.translation(player.judging));
|
||||||
game.delay(2);
|
game.delay(2);
|
||||||
event.trigger('judge');
|
event.trigger('judge');
|
||||||
|
@ -7057,9 +7061,10 @@ window.play={};
|
||||||
case 'strict_sort':
|
case 'strict_sort':
|
||||||
modeconfig.push(ui.create.switcher('strict_sort',get.config('strict_sort'),ui.click.sidebar.local));
|
modeconfig.push(ui.create.switcher('strict_sort',get.config('strict_sort'),ui.click.sidebar.local));
|
||||||
modeconfig.push(ui.create.switcher('reverse_sort',get.config('reverse_sort'),ui.click.sidebar.reverse_sort));break;
|
modeconfig.push(ui.create.switcher('reverse_sort',get.config('reverse_sort'),ui.click.sidebar.reverse_sort));break;
|
||||||
default:
|
default:{
|
||||||
if(Array.isArray(lib.config.current_mode[i])){
|
if(typeof lib.config.current_mode[i]==='function'){
|
||||||
modeconfig.push(ui.create.switcher.apply(this,lib.config.current_mode[i]));
|
modeconfig.push(lib.config.current_mode[i](lib,get,ui));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9646,11 +9651,13 @@ window.play={};
|
||||||
}
|
}
|
||||||
if(ui.dialog){
|
if(ui.dialog){
|
||||||
if(lib.config.mode=='chess'){
|
if(lib.config.mode=='chess'){
|
||||||
if(ui.dialog.content.offsetHeight<240){
|
if(ui.dialog.content.offsetHeight<240&&(!ui.dialog.buttons||!ui.dialog.buttons.length)){
|
||||||
ui.dialog.style.height=ui.dialog.content.offsetHeight+'px';
|
ui.dialog.style.height=ui.dialog.content.offsetHeight+'px';
|
||||||
|
ui.dialog.classList.add('slim');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ui.dialog.style.height='';
|
ui.dialog.style.height='';
|
||||||
|
ui.dialog.classList.remove('slim');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ui.dialog.content.offsetHeight<=240||
|
if(ui.dialog.content.offsetHeight<=240||
|
||||||
|
@ -10813,6 +10820,18 @@ window.play={};
|
||||||
disvalue:function(card,player){
|
disvalue:function(card,player){
|
||||||
return -ai.get.value(card,player);
|
return -ai.get.value(card,player);
|
||||||
},
|
},
|
||||||
|
skillthreaten:function(skill,player,target){
|
||||||
|
if(!lib.skill[skill]) return 1;
|
||||||
|
if(!lib.skill[skill].ai) return 1;
|
||||||
|
var threaten=lib.skill[skill].ai.threaten;
|
||||||
|
if(typeof threaten=='number') return threaten;
|
||||||
|
if(typeof threaten=='function'){
|
||||||
|
player=player||_status.event.player;
|
||||||
|
target=target||player;
|
||||||
|
return threaten(player,target);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
},
|
||||||
order:function(item){
|
order:function(item){
|
||||||
var aii=get.info(item).ai;
|
var aii=get.info(item).ai;
|
||||||
var order;
|
var order;
|
||||||
|
@ -11016,6 +11035,7 @@ window.play={};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
lib.init.init();
|
||||||
HTMLDivElement.prototype.animate=function(name){
|
HTMLDivElement.prototype.animate=function(name){
|
||||||
this.classList.add(name);
|
this.classList.add(name);
|
||||||
var that=this;
|
var that=this;
|
||||||
|
@ -11394,7 +11414,6 @@ window.play={};
|
||||||
console.log(str);
|
console.log(str);
|
||||||
return aa+bb+cc+dd;
|
return aa+bb+cc+dd;
|
||||||
}
|
}
|
||||||
lib.init.init();
|
|
||||||
window.onkeydown=function(e){
|
window.onkeydown=function(e){
|
||||||
if(e.keyCode==32){
|
if(e.keyCode==32){
|
||||||
var node=ui.window.querySelector('#paused');
|
var node=ui.window.querySelector('#paused');
|
||||||
|
|
|
@ -54,6 +54,9 @@
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
#arena>.dialog.slim:not(.center){
|
||||||
|
top:40px;
|
||||||
|
}
|
||||||
#control{
|
#control{
|
||||||
top:calc(100% - 155px);
|
top:calc(100% - 155px);
|
||||||
}
|
}
|
||||||
|
@ -101,3 +104,16 @@
|
||||||
.playergrid.temp{
|
.playergrid.temp{
|
||||||
opacity:0.3;
|
opacity:0.3;
|
||||||
}
|
}
|
||||||
|
.chessscroll{
|
||||||
|
height:calc(100% - 162px);
|
||||||
|
width:20px;
|
||||||
|
top:42px;
|
||||||
|
z-index:1;
|
||||||
|
position:fixed;
|
||||||
|
}
|
||||||
|
.chessscroll.left{
|
||||||
|
left:0;
|
||||||
|
}
|
||||||
|
.chessscroll.right{
|
||||||
|
right:0;
|
||||||
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ mode.chess={
|
||||||
},
|
},
|
||||||
chessFocus:function(){
|
chessFocus:function(){
|
||||||
if(ui.chess._chessdrag) return;
|
if(ui.chess._chessdrag) return;
|
||||||
|
if(_status.chessscrolling) return;
|
||||||
var player=this;
|
var player=this;
|
||||||
var dx=0,dy=0;
|
var dx=0,dy=0;
|
||||||
|
|
||||||
|
@ -639,6 +640,30 @@ mode.chess={
|
||||||
delete _status.currentChessFocus;
|
delete _status.currentChessFocus;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ui.chessscroll1=ui.create.div('.chessscroll.left',ui.chessContainer);
|
||||||
|
ui.chessscroll2=ui.create.div('.chessscroll.right',ui.chessContainer);
|
||||||
|
var chessscroll=function(){
|
||||||
|
var direction=this.direction;
|
||||||
|
var speed=get.config('chessscroll_speed');
|
||||||
|
if(!speed) return;
|
||||||
|
var interval=setInterval(function(){
|
||||||
|
ui.chessContainer.scrollLeft+=speed*direction;
|
||||||
|
},16);
|
||||||
|
_status.chessscrolling=interval;
|
||||||
|
};
|
||||||
|
var leavescroll=function(){
|
||||||
|
if(_status.chessscrolling){
|
||||||
|
clearInterval(_status.chessscrolling);
|
||||||
|
delete _status.chessscrolling;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ui.chessscroll1.direction=-1;
|
||||||
|
ui.chessscroll1.addEventListener('mouseenter',chessscroll);
|
||||||
|
ui.chessscroll1.addEventListener('mouseleave',leavescroll);
|
||||||
|
|
||||||
|
ui.chessscroll2.direction=1;
|
||||||
|
ui.chessscroll2.addEventListener('mouseenter',chessscroll);
|
||||||
|
ui.chessscroll2.addEventListener('mouseleave',leavescroll);
|
||||||
|
|
||||||
for(var i=0;i<ui.chesswidth;i++){
|
for(var i=0;i<ui.chesswidth;i++){
|
||||||
for(var j=0;j<ui.chessheight;j++){
|
for(var j=0;j<ui.chessheight;j++){
|
||||||
|
@ -1013,6 +1038,7 @@ mode.chess={
|
||||||
trueColor:"zhu",
|
trueColor:"zhu",
|
||||||
falseColor:"wei",
|
falseColor:"wei",
|
||||||
_chessmove:'移动',
|
_chessmove:'移动',
|
||||||
|
chessscroll_speed_config:'边缘滚动速度'
|
||||||
},
|
},
|
||||||
ui:{
|
ui:{
|
||||||
create:{
|
create:{
|
||||||
|
@ -1059,5 +1085,13 @@ mode.chess={
|
||||||
'任何卡牌或技能无法指定位置相隔8个格以上的角色为目标<li>'+
|
'任何卡牌或技能无法指定位置相隔8个格以上的角色为目标<li>'+
|
||||||
'杀死对方阵营的角色可摸一张牌,杀死本方阵营无惩罚'
|
'杀死对方阵营的角色可摸一张牌,杀死本方阵营无惩罚'
|
||||||
},
|
},
|
||||||
config:['battle_number','ban_weak','free_choose','change_choice'],
|
config:['battle_number','ban_weak','free_choose','change_choice',
|
||||||
|
function(lib,get,ui){
|
||||||
|
var current=get.config('chessscroll_speed');
|
||||||
|
if(typeof current!=='number'){
|
||||||
|
game.saveConfig('chessscroll_speed',20,true);
|
||||||
|
current=20;
|
||||||
|
}
|
||||||
|
return ui.create.switcher('chessscroll_speed',[0,10,20,30],10,ui.click.sidebar.local);
|
||||||
|
}],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue