This commit is contained in:
libccy 2015-12-04 00:28:06 +08:00
parent d67b829008
commit 6b098817b0
8 changed files with 375 additions and 51 deletions

View File

@ -717,6 +717,10 @@ card.standard={
}
}
"step 3"
if(event.target.isDead()||event.player.isDead()){
event.finish();
}
else{
if(result.bool){
if(event.turn==target) event.turn=player;
else event.turn=target;
@ -730,6 +734,7 @@ card.standard={
player.damage(target);
}
}
}
},
ai:{
basic:{

View File

@ -626,7 +626,7 @@ character.gujian={
filter:function(event,player){
if(event.card.name!='sha') return false;
if(event.targets.length!=1) return false;
if(player.num('h',{type:'basic'})==player.num('h')) return false;
if(!player.num('he')) return false;
var target=event.targets[0];
for(var i=0;i<game.players.length;i++){
if(player!=game.players[i]&&target!=game.players[i]&&get.distance(target,game.players[i])<=1){
@ -641,16 +641,13 @@ character.gujian={
for(var i=0;i<game.players.length;i++){
if(player!=game.players[i]&&trigger.targets[0]!=game.players[i]&&get.distance(trigger.targets[0],game.players[i])<=1){
event.targets.push(game.players[i]);
game.players[i].classList.add('selected');
}
}
var num=0;
for(var i=0;i<event.targets.length;i++){
num+=ai.get.effect(event.targets[i],{name:'sha'},player,player);
}
var next=player.chooseToDiscard(function(card){
return get.type(card)!='basic';
},'是否发动千军?');
var next=player.chooseToDiscard('是否对'+get.translation(event.targets)+'发动千军?','he');
next.logSkill=['qianjun',event.targets];
next.ai=function(card){
if(num<=0) return -1;

View File

@ -5454,7 +5454,7 @@ character.yijiang={
xinenyuan:'恩怨',
xinenyuan_info:'每当你受到1点伤害后你可以令伤害来源选择一项交给你一张手牌或失去1点体力。',
xinxuanhuo:'眩惑',
xinxuanhuo_info:'摸牌阶段开始时,你可以放弃摸牌并选择一名其他角色,改为令其摸两张牌,然后该角色需对其攻击范围内你选择的另一名角色使用一张杀,若其未如此做或其攻击范围内没有使用杀的目标,你获得其两张牌',
xinxuanhuo_info:'摸牌阶段开始时,你可以放弃摸牌并选择一名其他角色,改为令其摸两张牌,然后该角色需对其攻击范围内你选择的另一名角色使用一张杀,若其未如此做或其攻击范围内没有使用杀的目标,你获得其两张牌,然后其摸一张牌',
fuhun:'父魂',
fuhun2:'父魂',
fuhun_info:'你可以将两张手牌当杀使用或打出;出牌阶段,若你以此法使用的杀造成了伤害,你获得技能“武圣”、“咆哮”直到回合结束。',

View File

@ -18,7 +18,8 @@
var lib={
version:1.63,
changeLog:[
'流畅模式折叠手牌',
'折叠手牌',
'触屏拖拽',
'自定义背景',
'bug修复'
],
@ -104,6 +105,16 @@
init:true,
unfrequent:true,
},
enable_dragline:{
name:'拖拽指示线',
init:true,
unfrequent:true,
},
enable_touchdragline:{
name:'拖拽指示线',
init:false,
unfrequent:true,
},
wuxie_self:{
name:'不无懈自己',
init:true,
@ -265,6 +276,20 @@
map.swipe_up.hide();
map.swipe_down.hide();
}
if(lib.config.enable_drag){
if(lib.config.touchscreen){
map.enable_dragline.hide();
map.enable_touchdragline.show();
}
else{
map.enable_dragline.show();
map.enable_touchdragline.hide();
}
}
else{
map.enable_dragline.hide();
map.enable_touchdragline.hide();
}
}
}
},
@ -773,7 +798,7 @@
},
die_flip:{
name:'阵亡效果',
init:false,
init:true,
unfrequent:true,
},
animation:{
@ -2362,6 +2387,9 @@
if(!db.objectStoreNames.contains('image')){
db.createObjectStore('image');
}
if(!db.objectStoreNames.contains('audio')){
db.createObjectStore('audio');
}
if(!db.objectStoreNames.contains('character')){
db.createObjectStore('character');
}
@ -2383,6 +2411,36 @@
}
}
}
lib.cardSelectObserver=new MutationObserver(function(mutations){
for(var i=0;i<mutations.length;i++){
if(mutations[i].attributeName=='class'){
var node=mutations[i].target;
if(node._transform&&node.parentNode&&node.parentNode.parentNode&&
node.parentNode.parentNode.parentNode==ui.me){
if(node.classList.contains('selected')){
setTimeout((function(node){
return function(){
if(node._transform&&node.parentNode&&node.parentNode.parentNode&&
node.parentNode.parentNode.parentNode==ui.me){
if(node.classList.contains('selected')&&
!node.parentNode.parentNode.classList.contains('scrollh')){
node.style.transform=node._transform+' translateY(-20px)';
}
else{
node.style.transform=node._transform;
}
}
}
}(node)),200);
}
else{
node.style.transform=node._transform;
}
}
}
}
});
},
css:function(path,file,before){
var style = document.createElement("link");
@ -7035,11 +7093,9 @@
break;
}
}
// game.print(card.name,card.timeout,card.className)
if(!equipped){
player.node.equips.appendChild(card);
}
// player.node.equips.dataset.number=player.num('e');
return player;
},
$gain:function(card,log,init){
@ -10820,7 +10876,8 @@
}
}
}
if(ok&&auto&&lib.config.auto_confirm&&(!_status.mousedragging||!_status.mouseleft)&&!_status.mousedown){
if(ok&&auto&&lib.config.auto_confirm&&(!_status.mousedragging||!_status.mouseleft)&&
!_status.mousedown&&!_status.touchnocheck){
if(ui.confirm){
if(!skillinfo||!skillinfo.preservecancel){
ui.confirm.close();
@ -10911,6 +10968,10 @@
_status.lastdragchange.length=0;
_status.mousedragging=null;
_status.mousedragorigin=null;
while(ui.touchlines.length){
ui.touchlines.shift().delete();
}
}
ui.canvas.width=ui.arena.offsetWidth;
ui.canvas.height=ui.arena.offsetHeight;
@ -11565,6 +11626,7 @@
var ui={
updates:[],
thrown:[],
touchlines:[],
refresh:function(node){
void window.getComputedStyle(node, null).getPropertyValue("opacity");
},
@ -12264,7 +12326,6 @@
delete ui.roundmenu._resetTimeout;
},1000);
});
// lib.setLongPress(ui.roundmenu,resetround);
}
else{
ui.roundmenu.oncontextmenu=resetround;
@ -14907,6 +14968,11 @@
ui.create.div(node.node.identity);
node.addEventListener(lib.config.touchscreen?'touchend':'click',ui.click.target);
node.node.identity.addEventListener(lib.config.touchscreen?'touchend':'click',ui.click.identity);
if(lib.config.touchscreen){
node.addEventListener('touchstart',ui.click.playertouchstart);
}
return node;
},
players:function(num){
@ -14997,6 +15063,13 @@
node.storage={};
if(info!='noclick'){
node.addEventListener(lib.config.touchscreen?'touchend':'click',ui.click.card);
if(lib.config.touchscreen){
node.addEventListener('touchstart',ui.click.cardtouchstart);
node.addEventListener('touchmove',ui.click.cardtouchmove);
}
if(lib.cardSelectObserver){
lib.cardSelectObserver.observe(node,{attributes:true});
}
}
return node;
},
@ -15436,6 +15509,158 @@
else if(_status._swipeorigin&&e.touches[0]){
_status._swipeorigin.touches=e.touches[0];
}
if(_status.mousedragging&&e.touches.length){
e.preventDefault();
var item=document.elementFromPoint(e.touches[0].clientX,e.touches[0].clientY);
while(item){
if(lib.config.enable_touchdragline&&_status.mouseleft&&lib.config.mode!='chess'){
ui.canvas.width=ui.arena.offsetWidth;
ui.canvas.height=ui.arena.offsetHeight;
var ctx=ui.ctx;
ctx.shadowBlur=5;
ctx.shadowColor='rgba(0,0,0,0.3)';
ctx.strokeStyle='white';
ctx.lineWidth=3;
ctx.setLineDash([8,2]);
ctx.beginPath();
ctx.moveTo(_status.mousedragging.clientX-ui.arena.offsetLeft,_status.mousedragging.clientY-ui.arena.offsetTop);
if(_status.multitarget){
for(var i=0;i<_status.lastdragchange.length;i++){
var exy=_status.lastdragchange[i]._lastdragchange;
ctx.lineTo(exy[0],exy[1]);
}
}
if(!_status.selectionfull){
ctx.lineTo(e.touches[0].clientX-ui.arena.offsetLeft,e.touches[0].clientY-ui.arena.offsetTop);
}
ctx.stroke();
if(!_status.multitarget){
for(var i=0;i<_status.lastdragchange.length;i++){
ctx.moveTo(_status.mousedragging.clientX-ui.arena.offsetLeft,_status.mousedragging.clientY-ui.arena.offsetTop);
var exy=_status.lastdragchange[i]._lastdragchange;
ctx.lineTo(exy[0],exy[1]);
ctx.stroke();
}
}
}
if(item==_status.mousedragorigin){
if(_status.mouseleft){
_status.mousedragging=null;
_status.mousedragorigin=null;
_status.clicked=false;
game.uncheck();
game.check();
ui.canvas.width=ui.arena.offsetWidth;
ui.canvas.height=ui.arena.offsetHeight;
_status.clicked=true;
}
return;
}
var itemtype=get.itemtype(item);
if(itemtype=='card'||itemtype=='button'||itemtype=='player'){
_status.mouseleft=true;
var ex=e.touches[0].clientX-ui.arena.offsetLeft;
var ey=e.touches[0].clientY-ui.arena.offsetTop;
var exx=ex,eyy=ey;
if(lib.config.mode=='chess'){
ex-=-ui.chessContainer.scrollLeft+ui.chess.offsetLeft;
ey-=-ui.chessContainer.scrollTop+ui.chess.offsetTop;
}
if(itemtype!='player'||(ex>item.offsetLeft&&ex<item.offsetLeft+item.offsetWidth&&
ey>item.offsetTop&&ey<item.offsetTop+item.offsetHeight)){
var targetfixed=false;
if(itemtype=='player'){
if(get.select(_status.event.selectTarget)[1]==-1){
targetfixed=true;
}
}
if(!targetfixed&&item.classList.contains('selectable')&&_status.dragstatuschanged!=item){
_status.mouseleft=true;
_status.dragstatuschanged=item;
_status.clicked=false;
_status.dragged=false;
var notbefore=itemtype=='player'&&!item.classList.contains('selected');
ui.click[itemtype].call(item);
if(item.classList.contains('selected')){
if(notbefore){
_status.lastdragchange.push(item);
item._lastdragchange=[exx,eyy];
if(false){
var from=[_status.mousedragging.clientX-ui.arena.offsetLeft,_status.mousedragging.clientY-ui.arena.offsetTop];
var to=[exx,eyy];
var node=ui.create.div('.linexy.hidden');
node.style.left=from[0]+'px';
node.style.top=from[1]+'px';
node.style.transitionDuration='0.3s';
node.style.backgroundColor='white';
var dy=to[1]-from[1];
var dx=to[0]-from[0];
var deg=Math.atan(Math.abs(dy)/Math.abs(dx))/Math.PI*180;
if(dx>=0){
if(dy<=0){
deg+=90;
}
else{
deg=90-deg;
}
}
else{
if(dy<=0){
deg=270-deg;
}
else{
deg+=270;
}
}
node.style.transform='rotate('+(-deg)+'deg) scaleY(0)';
node.style.height=get.xyDistance(from,to)+'px';
if(lib.config.mode=='chess'){
ui.chess.appendChild(node);
}
else{
ui.arena.appendChild(node);
}
ui.refresh(node);
node.show();
node.style.transform='rotate('+(-deg)+'deg) scaleY(1)';
ui.touchlines.push(node);
node._origin=item;
}
}
}
else{
_status.lastdragchange.remove(item);
for(var i=0;i<ui.touchlines.length;i++){
if(ui.touchlines[i]._origin==item){
ui.touchlines[i].delete();
ui.touchlines.splice(i--,1);
}
}
}
_status.selectionfull=true;
if(_status.event.filterButton&&ui.selected.buttons.length<get.select(_status.event.selectButton)[1]){
_status.selectionfull=false;
}
else if(_status.event.filterCard&&ui.selected.cards.length<get.select(_status.event.selectCard)[1]){
_status.selectionfull=false;
}
else if(_status.event.filterTarget&&ui.selected.targets.length<get.select(_status.event.selectTarget)[1]){
_status.selectionfull=false;
}
}
}
return;
}
item=item.parentNode;
}
_status.mouseleft=true;
_status.dragstatuschanged=null;
}
},
windowtouchend:function(e){
if(e.touches.length==1&&!_status.dragged){
@ -15471,7 +15696,7 @@
game.saveConfig('roundmenu_transform',translate);
delete _status.draggingroundmenu;
}
else if(_status._swipeorigin&&!_status.paused2){
else if(_status._swipeorigin&&!_status.paused2&&!_status.mousedragging){
if(get.currentTime()-_status._swipeorigin.time<500){
var dx=_status._swipeorigin.touches.clientX-_status._swipeorigin.clientX;
var dy=_status._swipeorigin.touches.clientY-_status._swipeorigin.clientY;
@ -15544,6 +15769,39 @@
}
}
var tmpflag=false;
_status.mousedown=false;
_status.clicked=false;
if(_status.mousedragging&&_status.mouseleft){
if(game.check()){
if(ui.confirm){
ui.confirm.close();
}
ui.click.ok();
}
else{
game.uncheck();
game.check();
}
}
else if(_status.mousedragging&&_status.mousedragorigin){
tmpflag=_status.mousedragorigin;
}
_status.lastdragchange.length=0;
_status.mousedragging=null;
_status.mouseleft=false;
_status.mousedragorigin=null;
_status.dragstatuschanged=false;
while(ui.touchlines.length){
ui.touchlines.shift().delete();
}
ui.canvas.width=ui.arena.offsetWidth;
ui.canvas.height=ui.arena.offsetHeight;
if(tmpflag){
game.check();
}
_status.dragged=false;
_status.clicked=false;
},
checkroundtranslate:function(translate){
var translate=translate||ui.roundmenu._dragtransform;
@ -15579,6 +15837,7 @@
var node=_status.currentmouseenter;
if(_status.mousedragging){
e.preventDefault();
if(lib.config.enable_dragline){
ui.canvas.width=ui.arena.offsetWidth;
ui.canvas.height=ui.arena.offsetHeight;
var ctx=ui.ctx;
@ -15609,7 +15868,7 @@
ctx.stroke();
}
}
}
for(var i=0;i<e.path.length;i++){
if(e.path[i]==_status.mousedragorigin){
@ -15763,7 +16022,6 @@
}
}
var evt=_status.event;
if(!lib.config.enable_drag) return;
if(!ui.arena.classList.contains('selecting')) return;
@ -15790,6 +16048,40 @@
}
}
},
cardtouchstart:function(e){
if(e.touches.length!=1) return;
if(!lib.config.enable_drag) return;
if(!this.parentNode) return;
if(!this.parentNode.parentNode) return;
if(this.parentNode.parentNode.parentNode!=ui.me) return;
if(this.parentNode.parentNode.classList.contains('scrollh')) return;
if(this.classList.contains('selectable')&&
!this.classList.contains('selected')&&
!this.classList.contains('noclick')){
this._waitingfordrag={clientX:e.touches[0].clientX,clientY:e.touches[0].clientY};
}
},
cardtouchmove:function(e){
if(this._longpresstimeout){
clearTimeout(this._longpresstimeout);
delete this._longpresstimeout;
}
if(this._waitingfordrag){
var drag=this._waitingfordrag;
_status.clicked=false;
_status.touchnocheck=true;
ui.click.card.call(this);
_status.touchnocheck=false;
if(this.classList.contains('selected')){
_status.mousedragging=drag;
_status.mousedragorigin=this;
_status.mouseleft=false;
_status.selectionfull=false;
_status.multitarget=false;
}
delete this._waitingfordrag;
}
},
windowmouseup:function(e){
if(_status.draggingdialog){
var ddialog=_status.draggingdialog;
@ -15861,6 +16153,7 @@
ui.click[get.itemtype(tmpflag)].call(tmpflag);
game.check();
}
// ui.updatehl();
}
},
mousemove:function(){
@ -15916,6 +16209,16 @@
_status.longpressed=false;
},500);
func.call(node,e);
if(lib.config.touchscreen&&lib.config.enable_drag&&!node._waitingfordrag){
_status.mousedragging=null;
_status.mousedragorigin=null;
_status.clicked=false;
game.uncheck();
game.check();
ui.canvas.width=ui.arena.offsetWidth;
ui.canvas.height=ui.arena.offsetHeight;
_status.clicked=true;
}
}
},500);
},
@ -16091,6 +16394,7 @@
game.check();
},
card:function(){
delete this._waitingfordrag;
if(_status.dragged) return;
if(_status.clicked) return;
if(ui.intro) return;
@ -16101,17 +16405,21 @@
return;
}
if(this.classList.contains('selectable')==false) return;
var notoggle=false;
if(this.classList.contains('selected')){
ui.selected.cards.remove(this);
if(_status.multitarget){
game.uncheck();
game.check();
notoggle=true;
}
}
else{
ui.selected.cards.add(this);
}
if(!notoggle){
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'){
@ -17248,6 +17556,7 @@
}
for(var i=0;i<hs1.length;i++){
hs1[i].style.transform='translateX('+(i*offset1)+'px)';
hs1[i]._transform='translateX('+(i*offset1)+'px)';
ui.refresh(hs1[i]);
hs1[i].classList.remove('drawinghidden');
}
@ -17262,6 +17571,7 @@
}
for(var i=0;i<hs2.length;i++){
hs2[i].style.transform='translateX('+(i*offset2)+'px)';
hs2[i]._transform='translateX('+(i*offset2)+'px)';
ui.refresh(hs2[i]);
hs2[i].classList.remove('drawinghidden');
}
@ -19255,6 +19565,7 @@
game.me.node.handcards1.appendChild(card);
game.check();
game.me.update();
ui.updatehl();
}
},
s:function(skill){

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -142,7 +142,7 @@ table{table-layout: fixed;}
width: calc(50% - 140px);height: 127px;padding: 10px;
text-align: left;
}
#handcards1,#handcards2{white-space:nowrap;overflow-x: hidden;overflow-y:hidden;display: block;}
#handcards1,#handcards2{white-space:nowrap;overflow-x: visible;overflow-y:visible;display: block;}
#handcards1.scrollh,#handcards2.scrollh{overflow-x: scroll;}
#handcards1{left: 0;top:calc(100% - 140px);}
#handcards2{left: calc(50% + 120px);top:calc(100% - 140px);}
@ -1203,6 +1203,16 @@ div:hover>.wunature{
#me .card.selected{
box-shadow: rgba(0, 0, 0, 0.2) 0 0 0 1px,rgb(255, 0, 0) 0 0 5px, rgba(255, 0, 0, 1) 0 0 10px !important;
}
#me>#handcards1:not(.scrollh),
#me>#handcards2:not(.scrollh){
z-index: 3;
}
/*#me>div:not(.scrollh)>.handcards>.card{
top:0;
}
#me>div:not(.scrollh)>.handcards>.card.selected{
top:-20px;
}*/
.glow{
box-shadow: rgba(0, 0, 0, 0.2) 0 0 0 1px, rgba(0, 133, 255, 0.4) 0 0 5px, rgba(0, 133, 255, 0.5) 0 0 12px, rgba(0, 133, 255, 0.8) 0 0 15px !important;
}

View File

@ -29,5 +29,6 @@
}
],
"display": "fullscreen",
"orientation": "landscape"
"orientation": "landscape",
"xwalk_android_keep_screen_on":true
}