diff --git a/audio/die/re_caoxiu.mp3 b/audio/die/re_caoxiu.mp3 new file mode 100644 index 000000000..67bfe9400 Binary files /dev/null and b/audio/die/re_caoxiu.mp3 differ diff --git a/audio/die/re_sunxiu.mp3 b/audio/die/re_sunxiu.mp3 new file mode 100644 index 000000000..8e8d6722d Binary files /dev/null and b/audio/die/re_sunxiu.mp3 differ diff --git a/audio/skill/reqingxi1.mp3 b/audio/skill/reqingxi1.mp3 new file mode 100644 index 000000000..fcaf8cbaf Binary files /dev/null and b/audio/skill/reqingxi1.mp3 differ diff --git a/audio/skill/reqingxi2.mp3 b/audio/skill/reqingxi2.mp3 new file mode 100644 index 000000000..07b695ae0 Binary files /dev/null and b/audio/skill/reqingxi2.mp3 differ diff --git a/audio/skill/rexingxue1.mp3 b/audio/skill/rexingxue1.mp3 new file mode 100644 index 000000000..a6e688014 Binary files /dev/null and b/audio/skill/rexingxue1.mp3 differ diff --git a/audio/skill/rexingxue2.mp3 b/audio/skill/rexingxue2.mp3 new file mode 100644 index 000000000..96bd69fdb Binary files /dev/null and b/audio/skill/rexingxue2.mp3 differ diff --git a/audio/skill/reyanzhu1.mp3 b/audio/skill/reyanzhu1.mp3 new file mode 100644 index 000000000..b768c2df0 Binary files /dev/null and b/audio/skill/reyanzhu1.mp3 differ diff --git a/audio/skill/reyanzhu2.mp3 b/audio/skill/reyanzhu2.mp3 new file mode 100644 index 000000000..5397533b9 Binary files /dev/null and b/audio/skill/reyanzhu2.mp3 differ diff --git a/character/diy.js b/character/diy.js index a9b22f745..129997d86 100755 --- a/character/diy.js +++ b/character/diy.js @@ -1146,7 +1146,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ chooseButton:{ dialog:function(){ var list=[]; - for(var i of lib.inpile){ + var list2=['pyzhuren_heart','pyzhuren_diamond','pyzhuren_club','pyzhuren_spade','pyzhuren_shandian','rewrite_zhuge']; + list2.addArray(lib.inpile); + for(var i of list2){ var sub=get.subtype(i); if(['equip1','equip4'].contains(sub)) list.push([sub,'',i]); } @@ -1158,7 +1160,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(get.subtype(name)=='equip4'||player.getEquip(name)) return 0; var sha=player.countCards('h','sha'); switch(name){ - case 'zhuge': + case 'rewrite_zhuge': return sha-player.getCardUsable('sha'); case 'guding': if(sha>0&&game.hasPlayer(function(current){ @@ -1272,7 +1274,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ 'step 0' var list=[]; - for(var i of lib.inpile){ + var list2=['rewrite_bagua','rewrite_renwang','rewrite_tengjia','rewrite_baiyin']; + list2.addArray(lib.inpile); + for(var i of list2){ var sub=get.subtype(i); if(['equip2','equip3'].contains(sub)) list.push([sub,'',i]); } @@ -1284,13 +1288,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ case 'yexingyi': if(player.hp>2||player.getEquip('bagua')||player.getEquip('tengjia')) return 1.5+Math.random(); return 0.5+Math.random(); - case 'bagua':case 'renwang': + case 'rewrite_bagua':case 'rewrite_renwang': if(player.getEquip('bagua')||player.getEquip('tengjia')||player.getEquip('renwang')) return Math.random(); return 1.2+Math.random(); - case 'tengjia': + case 'rewrite_tengjia': if(player.getEquip('baiyin')) return 1.3+Math.random(); return Math.random(); - case 'baiyin': + case 'rewrite_baiyin': return 0.4+Math.random(); default: return 0; } diff --git a/character/hearth.js b/character/hearth.js index 64f95c8dd..266d9d295 100644 --- a/character/hearth.js +++ b/character/hearth.js @@ -313,7 +313,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, priority:-1, filter:function(event,player){ - return event.card==player.storage.wxuying; + return event.cards.contains(player.storage.wxuying); }, content:function(){ if(_status.currentPhase==player){ @@ -1379,6 +1379,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.discard(cards); if(event.position=='e'){ var name=cards[0].name; + if(name.indexOf('hstianqi_')!=0) return; for(var i=0;i0; + }).set('prompt',false); + 'step 1' + if(result.bool){ + player.chat('我愿意!'); + var sex='伴侣'; + switch(player.sex){ + case 'male':sex='丈夫';break; + case 'female':sex='妻子';break; + } + game.broadcastAll(function(str,id){ + var dialog=get.idDialog(id); + if(dialog) dialog.content.childNodes[1].innerHTML='
'+str+'
'; + },get.translation(target)+',你是否发誓娶'+get.translation(player)+'作为你的妻子,无论顺境或是逆境,富裕或贫穷,健康或疾病,快乐或忧愁,风雨同舟,患难与共,同甘共苦,缔结神圣的婚姻契约,成为终生的伴侣?',event.videoId); + game.delay(4); + target.chooseBool().set('ai',function(){ + return true; + }).set('prompt',false); + } + else event.goto(4); + 'step 2' + if(result.bool){ + target.chat('我愿意!'); + if(target.name2!=undefined){ + target.chooseControl(target.name1,target.name2).set('prompt','请选择要更换的武将牌'); + } + else event._result={control:target.name}; + } + else event.goto(4); + 'step 3' + target.reinit(result.control,'guansuo'); + if(_status.characterlist){ + _status.characterlist.add(result.control); + _status.characterlist.remove('guansuo'); + } + if(target.group!='shu') target.changeGroup('shu'); + target.draw(3); + 'step 4' + game.broadcastAll('closeDialog',event.videoId); + player.recover(); + player.addSkill('decadezhennan'); + }, + mark:true, + intro:{ + content:"limited", + }, + }, + decadezhennan:{ + audio:'xinfu_zhennan', + trigger:{ + target:"useCardToTargeted", + }, + filter:function (event,player){ + return event.targets&&event.targets.length>1&&get.type2(event.card)=='trick'; + }, + direct:true, + content:function (){ + "step 0" + player.chooseTarget(get.prompt('decadezhennan'),'对一名其他角色造成1点随机伤害',function(card,player,target){ + return target!=player; + }).set('ai',function(target){ + var player=_status.event.player; + return get.damageEffect(target,player,player); + }); + "step 1" + if(result.bool&&result.targets&&result.targets.length){ + player.logSkill('decadezhennan',result.targets); + result.targets[0].damage(); + } + }, + ai:{ + expose:0.25, + }, + }, yujue:{ derivation:'zhihu', enable:'phaseUse', @@ -3477,6 +3610,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ lose:false, content:function(){ target.equip(cards[0]); + if(cards[0].name.indexOf('pyzhuren_')==0) player.draw(2); }, ai:{ order:11, @@ -3505,12 +3639,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!player.countCards('h','sha')) return 4-get.value(card); return 0; } - return 2+card.number/2-get.value(card); + return 7-get.value(card); }, content:function(){ + player.addSkill('pyzhuren_destroy'); if(!_status.pyzhuren) _status.pyzhuren={}; - var rand=get.number(cards[0])/13; - if(get.isLuckyStar(player)) rand=1; + var rand=0.85; + var num=get.number(cards[0]); + if(num>4) rand=0.9; + if(num>8) rand=0.95; + if(num>12||cards[0].name=='shandian'||get.isLuckyStar(player)) rand=1; var name='pyzhuren_'+(cards[0][cards[0].name=='shandian'?'name':'suit']); if(!lib.card[name]||_status.pyzhuren[name]||Math.random()>rand){ player.popup('杯具'); @@ -3531,11 +3669,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player:1, }, }, - group:'pyzhuren_destroy', }, pyzhuren_destroy:{ - trigger:{global:['loseAfter','cardsDiscardAfter']}, + trigger:{global:['loseEnd','cardsDiscardEnd']}, forced:true, + charlotte:true, filter:function(event,player){ var cs=event.cards; for(var i=0;i0; - return player.countCards('h',this.filterCard)>0; - }, - filterCard:function(card){ - return get.name(card)=='sha'||get.subtype(card)=='equip1'; + return player.countCards('he',function(card){ + return card!=player.getEquip('pyzhuren_diamond'); + })>0; }, content:function(){ 'step 0' - var next=player.chooseToDiscard('h',lib.skill.pyzhuren_diamond.filterCard,get.prompt(event.name,trigger.player),'弃置一张【杀】或武器牌,令即将对其造成的伤害+1'); + var next=player.chooseToDiscard('he',function(card,player){ + return card!=player.getEquip('pyzhuren_diamond'); + },get.prompt(event.name,trigger.player),'弃置一张牌,令即将对其造成的伤害+1'); next.ai=function(card){ if(_status.event.goon) return 6-get.value(card); return -1; @@ -3603,6 +3752,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ next.logSkill=[event.name,trigger.player]; 'step 1' if(result.bool) trigger.num++; + else player.storage.counttrigger.pyzhuren_diamond--; }, ai:{ expose:0.25, @@ -3612,8 +3762,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:true, trigger:{player:'useCard2'}, direct:true, + equipSkill:true, + usable:2, filter:function(event,player){ - if(player.countUsed(null,true)>1) return false; if(event.card.name!='sha'&&get.type(event.card)!='trick') return false; var info=get.info(event.card); if(info.allowMultiple==false) return false; @@ -3644,6 +3795,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ event.targets=result.targets; } else{ + player.storage.counttrigger[event.name]--; event.finish(); } 'step 2' @@ -3657,14 +3809,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:true, trigger:{player:'useCardToPlayered'}, filter:function(event,player){ - return event.card.name=='sha'&&event.targets.length==1&&get.color(event.card)=='black'; + return event.card.name=='sha';//&&event.targets.length==1&&get.color(event.card)=='black'; }, check:function(event,player){ return get.attitude(player,event.target)<=0; }, + logTarget:'target', content:function(){ - trigger.target.gain(trigger.cards.filterInD(),'gain2','log'); - trigger.target.loseHp().set('source',player); + player.addTempSkill('pyzhuren_spade2'); + player.addMark('pyzhuren_spade2',1,false); + //trigger.target.gain(trigger.cards.filterInD(),'gain2','log'); + trigger.target.loseHp(Math.min(player.countMark('pyzhuren_spade2'),5)).set('source',player); }, ai:{ jueqing:true, @@ -3677,25 +3832,34 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, }, + pyzhuren_spade2:{onremove:true}, pyzhuren_shandian:{ audio:true, trigger:{player:'useCardToPlayered'}, filter:function(event,player){ - return event.card.name=='sha'&&event.targets.length==1; + return event.card.name=='sha';//&&event.targets.length==1; }, check:function(event,player){ return get.attitude(player,event.target)<=0; }, + logTarget:'target', content:function(){ 'step 0' - player.judge(function(card){ - if(get.suit(card)=='spade'&&card.number>1&&card.number<10) return 10; + trigger.target.judge(function(card){ + var suit=get.suit(card); + if(suit=='spade') return -10; + if(suit=='club') return -5; return 0; }); 'step 1' - if(result.bool){ + if(result.suit=='spade'){ trigger.target.damage(3,'thunder'); - trigger.getParent().excluded.add(trigger.target); + //trigger.getParent().excluded.add(trigger.target); + } + else if(result.suit=='club'){ + trigger.target.damage('thunder'); + player.recover(); + player.draw(); } }, }, @@ -5414,7 +5578,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ skills:['pyzhuren_heart'], ai:{ basic:{ - equipValue:2 + equipValue:4 } }, }, @@ -5427,7 +5591,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ skills:['pyzhuren_diamond'], ai:{ basic:{ - equipValue:2 + equipValue:3 } }, }, @@ -5440,9 +5604,22 @@ game.import('character',function(lib,game,ui,get,ai,_status){ skills:['pyzhuren_club'], ai:{ basic:{ - equipValue:2 + equipValue:5 } }, + loseDelay:false, + onLose:function(){ + var next=game.createEvent('baiyin_recover'); + event.next.remove(next); + var evt=event.getParent(); + if(evt.getlx===false) evt=evt.getParent(); + evt.after.push(next); + next.player=player; + next.setContent(function(){ + if(player.isDamaged()) player.logSkill('pyzhuren_club'); + player.recover(); + }); + }, }, pyzhuren_spade:{ fullskin:true, @@ -5452,7 +5629,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ skills:['pyzhuren_spade'], ai:{ basic:{ - equipValue:2.6 + equipValue:3 } }, }, @@ -5465,7 +5642,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ skills:['pyzhuren_shandian'], ai:{ basic:{ - equipValue:2 + equipValue:3 } }, }, @@ -5653,21 +5830,21 @@ game.import('character',function(lib,game,ui,get,ai,_status){ pingjian_info:'结束阶段开始时/当你受到伤害后/出牌阶段限一次,你可以令系统随机从剩余武将牌堆中检索出三张拥有发动时机为结束阶段开始时/当你受到伤害后/出牌阶段的技能的武将牌。然后你可以选择尝试发动其中一个技能或摸一张牌。每个技能每局只能选择一次。', pingjian_use:'评荐', pytianjiang:'天匠', - pytianjiang_info:'游戏开始时,你随机获得两张不同副类别的装备牌,并置入你的装备区。出牌阶段,你可以将装备区内的牌移动到其他角色的装备区(可替换原装备)。', + pytianjiang_info:'游戏开始时,你随机获得两张不同副类别的装备牌,并置入你的装备区。出牌阶段,你装备区里的牌可以移动至其他角色的装备区并替换其原有装备。', pytianjiang_move:'天匠', pyzhuren:'铸刃', pyzhuren_info:'出牌阶段限一次,你可以弃置一张手牌。根据此牌的花色点数,你有一定概率打造成功并获得一张武器牌(若打造失败或武器已有则改为摸一张【杀】,花色决定武器名称,点数决定成功率)。此武器牌进入弃牌堆时,将其移出游戏。', pyzhuren_destroy:'铸刃', pyzhuren_heart:'红缎枪', - pyzhuren_heart_info:'每回合限一次,当你使用【杀】造成伤害后,你可以进行判定,若结果为红色,你回复1点体力。', + pyzhuren_heart_info:'每回合限一次,当你使用【杀】造成伤害后,你可以进行判定,若结果为:红色,你回复1点体力;黑色:你摸两张牌。', pyzhuren_diamond:'烈淬刀', - pyzhuren_diamond_info:'当你使用【杀】对目标角色造成伤害时,你可以弃置一张【杀】或武器牌,令此伤害+1。', + pyzhuren_diamond_info:'每回合限两次,当你使用【杀】对目标角色造成伤害时,你可以弃置一张牌,令此伤害+1。你使用【杀】的次数上限+1。', pyzhuren_club:'水波剑', - pyzhuren_club_info:'当你于出牌阶段使用第一张牌时,若此牌是普通锦囊牌或【杀】,则你可以为此牌增加一个目标。', + pyzhuren_club_info:'每回合限两次,当你使用普通锦囊牌或【杀】时,你可以为此牌增加一个目标。当你失去装备区里的【水波剑】后,你回复1点体力。', pyzhuren_spade:'混毒弯匕', - pyzhuren_spade_info:'当你使用的黑色【杀】指定单一目标后,你可令该角色获得此【杀】,然后其失去1点体力。', + pyzhuren_spade_info:'当你使用【杀】指定目标后,你可令其失去X点体力(X为此技能本回合内发动过的次数且至多为5)。', pyzhuren_shandian:'天雷刃', - pyzhuren_shandian_info:'当你使用【杀】仅指定一名角色为目标后,可令其进行一次判定,若结果为黑桃2~黑桃9,该角色受到3点雷电伤害,然后此【杀】对其无效。', + pyzhuren_shandian_info:'当你使用【杀】指定目标后,可令其进行判定,若结果为:黑桃,其受到3点雷属性伤害;梅花,其受到1点雷属性伤害,你回复1点体力并摸一张牌。', songshu:'颂蜀', songshu_info:'出牌阶段,你可以和其他角色拼点。若你没赢,其摸两张牌,且你本阶段内不能再发动〖颂蜀〗', @@ -5844,6 +6021,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ tuxing:'图兴', tuxing2:'图兴', tuxing_info:'锁定技,当你废除一个装备栏时,你加1点体力上限并回复1点体力。然后若你所有的装备栏均已被废除,则你减4点体力上限,且本局游戏内使用【杀】造成的伤害+1。', + re_hejin:'何进', + xin_baosanniang:'鲍三娘', + decadexushen:"许身", + decadexushen_info:"限定技,当你因其他角色而脱离濒死状态后,若场上没有“关索”,则你可发动此技能。你可令其选择是否将自己的一张武将牌变更为“关索”并摸三张牌。然后你回复一点体力,并获得技能〖镇南〗。", + decadezhennan:"镇南", + decadezhennan_info:"当你成为锦囊牌的目标后,若此牌的目标数大于1,则你可以对一名其他角色造成1点伤害。", sp_whlw:"文和乱武", sp_zlzy:"逐鹿中原", diff --git a/character/yijiang.js b/character/yijiang.js index f2860ced2..8b7b3635f 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -62,11 +62,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ hanhaoshihuan:['male','wei',4,['shenduan','yonglve']], caorui:['male','wei',3,['huituo','mingjian','xingshuai'],['zhu']], - caoxiu:['male','wei',4,['qianju','reqingxi']], + caoxiu:['male','wei',4,['qianju','qingxi']], zhongyao:['male','wei',3,['huomo','zuoding']], liuchen:['male','shu',4,['zhanjue','qinwang'],['zhu']], zhangyi:['male','shu',4,['wurong','shizhi']], - sunxiu:['male','wu',3,['reyanzhu','rexingxue','rezhaofu'],['zhu']], + sunxiu:['male','wu',3,['yanzhu','xingxue','zhaofu'],['zhu']], zhuzhi:['male','wu',4,['xinanguo']], quancong:['male','wu',4,['yaoming']], gongsunyuan:['male','qun',4,['huaiyi']], @@ -320,7 +320,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return player.countCards('he')>0; }, content:function(){ - player.chooseToDiscard('是否发动【伤逝】弃置一张牌?').set('logSkill','reshangshi').set('ai',function(card){ + player.chooseToDiscard('是否发动【伤逝】弃置一张牌?','he').set('logSkill','reshangshi').set('ai',function(card){ var player=_status.event.player; if(player.countCards('h')>player.getDamagedHp()+_status.event.getTrigger().num) return 1; if(player.isPhaseUsing()) return 0.1-player.getUseValue(card,null,true)/Math.max(0.1,get.value(card)); @@ -4974,7 +4974,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, reqingxi:{ - audio:'qingxi', + audio:2, trigger:{player:'useCardToPlayered'}, filter:function(event,player){ return event.card.name=='sha'||event.card.name=='juedou'; @@ -5024,25 +5024,25 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!map[id]) map[id]={}; if(!map[id].extraDamage) map[id].extraDamage=0; map[id].extraDamage++; - trigger.target.judge(function(card){ - if(get.color(card)=='red') return -1; + player.judge(function(card){ + if(get.color(card)=='red') return 1; return 0; }); } 'step 2' - if(result.bool===false) trigger.directHit.add(trigger.target); + if(result.color=='red') trigger.directHit.add(trigger.target); } }, reqingxi2:{ mod:{ cardEnabled:function(card,player){ if(player.storage.reqingxi2&&player.storage.reqingxi2.filter(function(cd){ - return get.color(cd)!=get.color(card); + return get.color(cd)==get.color(card); }).length) return false; }, cardRespondable:function(card,player){ if(player.storage.reqingxi2&&player.storage.reqingxi2.filter(function(cd){ - return get.color(cd)!=get.color(card); + return get.color(cd)==get.color(card); }).length) return false; }, }, @@ -6423,7 +6423,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, reyanzhu:{ enable:'phaseUse', - audio:'yanzhu', + audio:2, usable:1, filterTarget:lib.filter.notMe, derivation:['reyanzhu_rewrite','rexingxue_rewrite'], @@ -6480,13 +6480,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ rexingxue:{ trigger:{player:'phaseJieshuBegin'}, direct:true, - audio:'xingxue', + audio:2, filter:function(event,player){ - return (player.storage.reyanzhu?player.hp:player.maxHp)>0; + return (player.storage.reyanzhu?player.maxHp:player.hp)>0; }, content:function(){ 'step 0' - player.chooseTarget([1,(player.storage.reyanzhu?player.maxHp:player.hp)],get.prompt('rexingxue'),'令所有目标角色依次摸一张牌,然后所有手牌数不等于体力值的目标角色依次将一张牌置于牌堆顶').set('ai',function(target){ + player.chooseTarget([1,player.storage.reyanzhu?player.maxHp:player.hp],get.prompt('rexingxue'),'令所有目标角色依次摸一张牌,然后所有手牌数大于体力值的目标角色依次将一张牌置于牌堆顶').set('ai',function(target){ var att=get.attitude(player,target); if(target.countCards('h')==target.hp-1) att*=2; return att; @@ -6507,7 +6507,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } else event.finish(); 'step 4' - if(target.isAlive()&&target.countCards('h')&&target.countCards('h')!=target.hp) target.chooseCard('he',true,'将一张牌置于牌堆顶'); + if(target.isAlive()&&target.countCards('h')&&target.countCards('h')>target.hp) target.chooseCard('he',true,'将一张牌置于牌堆顶'); else event.goto(3); 'step 5' if(result&&result.cards){ @@ -12085,8 +12085,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return '出牌阶段限一次,你可以选择一名其他角色。该角色下一次受到的伤害+1直到其下回合开始。'; }, rexingxue:function(player){ - if(player.storage.reyanzhu) return '结束阶段开始时,你可以令至多X名角色各摸一张牌。然后若有手牌数不等于体力值的目标角色,则这些角色各将一张牌置于牌堆顶。(X为你的体力上限)。'; - return '结束阶段开始时,你可以令至多X名角色各摸一张牌。然后若有手牌数不等于体力值的目标角色,则这些角色各将一张牌置于牌堆顶。(X为你的体力值)。'; + if(player.storage.reyanzhu) return '结束阶段开始时,你可以令至多X名角色各摸一张牌。然后若有手牌数大于体力值的目标角色,则这些角色各将一张牌置于牌堆顶。(X为你的体力上限)。'; + return '结束阶段开始时,你可以令至多X名角色各摸一张牌。然后若有手牌数大于体力值的目标角色,则这些角色各将一张牌置于牌堆顶。(X为你的体力值)。'; }, jiaozhao:function(player){ if(player.storage.jiaozhao2) return '出牌阶段限一次,你可以展示一张手牌,然后声明一张基本牌或普通锦囊牌的牌名。在此出牌阶段内,你可以将此手牌当声明的牌使用且你不能被选择为目标。'; @@ -12309,7 +12309,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ reqianju:'千驹', reqianju_info:'锁定技,若你已受伤,你计算与其他角色的距离时-X(X为你已损失的体力值且至少为1)。', reqingxi:'倾袭', - reqingxi_info:'当你使用【杀】或【决斗】指定目标后,你可以令其选择一项:1、弃置X张手牌(X为你攻击范围内的角色数,且当你装备区内有武器牌/没有武器牌时至多为4/2),若如此做,其弃置你的此武器牌;2、令此牌的伤害值+1且其进行判定,若结果为红色,则其不能响应此牌。', + reqingxi_info:'当你使用【杀】或【决斗】指定目标后,你可以令其选择一项:1、弃置X张手牌(X为你攻击范围内的角色数,且当你装备区内有武器牌/没有武器牌时至多为4/2),若如此做,其弃置你的此武器牌;2、令此牌的伤害值+1且你进行判定,若结果为红色,则其不能响应此牌。', jieyue:'节钺', jieyue1:'节钺', jieyue2:'节钺', @@ -12381,9 +12381,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ reyanzhu_rewrite:'宴诛·改', reyanzhu_rewrite_info:'出牌阶段限一次,你可以选择一名其他角色。该角色下一次受到的伤害+1直到其下回合开始。', rexingxue:'兴学', - rexingxue_info:'结束阶段开始时,你可以令至多X名角色各摸一张牌。然后若有手牌数不等于体力值的目标角色,则这些角色各将一张牌置于牌堆顶。(X为你的体力值)。', + rexingxue_info:'结束阶段开始时,你可以令至多X名角色各摸一张牌。然后若有手牌数大于体力值的目标角色,则这些角色各将一张牌置于牌堆顶。(X为你的体力值)。', rexingxue_rewrite:'兴学·改', - rexingxue_rewrite_info:'结束阶段开始时,你可以令至多X名角色各摸一张牌。然后若有手牌数不等于体力值的目标角色,则这些角色各将一张牌置于牌堆顶。(X为你的体力上限)。', + rexingxue_rewrite_info:'结束阶段开始时,你可以令至多X名角色各摸一张牌。然后若有手牌数大于体力值的目标角色,则这些角色各将一张牌置于牌堆顶。(X为你的体力上限)。', rezhaofu:'诏缚', rezhaofu_info:'主公技,锁定技,你攻击范围内的角色视为在其他吴势力角色的攻击范围内。', wurong:'怃戎', diff --git a/game/asset.js b/game/asset.js index 8160ba08b..551e19399 100644 --- a/game/asset.js +++ b/game/asset.js @@ -1,5 +1,5 @@ window.noname_asset_list=[ - 'v1.9.105.7', + 'v1.9.105.8', 'audio/background/aozhan_chaoming.mp3', 'audio/background/aozhan_online.mp3', 'audio/background/aozhan_rewrite.mp3', @@ -632,6 +632,8 @@ window.noname_asset_list=[ 'audio/die/re_yufan.mp3', 'audio/die/xin_jianyong.mp3', 'audio/die/sp_zhangliao.mp3', + 'audio/die/re_caoxiu.mp3', + 'audio/die/re_sunxiu.mp3', 'audio/skill/anguo1.mp3', 'audio/skill/anguo2.mp3', @@ -2789,6 +2791,12 @@ window.noname_asset_list=[ 'audio/skill/mubing2.mp3', 'audio/skill/ziqu1.mp3', 'audio/skill/ziqu2.mp3', + 'audio/skill/reqingxi1.mp3', + 'audio/skill/reqingxi2.mp3', + 'audio/skill/rexingxue1.mp3', + 'audio/skill/rexingxue2.mp3', + 'audio/skill/reyanzhu1.mp3', + 'audio/skill/reyanzhu2.mp3', 'font/huangcao.ttf', 'font/shousha.ttf', @@ -3429,6 +3437,10 @@ window.noname_asset_list=[ 'image/character/ol_yuanshu.jpg', 'image/character/key_kotori.jpg', 'image/character/key_ryoichi.jpg', + 'image/character/re_caoxiu.jpg', + 'image/character/re_hejin.jpg', + 'image/character/re_sunxiu.jpg', + 'image/character/xin_baosanniang.jpg', 'image/character/baiwuchang.jpg', 'image/character/baosanniang.jpg', diff --git a/game/game.js b/game/game.js index e2bd40203..d61693b0f 100644 --- a/game/game.js +++ b/game/game.js @@ -11653,7 +11653,7 @@ } event.backup(event.buttoned+'_backup'); if(info.prompt){ - event.openskilldialog=info.prompt(result.links,player); + event.openskilldialog=info.prompt(info.chooseControl?result:result.links,player); } } else{ @@ -48511,8 +48511,19 @@ } if(type=='in'){ if(info.enable=='phaseUse') num+=0.5; - if(info.trigger&&['phaseBegin','phaseDrawBegin','phaseUseBegin','phaseEnd'].contains(info.trigger.player)){ - num+=0.5; + if(info.trigger&&info.trigger.player){ + var list=Array.isArray(info.trigger.player)?info.trigger.player:[info.trigger.player]; + var add=false; + for(var i of list){ + for(var j of lib.phaseName){ + if(i.indexOf[j]==0){ + num+=0.5; + add=true; + break; + } + } + if(add) break; + } } if(info.trigger&&((typeof info.trigger.player=='string'&&info.trigger.player.indexOf('use')==0)||info.trigger.source)){ num+=0.3; diff --git a/game/update.js b/game/update.js index 7ca225b3b..78e805743 100644 --- a/game/update.js +++ b/game/update.js @@ -1,8 +1,8 @@ window.noname_update={ - version:'1.9.105.7', - update:'1.9.105.6.1', + version:'1.9.105.8', + update:'1.9.105.7', changeLog:[ - '神户小鸟、三谷良一', + '界曹休、界孙休、新鲍三娘', 'bug修复', ], @@ -21,33 +21,33 @@ window.noname_update={ //'card/zhulu.js', 'character/diy.js', //'character/extra.js', - //'character/hearth.js', + 'character/hearth.js', //'character/gujian.js', //'character/gwent.js', //'character/hearth.js', 'character/mobile.js', //'character/mtg.js', - 'character/old.js', + //'character/old.js', 'character/refresh.js', - 'character/shenhua.js', + //'character/shenhua.js', 'character/sp.js', 'character/sp2.js', //'character/tw.js', - 'character/standard.js', + //'character/standard.js', //'character/swd.js', //'character/xianjian.js', - 'character/xinghuoliaoyuan.js', + //'character/xinghuoliaoyuan.js', 'character/yijiang.js', //'character/yxs.js', //'extension/boss/extension.js', //'layout/default/layout.css', //'layout/nova/layout.css', - //'mode/identity.js', + 'mode/identity.js', //'mode/doudizhu.js', 'mode/guozhan.js', - //'mode/chess.js', - //'mode/tafang.js', - //'mode/single.js', + 'mode/chess.js', + 'mode/tafang.js', + 'mode/single.js', //'mode/stone.js', //'mode/brawl.js', //'mode/versus.js', diff --git a/image/character/re_caoxiu.jpg b/image/character/re_caoxiu.jpg new file mode 100644 index 000000000..2d092f46e Binary files /dev/null and b/image/character/re_caoxiu.jpg differ diff --git a/image/character/re_hejin.jpg b/image/character/re_hejin.jpg new file mode 100644 index 000000000..12c3d4f37 Binary files /dev/null and b/image/character/re_hejin.jpg differ diff --git a/image/character/re_sunxiu.jpg b/image/character/re_sunxiu.jpg new file mode 100644 index 000000000..ab7ce53aa Binary files /dev/null and b/image/character/re_sunxiu.jpg differ diff --git a/image/character/xin_baosanniang.jpg b/image/character/xin_baosanniang.jpg new file mode 100644 index 000000000..959b70ad3 Binary files /dev/null and b/image/character/xin_baosanniang.jpg differ diff --git a/image/skin/key_yui/3.jpg b/image/skin/key_yui/3.jpg new file mode 100644 index 000000000..05826ddde Binary files /dev/null and b/image/skin/key_yui/3.jpg differ diff --git a/mode/chess.js b/mode/chess.js index 1fda8fc84..94946d28d 100644 --- a/mode/chess.js +++ b/mode/chess.js @@ -1,6329 +1,6332 @@ -'use strict'; -game.import('mode',function(lib,game,ui,get,ai,_status){ - return { - name:'chess', - canvasUpdates2:[], - hiddenCharacters:[], - start:function(){ - "step 0" - _status.gameDrawed=true; - _status.mode=get.config('chess_mode'); - if(lib.config.player_border=='normal'&&(lib.config.layout=='long'||lib.config.layout=='long2')){ - ui.arena.classList.add('lslim_player'); - } - // if(_status.mode=='leader'){ - // _status.mode='combat'; - // } - if(lib.config.test_game){ - _status.mode='combat'; - game.saveConfig('additional_player',false,true); - } - if(_status.mode=='combat'){ - _status.first_less=true; - } - "step 1" - for(var i in lib.skill){ - if(lib.skill[i].changeSeat){ - lib.skill[i]={}; - if(lib.translate[i+'_info']){ - lib.translate[i+'_info']='此模式下不可用'; - } - } - } - lib.init.css(lib.assetURL+'layout/mode','chess'); - ui.chesssheet=document.createElement('style'); - document.head.appendChild(ui.chesssheet); - var playback=localStorage.getItem(lib.configprefix+'playback'); - lib.treasurelist=[]; - if(get.config('chess_character')||playback||_status.mode=='leader'){ - for(var i in lib.characterPack.mode_chess){ - if(i.indexOf('treasure_')==0){ - lib.treasurelist.push(i); - } - if(!playback&&i.indexOf('leader_')==0&&_status.mode!='leader') continue; - lib.character[i]=lib.characterPack.mode_chess[i]; - if(!lib.character[i][4]){ - lib.character[i][4]=[]; - } - } - } - if(get.config('chess_card')){ - lib.card.list.addArray(lib.chess_cardlist); - } - ui.create.cardsAsync(); - game.finishCards(); - game.addGlobalSkill('autoswap'); - ui.chessContainer=ui.create.div('#chess-container',ui.arena); - ui.chessContainer.move=ui.click.moveContainer; - ui.chessContainer.chessLeft=0; - ui.chessContainer.chessTop=0; - // lib.setScroll(ui.chessContainer); - ui.chess=ui.create.div('#chess',ui.chessContainer); - ui.canvas2=document.createElement('canvas'); - ui.canvas2.id='canvas2'; - ui.chess.appendChild(ui.canvas2); - ui.ctx2=ui.canvas2.getContext('2d'); - game.me=ui.create.player(); - if(playback){ - for(var i in lib.characterPack){ - for(var j in lib.characterPack[i]){ - lib.character[j]=lib.character[j]||lib.characterPack[i][j]; - } - } - game.pause(); - ui.system.style.display='none'; - _status.playback=playback; - localStorage.removeItem(lib.configprefix+'playback'); - var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); - store.get(parseInt(playback)).onsuccess=function(e){ - if(e.target.result){ - event.video=e.target.result.video; - game.resume(); - } - else{ - alert('播放失败:找不到录像'); - game.reload(); - } - } - } - else{ - switch(_status.mode){ - case 'leader':{ - game.leaderView(); - break; - } - case 'three':{ - if(lib.config.continue_name_chess){ - event._result={ - friend:lib.config.continue_name_chess.friend, - enemy:lib.config.continue_name_chess.enemy, - } - _status.color=lib.config.continue_name_chess.color; - game.saveConfig('continue_name_chess'); - game.delay(0.5); - lib.init.onfree(); - } - else{ - game.chooseCharacterDouble(function(i){ - if(lib.character[i][4].contains('chessboss')){ - return false; - } - return !lib.filter.characterDisabled(i); - },function(i){ - switch(i){ - case 0:return '主帅'; - case 1:return '副帅'; - default:return '前锋'; - } - }); - } - break; - } - case 'combat':{ - game.chooseCharacter(); - break; - } - default:{ - game.chooseCharacter(); - } - } - } - "step 2" - ui.arena.classList.add('chess'); - if(_status.mode=='three'){ - _status.mylist=result.friend; - _status.enemylist=result.enemy; - _status.friendBackup=_status.mylist.slice(0); - _status.enemyBackup=_status.enemylist.slice(0); - } - var mylistmap,enemylistmap; - if(event.video){ - var videocontent; - for(var ii=0;ii0){ - var ng=Math.floor(gridnum*nco); - for(var i=0;i_status.enemyDied){ - game.forceOver(false); - } - else{ - game.forceOver(); - } - }); - ui.finishGame.classList.add('finish_game'); - ui.finishGame.parentNode.insertBefore(finishGameBr,ui.finishGame); - } - - ui.create.me(); - ui.create.fakeme(); - - if(!event.video&&((_status.mode=='combat'&&get.config('zhu')&&!_status.vsboss&&game.players.length>2)||_status.mode=='three')){ - game.friendZhu=event.friendZhu; - game.friendZhu.hp++; - game.friendZhu.maxHp++; - game.friendZhu.update(); - game.friendZhu.node.identity.firstChild.innerHTML='将'; - - for(var i=0;i=ui.chesswidth){ - x=ui.chesswidth-1; - } - if(y>=ui.chessheight){ - y=ui.chessheight-1; - } - - var pos=y*ui.chesswidth+x; - if(!lib.posmap[pos]){ - delete lib.posmap[this.dataset.position]; - // this.changeSeat(pos,false); - ui.placeChess(this,pos); - lib.posmap[pos]=this; - this.chessFocus(); - } - - if(get.mode()=='tafang'&&!_status.video){ - if(_status.tafangend.contains(this.dataset.position)){ - if(_status.enemies.contains(this)){ - game.over(false); - } - else{ - this.delete(); - delete lib.posmap[this]; - game.players.remove(this); - _status.friends.remove(this); - this.classList.add('dead'); - if(_status.roundStart==this){ - _status.roundStart=player.next||player.getNext()||game.players[0]; - } - if(this==game.me){ - if(ui.confirm){ - ui.confirm.close(); - } - if(_status.friends.length==0){ - ui.fakeme.hide(); - this.node.handcards1.delete(); - this.node.handcards2.delete(); - game.me=ui.create.player(); - game.me.side=false; - game.addVideo('removeTafangPlayer'); - } - else{ - game.modeSwapPlayer(_status.friends[0]); - } - } - for(var i=0;i0&&this.movable(1,0)) return true; - if(dy<0&&this.movable(0,-1)) return true; - if(dy>0&&this.movable(0,1)) return true; - return false; - }, - moveTowards:function(target,forbid){ - var fxy=this.getXY(); - var txy; - if(Array.isArray(target)){ - txy=target; - } - else if(typeof target=='string'){ - var pos=parseInt(target); - txy=[pos%ui.chesswidth,Math.floor(pos/ui.chesswidth)]; - } - else{ - txy=target.getXY(); - } - var dx=txy[0]-fxy[0]; - var dy=txy[1]-fxy[1]; - forbid=forbid||[]; - if(Math.abs(dx)>Math.abs(dy)){ - if(dx<0){ - if(!forbid.contains('moveLeft')&&this.movable(-1,0)){ - this.moveLeft(); - return 'moveLeft'; - } - } - else if(dx>0){ - if(!forbid.contains('moveRight')&&this.movable(1,0)){ - this.moveRight(); - return 'moveRight'; - } - } - if(dy<0){ - if(!forbid.contains('moveUp')&&this.movable(0,-1)){ - this.moveUp(); - return 'moveUp'; - } - } - else if(dy>0){ - if(!forbid.contains('moveDown')&&this.movable(0,1)){ - this.moveDown(); - return 'moveDown'; - } - } - } - else{ - if(dy<0){ - if(!forbid.contains('moveUp')&&this.movable(0,-1)){ - this.moveUp(); - return 'moveUp'; - } - } - else if(dy>0){ - if(!forbid.contains('moveDown')&&this.movable(0,1)){ - this.moveDown(); - return 'moveDown'; - } - } - if(dx<0){ - if(!forbid.contains('moveLeft')&&this.movable(-1,0)){ - this.moveLeft(); - return 'moveLeft'; - } - } - else if(dx>0){ - if(!forbid.contains('moveRight')&&this.movable(1,0)){ - this.moveRight(); - return 'moveRight'; - } - } - } - return false; - }, - chessFocus:function(){ - game.addVideo('chessFocus',this); - if(ui.chess._chessdrag) return; - if(_status.chessscrolling) return; - var player=this; - var dx=0,dy=0; - - if(player.getLeft()-ui.chessContainer.chessLeft<14){ - dx=player.getLeft()-ui.chessContainer.chessLeft-14; - } - else if(player.getLeft()-ui.chessContainer.chessLeft>ui.chessContainer.offsetWidth-134){ - dx=player.getLeft()-ui.chessContainer.chessLeft-ui.chessContainer.offsetWidth+134; - } - if(player.getTop()-ui.chessContainer.chessTop<14){ - dy=player.getTop()-ui.chessContainer.chessTop-14; - } - else if(player.getTop()+ui.chess.offsetTop-ui.chessContainer.chessTop>ui.chessContainer.offsetHeight-134){ - dy=player.getTop()+ui.chess.offsetTop-ui.chessContainer.chessTop-ui.chessContainer.offsetHeight+134; - } - // if(_status.currentChessFocus){ - // cancelAnimationFrame(_status.currentChessFocus); - // } - var count=lib.config.low_performance?6:12; - var ddx=Math.floor(dx/count); - var ddy=Math.floor(dy/count); - if(dx||dy){ - ui.chessContainer.move(dx,dy,true); - // var chessFocus=function(){ - // if(count--){ - // ui.chessContainer.chessLeft+=ddx; - // ui.chessContainer.chessTop+=ddy; - // _status.currentChessFocus=requestAnimationFrame(chessFocus); - // } - // else{ - // ui.chessContainer.chessLeft+=dx%count; - // ui.chessContainer.chessTop+=dy%count; - // cancelAnimationFrame(_status.currentChessFocus); - // delete _status.currentChessFocus; - // } - // }; - // _status.currentChessFocus=requestAnimationFrame(chessFocus); - } - }, - getXY:function(){ - var pos=parseInt(this.dataset.position); - var x=pos%ui.chesswidth; - var y=Math.floor(pos/ui.chesswidth); - return [x,y]; - }, - getDataPos:function(x,y){ - var xy=this.getXY(); - if(typeof x!='number') x=0; - if(typeof y!='number') y=0; - x+=xy[0]; - y+=xy[1]; - return x+y*ui.chesswidth; - }, - getNeighbour:function(x,y){ - var xy=this.getXY(); - if(xy[0]+x<0) return null; - if(xy[1]+y<0) return null; - if(xy[0]+x>=ui.chesswidth) return null; - if(xy[1]+y>=ui.chessheight) return null; - return lib.posmap[this.getDataPos(x,y)]||null; - }, - getNeighbours:function(){ - var players=[]; - for(var i=0;i=ui.chesswidth) return false; - if(xy[1]+y>=ui.chessheight) return false; - return !this.getNeighbour(x,y); - }, - moveRight:function(){ - if(this.movable(1,0)){ - this.move(1,0); - return true; - } - return false; - }, - moveLeft:function(){ - if(this.movable(-1,0)){ - this.move(-1,0); - return true; - } - return false; - }, - moveUp:function(){ - if(this.movable(0,-1)){ - this.move(0,-1); - return true; - } - return false; - }, - moveDown:function(){ - if(this.movable(0,1)){ - this.move(0,1); - return true; - } - return false; - }, - dieAfter:function(source){ - var player=this; - if(_status.friends){ - _status.friends.remove(this); - } - if(_status.enemies){ - _status.enemies.remove(this); - } - if(ui.friendDied&&player.side==game.me.side){ - ui.friendDied.innerHTML='阵亡: '+get.cnNumber(++_status.friendDied,true); - } - if(ui.enemyDied&&player.side!=game.me.side){ - ui.enemyDied.innerHTML='杀敌: '+get.cnNumber(++_status.enemyDied,true); - } - delete lib.posmap[player.dataset.position]; - setTimeout(function(){ - player.delete(); - },500); - for(var i=0;i1){ - if(cards){ - that.$gain(cards,null,false) - } - else{ - that.$gain(num-1,null,false) - } - } - }, - $throw:function(card,time,init){ - if(init!==false){ - if(get.itemtype(card)!='cards'){ - if(get.itemtype(card)=='card'){ - card=[card]; - } - else{ - return; - } - } - game.addVideo('throw',this,[get.cardsInfo(card),time]); - } - this.chessFocus(); - if(get.itemtype(card)=='cards'){ - for(var i=0;i=0){ - for(var i=0;i=ui.chessContainer.offsetHeight){ - amin=0; - amax=90; - } - else{ - amin=-90; - amax=90; - } - } - else if(rect.left+rect.width+80>=ui.chessContainer.offsetWidth){ - if(rect.top<=80){ - amin=180; - amax=270; - } - else if(rect.top+rect.height+80>=ui.chessContainer.offsetHeight){ - amin=90; - amax=180; - } - else{ - amin=90; - amax=270; - } - } - else if(rect.top<=80){ - amin=180; - amax=360; - } - else if(rect.top+rect.height+80>=ui.chessContainer.offsetHeight){ - amin=0; - amax=180; - } - else{ - var dx=ui.chessContainer.offsetWidth/2-(rect.left+rect.width/2); - var dy=-ui.chessContainer.offsetHeight/2+(rect.top+rect.height/2); - var ang=Math.abs(Math.atan(dy/dx))*180/Math.PI; - if(dx<0){ - if(dy>0){ - ang=180-ang; - } - else{ - ang+=180; - } - } - else if(dy<0){ - ang=360-ang; - } - amin=ang-180; - amax=ang+180; - } - var da=(amax-amin)/(thrown.length*2); - if(da>30&&thrown.length>1){ - amin+=(da-30)*thrown.length; - da=30; - } - for(var i=0;i.player'+pos+ - // '{left:'+(14+i*148)+'px;top:'+(14+j*148)+'px}',0); - ui.chesssheet.sheet.insertRule('#arena.chess #chess>.card'+pos+ - '{left:'+(22+i*148)+'px;top:'+(22+j*148)+'px}',0); - ui.chesssheet.sheet.insertRule('#arena.chess #chess>.popup'+pos+ - '{left:'+(19+i*148)+'px;top:'+(142+j*148)+'px}',0); - } - } - }, - getVideoName:function(){ - var str='战棋'+get.translation(_status.mode)+' - '+_status.friendCount+'v'+_status.enemyCount; - var name=[get.translation(game.me.name),str]; - return name; - }, - addChessPlayer:function(name,enemy,num,pos){ - if(typeof num!='number'){ - num=4; - } - var player=ui.create.player(); - player.getId(); - if(enemy=='treasure'){ - player.animate('judgestart'); - player.side=null; - player.identity='neutral'; - player.setIdentity(); - player.node.identity.dataset.color='zhong'; - player.classList.add('treasure'); - player.node.hp.classList.add('treasure'); - player.life=6+Math.floor(Math.random()*6); - game.treasures.add(player); - } - else{ - player.animate('start'); - if(enemy){ - if(get.mode()=='tafang'){ - player.side=true; - } - else{ - player.side=!game.me.side; - } - player.setIdentity('enemy'); - player.identity='enemy'; - } - else{ - if(get.mode()=='tafang'){ - player.side=false; - } - else{ - player.side=game.me.side; - } - player.setIdentity('friend'); - player.identity='friend'; - } - player.node.identity.dataset.color=get.translation(player.side+'Color'); - game.players.push(player); - // if(lib.config.animation){ - // setTimeout(function(){ - // player.$rare2(); - // },300); - // } - } - ui.chess.appendChild(player); - if(_status.video||(pos&&!lib.posmap[pos])){ - ui.placeChess(player,pos); - } - else{ - var grids=[]; - var gridnum=ui.chessheight*ui.chesswidth; - for(var i=0;i=ui.chesswidth){ - x=ui.chesswidth-1; - } - if(y>=ui.chessheight){ - y=ui.chessheight-1; - } - - pos=y*ui.chesswidth+x; - } - if(!lib.posmap[pos]){ - var grid=ui.create.div('.player.minskin.obstacle',ui.chess).animate('start'); - ui.placeChess(grid,pos); - grid.listen(ui.click.obstacle); - lib.posmap[pos]=grid; - game.obstacles.push(grid); - return grid; - } - return null; - }, - addTempObstacle:function(x,y,num){ - var node=game.addObstacle(x,y); - if(node){ - game.colorObstacle(node,'blue'); - node.tempObstacle=num; - } - }, - removeObstacle:function(pos){ - if(get.is.div(pos)){ - pos=pos.dataset.position; - } - var node=lib.posmap[pos]; - if(node&&game.obstacles.contains(node)){ - game.addVideo('removeObstacle',null,pos); - game.obstacles.remove(node); - delete lib.posmap[pos]; - node.delete(); - } - }, - moveObstacle:function(pos,x,y){ - if(get.is.div(pos)){ - pos=pos.dataset.position; - } - var node=lib.posmap[pos]; - if(node&&game.obstacles.contains(node)){ - pos=parseInt(pos); - var x2=pos%ui.chesswidth+x; - var y2=Math.floor(pos/ui.chesswidth)+y; - if(x2>=ui.chesswidth){ - x2=ui.chesswidth-1; - } - if(y2>=ui.chessheight){ - y2=ui.chessheight-1; - } - if(x2<0){ - x2=0; - } - if(y2<0){ - y2=0; - } - var pos2=y2*ui.chesswidth+x2; - if(!lib.posmap[pos2]){ - game.addVideo('moveObstacle',null,[pos,x,y]); - ui.placeChess(node,pos2); - delete lib.posmap[pos]; - lib.posmap[pos2]=node; - return true; - } - } - return false; - }, - colorObstacle:function(pos,color){ - if(get.is.div(pos)){ - pos=pos.dataset.position; - } - var node=lib.posmap[pos]; - if(node&&game.obstacles.contains(node)){ - game.addVideo('colorObstacle',null,[pos,color]); - node.dataset.obscolor=color; - } - }, - addOverDialog:function(dialog,result){ - if(ui.finishGame){ - ui.finishGame.remove(); - } - dialog.classList.add('center'); - if(_status.mode!='leader') return; - if(result=='战斗胜利'){ - _status.victory=true; - if(!_status.enterArena){ - var div=ui.create.div(); - div.innerHTML='获得'+game.reward+'金'; - dialog.add(div); - if(_status.challenge&&_status.challengeMoney<=game.data.dust){ - var div2=ui.create.div(); - div2.style.display='block'; - div2.innerHTML='招降所需招募令:'+_status.challengeMoney+'/'+game.data.dust; - dialog.add(div2); - } - game.changeMoney(game.reward); - game.saveData(); - } - } - else if(_status.zhaoxiang){ - var div=ui.create.div(); - div.innerHTML='招降'+get.translation(_status.zhaoxiang)+'成功'; - dialog.add(div); - } - }, - controlOver:function(){ - if(_status.mode=='three'){ - ui.create.control('再战',function(){ - game.saveConfig('continue_name_chess',{ - friend:_status.friendBackup, - enemy:_status.enemyBackup, - color:_status.color - }); - game.saveConfig('mode',lib.config.mode); - localStorage.setItem(lib.configprefix+'directstart',true); - game.reload(); - }); - } - ui.create.control('返回',game.reload); - if(_status.mode!='leader') return; - if(_status.enterArena){ - game.data.arena.acted.length=0; - if(_status.victory){ - game.data.arena.win++; - for(var i=0;i=money){ - ui.create.control('招降'+get.translation(_status.challenge),function(){ - game.data.character.add(_status.challenge); - game.data.challenge=game.getLeaderList(); - game.changeDust(-money); - game.reload(); - }); - } - } - } - }, - phaseLoopThree:function(player){ - var next=game.createEvent('phaseLoop'); - next.player=player; - next.swap=function(player){ - if(player.side==game.me.side){ - return game.enemyZhu; - } - else{ - return game.me; - } - }, - next.setContent(function(){ - 'step 0' - player.classList.add('acted'); - player.phase(); - 'step 1' - if(player!=game.friendZhu&&player!=game.enemyZhu){ - for(var i=0;inum1){ - if(next.side==game.me.side){ - next=game.me; - } - var str; - if(num2-num1>1){ - str='选择至多'+get.cnNumber(num2-num1)+'个已方角色各摸一张牌' - } - else{ - str='选择一个已方角色摸一张牌' - } - var nevt=next.chooseTarget(str,function(card,player,target){ - return target.side==next.side; - },[1,num2-num1]); - nevt.ai=function(target){ - return Math.max(1,10-target.countCards('h')); - }; - nevt.includeOut=true; - nevt.chessForceAll=true; - } - else{ - game.delay(); - event.goto(2); - } - } - else{ - event.goto(2); - } - "step 1" - if(result.bool){ - game.asyncDraw(result.targets); - } - "step 2" - if(player.side==game.me.side){ - player=game.me; - } - if(player.isDead()){ - for(var i=0;i1){ - var nevt=player.chooseTarget('选择下一个行动的角色',function(card,player,target){ - return target.side==player.side&&!target.classList.contains('acted'); - },true); - nevt.chessForceAll=true; - nevt.includeOut=true; - nevt.ai=function(target){ - var nj=target.countCards('j'); - if(nj){ - return -nj; - } - return Math.max(0,10-target.hp); - } - } - else if(players.length){ - event.decided=players[0]; - } - else{ - event.player=game.findPlayer(function(current){ - return current.side!=player.side; - }); - event.goto(0); - } - "step 3" - if(event.decided){ - event.decided.phase(); - event.justacted=event.decided; - delete event.decided; - } - else{ - var current=result.targets[0]; - current.phase(); - event.justacted=current; - } - "step 4" - event.justacted.classList.add('acted'); - event.goto(0); - for(var i=0;i'+game.data.money+'金币'); - uiintro.addText('通过战斗或竞技场可获得金币。花费100金币可招募3名随机武将;花费150金币可参加一次竞技场'); - uiintro.add(''+game.data.dust+'招募令'); - uiintro.addText('通过遣返武将或竞技场可获得招募令。挑战武将成功后可通过招募令招募该武将,普通/稀有/史诗/传说武将分别花费40/100/400/1600招募令'); - }); - ui.money.innerHTML=''+game.data.dust+''+ - ''+game.data.money+''; - ui.money.style.top='auto'; - ui.money.style.left='auto'; - ui.money.style.right='20px'; - ui.money.style.bottom='15px'; - ui.money.childNodes[0].style.color='rgb(111, 198, 255)'; - ui.money.childNodes[1].style.fontFamily='huangcao'; - ui.money.childNodes[1].style.marginRight='10px'; - ui.money.childNodes[2].style.color='#FFE600'; - ui.money.childNodes[3].style.fontFamily='huangcao'; - ui.money.style.letterSpacing='4px'; - for(var i in lib.rank){ - if(Array.isArray(lib.rank[i])){ - for(var j=0;jb?1:-1; - } - return aa>bb?1:-1; - }); - if(game.data.character.length==0||!game.data.challenge){ - game.data.character=lib.rank.rarity.common.randomGets(3); - game.data.challenge=game.getLeaderList(); - game.saveData(); - } - var fixButton=function(button){ - var rarity=game.getRarity(button.link); - if(rarity!='common'){ - var intro=button.node.intro; - intro.classList.add('showintro'); - intro.style.fontFamily='huangcao'; - intro.style.fontSize='20px'; - intro.style.top='82px'; - intro.style.left='2px'; - switch(rarity){ - case 'rare':intro.dataset.nature='waterm';break; - case 'epic':intro.dataset.nature='thunderm';break; - case 'legend':intro.dataset.nature='metalm';break; - } - intro.innerHTML=get.translation(rarity); - } - } - game.leaderLord=['leader_caocao','leader_liubei','leader_sunquan']; - var dialog1=ui.create.dialog('选择君主','hidden'); - event.dialog1=dialog1; - dialog1.classList.add('fullheight'); - dialog1.classList.add('halfleft'); - dialog1.classList.add('fixed'); - dialog1.classList.add('pointerbutton'); - dialog1.add([game.leaderLord,'character']); - var i; - for(i=0;ib?1:-1; - }); - captnode.innerHTML=''; - for(i=0;i3&&selected.character.length){ - event.removeCharacter.animate('controlpressdownx',500); - event.removeCharacter.classList.remove('disabled'); - } - if(game.data.money<150&&!game.data._arena){ - event.enterArena.classList.add('disabled'); - } - else{ - event.enterArena.animate('controlpressdownx',500); - event.enterArena.classList.remove('disabled'); - } - if(game.data.money<100){ - event.addCharacter.classList.add('disabled'); - } - else{ - event.addCharacter.animate('controlpressdownx',500); - event.addCharacter.classList.remove('disabled'); - } - initcapt(); - },200); - },200); - },500); - }; - event.addCharacter=ui.create.control('招募','nozoom',zhaomu2); - if(game.data.money<150&&!game.data._arena){ - event.enterArena.classList.add('disabled'); - } - if(game.data.money<100){ - event.addCharacter.classList.add('disabled'); - } - var qianfan=function(){ - if(_status.kaibao) return; - if(game.data.character.length<=3) return; - if(!selected.character.length) return; - // _status.chessclicked=true; - // _status.qianfan=true; - // event.enterArena.style.opacity=0.5; - // event.addCharacter.style.opacity=0.5; - // event.fight.style.opacity=0.5; - var current=selected.character.slice(0); - clearSelected(); - var maxq=game.data.character.length-3; - if(current.length<=maxq){ - for(var i=0;i=100){ - event.addCharacter.animate('controlpressdownx',500); - event.addCharacter.classList.remove('disabled'); - } - if(game.data.money>=150){ - event.enterArena.animate('controlpressdownx',500); - event.enterArena.classList.remove('disabled'); - } - node.delete(); - dialog1.buttons.remove(node); - } - initcapt(); - } - }; - event.removeCharacter=ui.create.control('遣返','nozoom',qianfan); - event.removeCharacter.classList.add('disabled'); - event.fight=ui.create.control('开始战斗','nozoom',function(){ - if(_status.kaibao||_status.qianfan) return; - if(selected.challenge.length){ - var cname=selected.challenge[0].link; - var rarity=game.getRarity(cname); - switch(rarity){ - case 'common':rarity=40;break; - case 'rare':rarity=100;break; - case 'epic':rarity=400;break; - case 'legend':rarity=1600;break; - } - if(!confirm('即将挑战'+get.translation(cname)+',战斗胜利后可消耗'+rarity+'招募令招募该武将,无论是否招募,挑战列表将被刷新。是否继续?')){ - return; - } - } - _status.enemylist=[]; - _status.mylist=[]; - if(selected.lord.length){ - _status.mylist.push(selected.lord[0].link); - _status.lord=selected.lord[0].link; - } - if(selected.character.length){ - for(var i=0;i0){ - switch(difficulty){ - case 'leader_easy':reward+=10*numdel;break; - case 'leader_medium':reward+=20*numdel;break; - case 'leader_hard':reward+=40*numdel;break; - } - } - var punish=0; - for(var i=0;i<_status.mylist.length;i++){ - switch(get.rank(_status.mylist[i])){ - case 's':punish+=25;break; - case 'ap':punish+=20;break; - case 'a':punish+=16;break; - case 'am':punish+=12;break; - case 'bp':punish+=9;break; - case 'b':punish+=7;break; - case 'bm':punish+=5;break; - case 'c':punish+=3;break; - case 'd':punish+=2;break; - } - } - if(numdel<0){ - switch(difficulty){ - case 'leader_easy':punish-=5*numdel;break; - case 'leader_medium':punish-=10*numdel;break; - case 'leader_hard':punish-=20*numdel;break; - } - } - game.reward=Math.max(3*_status.enemylist.length,reward-punish); - if(!_status.lord){ - switch(difficulty){ - case 'leader_easy':game.reward+=10;break; - case 'leader_medium':game.reward+=20;break; - case 'leader_hard':game.reward+=40;break; - } - } - game.resume(); - }); - event.custom.replace.button=function(button){ - if(_status.kaibao) return; - if(button.classList.contains('unselectable')&& - !button.classList.contains('selected')) return; - _status.chessclicked=true; - button.classList.toggle('selected'); - if(button.classList.contains('selected')){ - selected[button.area].add(button); - } - else{ - selected[button.area].remove(button); - } - switch(button.area){ - case 'lord':{ - for(var i=0;i5)|| - (_status.qianfan&&selected.character.length>=maxq)){ - dialog1.buttons[i].classList.add('unselectable'); - } - else{ - dialog1.buttons[i].classList.remove('unselectable'); - } - } - } - break; - } - case 'difficulty':case 'number':{ - for(var i=0;i3){ - event.removeCharacter.animate('controlpressdownx',500); - event.removeCharacter.classList.remove('disabled'); - } - else{ - event.removeCharacter.classList.add('disabled'); - } - }; - event.custom.add.window=function(){ - if(!_status.kaibao){ - var glows=document.querySelectorAll('.button.glow2'); - for(var i=0;i=100){ - event.addCharacter.animate('controlpressdownx',500); - event.addCharacter.classList.remove('disabled'); - } - else{ - event.addCharacter.classList.add('disabled'); - } - if(game.data.money>=150||game.data._arena){ - event.enterArena.animate('controlpressdownx',500); - event.enterArena.classList.remove('disabled'); - } - else{ - event.enterArena.classList.add('disabled'); - } - event.fight.style.opacity=1; - } - clearSelected(); - }; - lib.init.onfree(); - game.pause(); - 'step 2' - if(!game.data.arena){ - event.dialog1.close(); - event.dialog2.close(); - event.fight.close(); - event.enterArena.close(); - event.addCharacter.close(); - event.removeCharacter.close(); - } - ui.arena.classList.add('leaderhide'); - ui.money.hide(); - game.delay(); - 'step 3' - ui.arena.classList.remove('leaderhide'); - if(!_status.enterArena){ - ui.wuxie.show(); - ui.auto.show(); - ui.control.style.top=''; - if(!get.is.safari()){ - ui.control.style.transition=''; - ui.control.style.display='none'; - } - event.finish(); - } - else{ - game.minskin=false; - event.arenanodes=[]; - event.arenachoice=[]; - event.arenachoicenodes=[]; - event.arrangeNodes=function(){ - var num=event.arenachoicenodes.length; - var width=num*75+(num-1)*8; - for(var i=0;i=3){ - for(var i=0;i胜'; - victory.style.top='auto'; - victory.style.left='auto'; - victory.style.right='20px'; - victory.style.bottom='15px'; - victory.style.fontSize='30px' - victory.style.fontFamily='huangcao'; - victory.firstChild.style.marginRight='5px'; - ui.window.appendChild(victory); - ui.refresh(victory); - victory.show(); - - event.checkPrize=function(){ - // event.kaibao=true; - event.prize=[]; - event.turnCard2=function(){ - if(this.turned) return; - _status.chessclicked=true; - this.turned=true; - var node=this; - setTimeout(function(){ - node.turned2=true; - },1000); - if(node.name=='chess_coin'||node.name=='chess_dust'){ - node.style.transition='all 0s'; - node.style.transform='none'; - node.style.overflow='visible'; - node.style.background='none'; - node.style.boxShadow='none'; - var div=ui.create.div(node); - div.style.transition='all 0s'; - if(node.name=='chess_coin'){ - div.innerHTML=''+node.num+''; - div.firstChild.style.color='rgb(255, 230, 0)'; - node.$coin(); - } - else{ - div.innerHTML=''+node.num+''; - div.firstChild.style.color='rgb(111, 198, 255)'; - div.firstChild.style.marginRight='3px'; - node.$dust(); - } - div.style.fontFamily='huangcao'; - div.style.fontSize='50px'; - div.style.top='40px'; - div.style.letterSpacing='8px'; - div.style.whiteSpace='nowrap'; - // div.dataset.nature='metal'; - - return; - } - node.style.transition='all ease-in 0.3s'; - node.style.transform='perspective(1200px) rotateY(270deg) translateX(150px)'; - var onEnd=function(){ - node.init(node.name); - node.node.avatar.style.display=''; - if(node.rarity){ - node.node.intro.innerHTML=get.translation(node.rarity); - node.node.intro.classList.add('showintro'); - } - node.classList.add('playerflip'); - node.style.transform='none'; - node.style.transition=''; - if(lib.config.animation&&!lib.config.low_performance){ - setTimeout(function(){ - switch(game.getRarity(node.name)){ - case 'rare':node.$rare();break; - case 'epic':node.$epic();break; - case 'legend':node.$legend();break; - } - },150); - } - }; - node.listenTransition(onEnd); - }; - setTimeout(function(){ - nodes[0].delete(); - },400+Math.random()*300); - setTimeout(function(){ - nodes[1].delete(); - },400+Math.random()*300); - setTimeout(function(){ - nodes[2].delete(); - },400+Math.random()*300); - setTimeout(function(){ - nodes[3].delete(); - },400+Math.random()*300); - setTimeout(function(){ - nodes[4].delete(); - },400+Math.random()*300); - setTimeout(function(){ - nodes[5].delete(); - },400+Math.random()*300); - setTimeout(function(){ - nodes[6].delete(); - },400+Math.random()*300); - setTimeout(function(){ - nodes[7].delete(); - },400+Math.random()*300); - setTimeout(function(){ - nodes[8].delete(); - },400+Math.random()*300); - setTimeout(function(){ - var prize=new Array(6); - var map=[1,2,3,4,5]; - var ccount=3; - var win=game.data.arena.win; - var prizeValue; - switch(win){ - case 0:prizeValue=100;break; - case 1:prizeValue=120;break; - case 2:prizeValue=150;break; - case 3:prizeValue=190;break; - case 4:prizeValue=240;break; - case 5:prizeValue=300;break; - case 6:prizeValue=370;break; - case 7:prizeValue=450;break; - case 8:prizeValue=540;break; - case 9:prizeValue=640;break; - case 10:prizeValue=750;break; - case 11:prizeValue=870;break; - case 12:prizeValue=1000;break; - } - if(Math.random()<0.4){ - if(win>=3&&Math.random()<0.5){ - ccount=4; - prizeValue-=33; - } - else{ - ccount=2; - prizeValue+=33; - } - } - prizeValue-=100; - while(ccount--){ - prize[map.randomRemove()]=game.getLeaderCharacter(); - } - if(map.length){ - prizeValue/=map.length; - } - while(map.length){ - var val=Math.round((Math.random()*0.4+0.8)*prizeValue); - if(Math.random()<0.7){ - prize[map.shift()]=['chess_coin',Math.max(Math.ceil(Math.random()*5),val)]; - } - else{ - val=Math.round(val/3); - prize[map.shift()]=['chess_dust',Math.max(Math.ceil(Math.random()*3),val)]; - } - } - for(var i=1;i=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(); - }; - - var clickedJiange=false; - var clickJiange=function(){ - clickedJiange=true; - if(this.classList.contains('glow2')){ - this.classList.remove('glow2'); - } - else{ - this.classList.add('glow2'); - } - addToButton(); - }; - - - for(var i=0;inum){ - for(var i=num;i2) return false; - var xy1=event.source.getXY(); - var xy2=player.getXY(); - var dx=xy2[0]-xy1[0]; - var dy=xy2[1]-xy1[1]; - // if(dx*dy!=0) return false; - if(dx==0&&Math.abs(dy)==2){ - dy/=2; - } - if(dy==0&&Math.abs(dx)==2){ - dx/=2; - } - return player.movable(dx,dy); - }, - content:function(){ - var xy1=trigger.source.getXY(); - var xy2=player.getXY(); - var dx=xy2[0]-xy1[0]; - var dy=xy2[1]-xy1[1]; - if(dx==0&&Math.abs(dy)==2){ - dy/=2; - } - if(dy==0&&Math.abs(dx)==2){ - dx/=2; - } - if(player.movable(dx,dy)){ - player.move(dx,dy); - } - } - }, - dubiaoxianjing:{ - global:'dubiaoxianjing2' - }, - dubiaoxianjing2:{ - trigger:{player:'phaseAfter'}, - forced:true, - popup:false, - filter:function(event,player){ - if(player.hp<=1) return false; - for(var i=0;i1) return false; - for(var i=0;inh) return false; - } - return true; - } - } - return false; - }, - content:function(){ - 'step 0' - var source=null; - for(var i=0;i3; - } - } - return false; - }, - content:function(){ - 'step 0' - var source=null; - for(var i=0;igame.data.arena.dead.length; - }, - direct:true, - delay:0, - preservecancel:true, - content:function(){ - "step 0" - var list=game.data.arena.arenachoice.slice(0); - for(var i=0;i

' - for(var i=0;i'+ - (skill.chance(targets[i],player)*100).toFixed(2)+'%
'; - } - str+='

' - } - return str; - }, - chance:function(target,player){ - var chance; - var renyi=player.hasSkill('leader_renyi'); - switch(target.hp){ - case 1:chance=0.7;break; - case 2:chance=0.4;break; - default:chance=0.2;break; - } - switch(target.countCards('he')){ - case 0:break; - case 1:chance/=1.2;break; - case 2:chance/=1.4;break; - case 3:chance/=1.7;break; - default:chance/=2;break; - } - switch(game.getRarity(target.name)){ - case 'common':{ - if(renyi) chance*=2; - break; - } - case 'rare':{ - chance/=2; - if(renyi) chance*=2; - break; - } - case 'epic':{ - chance/=5; - if(renyi) chance*=1.5; - break; - } - case 'legend':{ - chance/=15; - if(renyi) chance*=1.2; - break; - } - } - return Math.min(1,chance); - }, - filter:function(){ - return game.data.dust>=10; - }, - filterTarget:function(card,player,target){ - return game.isChessNeighbour(player,target)&&!game.data.character.contains(target.name); - }, - content:function(){ - var chance=lib.skill.leader_zhaoxiang.chance(target,player); - game.changeDust(-10); - if(Math.random()0; - }, - content:function(){ - switch(_status.difficulty){ - case 'leader_easy':game.reward+=2*trigger.num;break; - case 'leader_medium':game.reward+=4*trigger.num;break; - case 'leader_hard':game.reward+=6*trigger.num;break; - } - } - }, - leader_renyi:{ - unique:true, - }, - leader_mouduan:{ - unique:true, - global:'leader_mouduan2' - }, - leader_mouduan2:{ - mod:{ - chessMove:function(player,current){ - if(player.side&&player.name!=_status.lord) return current+1; - } - } - }, - tongshuai:{ - unique:true, - forbid:['guozhan'], - init:function(player){ - player.storage.tongshuai={ - list:[], - owned:{}, - player:player, - get:function(num){ - if(typeof num!='number') num=1; - var player=this.player; - while(num--){ - var name=player.storage.tongshuai.unowned.shift(); - if(!name) return; - var skills=lib.character[name][3].slice(0); - for(var i=0;i
【'+get.translation(skill)+ - '】
'+lib.translate[skill+'_info']+'
'); - } - } - }, - // mark:true - }, - tongshuai1:{ - trigger:{global:'gameStart'}, - forced:true, - popup:false, - priority:10, - content:function(){ - for(var i=0;i1){ - player.storage.tongshuai.get(2); - } - else if(player.storage.tongshuai.unowned.length==1){ - player.storage.tongshuai.get(); - } - else{ - player.removeSkill('tongshuai'); - } - } - }, - tongshuai2:{ - audio:2, - trigger:{player:['phaseBegin','phaseEnd'],global:'gameStart'}, - filter:function(event,player,name){ - if(!player.hasSkill('tongshuai')) return false; - if(name=='phaseBegin'&&game.phaseNumber==1) return false; - return true; - }, - priority:-9, - forced:true, - popup:false, - content:function(){ - var slist=player.storage.tongshuai.owned; - var list=[]; - for(var i in slist){ - list.push(i); - } - if(event.isMine()){ - event.dialog=ui.create.dialog('选择获得一项技能',[list,'character']); - if(trigger.name=='game'){ - event.control=ui.create.control(); - } - else{ - event.control=ui.create.control(['cancel']); - } - event.clickControl=function(link){ - if(link!='cancel'){ - var currentname=event.dialog.querySelector('.selected.button').link; - var mark=player.marks.tongshuai; - if(!mark){ - player.markSkill('tongshuai'); - mark=player.marks.tongshuai; - if(mark.firstChild){ - mark.firstChild.remove(); - } - } - mark.setBackground(currentname,'character'); - - player.addAdditionalSkill('tongshuai',link); - game.addVideo('chess_tongshuai_skill',player,[currentname,link]); - player.logSkill('tongshuai2'); - game.log(player,'获得技能','【'+get.translation(link)+'】'); - player.popup(link); - - for(var i=0;i0; - }, - content:function(){ - player.storage.tongshuai.get(); - } - }, - cangming:{ - enable:'phaseUse', - usable:1, - unique:true, - filter:function(event,player){ - if(player.isTurnedOver()) return false; - var suits=[]; - var hs=player.getCards('h'); - for(var i=0;i=4) return true; - } - return false; - }, - filterCard:function(card){ - var suit=get.suit(card); - for(var i=0;i1) break; - } - } - if(num<=1) return; - if(_status.currentPhase==player&&player.countCards('h')=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.hasSkill('cangming2')) return 'zeroplayertarget'; - } - } - }, - result:{ - target:function(player){ - var num=0; - for(var i=0;i1) break; - } - } - if(num<=1) return 0; - return -10; - } - } - }, - }, - cangming2:{ - trigger:{player:'phaseBegin'}, - forced:true, - popup:false, - content:function(){ - for(var i=0;i0; - }, - check:function(event,player){ - var targets=lib.skill.guanchuan.getTargets(player,event.targets[0]); - var eff=0; - for(var i=0;i0; - }, - content:function(){ - var targets=lib.skill.guanchuan.getTargets(player,trigger.targets[0]); - for(var i=0;i1&&lib.filter.filterCard({name:'sha'},player); - }, - filterCard:{name:'sha'}, - selectCard:2, - check:function(card){ - var num=0; - var player=_status.event.player; - for(var i=0;i0){ - num++; - if(num>1) return 8-get.value(card); - } - } - return 0; - }, - selectTarget:[1,Infinity], - discard:false, - prepare:'throw', - filterTarget:function(card,player,target){ - return lib.filter.targetEnabled({name:'sha'},player,target)&& - get.distance(player,target,'pure')<=5; - }, - content:function(){ - targets.sort(lib.sort.seat); - player.useCard({name:'sha'},cards,targets,'luanjian').animate=false; - }, - multitarget:true, - ai:{ - order:function(){ - return get.order({name:'sha'})+0.1; - }, - result:{ - target:function(player,target){ - return get.effect(target,{name:'sha'},player,target); - } - }, - effect:{ - player:function(card,player){ - if(_status.currentPhase!=player) return; - if(card.name=='sha'&&player.countCards('h','sha')<2&&player.countCards('h')<=player.hp){ - var num=0; - var player=_status.event.player; - for(var i=0;i1) return 'zeroplayertarget'; - } - } - } - } - }, - } - }, - zhiming:{ - trigger:{source:'damageBegin'}, - filter:function(event,player){ - return get.distance(event.player,player,'attack')>1&&event.card&&event.card.name=='sha'; - }, - forced:true, - content:function(){ - trigger.num++; - } - }, - lianshe:{ - mod:{ - cardUsable:function(card,player,num){ - if(card.name=='sha'){ - return num+player.countUsed()-player.countUsed('sha'); - } - }, - }, - trigger:{player:'useCard'}, - frequent:true, - filter:function(event){ - return event.card&&event.card.name=='sha'; - }, - usable:1, - content:function(){ - player.draw(); - }, - ai:{ - threaten:1.5 - } - }, - pianyi:{ - trigger:{player:'phaseEnd'}, - direct:true, - filter:function(event,player){ - return !player.getStat('damage'); - }, - content:function(){ - "step 0" - player.chooseToMove(2,get.prompt('pianyi')); - "step 1" - if(result.bool){ - player.logSkill('pianyi'); - } - } - }, - lingdong:{ - trigger:{player:'phaseEnd'}, - direct:true, - filter:function(event,player){ - return player.countUsed('sha')>0; - }, - content:function(){ - "step 0" - player.chooseToMove(player.countUsed('sha'),get.prompt('lingdong')); - "step 1" - if(result.bool){ - player.logSkill('lingdong'); - } - } - }, - _noactpunish:{ - trigger:{player:'useCard'}, - filter:function(event,player){ - return _status.currentPhase==player&&event.targets&&(event.targets.length>1||event.targets[0]!=player); - }, - forced:true, - popup:false, - content:function(){ - player.addTempSkill('noactpunish'); - } - }, - noactpunish:{}, - _chess_chuzhang:{ - enable:'phaseUse', - usable:1, - direct:true, - delay:false, - preservecancel:true, - filter:function(event,player){ - var num=0; - var xy=player.getXY(); - var neighbour; - neighbour=player.getNeighbour(-1,0); - if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ - num++; - } - else if(xy[0]==0){ - num++; - } - neighbour=player.getNeighbour(1,0); - if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ - num++; - } - else if(xy[0]+1>=ui.chesswidth){ - num++; - } - neighbour=player.getNeighbour(0,-1); - if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ - num++; - } - else if(xy[1]==0){ - num++; - } - neighbour=player.getNeighbour(0,1); - if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ - num++; - } - else if(xy[1]+1>=ui.chessheight){ - num++; - } - return num>=3; - }, - content:function(){ - 'step 0' - event.obstacles=[]; - event.movemap={}; - var neighbour; - neighbour=player.getNeighbour(-1,0); - if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ - event.obstacles.push(neighbour); - if(player.movable(-2,0)){ - event.movemap['[-1,0]']=neighbour; - } - } - neighbour=player.getNeighbour(1,0); - if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ - event.obstacles.push(neighbour); - if(player.movable(2,0)){ - event.movemap['[1,0]']=neighbour; - } - } - neighbour=player.getNeighbour(0,-1); - if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ - event.obstacles.push(neighbour); - if(player.movable(0,-2)){ - event.movemap['[0,-1]']=neighbour; - } - } - neighbour=player.getNeighbour(0,1); - if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ - event.obstacles.push(neighbour); - if(player.movable(0,2)){ - event.movemap['[0,1]']=neighbour; - } - } - if(!event.obstacles.length){ - event.finish(); - return; - } - else if(event.obstacles.length==1){ - event.obstacle=event.obstacles[0]; - } - else if(event.isMine()){ - for(var i=0;i'+lib.translate._chess_chuzhang_info+''); - event.custom.replace.confirm=function(){ - player.getStat().skill._chess_chuzhang--; - event.cancelled=true; - game.resume(); - }; - } - 'step 1' - if(ui.confirm){ - ui.confirm.classList.add('removing'); - } - _status.imchoosing=false; - if(!event.cancelled){ - if(!event.obstacle){ - event.obstacle=event.obstacles.randomGet(); - } - var moved=false; - for(var i in event.movemap){ - if(event.movemap[i]==event.obstacle){ - var xy=JSON.parse(i); - if(game.moveObstacle(event.obstacle,xy[0],xy[1])){ - moved=true; - break; - } - } - } - if(!moved){ - game.removeObstacle(event.obstacle); - } - player.popup('除障'); - game.delay(); - } - for(var i=0;i0; - }, - content:function(){ - "step 0" - var move=2; - move=game.checkMod(player,move,'chessMove',player); - player.chooseToMove(move).phasing=true; - "step 1" - if(ui.confirm){ - ui.confirm.classList.add('removing'); - } - if(!result.bool){ - var skill=player.getStat().skill; - skill._chessmove--; - if(typeof skill._chessmovetried=='number'){ - skill._chessmovetried++; - } - else{ - skill._chessmovetried=1; - } - } - }, - ai:{ - order:5, - result:{ - playerx:function(player){ - if(get.mode()=='tafang'&&_status.enemies.contains(player)){ - return 1; - } - var nh=player.countCards('h'); - if(!player.countCards('h','sha')&& - !player.countCards('h','shunshou')&& - !player.countCards('h','bingliang')){ - if(nh<=Math.min(3,player.hp)) return Math.random()-0.3; - else if(nh<=Math.min(2,player.hp)) return Math.random()-0.4; - return Math.random()-0.5; - } - var neighbour; - neighbour=player.getNeighbour(0,1); - if(neighbour&&game.players.contains(neighbour)&&neighbour.side!=player.side){ - if(get.distance(player,neighbour,'attack')<1) return 1; - return 0; - } - neighbour=player.getNeighbour(0,-1); - if(neighbour&&game.players.contains(neighbour)&&neighbour.side!=player.side){ - if(get.distance(player,neighbour,'attack')<1) return 1; - return 0; - } - neighbour=player.getNeighbour(1,0); - if(neighbour&&game.players.contains(neighbour)&&neighbour.side!=player.side){ - if(get.distance(player,neighbour,'attack')<1) return 1; - return 0; - } - neighbour=player.getNeighbour(-1,0); - if(neighbour&&game.players.contains(neighbour)&&neighbour.side!=player.side){ - if(get.distance(player,neighbour,'attack')<1) return 1; - return 0; - } - return 1; - }, - player:function(player){ - if(player.getStat().skill._chessmovetried>=10){ - return 0; - } - var x=lib.skill._chessmove.ai.result.playerx(player); - if(player.isMad()) return -x; - return x; - } - } - } - }, - _chesscenter:{ - trigger:{player:['phaseBegin','useCardBegin','useSkillBegin','respondBegin','damageBegin','loseHpBegin'], - target:'useCardToBegin'}, - forced:true, - priority:100, - popup:false, - content:function(){ - player.chessFocus(); - }, - }, - boss_bfengxing:{ - 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-get.value(card);}, - filterTarget:function(card,player,target){ - return get.distance(player,target)<=5&&player!=target; - }, - filter:function(event,player){ - return player.countCards('h',{color:'red'})>0; - }, - selectTarget:-1, - content:function(){ - target.damage('fire'); - }, - line:'fire', - ai:{ - order:1, - result:{ - target:function(player,target){ - return 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.countCards('he',{subtype:get.subtype(card)})>1){ - return 12-get.equipValue(card); - } - return 8-get.equipValue(card); - }, - filter:function(event,player){ - return player.countCards('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 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=ui.chessheight-1) return false; - } - var node=ui.create.div('.player.minskin.playergrid',player.parentNode); - node.link=player; - ui.placeChess(node,pos); - return node; - }, - fakeme:function(){ - if(ui.fakeme){ - ui.fakeme.delete(); - } - ui.fakeme=ui.create.div('.fakeme.avatar',ui.me); - ui.fakeme.style.backgroundImage=game.me.node.avatar.style.backgroundImage; - } - }, - click:{ - moveContainer:function(x,y,scroll){ - if(scroll){ - clearTimeout(ui.chessContainer._scrolling); - ui.chessContainer._scrolling=true; - ui.chess.style.transition='transform 0.5s'; - ui.refresh(ui.chess); - } - else if(ui.chessContainer._scrolling){ - return; - } - if(typeof x==='number') ui.chessContainer.chessLeft+=x; - if(typeof y==='number') ui.chessContainer.chessTop+=y; - var xmin=0; - if(lib.config.show_history=='left'){ - xmin=-50; - } - if(ui.chessContainer.chessLeftxmax) ui.chessContainer.chessLeft=xmax; - if(ui.chessContainer.chessTop>ymax) ui.chessContainer.chessTop=ymax; - ui.chess.style.transform='translate('+(-ui.chessContainer.chessLeft)+'px,'+(-ui.chessContainer.chessTop)+'px)'; - if(scroll){ - var ending=ui.chess.listenTransition(function(){ - if(ui.chess._ending==ending){ - clearTimeout(ui.chessContainer._scrolling); - delete ui.chess._ending; - ui.chess._scrolling=setTimeout(function(){ - ui.chessContainer._scrolling=null; - ui.chess.style.transition=''; - },500); - } - }); - ui.chess._ending=ending; - } - }, - chessInfo:function(e){ - if(this.link.isAlive()){ - this.link.chessFocus(); - if(this.link.classList.contains('selectable')|| - this.link.classList.contains('selected')){ - ui.click.target.call(this.link,e); - ui.click.window.call(ui.window,e); - } - e.stopPropagation(); - } - }, - playergrid:function(){ - if(!_status.paused) return; - var pos=parseInt(this.dataset.position); - this.link.moveTo(pos%ui.chesswidth,Math.floor(pos/ui.chesswidth)); - if(ui.movegrids){ - while(ui.movegrids.length){ - ui.movegrids.shift().delete(); - } - } - _status.event.result={ - bool:true, - move:this.link.dataset.position - }; - game.resume(); - }, - obstacle:function(){ - if(_status.event.chooseObstacle&&_status.paused&& - _status.event.obstacles&&_status.event.obstacles.contains(this)){ - _status.event.obstacle=this; - game.resume(); - } - } - } - }, - get:{ - chessDistance:function(from,to){ - var fxy=from.getXY(); - var txy=to.getXY(); - return Math.abs(fxy[0]-txy[0])+Math.abs(fxy[1]-txy[1]); - }, - rawAttitude:function(from,to){ - return (from.side===to.side?6:-6); - } - }, - card:{ - chess_shezhang:{ - type:'basic', - fullskin:true, - modeimage:'chess', - enable:true, - filterTarget:function(card,player,target){ - if(target.movable(-1,0)) return true; - if(target.movable(1,0)) return true; - if(target.movable(0,-1)) return true; - if(target.movable(0,1)) return true; - return false; - }, - content:function(){ - var xy=target.getXY(); - var x=xy[0]; - var y=xy[1]; - if(target.movable(-1,0)){ - game.addTempObstacle(x-1,y,game.countPlayer()); - } - if(target.movable(1,0)){ - game.addTempObstacle(x+1,y,game.countPlayer()); - } - if(target.movable(0,1)){ - game.addTempObstacle(x,y+1,game.countPlayer()); - } - if(target.movable(0,-1)){ - game.addTempObstacle(x,y-1,game.countPlayer()); - } - }, - content_old:function(){ - 'step 0' - var pos=parseInt(player.dataset.position); - var poses=[]; - if(player.movable(-1,0)){ - poses.push(pos-1); - } - if(player.movable(1,0)){ - poses.push(pos+1); - } - if(player.movable(0,-1)){ - poses.push(pos-ui.chesswidth); - } - if(player.movable(0,1)){ - poses.push(pos+ui.chesswidth); - } - event.poses=poses; - if(poses.length==1){ - event.obstacle=poses[0]; - event.grids=[]; - } - else if(event.isMine()){ - event.grids=player.createRangeShadow(1,function(){ - event.obstacle=this.dataset.position; - game.resume(); - }) - game.pause(); - _status.imchoosing=true; - for(var i=0;i对阵模式
  • n人对战n人的模式,由单人控制,开始游戏后随机分配位置与出牌顺序
  • '+ - '每人在出牌阶段有一次移动的机会,可移动的最大距离为2
  • '+ - '任何卡牌或技能无法指定位置相隔8个格以上的角色为目标
  • '+ - '杀死对方阵营的角色可摸一张牌,杀死本方阵营无惩罚
  • '+ - '若开启主将,双方各选择一名角色成为主将。主将体力上限加一,主将死亡后,若有副将,副将代替之成为主将,否则游戏结束
  • '+ - '开启无尽模式后,任何一方有角色死亡都将选择一名新角色重新加入战场,直到点击左上角的结束游戏按钮手动结束游戏。结束游戏时,杀敌更多的一方获胜
  • '+ - '行动顺序为指定时,双方无论存活角色角色多少都将轮流进行行动。在一方所有角色行动完毕进行下一轮行动时,若其人数比另一方少,另一方可指定至多X名角色名摸一张牌,X为人数之差
  • '+ - '开启战场机关后,每个回合结束时有一定机率出现一个机关,该机关不参与战斗,并有一个影响周围或全体角色的效果。机关在出现后的5~10个回合内消失
  • '+ - '开启击退效果后,当一名角色对距离两格以内的目标造成伤害后,受伤害角色将沿反方向移动一格
  • '+ - '战场上可设置出现随机路障,角色无法移动到路障处。当一名角色的周围四格有至少三格为路障或在战场外时,其可以在回合内清除一个相邻路障
'+ - '
君主模式
  • 收集武将进行战斗,根据战斗难度及我方出场武将的强度,战斗胜利后将获得数量不等的金钱。没有君主出场时,获得的金钱较多
  • '+ - '金钱可以用来招募随机武将,招到已有武将,或遣返不需要的武将时可得到招募令
  • '+ - '战斗中有君主出场时可招降敌将,成功率取决于敌将的稀有度、剩余体力值以及手牌数。成功后战斗立即结束且没有金钱奖励。每发动一次招降,无论成功还是失败,都会扣除10招募令
  • '+ - '挑战武将会与该武将以及与其强度相近的武将进行战斗,敌方人数与我方出场人数相同,但不少于3。胜利后可通过招募令招募该武将,普通/稀有/史诗/传说武将分别需要40/100/400/1600招募令
  • '+ - '竞技场:
    随机选择9名武将,每次派出1~3名武将参战。战斗中阵亡的武将不能再次上场。

    战斗后武将进入疲劳状态,若立即再次出场则初始体力值-1。

    战斗中本方武将行动时可召唤后援,令一名未出场的已方武将加入战斗。后援武将在战斗结束后无论存活与否均不能再次出场

    当取得12场胜利或所有武将全部阵亡后结束,并根据胜场数获得随机奖励
  • '+ - '修改金钱:
    game.changeMoney
    修改招募令:
    game.changeDust
' - }, - }; -}); +'use strict'; +game.import('mode',function(lib,game,ui,get,ai,_status){ + return { + name:'chess', + canvasUpdates2:[], + hiddenCharacters:[], + start:function(){ + "step 0" + _status.gameDrawed=true; + _status.mode=get.config('chess_mode'); + if(lib.config.player_border=='normal'&&(lib.config.layout=='long'||lib.config.layout=='long2')){ + ui.arena.classList.add('lslim_player'); + } + // if(_status.mode=='leader'){ + // _status.mode='combat'; + // } + if(lib.config.test_game){ + _status.mode='combat'; + game.saveConfig('additional_player',false,true); + } + if(_status.mode=='combat'){ + _status.first_less=true; + } + "step 1" + for(var i in lib.skill){ + if(lib.skill[i].changeSeat){ + lib.skill[i]={}; + if(lib.translate[i+'_info']){ + lib.translate[i+'_info']='此模式下不可用'; + } + } + } + lib.init.css(lib.assetURL+'layout/mode','chess'); + ui.chesssheet=document.createElement('style'); + document.head.appendChild(ui.chesssheet); + var playback=localStorage.getItem(lib.configprefix+'playback'); + lib.treasurelist=[]; + if(get.config('chess_character')||playback||_status.mode=='leader'){ + for(var i in lib.characterPack.mode_chess){ + if(i.indexOf('treasure_')==0){ + lib.treasurelist.push(i); + } + if(!playback&&i.indexOf('leader_')==0&&_status.mode!='leader') continue; + lib.character[i]=lib.characterPack.mode_chess[i]; + if(!lib.character[i][4]){ + lib.character[i][4]=[]; + } + } + } + if(get.config('chess_card')){ + lib.card.list.addArray(lib.chess_cardlist); + } + ui.create.cardsAsync(); + game.finishCards(); + game.addGlobalSkill('autoswap'); + ui.chessContainer=ui.create.div('#chess-container',ui.arena); + ui.chessContainer.move=ui.click.moveContainer; + ui.chessContainer.chessLeft=0; + ui.chessContainer.chessTop=0; + // lib.setScroll(ui.chessContainer); + ui.chess=ui.create.div('#chess',ui.chessContainer); + ui.canvas2=document.createElement('canvas'); + ui.canvas2.id='canvas2'; + ui.chess.appendChild(ui.canvas2); + ui.ctx2=ui.canvas2.getContext('2d'); + game.me=ui.create.player(); + if(playback){ + for(var i in lib.characterPack){ + for(var j in lib.characterPack[i]){ + lib.character[j]=lib.character[j]||lib.characterPack[i][j]; + } + } + game.pause(); + ui.system.style.display='none'; + _status.playback=playback; + localStorage.removeItem(lib.configprefix+'playback'); + var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); + store.get(parseInt(playback)).onsuccess=function(e){ + if(e.target.result){ + event.video=e.target.result.video; + game.resume(); + } + else{ + alert('播放失败:找不到录像'); + game.reload(); + } + } + } + else{ + switch(_status.mode){ + case 'leader':{ + game.leaderView(); + break; + } + case 'three':{ + if(lib.config.continue_name_chess){ + event._result={ + friend:lib.config.continue_name_chess.friend, + enemy:lib.config.continue_name_chess.enemy, + } + _status.color=lib.config.continue_name_chess.color; + game.saveConfig('continue_name_chess'); + game.delay(0.5); + lib.init.onfree(); + } + else{ + game.chooseCharacterDouble(function(i){ + if(lib.character[i][4].contains('chessboss')){ + return false; + } + return !lib.filter.characterDisabled(i); + },function(i){ + switch(i){ + case 0:return '主帅'; + case 1:return '副帅'; + default:return '前锋'; + } + }); + } + break; + } + case 'combat':{ + game.chooseCharacter(); + break; + } + default:{ + game.chooseCharacter(); + } + } + } + "step 2" + ui.arena.classList.add('chess'); + if(_status.mode=='three'){ + _status.mylist=result.friend; + _status.enemylist=result.enemy; + _status.friendBackup=_status.mylist.slice(0); + _status.enemyBackup=_status.enemylist.slice(0); + } + var mylistmap,enemylistmap; + if(event.video){ + var videocontent; + for(var ii=0;ii0){ + var ng=Math.floor(gridnum*nco); + for(var i=0;i_status.enemyDied){ + game.forceOver(false); + } + else{ + game.forceOver(); + } + }); + ui.finishGame.classList.add('finish_game'); + ui.finishGame.parentNode.insertBefore(finishGameBr,ui.finishGame); + } + + ui.create.me(); + ui.create.fakeme(); + + if(!event.video&&((_status.mode=='combat'&&get.config('zhu')&&!_status.vsboss&&game.players.length>2)||_status.mode=='three')){ + game.friendZhu=event.friendZhu; + game.friendZhu.hp++; + game.friendZhu.maxHp++; + game.friendZhu.update(); + game.friendZhu.node.identity.firstChild.innerHTML='将'; + + for(var i=0;i=ui.chesswidth){ + x=ui.chesswidth-1; + } + if(y>=ui.chessheight){ + y=ui.chessheight-1; + } + + var pos=y*ui.chesswidth+x; + if(!lib.posmap[pos]){ + delete lib.posmap[this.dataset.position]; + // this.changeSeat(pos,false); + ui.placeChess(this,pos); + lib.posmap[pos]=this; + this.chessFocus(); + } + + if(get.mode()=='tafang'&&!_status.video){ + if(_status.tafangend.contains(this.dataset.position)){ + if(_status.enemies.contains(this)){ + game.over(false); + } + else{ + this.delete(); + delete lib.posmap[this]; + game.players.remove(this); + _status.friends.remove(this); + this.classList.add('dead'); + if(_status.roundStart==this){ + _status.roundStart=player.next||player.getNext()||game.players[0]; + } + if(this==game.me){ + if(ui.confirm){ + ui.confirm.close(); + } + if(_status.friends.length==0){ + ui.fakeme.hide(); + this.node.handcards1.delete(); + this.node.handcards2.delete(); + game.me=ui.create.player(); + game.me.side=false; + game.addVideo('removeTafangPlayer'); + } + else{ + game.modeSwapPlayer(_status.friends[0]); + } + } + for(var i=0;i0&&this.movable(1,0)) return true; + if(dy<0&&this.movable(0,-1)) return true; + if(dy>0&&this.movable(0,1)) return true; + return false; + }, + moveTowards:function(target,forbid){ + var fxy=this.getXY(); + var txy; + if(Array.isArray(target)){ + txy=target; + } + else if(typeof target=='string'){ + var pos=parseInt(target); + txy=[pos%ui.chesswidth,Math.floor(pos/ui.chesswidth)]; + } + else{ + txy=target.getXY(); + } + var dx=txy[0]-fxy[0]; + var dy=txy[1]-fxy[1]; + forbid=forbid||[]; + if(Math.abs(dx)>Math.abs(dy)){ + if(dx<0){ + if(!forbid.contains('moveLeft')&&this.movable(-1,0)){ + this.moveLeft(); + return 'moveLeft'; + } + } + else if(dx>0){ + if(!forbid.contains('moveRight')&&this.movable(1,0)){ + this.moveRight(); + return 'moveRight'; + } + } + if(dy<0){ + if(!forbid.contains('moveUp')&&this.movable(0,-1)){ + this.moveUp(); + return 'moveUp'; + } + } + else if(dy>0){ + if(!forbid.contains('moveDown')&&this.movable(0,1)){ + this.moveDown(); + return 'moveDown'; + } + } + } + else{ + if(dy<0){ + if(!forbid.contains('moveUp')&&this.movable(0,-1)){ + this.moveUp(); + return 'moveUp'; + } + } + else if(dy>0){ + if(!forbid.contains('moveDown')&&this.movable(0,1)){ + this.moveDown(); + return 'moveDown'; + } + } + if(dx<0){ + if(!forbid.contains('moveLeft')&&this.movable(-1,0)){ + this.moveLeft(); + return 'moveLeft'; + } + } + else if(dx>0){ + if(!forbid.contains('moveRight')&&this.movable(1,0)){ + this.moveRight(); + return 'moveRight'; + } + } + } + return false; + }, + chessFocus:function(){ + game.addVideo('chessFocus',this); + if(ui.chess._chessdrag) return; + if(_status.chessscrolling) return; + var player=this; + var dx=0,dy=0; + + if(player.getLeft()-ui.chessContainer.chessLeft<14){ + dx=player.getLeft()-ui.chessContainer.chessLeft-14; + } + else if(player.getLeft()-ui.chessContainer.chessLeft>ui.chessContainer.offsetWidth-134){ + dx=player.getLeft()-ui.chessContainer.chessLeft-ui.chessContainer.offsetWidth+134; + } + if(player.getTop()-ui.chessContainer.chessTop<14){ + dy=player.getTop()-ui.chessContainer.chessTop-14; + } + else if(player.getTop()+ui.chess.offsetTop-ui.chessContainer.chessTop>ui.chessContainer.offsetHeight-134){ + dy=player.getTop()+ui.chess.offsetTop-ui.chessContainer.chessTop-ui.chessContainer.offsetHeight+134; + } + // if(_status.currentChessFocus){ + // cancelAnimationFrame(_status.currentChessFocus); + // } + var count=lib.config.low_performance?6:12; + var ddx=Math.floor(dx/count); + var ddy=Math.floor(dy/count); + if(dx||dy){ + ui.chessContainer.move(dx,dy,true); + // var chessFocus=function(){ + // if(count--){ + // ui.chessContainer.chessLeft+=ddx; + // ui.chessContainer.chessTop+=ddy; + // _status.currentChessFocus=requestAnimationFrame(chessFocus); + // } + // else{ + // ui.chessContainer.chessLeft+=dx%count; + // ui.chessContainer.chessTop+=dy%count; + // cancelAnimationFrame(_status.currentChessFocus); + // delete _status.currentChessFocus; + // } + // }; + // _status.currentChessFocus=requestAnimationFrame(chessFocus); + } + }, + getXY:function(){ + var pos=parseInt(this.dataset.position); + var x=pos%ui.chesswidth; + var y=Math.floor(pos/ui.chesswidth); + return [x,y]; + }, + getDataPos:function(x,y){ + var xy=this.getXY(); + if(typeof x!='number') x=0; + if(typeof y!='number') y=0; + x+=xy[0]; + y+=xy[1]; + return x+y*ui.chesswidth; + }, + getNeighbour:function(x,y){ + var xy=this.getXY(); + if(xy[0]+x<0) return null; + if(xy[1]+y<0) return null; + if(xy[0]+x>=ui.chesswidth) return null; + if(xy[1]+y>=ui.chessheight) return null; + return lib.posmap[this.getDataPos(x,y)]||null; + }, + getNeighbours:function(){ + var players=[]; + for(var i=0;i=ui.chesswidth) return false; + if(xy[1]+y>=ui.chessheight) return false; + return !this.getNeighbour(x,y); + }, + moveRight:function(){ + if(this.movable(1,0)){ + this.move(1,0); + return true; + } + return false; + }, + moveLeft:function(){ + if(this.movable(-1,0)){ + this.move(-1,0); + return true; + } + return false; + }, + moveUp:function(){ + if(this.movable(0,-1)){ + this.move(0,-1); + return true; + } + return false; + }, + moveDown:function(){ + if(this.movable(0,1)){ + this.move(0,1); + return true; + } + return false; + }, + dieAfter2:function(){ + var player=this; + delete lib.posmap[player.dataset.position]; + setTimeout(function(){ + player.delete(); + },500); + for(var i=0;i1){ + if(cards){ + that.$gain(cards,null,false) + } + else{ + that.$gain(num-1,null,false) + } + } + }, + $throw:function(card,time,init){ + if(init!==false){ + if(get.itemtype(card)!='cards'){ + if(get.itemtype(card)=='card'){ + card=[card]; + } + else{ + return; + } + } + game.addVideo('throw',this,[get.cardsInfo(card),time]); + } + this.chessFocus(); + if(get.itemtype(card)=='cards'){ + for(var i=0;i=0){ + for(var i=0;i=ui.chessContainer.offsetHeight){ + amin=0; + amax=90; + } + else{ + amin=-90; + amax=90; + } + } + else if(rect.left+rect.width+80>=ui.chessContainer.offsetWidth){ + if(rect.top<=80){ + amin=180; + amax=270; + } + else if(rect.top+rect.height+80>=ui.chessContainer.offsetHeight){ + amin=90; + amax=180; + } + else{ + amin=90; + amax=270; + } + } + else if(rect.top<=80){ + amin=180; + amax=360; + } + else if(rect.top+rect.height+80>=ui.chessContainer.offsetHeight){ + amin=0; + amax=180; + } + else{ + var dx=ui.chessContainer.offsetWidth/2-(rect.left+rect.width/2); + var dy=-ui.chessContainer.offsetHeight/2+(rect.top+rect.height/2); + var ang=Math.abs(Math.atan(dy/dx))*180/Math.PI; + if(dx<0){ + if(dy>0){ + ang=180-ang; + } + else{ + ang+=180; + } + } + else if(dy<0){ + ang=360-ang; + } + amin=ang-180; + amax=ang+180; + } + var da=(amax-amin)/(thrown.length*2); + if(da>30&&thrown.length>1){ + amin+=(da-30)*thrown.length; + da=30; + } + for(var i=0;i.player'+pos+ + // '{left:'+(14+i*148)+'px;top:'+(14+j*148)+'px}',0); + ui.chesssheet.sheet.insertRule('#arena.chess #chess>.card'+pos+ + '{left:'+(22+i*148)+'px;top:'+(22+j*148)+'px}',0); + ui.chesssheet.sheet.insertRule('#arena.chess #chess>.popup'+pos+ + '{left:'+(19+i*148)+'px;top:'+(142+j*148)+'px}',0); + } + } + }, + getVideoName:function(){ + var str='战棋'+get.translation(_status.mode)+' - '+_status.friendCount+'v'+_status.enemyCount; + var name=[get.translation(game.me.name),str]; + return name; + }, + addChessPlayer:function(name,enemy,num,pos){ + if(typeof num!='number'){ + num=4; + } + var player=ui.create.player(); + player.getId(); + if(enemy=='treasure'){ + player.animate('judgestart'); + player.side=null; + player.identity='neutral'; + player.setIdentity(); + player.node.identity.dataset.color='zhong'; + player.classList.add('treasure'); + player.node.hp.classList.add('treasure'); + player.life=6+Math.floor(Math.random()*6); + game.treasures.add(player); + } + else{ + player.animate('start'); + if(enemy){ + if(get.mode()=='tafang'){ + player.side=true; + } + else{ + player.side=!game.me.side; + } + player.setIdentity('enemy'); + player.identity='enemy'; + } + else{ + if(get.mode()=='tafang'){ + player.side=false; + } + else{ + player.side=game.me.side; + } + player.setIdentity('friend'); + player.identity='friend'; + } + player.node.identity.dataset.color=get.translation(player.side+'Color'); + game.players.push(player); + // if(lib.config.animation){ + // setTimeout(function(){ + // player.$rare2(); + // },300); + // } + } + ui.chess.appendChild(player); + if(_status.video||(pos&&!lib.posmap[pos])){ + ui.placeChess(player,pos); + } + else{ + var grids=[]; + var gridnum=ui.chessheight*ui.chesswidth; + for(var i=0;i=ui.chesswidth){ + x=ui.chesswidth-1; + } + if(y>=ui.chessheight){ + y=ui.chessheight-1; + } + + pos=y*ui.chesswidth+x; + } + if(!lib.posmap[pos]){ + var grid=ui.create.div('.player.minskin.obstacle',ui.chess).animate('start'); + ui.placeChess(grid,pos); + grid.listen(ui.click.obstacle); + lib.posmap[pos]=grid; + game.obstacles.push(grid); + return grid; + } + return null; + }, + addTempObstacle:function(x,y,num){ + var node=game.addObstacle(x,y); + if(node){ + game.colorObstacle(node,'blue'); + node.tempObstacle=num; + } + }, + removeObstacle:function(pos){ + if(get.is.div(pos)){ + pos=pos.dataset.position; + } + var node=lib.posmap[pos]; + if(node&&game.obstacles.contains(node)){ + game.addVideo('removeObstacle',null,pos); + game.obstacles.remove(node); + delete lib.posmap[pos]; + node.delete(); + } + }, + moveObstacle:function(pos,x,y){ + if(get.is.div(pos)){ + pos=pos.dataset.position; + } + var node=lib.posmap[pos]; + if(node&&game.obstacles.contains(node)){ + pos=parseInt(pos); + var x2=pos%ui.chesswidth+x; + var y2=Math.floor(pos/ui.chesswidth)+y; + if(x2>=ui.chesswidth){ + x2=ui.chesswidth-1; + } + if(y2>=ui.chessheight){ + y2=ui.chessheight-1; + } + if(x2<0){ + x2=0; + } + if(y2<0){ + y2=0; + } + var pos2=y2*ui.chesswidth+x2; + if(!lib.posmap[pos2]){ + game.addVideo('moveObstacle',null,[pos,x,y]); + ui.placeChess(node,pos2); + delete lib.posmap[pos]; + lib.posmap[pos2]=node; + return true; + } + } + return false; + }, + colorObstacle:function(pos,color){ + if(get.is.div(pos)){ + pos=pos.dataset.position; + } + var node=lib.posmap[pos]; + if(node&&game.obstacles.contains(node)){ + game.addVideo('colorObstacle',null,[pos,color]); + node.dataset.obscolor=color; + } + }, + addOverDialog:function(dialog,result){ + if(ui.finishGame){ + ui.finishGame.remove(); + } + dialog.classList.add('center'); + if(_status.mode!='leader') return; + if(result=='战斗胜利'){ + _status.victory=true; + if(!_status.enterArena){ + var div=ui.create.div(); + div.innerHTML='获得'+game.reward+'金'; + dialog.add(div); + if(_status.challenge&&_status.challengeMoney<=game.data.dust){ + var div2=ui.create.div(); + div2.style.display='block'; + div2.innerHTML='招降所需招募令:'+_status.challengeMoney+'/'+game.data.dust; + dialog.add(div2); + } + game.changeMoney(game.reward); + game.saveData(); + } + } + else if(_status.zhaoxiang){ + var div=ui.create.div(); + div.innerHTML='招降'+get.translation(_status.zhaoxiang)+'成功'; + dialog.add(div); + } + }, + controlOver:function(){ + if(_status.mode=='three'){ + ui.create.control('再战',function(){ + game.saveConfig('continue_name_chess',{ + friend:_status.friendBackup, + enemy:_status.enemyBackup, + color:_status.color + }); + game.saveConfig('mode',lib.config.mode); + localStorage.setItem(lib.configprefix+'directstart',true); + game.reload(); + }); + } + ui.create.control('返回',game.reload); + if(_status.mode!='leader') return; + if(_status.enterArena){ + game.data.arena.acted.length=0; + if(_status.victory){ + game.data.arena.win++; + for(var i=0;i=money){ + ui.create.control('招降'+get.translation(_status.challenge),function(){ + game.data.character.add(_status.challenge); + game.data.challenge=game.getLeaderList(); + game.changeDust(-money); + game.reload(); + }); + } + } + } + }, + phaseLoopThree:function(player){ + var next=game.createEvent('phaseLoop'); + next.player=player; + next.swap=function(player){ + if(player.side==game.me.side){ + return game.enemyZhu; + } + else{ + return game.me; + } + }, + next.setContent(function(){ + 'step 0' + player.classList.add('acted'); + player.phase(); + 'step 1' + if(player!=game.friendZhu&&player!=game.enemyZhu){ + for(var i=0;inum1){ + if(next.side==game.me.side){ + next=game.me; + } + var str; + if(num2-num1>1){ + str='选择至多'+get.cnNumber(num2-num1)+'个已方角色各摸一张牌' + } + else{ + str='选择一个已方角色摸一张牌' + } + var nevt=next.chooseTarget(str,function(card,player,target){ + return target.side==next.side; + },[1,num2-num1]); + nevt.ai=function(target){ + return Math.max(1,10-target.countCards('h')); + }; + nevt.includeOut=true; + nevt.chessForceAll=true; + } + else{ + game.delay(); + event.goto(2); + } + } + else{ + event.goto(2); + } + "step 1" + if(result.bool){ + game.asyncDraw(result.targets); + } + "step 2" + if(player.side==game.me.side){ + player=game.me; + } + if(player.isDead()){ + for(var i=0;i1){ + var nevt=player.chooseTarget('选择下一个行动的角色',function(card,player,target){ + return target.side==player.side&&!target.classList.contains('acted'); + },true); + nevt.chessForceAll=true; + nevt.includeOut=true; + nevt.ai=function(target){ + var nj=target.countCards('j'); + if(nj){ + return -nj; + } + return Math.max(0,10-target.hp); + } + } + else if(players.length){ + event.decided=players[0]; + } + else{ + event.player=game.findPlayer(function(current){ + return current.side!=player.side; + }); + event.goto(0); + } + "step 3" + if(event.decided){ + event.decided.phase(); + event.justacted=event.decided; + delete event.decided; + } + else{ + var current=result.targets[0]; + current.phase(); + event.justacted=current; + } + "step 4" + event.justacted.classList.add('acted'); + event.goto(0); + for(var i=0;i'+game.data.money+'金币'); + uiintro.addText('通过战斗或竞技场可获得金币。花费100金币可招募3名随机武将;花费150金币可参加一次竞技场'); + uiintro.add(''+game.data.dust+'招募令'); + uiintro.addText('通过遣返武将或竞技场可获得招募令。挑战武将成功后可通过招募令招募该武将,普通/稀有/史诗/传说武将分别花费40/100/400/1600招募令'); + }); + ui.money.innerHTML=''+game.data.dust+''+ + ''+game.data.money+''; + ui.money.style.top='auto'; + ui.money.style.left='auto'; + ui.money.style.right='20px'; + ui.money.style.bottom='15px'; + ui.money.childNodes[0].style.color='rgb(111, 198, 255)'; + ui.money.childNodes[1].style.fontFamily='huangcao'; + ui.money.childNodes[1].style.marginRight='10px'; + ui.money.childNodes[2].style.color='#FFE600'; + ui.money.childNodes[3].style.fontFamily='huangcao'; + ui.money.style.letterSpacing='4px'; + for(var i in lib.rank){ + if(Array.isArray(lib.rank[i])){ + for(var j=0;jb?1:-1; + } + return aa>bb?1:-1; + }); + if(game.data.character.length==0||!game.data.challenge){ + game.data.character=lib.rank.rarity.common.randomGets(3); + game.data.challenge=game.getLeaderList(); + game.saveData(); + } + var fixButton=function(button){ + var rarity=game.getRarity(button.link); + if(rarity!='common'){ + var intro=button.node.intro; + intro.classList.add('showintro'); + intro.style.fontFamily='huangcao'; + intro.style.fontSize='20px'; + intro.style.top='82px'; + intro.style.left='2px'; + switch(rarity){ + case 'rare':intro.dataset.nature='waterm';break; + case 'epic':intro.dataset.nature='thunderm';break; + case 'legend':intro.dataset.nature='metalm';break; + } + intro.innerHTML=get.translation(rarity); + } + } + game.leaderLord=['leader_caocao','leader_liubei','leader_sunquan']; + var dialog1=ui.create.dialog('选择君主','hidden'); + event.dialog1=dialog1; + dialog1.classList.add('fullheight'); + dialog1.classList.add('halfleft'); + dialog1.classList.add('fixed'); + dialog1.classList.add('pointerbutton'); + dialog1.add([game.leaderLord,'character']); + var i; + for(i=0;ib?1:-1; + }); + captnode.innerHTML=''; + for(i=0;i3&&selected.character.length){ + event.removeCharacter.animate('controlpressdownx',500); + event.removeCharacter.classList.remove('disabled'); + } + if(game.data.money<150&&!game.data._arena){ + event.enterArena.classList.add('disabled'); + } + else{ + event.enterArena.animate('controlpressdownx',500); + event.enterArena.classList.remove('disabled'); + } + if(game.data.money<100){ + event.addCharacter.classList.add('disabled'); + } + else{ + event.addCharacter.animate('controlpressdownx',500); + event.addCharacter.classList.remove('disabled'); + } + initcapt(); + },200); + },200); + },500); + }; + event.addCharacter=ui.create.control('招募','nozoom',zhaomu2); + if(game.data.money<150&&!game.data._arena){ + event.enterArena.classList.add('disabled'); + } + if(game.data.money<100){ + event.addCharacter.classList.add('disabled'); + } + var qianfan=function(){ + if(_status.kaibao) return; + if(game.data.character.length<=3) return; + if(!selected.character.length) return; + // _status.chessclicked=true; + // _status.qianfan=true; + // event.enterArena.style.opacity=0.5; + // event.addCharacter.style.opacity=0.5; + // event.fight.style.opacity=0.5; + var current=selected.character.slice(0); + clearSelected(); + var maxq=game.data.character.length-3; + if(current.length<=maxq){ + for(var i=0;i=100){ + event.addCharacter.animate('controlpressdownx',500); + event.addCharacter.classList.remove('disabled'); + } + if(game.data.money>=150){ + event.enterArena.animate('controlpressdownx',500); + event.enterArena.classList.remove('disabled'); + } + node.delete(); + dialog1.buttons.remove(node); + } + initcapt(); + } + }; + event.removeCharacter=ui.create.control('遣返','nozoom',qianfan); + event.removeCharacter.classList.add('disabled'); + event.fight=ui.create.control('开始战斗','nozoom',function(){ + if(_status.kaibao||_status.qianfan) return; + if(selected.challenge.length){ + var cname=selected.challenge[0].link; + var rarity=game.getRarity(cname); + switch(rarity){ + case 'common':rarity=40;break; + case 'rare':rarity=100;break; + case 'epic':rarity=400;break; + case 'legend':rarity=1600;break; + } + if(!confirm('即将挑战'+get.translation(cname)+',战斗胜利后可消耗'+rarity+'招募令招募该武将,无论是否招募,挑战列表将被刷新。是否继续?')){ + return; + } + } + _status.enemylist=[]; + _status.mylist=[]; + if(selected.lord.length){ + _status.mylist.push(selected.lord[0].link); + _status.lord=selected.lord[0].link; + } + if(selected.character.length){ + for(var i=0;i0){ + switch(difficulty){ + case 'leader_easy':reward+=10*numdel;break; + case 'leader_medium':reward+=20*numdel;break; + case 'leader_hard':reward+=40*numdel;break; + } + } + var punish=0; + for(var i=0;i<_status.mylist.length;i++){ + switch(get.rank(_status.mylist[i])){ + case 's':punish+=25;break; + case 'ap':punish+=20;break; + case 'a':punish+=16;break; + case 'am':punish+=12;break; + case 'bp':punish+=9;break; + case 'b':punish+=7;break; + case 'bm':punish+=5;break; + case 'c':punish+=3;break; + case 'd':punish+=2;break; + } + } + if(numdel<0){ + switch(difficulty){ + case 'leader_easy':punish-=5*numdel;break; + case 'leader_medium':punish-=10*numdel;break; + case 'leader_hard':punish-=20*numdel;break; + } + } + game.reward=Math.max(3*_status.enemylist.length,reward-punish); + if(!_status.lord){ + switch(difficulty){ + case 'leader_easy':game.reward+=10;break; + case 'leader_medium':game.reward+=20;break; + case 'leader_hard':game.reward+=40;break; + } + } + game.resume(); + }); + event.custom.replace.button=function(button){ + if(_status.kaibao) return; + if(button.classList.contains('unselectable')&& + !button.classList.contains('selected')) return; + _status.chessclicked=true; + button.classList.toggle('selected'); + if(button.classList.contains('selected')){ + selected[button.area].add(button); + } + else{ + selected[button.area].remove(button); + } + switch(button.area){ + case 'lord':{ + for(var i=0;i5)|| + (_status.qianfan&&selected.character.length>=maxq)){ + dialog1.buttons[i].classList.add('unselectable'); + } + else{ + dialog1.buttons[i].classList.remove('unselectable'); + } + } + } + break; + } + case 'difficulty':case 'number':{ + for(var i=0;i3){ + event.removeCharacter.animate('controlpressdownx',500); + event.removeCharacter.classList.remove('disabled'); + } + else{ + event.removeCharacter.classList.add('disabled'); + } + }; + event.custom.add.window=function(){ + if(!_status.kaibao){ + var glows=document.querySelectorAll('.button.glow2'); + for(var i=0;i=100){ + event.addCharacter.animate('controlpressdownx',500); + event.addCharacter.classList.remove('disabled'); + } + else{ + event.addCharacter.classList.add('disabled'); + } + if(game.data.money>=150||game.data._arena){ + event.enterArena.animate('controlpressdownx',500); + event.enterArena.classList.remove('disabled'); + } + else{ + event.enterArena.classList.add('disabled'); + } + event.fight.style.opacity=1; + } + clearSelected(); + }; + lib.init.onfree(); + game.pause(); + 'step 2' + if(!game.data.arena){ + event.dialog1.close(); + event.dialog2.close(); + event.fight.close(); + event.enterArena.close(); + event.addCharacter.close(); + event.removeCharacter.close(); + } + ui.arena.classList.add('leaderhide'); + ui.money.hide(); + game.delay(); + 'step 3' + ui.arena.classList.remove('leaderhide'); + if(!_status.enterArena){ + ui.wuxie.show(); + ui.auto.show(); + ui.control.style.top=''; + if(!get.is.safari()){ + ui.control.style.transition=''; + ui.control.style.display='none'; + } + event.finish(); + } + else{ + game.minskin=false; + event.arenanodes=[]; + event.arenachoice=[]; + event.arenachoicenodes=[]; + event.arrangeNodes=function(){ + var num=event.arenachoicenodes.length; + var width=num*75+(num-1)*8; + for(var i=0;i=3){ + for(var i=0;i胜'; + victory.style.top='auto'; + victory.style.left='auto'; + victory.style.right='20px'; + victory.style.bottom='15px'; + victory.style.fontSize='30px' + victory.style.fontFamily='huangcao'; + victory.firstChild.style.marginRight='5px'; + ui.window.appendChild(victory); + ui.refresh(victory); + victory.show(); + + event.checkPrize=function(){ + // event.kaibao=true; + event.prize=[]; + event.turnCard2=function(){ + if(this.turned) return; + _status.chessclicked=true; + this.turned=true; + var node=this; + setTimeout(function(){ + node.turned2=true; + },1000); + if(node.name=='chess_coin'||node.name=='chess_dust'){ + node.style.transition='all 0s'; + node.style.transform='none'; + node.style.overflow='visible'; + node.style.background='none'; + node.style.boxShadow='none'; + var div=ui.create.div(node); + div.style.transition='all 0s'; + if(node.name=='chess_coin'){ + div.innerHTML=''+node.num+''; + div.firstChild.style.color='rgb(255, 230, 0)'; + node.$coin(); + } + else{ + div.innerHTML=''+node.num+''; + div.firstChild.style.color='rgb(111, 198, 255)'; + div.firstChild.style.marginRight='3px'; + node.$dust(); + } + div.style.fontFamily='huangcao'; + div.style.fontSize='50px'; + div.style.top='40px'; + div.style.letterSpacing='8px'; + div.style.whiteSpace='nowrap'; + // div.dataset.nature='metal'; + + return; + } + node.style.transition='all ease-in 0.3s'; + node.style.transform='perspective(1200px) rotateY(270deg) translateX(150px)'; + var onEnd=function(){ + node.init(node.name); + node.node.avatar.style.display=''; + if(node.rarity){ + node.node.intro.innerHTML=get.translation(node.rarity); + node.node.intro.classList.add('showintro'); + } + node.classList.add('playerflip'); + node.style.transform='none'; + node.style.transition=''; + if(lib.config.animation&&!lib.config.low_performance){ + setTimeout(function(){ + switch(game.getRarity(node.name)){ + case 'rare':node.$rare();break; + case 'epic':node.$epic();break; + case 'legend':node.$legend();break; + } + },150); + } + }; + node.listenTransition(onEnd); + }; + setTimeout(function(){ + nodes[0].delete(); + },400+Math.random()*300); + setTimeout(function(){ + nodes[1].delete(); + },400+Math.random()*300); + setTimeout(function(){ + nodes[2].delete(); + },400+Math.random()*300); + setTimeout(function(){ + nodes[3].delete(); + },400+Math.random()*300); + setTimeout(function(){ + nodes[4].delete(); + },400+Math.random()*300); + setTimeout(function(){ + nodes[5].delete(); + },400+Math.random()*300); + setTimeout(function(){ + nodes[6].delete(); + },400+Math.random()*300); + setTimeout(function(){ + nodes[7].delete(); + },400+Math.random()*300); + setTimeout(function(){ + nodes[8].delete(); + },400+Math.random()*300); + setTimeout(function(){ + var prize=new Array(6); + var map=[1,2,3,4,5]; + var ccount=3; + var win=game.data.arena.win; + var prizeValue; + switch(win){ + case 0:prizeValue=100;break; + case 1:prizeValue=120;break; + case 2:prizeValue=150;break; + case 3:prizeValue=190;break; + case 4:prizeValue=240;break; + case 5:prizeValue=300;break; + case 6:prizeValue=370;break; + case 7:prizeValue=450;break; + case 8:prizeValue=540;break; + case 9:prizeValue=640;break; + case 10:prizeValue=750;break; + case 11:prizeValue=870;break; + case 12:prizeValue=1000;break; + } + if(Math.random()<0.4){ + if(win>=3&&Math.random()<0.5){ + ccount=4; + prizeValue-=33; + } + else{ + ccount=2; + prizeValue+=33; + } + } + prizeValue-=100; + while(ccount--){ + prize[map.randomRemove()]=game.getLeaderCharacter(); + } + if(map.length){ + prizeValue/=map.length; + } + while(map.length){ + var val=Math.round((Math.random()*0.4+0.8)*prizeValue); + if(Math.random()<0.7){ + prize[map.shift()]=['chess_coin',Math.max(Math.ceil(Math.random()*5),val)]; + } + else{ + val=Math.round(val/3); + prize[map.shift()]=['chess_dust',Math.max(Math.ceil(Math.random()*3),val)]; + } + } + for(var i=1;i=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(); + }; + + var clickedJiange=false; + var clickJiange=function(){ + clickedJiange=true; + if(this.classList.contains('glow2')){ + this.classList.remove('glow2'); + } + else{ + this.classList.add('glow2'); + } + addToButton(); + }; + + + for(var i=0;inum){ + for(var i=num;i2) return false; + var xy1=event.source.getXY(); + var xy2=player.getXY(); + var dx=xy2[0]-xy1[0]; + var dy=xy2[1]-xy1[1]; + // if(dx*dy!=0) return false; + if(dx==0&&Math.abs(dy)==2){ + dy/=2; + } + if(dy==0&&Math.abs(dx)==2){ + dx/=2; + } + return player.movable(dx,dy); + }, + content:function(){ + var xy1=trigger.source.getXY(); + var xy2=player.getXY(); + var dx=xy2[0]-xy1[0]; + var dy=xy2[1]-xy1[1]; + if(dx==0&&Math.abs(dy)==2){ + dy/=2; + } + if(dy==0&&Math.abs(dx)==2){ + dx/=2; + } + if(player.movable(dx,dy)){ + player.move(dx,dy); + } + } + }, + dubiaoxianjing:{ + global:'dubiaoxianjing2' + }, + dubiaoxianjing2:{ + trigger:{player:'phaseAfter'}, + forced:true, + popup:false, + filter:function(event,player){ + if(player.hp<=1) return false; + for(var i=0;i1) return false; + for(var i=0;inh) return false; + } + return true; + } + } + return false; + }, + content:function(){ + 'step 0' + var source=null; + for(var i=0;i3; + } + } + return false; + }, + content:function(){ + 'step 0' + var source=null; + for(var i=0;igame.data.arena.dead.length; + }, + direct:true, + delay:0, + preservecancel:true, + content:function(){ + "step 0" + var list=game.data.arena.arenachoice.slice(0); + for(var i=0;i

' + for(var i=0;i'+ + (skill.chance(targets[i],player)*100).toFixed(2)+'%
'; + } + str+='

' + } + return str; + }, + chance:function(target,player){ + var chance; + var renyi=player.hasSkill('leader_renyi'); + switch(target.hp){ + case 1:chance=0.7;break; + case 2:chance=0.4;break; + default:chance=0.2;break; + } + switch(target.countCards('he')){ + case 0:break; + case 1:chance/=1.2;break; + case 2:chance/=1.4;break; + case 3:chance/=1.7;break; + default:chance/=2;break; + } + switch(game.getRarity(target.name)){ + case 'common':{ + if(renyi) chance*=2; + break; + } + case 'rare':{ + chance/=2; + if(renyi) chance*=2; + break; + } + case 'epic':{ + chance/=5; + if(renyi) chance*=1.5; + break; + } + case 'legend':{ + chance/=15; + if(renyi) chance*=1.2; + break; + } + } + return Math.min(1,chance); + }, + filter:function(){ + return game.data.dust>=10; + }, + filterTarget:function(card,player,target){ + return game.isChessNeighbour(player,target)&&!game.data.character.contains(target.name); + }, + content:function(){ + var chance=lib.skill.leader_zhaoxiang.chance(target,player); + game.changeDust(-10); + if(Math.random()0; + }, + content:function(){ + switch(_status.difficulty){ + case 'leader_easy':game.reward+=2*trigger.num;break; + case 'leader_medium':game.reward+=4*trigger.num;break; + case 'leader_hard':game.reward+=6*trigger.num;break; + } + } + }, + leader_renyi:{ + unique:true, + }, + leader_mouduan:{ + unique:true, + global:'leader_mouduan2' + }, + leader_mouduan2:{ + mod:{ + chessMove:function(player,current){ + if(player.side&&player.name!=_status.lord) return current+1; + } + } + }, + tongshuai:{ + unique:true, + forbid:['guozhan'], + init:function(player){ + player.storage.tongshuai={ + list:[], + owned:{}, + player:player, + get:function(num){ + if(typeof num!='number') num=1; + var player=this.player; + while(num--){ + var name=player.storage.tongshuai.unowned.shift(); + if(!name) return; + var skills=lib.character[name][3].slice(0); + for(var i=0;i
【'+get.translation(skill)+ + '】
'+lib.translate[skill+'_info']+'
'); + } + } + }, + // mark:true + }, + tongshuai1:{ + trigger:{global:'gameStart'}, + forced:true, + popup:false, + priority:10, + content:function(){ + for(var i=0;i1){ + player.storage.tongshuai.get(2); + } + else if(player.storage.tongshuai.unowned.length==1){ + player.storage.tongshuai.get(); + } + else{ + player.removeSkill('tongshuai'); + } + } + }, + tongshuai2:{ + audio:2, + trigger:{player:['phaseBegin','phaseEnd'],global:'gameStart'}, + filter:function(event,player,name){ + if(!player.hasSkill('tongshuai')) return false; + if(name=='phaseBegin'&&game.phaseNumber==1) return false; + return true; + }, + priority:-9, + forced:true, + popup:false, + content:function(){ + var slist=player.storage.tongshuai.owned; + var list=[]; + for(var i in slist){ + list.push(i); + } + if(event.isMine()){ + event.dialog=ui.create.dialog('选择获得一项技能',[list,'character']); + if(trigger.name=='game'){ + event.control=ui.create.control(); + } + else{ + event.control=ui.create.control(['cancel']); + } + event.clickControl=function(link){ + if(link!='cancel'){ + var currentname=event.dialog.querySelector('.selected.button').link; + var mark=player.marks.tongshuai; + if(!mark){ + player.markSkill('tongshuai'); + mark=player.marks.tongshuai; + if(mark.firstChild){ + mark.firstChild.remove(); + } + } + mark.setBackground(currentname,'character'); + + player.addAdditionalSkill('tongshuai',link); + game.addVideo('chess_tongshuai_skill',player,[currentname,link]); + player.logSkill('tongshuai2'); + game.log(player,'获得技能','【'+get.translation(link)+'】'); + player.popup(link); + + for(var i=0;i0; + }, + content:function(){ + player.storage.tongshuai.get(); + } + }, + cangming:{ + enable:'phaseUse', + usable:1, + unique:true, + filter:function(event,player){ + if(player.isTurnedOver()) return false; + var suits=[]; + var hs=player.getCards('h'); + for(var i=0;i=4) return true; + } + return false; + }, + filterCard:function(card){ + var suit=get.suit(card); + for(var i=0;i1) break; + } + } + if(num<=1) return; + if(_status.currentPhase==player&&player.countCards('h')=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.hasSkill('cangming2')) return 'zeroplayertarget'; + } + } + }, + result:{ + target:function(player){ + var num=0; + for(var i=0;i1) break; + } + } + if(num<=1) return 0; + return -10; + } + } + }, + }, + cangming2:{ + trigger:{player:'phaseBegin'}, + forced:true, + popup:false, + content:function(){ + for(var i=0;i0; + }, + check:function(event,player){ + var targets=lib.skill.guanchuan.getTargets(player,event.targets[0]); + var eff=0; + for(var i=0;i0; + }, + content:function(){ + var targets=lib.skill.guanchuan.getTargets(player,trigger.targets[0]); + for(var i=0;i1&&lib.filter.filterCard({name:'sha'},player); + }, + filterCard:{name:'sha'}, + selectCard:2, + check:function(card){ + var num=0; + var player=_status.event.player; + for(var i=0;i0){ + num++; + if(num>1) return 8-get.value(card); + } + } + return 0; + }, + selectTarget:[1,Infinity], + discard:false, + prepare:'throw', + filterTarget:function(card,player,target){ + return lib.filter.targetEnabled({name:'sha'},player,target)&& + get.distance(player,target,'pure')<=5; + }, + content:function(){ + targets.sort(lib.sort.seat); + player.useCard({name:'sha'},cards,targets,'luanjian').animate=false; + }, + multitarget:true, + ai:{ + order:function(){ + return get.order({name:'sha'})+0.1; + }, + result:{ + target:function(player,target){ + return get.effect(target,{name:'sha'},player,target); + } + }, + effect:{ + player:function(card,player){ + if(_status.currentPhase!=player) return; + if(card.name=='sha'&&player.countCards('h','sha')<2&&player.countCards('h')<=player.hp){ + var num=0; + var player=_status.event.player; + for(var i=0;i1) return 'zeroplayertarget'; + } + } + } + } + }, + } + }, + zhiming:{ + trigger:{source:'damageBegin'}, + filter:function(event,player){ + return get.distance(event.player,player,'attack')>1&&event.card&&event.card.name=='sha'; + }, + forced:true, + content:function(){ + trigger.num++; + } + }, + lianshe:{ + mod:{ + cardUsable:function(card,player,num){ + if(card.name=='sha'){ + return num+player.countUsed()-player.countUsed('sha'); + } + }, + }, + trigger:{player:'useCard'}, + frequent:true, + filter:function(event){ + return event.card&&event.card.name=='sha'; + }, + usable:1, + content:function(){ + player.draw(); + }, + ai:{ + threaten:1.5 + } + }, + pianyi:{ + trigger:{player:'phaseEnd'}, + direct:true, + filter:function(event,player){ + return !player.getStat('damage'); + }, + content:function(){ + "step 0" + player.chooseToMove(2,get.prompt('pianyi')); + "step 1" + if(result.bool){ + player.logSkill('pianyi'); + } + } + }, + lingdong:{ + trigger:{player:'phaseEnd'}, + direct:true, + filter:function(event,player){ + return player.countUsed('sha')>0; + }, + content:function(){ + "step 0" + player.chooseToMove(player.countUsed('sha'),get.prompt('lingdong')); + "step 1" + if(result.bool){ + player.logSkill('lingdong'); + } + } + }, + _noactpunish:{ + trigger:{player:'useCard'}, + filter:function(event,player){ + return _status.currentPhase==player&&event.targets&&(event.targets.length>1||event.targets[0]!=player); + }, + forced:true, + popup:false, + content:function(){ + player.addTempSkill('noactpunish'); + } + }, + noactpunish:{}, + _chess_chuzhang:{ + enable:'phaseUse', + usable:1, + direct:true, + delay:false, + preservecancel:true, + filter:function(event,player){ + var num=0; + var xy=player.getXY(); + var neighbour; + neighbour=player.getNeighbour(-1,0); + if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ + num++; + } + else if(xy[0]==0){ + num++; + } + neighbour=player.getNeighbour(1,0); + if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ + num++; + } + else if(xy[0]+1>=ui.chesswidth){ + num++; + } + neighbour=player.getNeighbour(0,-1); + if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ + num++; + } + else if(xy[1]==0){ + num++; + } + neighbour=player.getNeighbour(0,1); + if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ + num++; + } + else if(xy[1]+1>=ui.chessheight){ + num++; + } + return num>=3; + }, + content:function(){ + 'step 0' + event.obstacles=[]; + event.movemap={}; + var neighbour; + neighbour=player.getNeighbour(-1,0); + if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ + event.obstacles.push(neighbour); + if(player.movable(-2,0)){ + event.movemap['[-1,0]']=neighbour; + } + } + neighbour=player.getNeighbour(1,0); + if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ + event.obstacles.push(neighbour); + if(player.movable(2,0)){ + event.movemap['[1,0]']=neighbour; + } + } + neighbour=player.getNeighbour(0,-1); + if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ + event.obstacles.push(neighbour); + if(player.movable(0,-2)){ + event.movemap['[0,-1]']=neighbour; + } + } + neighbour=player.getNeighbour(0,1); + if(neighbour&&typeof neighbour.tempObstacle!='number'&&game.obstacles.contains(neighbour)){ + event.obstacles.push(neighbour); + if(player.movable(0,2)){ + event.movemap['[0,1]']=neighbour; + } + } + if(!event.obstacles.length){ + event.finish(); + return; + } + else if(event.obstacles.length==1){ + event.obstacle=event.obstacles[0]; + } + else if(event.isMine()){ + for(var i=0;i'+lib.translate._chess_chuzhang_info+''); + event.custom.replace.confirm=function(){ + player.getStat().skill._chess_chuzhang--; + event.cancelled=true; + game.resume(); + }; + } + 'step 1' + if(ui.confirm){ + ui.confirm.classList.add('removing'); + } + _status.imchoosing=false; + if(!event.cancelled){ + if(!event.obstacle){ + event.obstacle=event.obstacles.randomGet(); + } + var moved=false; + for(var i in event.movemap){ + if(event.movemap[i]==event.obstacle){ + var xy=JSON.parse(i); + if(game.moveObstacle(event.obstacle,xy[0],xy[1])){ + moved=true; + break; + } + } + } + if(!moved){ + game.removeObstacle(event.obstacle); + } + player.popup('除障'); + game.delay(); + } + for(var i=0;i0; + }, + content:function(){ + "step 0" + var move=2; + move=game.checkMod(player,move,'chessMove',player); + player.chooseToMove(move).phasing=true; + "step 1" + if(ui.confirm){ + ui.confirm.classList.add('removing'); + } + if(!result.bool){ + var skill=player.getStat().skill; + skill._chessmove--; + if(typeof skill._chessmovetried=='number'){ + skill._chessmovetried++; + } + else{ + skill._chessmovetried=1; + } + } + }, + ai:{ + order:5, + result:{ + playerx:function(player){ + if(get.mode()=='tafang'&&_status.enemies.contains(player)){ + return 1; + } + var nh=player.countCards('h'); + if(!player.countCards('h','sha')&& + !player.countCards('h','shunshou')&& + !player.countCards('h','bingliang')){ + if(nh<=Math.min(3,player.hp)) return Math.random()-0.3; + else if(nh<=Math.min(2,player.hp)) return Math.random()-0.4; + return Math.random()-0.5; + } + var neighbour; + neighbour=player.getNeighbour(0,1); + if(neighbour&&game.players.contains(neighbour)&&neighbour.side!=player.side){ + if(get.distance(player,neighbour,'attack')<1) return 1; + return 0; + } + neighbour=player.getNeighbour(0,-1); + if(neighbour&&game.players.contains(neighbour)&&neighbour.side!=player.side){ + if(get.distance(player,neighbour,'attack')<1) return 1; + return 0; + } + neighbour=player.getNeighbour(1,0); + if(neighbour&&game.players.contains(neighbour)&&neighbour.side!=player.side){ + if(get.distance(player,neighbour,'attack')<1) return 1; + return 0; + } + neighbour=player.getNeighbour(-1,0); + if(neighbour&&game.players.contains(neighbour)&&neighbour.side!=player.side){ + if(get.distance(player,neighbour,'attack')<1) return 1; + return 0; + } + return 1; + }, + player:function(player){ + if(player.getStat().skill._chessmovetried>=10){ + return 0; + } + var x=lib.skill._chessmove.ai.result.playerx(player); + if(player.isMad()) return -x; + return x; + } + } + } + }, + _chesscenter:{ + trigger:{player:['phaseBegin','useCardBegin','useSkillBegin','respondBegin','damageBegin','loseHpBegin'], + target:'useCardToBegin'}, + forced:true, + priority:100, + popup:false, + content:function(){ + player.chessFocus(); + }, + }, + boss_bfengxing:{ + 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-get.value(card);}, + filterTarget:function(card,player,target){ + return get.distance(player,target)<=5&&player!=target; + }, + filter:function(event,player){ + return player.countCards('h',{color:'red'})>0; + }, + selectTarget:-1, + content:function(){ + target.damage('fire'); + }, + line:'fire', + ai:{ + order:1, + result:{ + target:function(player,target){ + return 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.countCards('he',{subtype:get.subtype(card)})>1){ + return 12-get.equipValue(card); + } + return 8-get.equipValue(card); + }, + filter:function(event,player){ + return player.countCards('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 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=ui.chessheight-1) return false; + } + var node=ui.create.div('.player.minskin.playergrid',player.parentNode); + node.link=player; + ui.placeChess(node,pos); + return node; + }, + fakeme:function(){ + if(ui.fakeme){ + ui.fakeme.delete(); + } + ui.fakeme=ui.create.div('.fakeme.avatar',ui.me); + ui.fakeme.style.backgroundImage=game.me.node.avatar.style.backgroundImage; + } + }, + click:{ + moveContainer:function(x,y,scroll){ + if(scroll){ + clearTimeout(ui.chessContainer._scrolling); + ui.chessContainer._scrolling=true; + ui.chess.style.transition='transform 0.5s'; + ui.refresh(ui.chess); + } + else if(ui.chessContainer._scrolling){ + return; + } + if(typeof x==='number') ui.chessContainer.chessLeft+=x; + if(typeof y==='number') ui.chessContainer.chessTop+=y; + var xmin=0; + if(lib.config.show_history=='left'){ + xmin=-50; + } + if(ui.chessContainer.chessLeftxmax) ui.chessContainer.chessLeft=xmax; + if(ui.chessContainer.chessTop>ymax) ui.chessContainer.chessTop=ymax; + ui.chess.style.transform='translate('+(-ui.chessContainer.chessLeft)+'px,'+(-ui.chessContainer.chessTop)+'px)'; + if(scroll){ + var ending=ui.chess.listenTransition(function(){ + if(ui.chess._ending==ending){ + clearTimeout(ui.chessContainer._scrolling); + delete ui.chess._ending; + ui.chess._scrolling=setTimeout(function(){ + ui.chessContainer._scrolling=null; + ui.chess.style.transition=''; + },500); + } + }); + ui.chess._ending=ending; + } + }, + chessInfo:function(e){ + if(this.link.isAlive()){ + this.link.chessFocus(); + if(this.link.classList.contains('selectable')|| + this.link.classList.contains('selected')){ + ui.click.target.call(this.link,e); + ui.click.window.call(ui.window,e); + } + e.stopPropagation(); + } + }, + playergrid:function(){ + if(!_status.paused) return; + var pos=parseInt(this.dataset.position); + this.link.moveTo(pos%ui.chesswidth,Math.floor(pos/ui.chesswidth)); + if(ui.movegrids){ + while(ui.movegrids.length){ + ui.movegrids.shift().delete(); + } + } + _status.event.result={ + bool:true, + move:this.link.dataset.position + }; + game.resume(); + }, + obstacle:function(){ + if(_status.event.chooseObstacle&&_status.paused&& + _status.event.obstacles&&_status.event.obstacles.contains(this)){ + _status.event.obstacle=this; + game.resume(); + } + } + } + }, + get:{ + chessDistance:function(from,to){ + var fxy=from.getXY(); + var txy=to.getXY(); + return Math.abs(fxy[0]-txy[0])+Math.abs(fxy[1]-txy[1]); + }, + rawAttitude:function(from,to){ + return (from.side===to.side?6:-6); + } + }, + card:{ + chess_shezhang:{ + type:'basic', + fullskin:true, + modeimage:'chess', + enable:true, + filterTarget:function(card,player,target){ + if(target.movable(-1,0)) return true; + if(target.movable(1,0)) return true; + if(target.movable(0,-1)) return true; + if(target.movable(0,1)) return true; + return false; + }, + content:function(){ + var xy=target.getXY(); + var x=xy[0]; + var y=xy[1]; + if(target.movable(-1,0)){ + game.addTempObstacle(x-1,y,game.countPlayer()); + } + if(target.movable(1,0)){ + game.addTempObstacle(x+1,y,game.countPlayer()); + } + if(target.movable(0,1)){ + game.addTempObstacle(x,y+1,game.countPlayer()); + } + if(target.movable(0,-1)){ + game.addTempObstacle(x,y-1,game.countPlayer()); + } + }, + content_old:function(){ + 'step 0' + var pos=parseInt(player.dataset.position); + var poses=[]; + if(player.movable(-1,0)){ + poses.push(pos-1); + } + if(player.movable(1,0)){ + poses.push(pos+1); + } + if(player.movable(0,-1)){ + poses.push(pos-ui.chesswidth); + } + if(player.movable(0,1)){ + poses.push(pos+ui.chesswidth); + } + event.poses=poses; + if(poses.length==1){ + event.obstacle=poses[0]; + event.grids=[]; + } + else if(event.isMine()){ + event.grids=player.createRangeShadow(1,function(){ + event.obstacle=this.dataset.position; + game.resume(); + }) + game.pause(); + _status.imchoosing=true; + for(var i=0;i对阵模式
  • n人对战n人的模式,由单人控制,开始游戏后随机分配位置与出牌顺序
  • '+ + '每人在出牌阶段有一次移动的机会,可移动的最大距离为2
  • '+ + '任何卡牌或技能无法指定位置相隔8个格以上的角色为目标
  • '+ + '杀死对方阵营的角色可摸一张牌,杀死本方阵营无惩罚
  • '+ + '若开启主将,双方各选择一名角色成为主将。主将体力上限加一,主将死亡后,若有副将,副将代替之成为主将,否则游戏结束
  • '+ + '开启无尽模式后,任何一方有角色死亡都将选择一名新角色重新加入战场,直到点击左上角的结束游戏按钮手动结束游戏。结束游戏时,杀敌更多的一方获胜
  • '+ + '行动顺序为指定时,双方无论存活角色角色多少都将轮流进行行动。在一方所有角色行动完毕进行下一轮行动时,若其人数比另一方少,另一方可指定至多X名角色名摸一张牌,X为人数之差
  • '+ + '开启战场机关后,每个回合结束时有一定机率出现一个机关,该机关不参与战斗,并有一个影响周围或全体角色的效果。机关在出现后的5~10个回合内消失
  • '+ + '开启击退效果后,当一名角色对距离两格以内的目标造成伤害后,受伤害角色将沿反方向移动一格
  • '+ + '战场上可设置出现随机路障,角色无法移动到路障处。当一名角色的周围四格有至少三格为路障或在战场外时,其可以在回合内清除一个相邻路障
'+ + '
君主模式
  • 收集武将进行战斗,根据战斗难度及我方出场武将的强度,战斗胜利后将获得数量不等的金钱。没有君主出场时,获得的金钱较多
  • '+ + '金钱可以用来招募随机武将,招到已有武将,或遣返不需要的武将时可得到招募令
  • '+ + '战斗中有君主出场时可招降敌将,成功率取决于敌将的稀有度、剩余体力值以及手牌数。成功后战斗立即结束且没有金钱奖励。每发动一次招降,无论成功还是失败,都会扣除10招募令
  • '+ + '挑战武将会与该武将以及与其强度相近的武将进行战斗,敌方人数与我方出场人数相同,但不少于3。胜利后可通过招募令招募该武将,普通/稀有/史诗/传说武将分别需要40/100/400/1600招募令
  • '+ + '竞技场:
    随机选择9名武将,每次派出1~3名武将参战。战斗中阵亡的武将不能再次上场。

    战斗后武将进入疲劳状态,若立即再次出场则初始体力值-1。

    战斗中本方武将行动时可召唤后援,令一名未出场的已方武将加入战斗。后援武将在战斗结束后无论存活与否均不能再次出场

    当取得12场胜利或所有武将全部阵亡后结束,并根据胜场数获得随机奖励
  • '+ + '修改金钱:
    game.changeMoney
    修改招募令:
    game.changeDust
' + }, + }; +}); diff --git a/mode/guozhan.js b/mode/guozhan.js index 0460a9f16..161c36880 100644 --- a/mode/guozhan.js +++ b/mode/guozhan.js @@ -6597,7 +6597,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ game:{ getCharacterChoice:function(list,num){ var choice=list.splice(0,num); - var map={wei:[],shu:[],wu:[],qun:[]}; + var map={wei:[],shu:[],wu:[],qun:[],key:[]}; for(var i=0;i=8&&j!=0&&j!=ui.chesswidth-1) continue; - if(tafanglist.contains(j)){ - var cg=i*ui.chesswidth+j; - grids.remove(cg); - game.addObstacle(cg.toString(),false); - event.obs.push(cg.toString()); - } - } - } - for(var i=0;icount){ - map[i][j].classList.add('unselectable'); - map[i][j].classList.remove('pointerdiv'); - } - else if(i=='zhaomu'&&_status.friends.length+selectedZhaomu>=5){ - map[i][j].classList.add('unselectable'); - map[i][j].classList.remove('pointerdiv'); - } - else if(i=='bufang'){ - var numbufang=0; - for(var k=0;k=3){ - map[i][j].classList.add('unselectable'); - break; - } - } - } - } - } - ui.dialog.content.firstChild.innerHTML='剩余行动点:'+count; - } - var clickOrder=0; - event.custom.replace.button=function(button){ - if(!button.classList.contains('unselectable')|| - button.classList.contains('selected')){ - button.classList.toggle('selected'); - button._clickOrder=clickOrder++; - } - updateSelected(); - } - event.custom.add.window=function(clicked){ - if(clicked) return; - if(event.step>1) return; - for(var i in map){ - for(var j=0;j=5){ - event.control.childNodes[1].style.opacity=0.5; - event.control.childNodes[1].disabled=true; - if(_status.lastTafangCommand=='招募'){ - _status.lastTafangCommand='布防'; - } - } - _status.imchoosing=true; - ui.auto.hide(); - var eventdong=function(){ - var selected=dialog.querySelectorAll('.button.selected'); - event.bufang=[]; - event.zhaomu=[]; - event.xingdong=_status.friends.slice(0); - // var xingdongs=[]; - _status.remainingCount+=10; - for(var i=0;i0){ - game.pause(); - } - else{ - eventdong(); - } - 'step 1' - event.dialog.close(); - event.control.close(); - event.done.close(); - delete event.dialog; - delete event.control; - delete event.done; - 'step 2' - event.chooseObstacle=false; - if(event.bufang.length){ - event.obstacles=game.obstacles.slice(0); - for(var i=0;i=0;k--){ - var pos=i+k*ui.chesswidth; - if(lib.posmap[pos]){ - lib.posmap[pos].moveDown(); - } - } - } - } - } - if(shalldelay) game.delay(); - 'step 7' - event.justadded=[]; - if(_status.characterList.length){ - if(_status.enemies.length=10&&list1.length&&difficulty>1){ - // var enemy=game.addChessPlayer(_status.characterList.shift(),true,4,list1.randomRemove()); - // _status.enemies.push(enemy); - // event.justadded.push(enemy.name); - // } - // if(_status.turnCount>=20&&list1.length&&difficulty>1){ - // var enemy=game.addChessPlayer(_status.characterList.shift(),true,4,list1.randomRemove()); - // _status.enemies.push(enemy); - // event.justadded.push(enemy.name); - // } - // if(list1.length&&difficulty>2){ - // var enemy=game.addChessPlayer(_status.characterList.shift(),true,4,list1.randomRemove()); - // _status.enemies.push(enemy); - // event.justadded.push(enemy.name); - // } - } - } - else{ - game.over(true); - } - 'step 8' - if(event.xingdong.length){ - var toact=event.xingdong.shift(); - if(game.players.contains(toact)){ - toact.phase(); - } - event.redo(); - } - else{ - event.xingdong=_status.enemies.slice(0); - } - 'step 9' - if(event.xingdong.length){ - var enemy=event.xingdong.shift(); - if(!event.justadded.contains(enemy.name)&&game.players.contains(enemy)){ - enemy.phase(); - } - event.redo(); - } - else{ - event.mechlist=game.treasures.slice(0); - } - 'step 10' - if(event.mechlist.length){ - var mech=event.mechlist.shift(); - var info=lib.skill[mech.name+'_skill']; - if(!info.filter||info.filter(mech)){ - var next=game.createEvent('chessMech'); - next.player=mech; - next.setContent(info.content); - mech.chessFocus(); - if(lib.config.animation&&!lib.config.low_performance){ - mech.$epic2(); - } - game.delay(); - } - if(--mech.hp<=0){ - var next=game.createEvent('chessMechRemove'); - next.player=mech; - next.setContent('chessMechRemove'); - } - else{ - mech.update(); - } - event.redo(); - } - 'step 11' - delete event.xingdong; - delete event.mechlist; - if(_status.turnCount>=_status.turnTotal){ - game.over(true); - } - else{ - event.goto(0); - game.delay(); - } - }); - }, - loadMap:function(){ - var next=game.createEvent('loadMap'); - next.setContent(function(){ - if(!lib.storage.map){ - lib.storage.map=['basic_small','basic_medium','basic_large']; - } - if(!lib.storage.newmap){ - lib.storage.newmap=[]; - } - var sceneview=ui.create.div('.storyscene'); - if(!lib.config.touchscreen&&lib.config.mousewheel){ - sceneview._scrollspeed=30; - sceneview._scrollnum=10; - sceneview.onmousewheel=function(){ - if(!this.classList.contains('lockscroll')){ - ui.click.mousewheel.apply(this,arguments); - } - }; - } - lib.setScroll(sceneview); - var switchScene=function(){ - event.result=this.link; - sceneview.delete(); - setTimeout(game.resume,300); - } - var clickScene=function(e){ - if(this.classList.contains('unselectable')) return; - if(this._clicking) return; - if(e&&e.stopPropagation) e.stopPropagation(); - if(this.classList.contains('flipped')){ - return; - } - if(this.classList.contains('glow3')){ - this.classList.remove('glow3'); - lib.storage.newmap.remove(this.name); - game.save('newmap',lib.storage.newmap); - } - var sceneNode=this.parentNode; - var current=document.querySelector('.flipped.scene'); - if(current){ - restoreScene(current,true); - } - this.content.innerHTML=''; - ui.create.div('.menubutton.large.enter','进入',this.content,switchScene).link=this.name; - sceneNode.classList.add('lockscroll'); - var node=this; - node._clicking=true; - setTimeout(function(){ - node._clicking=false; - },700); - sceneNode.dx=ui.window.offsetWidth/2-(-sceneNode.scrollLeft+this.offsetLeft+this.offsetWidth/2); - if(Math.abs(sceneNode.dx)<20){ - sceneNode.dx=0; - } - if(!sceneNode.sceneInterval&&sceneNode.dx){ - sceneNode.sceneInterval=setInterval(function(){ - var dx=sceneNode.dx; - if(Math.abs(dx)<=2){ - sceneNode.scrollLeft-=dx; - clearInterval(sceneNode.sceneInterval); - delete sceneNode.sceneInterval; - } - else{ - var ddx=dx/Math.sqrt(Math.abs(dx))*1.5; - sceneNode.scrollLeft-=ddx; - sceneNode.dx-=ddx; - } - },16); - } - node.style.transition='all ease-in 0.2s'; - node.style.transform='perspective(1600px) rotateY(90deg) scale(0.75)'; - var onEnd=function(){ - node.removeEventListener('webkitTransitionEnd',onEnd); - node.classList.add('flipped'); - sceneNode.classList.add('lockscroll'); - node.style.transition='all ease-out 0.4s'; - node.style.transform='perspective(1600px) rotateY(180deg) scale(1)' - }; - node.listenTransition(onEnd); - } - ui.click.scene=clickScene; - var restoreScene=function(node,forced){ - if(node._clicking&&!forced) return; - if(node.transformInterval){ - clearInterval(node.transformInterval); - delete node.transformInterval; - } - var sceneNode=node.parentNode; - node._clicking=true; - setTimeout(function(){ - node._clicking=false; - },700); - node.style.transition='all ease-in 0.2s'; - node.style.transform='perspective(1600px) rotateY(90deg) scale(0.75)'; - var onEnd=function(){ - node.removeEventListener('webkitTransitionEnd',onEnd); - node.classList.remove('flipped'); - if(!sceneNode.querySelector('.flipped')){ - sceneNode.classList.remove('lockscroll'); - } - node.style.transition='all ease-out 0.4s'; - node.style.transform='perspective(1600px) rotateY(0deg) scale(0.7)' - }; - node.listenTransition(onEnd); - } - ui.click.scene2=restoreScene; - var createScene=function(name){ - var scene=lib.tafang.map[name]; - var node=ui.create.div('.scene',clickScene); - node.style.transform='perspective(1600px) rotateY(0deg) scale(0.7)'; - node.name=name; - node.bgnode=ui.create.div('.background.player',node); - node.info=scene; - ui.create.div('.avatar.menu',node.bgnode); - node.namenode=ui.create.div('.name',node,(scene.name)); - if(lib.storage.map.contains(name)){ - if(lib.storage.newmap.contains(name)){ - node.classList.add('glow3'); - } - node.namenode.dataset.nature='soilm'; - } - else{ - node.classList.add('unselectable'); - node.namenode.innerHTML=('未开启'); - } - var content=ui.create.div('.menu',node); - lib.setScroll(content); - node.content=content; - sceneview.appendChild(node); - return node; - } - event.custom.add.window=function(){ - var current=document.querySelector('.flipped.scene'); - if(current){ - restoreScene(current); - } - } - for(var i in lib.tafang.map){ - createScene(i); - } - ui.window.appendChild(sceneview.animate('start')); - game.pause(); - }); - }, - }, - skill:{ - tafang_mech_weixingxianjing_skill:{ - filter:function(player){ - for(var i=0;i<_status.enemies.length;i++){ - if(!_status.enemies[i].isTurnedOver()&& - get.chessDistance(player,_status.enemies[i])<=2){ - return true; - } - } - return false; - }, - content:function(){ - var list=[]; - for(var i=0;i<_status.enemies.length;i++){ - if(!_status.enemies[i].isTurnedOver()&& - get.chessDistance(player,_status.enemies[i])<=2){ - list.push(_status.enemies[i]); - } - } - if(list.length){ - game.log('小型陷阱发动'); - var target=list.randomGet(); - target.turnOver(); - game.logv(player,'tafang_mech_weixingxianjing_skill',[target]).node.text.style.display='none'; - player.line(target,'green'); - } - } - }, - tafang_mech_nengliangqiu_skill:{ - filter:function(player){ - for(var i=0;i<_status.friends.length;i++){ - if(get.chessDistance(player,_status.friends[i])<=3){ - return true; - } - } - return false; - }, - content:function(){ - var list1=[],list2=[]; - for(var i=0;i<_status.friends.length;i++){ - if(get.chessDistance(player,_status.friends[i])<=1){ - list2.push(_status.friends[i]); - } - else if(get.chessDistance(player,_status.friends[i])<=3){ - list1.push(_status.friends[i]); - } - // else if(get.chessDistance(player,_status.friends[i])<=4){ - // list2.push(_status.friends[i]); - // } - } - if(list2.length){ - game.asyncDraw(list2,2); - player.line(list2,'green'); - } - if(list1.length){ - game.asyncDraw(list1); - player.line(list1,'green'); - } - if(list1.length||list2.length){ - game.log('能量球发动'); - game.logv(player,'tafang_mech_nengliangqiu_skill',list1.concat(list2)).node.text.style.display='none'; - } - } - }, - tafang_mech_mutong_skill:{ - filter:function(player){ - for(var i=0;i<_status.enemies.length;i++){ - if(get.chessDistance(player,_status.enemies[i])<=3){ - return true; - } - } - return false; - }, - content:function(){ - var list=[]; - for(var i=0;i<_status.enemies.length;i++){ - if(get.chessDistance(player,_status.enemies[i])<=3){ - list.push(_status.enemies[i]); - } - } - if(list.length){ - game.log('木桶发动'); - var targets=list.randomGets(1); - game.logv(player,'tafang_mech_mutong_skill',targets).node.text.style.display='none'; - player.line(targets,'green'); - for(var i=0;i
  • 阻上敌人到达最下方的出口,坚持到给定的回合数即获得胜利
  • '+ - '每轮可获得10个行动点,用来布置机关、招募武将。场上每有一个友方武将,行动点数-1。游戏难度将影响不同操作消耗的行动点数。未用完的行动点将减半(向下取整)并累积到下一轮
  • '+ - '每一轮在最上方的一个随机位置增加一名敌人,若最上方已有角色,则将其下移一格
  • '+ - '战场上最多出现3个相同的机关,每个机关在置入战场3轮后消失。战场上最多招募5名友方角色。
  • '+ - '敌方角色到达底部出口时游戏失败,已方角色到达底部出口,将被移出游戏', - }, - }; -}); +'use strict'; +game.import('mode',function(lib,game,ui,get,ai,_status){ + return { + name:'tafang', + canvasUpdates2:[], + start:function(){ + "step 0" + _status.gameDrawed=true; + lib.init.css(lib.assetURL+'layout/mode','chess'); + lib.init.css(lib.assetURL+'layout/mode','tafang'); + game.loadMode('chess'); + "step 1" + if(get.is.phoneLayout()&&lib.config.touchscreen&& + !lib.config.show_round_menu&& + !['system','menu'].contains(lib.config.swipe_left)&& + !['system','menu'].contains(lib.config.swipe_right)&& + !['system','menu'].contains(lib.config.swipe_up)){ + ui.roundmenu.style.display=''; + } + if(lib.config.player_border=='normal'&&(lib.config.layout=='long'||lib.config.layout=='long2')){ + ui.arena.classList.add('lslim_player'); + } + for(var i in result.element){ + for(var j in result.element[i]){ + if(j!='dieAfter'){ + lib.element[i][j]=result.element[i][j]; + } + } + } + for(var i in result.ui){ + for(var j in result.ui[i]){ + ui[i][j]=result.ui[i][j]; + } + } + get.chessDistance=result.get.chessDistance; + get.rawAttitude=result.get.rawAttitude; + var toLoad=['addChessPlayer','addObstacle','removeObstacle','isChessNeighbour', + 'draw2','updateCanvas2','setChessInfo','modeSwapPlayer','initChess']; + for(var i=0;i=8&&j!=0&&j!=ui.chesswidth-1) continue; + if(tafanglist.contains(j)){ + var cg=i*ui.chesswidth+j; + grids.remove(cg); + game.addObstacle(cg.toString(),false); + event.obs.push(cg.toString()); + } + } + } + for(var i=0;icount){ + map[i][j].classList.add('unselectable'); + map[i][j].classList.remove('pointerdiv'); + } + else if(i=='zhaomu'&&_status.friends.length+selectedZhaomu>=5){ + map[i][j].classList.add('unselectable'); + map[i][j].classList.remove('pointerdiv'); + } + else if(i=='bufang'){ + var numbufang=0; + for(var k=0;k=3){ + map[i][j].classList.add('unselectable'); + break; + } + } + } + } + } + ui.dialog.content.firstChild.innerHTML='剩余行动点:'+count; + } + var clickOrder=0; + event.custom.replace.button=function(button){ + if(!button.classList.contains('unselectable')|| + button.classList.contains('selected')){ + button.classList.toggle('selected'); + button._clickOrder=clickOrder++; + } + updateSelected(); + } + event.custom.add.window=function(clicked){ + if(clicked) return; + if(event.step>1) return; + for(var i in map){ + for(var j=0;j=5){ + event.control.childNodes[1].style.opacity=0.5; + event.control.childNodes[1].disabled=true; + if(_status.lastTafangCommand=='招募'){ + _status.lastTafangCommand='布防'; + } + } + _status.imchoosing=true; + ui.auto.hide(); + var eventdong=function(){ + var selected=dialog.querySelectorAll('.button.selected'); + event.bufang=[]; + event.zhaomu=[]; + event.xingdong=_status.friends.slice(0); + // var xingdongs=[]; + _status.remainingCount+=10; + for(var i=0;i0){ + game.pause(); + } + else{ + eventdong(); + } + 'step 1' + event.dialog.close(); + event.control.close(); + event.done.close(); + delete event.dialog; + delete event.control; + delete event.done; + 'step 2' + event.chooseObstacle=false; + if(event.bufang.length){ + event.obstacles=game.obstacles.slice(0); + for(var i=0;i=0;k--){ + var pos=i+k*ui.chesswidth; + if(lib.posmap[pos]){ + lib.posmap[pos].moveDown(); + } + } + } + } + } + if(shalldelay) game.delay(); + 'step 7' + event.justadded=[]; + if(_status.characterList.length){ + if(_status.enemies.length=10&&list1.length&&difficulty>1){ + // var enemy=game.addChessPlayer(_status.characterList.shift(),true,4,list1.randomRemove()); + // _status.enemies.push(enemy); + // event.justadded.push(enemy.name); + // } + // if(_status.turnCount>=20&&list1.length&&difficulty>1){ + // var enemy=game.addChessPlayer(_status.characterList.shift(),true,4,list1.randomRemove()); + // _status.enemies.push(enemy); + // event.justadded.push(enemy.name); + // } + // if(list1.length&&difficulty>2){ + // var enemy=game.addChessPlayer(_status.characterList.shift(),true,4,list1.randomRemove()); + // _status.enemies.push(enemy); + // event.justadded.push(enemy.name); + // } + } + } + else{ + game.over(true); + } + 'step 8' + if(event.xingdong.length){ + var toact=event.xingdong.shift(); + if(game.players.contains(toact)){ + toact.phase(); + } + event.redo(); + } + else{ + event.xingdong=_status.enemies.slice(0); + } + 'step 9' + if(event.xingdong.length){ + var enemy=event.xingdong.shift(); + if(!event.justadded.contains(enemy.name)&&game.players.contains(enemy)){ + enemy.phase(); + } + event.redo(); + } + else{ + event.mechlist=game.treasures.slice(0); + } + 'step 10' + if(event.mechlist.length){ + var mech=event.mechlist.shift(); + var info=lib.skill[mech.name+'_skill']; + if(!info.filter||info.filter(mech)){ + var next=game.createEvent('chessMech'); + next.player=mech; + next.setContent(info.content); + mech.chessFocus(); + if(lib.config.animation&&!lib.config.low_performance){ + mech.$epic2(); + } + game.delay(); + } + if(--mech.hp<=0){ + var next=game.createEvent('chessMechRemove'); + next.player=mech; + next.setContent('chessMechRemove'); + } + else{ + mech.update(); + } + event.redo(); + } + 'step 11' + delete event.xingdong; + delete event.mechlist; + if(_status.turnCount>=_status.turnTotal){ + game.over(true); + } + else{ + event.goto(0); + game.delay(); + } + }); + }, + loadMap:function(){ + var next=game.createEvent('loadMap'); + next.setContent(function(){ + if(!lib.storage.map){ + lib.storage.map=['basic_small','basic_medium','basic_large']; + } + if(!lib.storage.newmap){ + lib.storage.newmap=[]; + } + var sceneview=ui.create.div('.storyscene'); + if(!lib.config.touchscreen&&lib.config.mousewheel){ + sceneview._scrollspeed=30; + sceneview._scrollnum=10; + sceneview.onmousewheel=function(){ + if(!this.classList.contains('lockscroll')){ + ui.click.mousewheel.apply(this,arguments); + } + }; + } + lib.setScroll(sceneview); + var switchScene=function(){ + event.result=this.link; + sceneview.delete(); + setTimeout(game.resume,300); + } + var clickScene=function(e){ + if(this.classList.contains('unselectable')) return; + if(this._clicking) return; + if(e&&e.stopPropagation) e.stopPropagation(); + if(this.classList.contains('flipped')){ + return; + } + if(this.classList.contains('glow3')){ + this.classList.remove('glow3'); + lib.storage.newmap.remove(this.name); + game.save('newmap',lib.storage.newmap); + } + var sceneNode=this.parentNode; + var current=document.querySelector('.flipped.scene'); + if(current){ + restoreScene(current,true); + } + this.content.innerHTML=''; + ui.create.div('.menubutton.large.enter','进入',this.content,switchScene).link=this.name; + sceneNode.classList.add('lockscroll'); + var node=this; + node._clicking=true; + setTimeout(function(){ + node._clicking=false; + },700); + sceneNode.dx=ui.window.offsetWidth/2-(-sceneNode.scrollLeft+this.offsetLeft+this.offsetWidth/2); + if(Math.abs(sceneNode.dx)<20){ + sceneNode.dx=0; + } + if(!sceneNode.sceneInterval&&sceneNode.dx){ + sceneNode.sceneInterval=setInterval(function(){ + var dx=sceneNode.dx; + if(Math.abs(dx)<=2){ + sceneNode.scrollLeft-=dx; + clearInterval(sceneNode.sceneInterval); + delete sceneNode.sceneInterval; + } + else{ + var ddx=dx/Math.sqrt(Math.abs(dx))*1.5; + sceneNode.scrollLeft-=ddx; + sceneNode.dx-=ddx; + } + },16); + } + node.style.transition='all ease-in 0.2s'; + node.style.transform='perspective(1600px) rotateY(90deg) scale(0.75)'; + var onEnd=function(){ + node.removeEventListener('webkitTransitionEnd',onEnd); + node.classList.add('flipped'); + sceneNode.classList.add('lockscroll'); + node.style.transition='all ease-out 0.4s'; + node.style.transform='perspective(1600px) rotateY(180deg) scale(1)' + }; + node.listenTransition(onEnd); + } + ui.click.scene=clickScene; + var restoreScene=function(node,forced){ + if(node._clicking&&!forced) return; + if(node.transformInterval){ + clearInterval(node.transformInterval); + delete node.transformInterval; + } + var sceneNode=node.parentNode; + node._clicking=true; + setTimeout(function(){ + node._clicking=false; + },700); + node.style.transition='all ease-in 0.2s'; + node.style.transform='perspective(1600px) rotateY(90deg) scale(0.75)'; + var onEnd=function(){ + node.removeEventListener('webkitTransitionEnd',onEnd); + node.classList.remove('flipped'); + if(!sceneNode.querySelector('.flipped')){ + sceneNode.classList.remove('lockscroll'); + } + node.style.transition='all ease-out 0.4s'; + node.style.transform='perspective(1600px) rotateY(0deg) scale(0.7)' + }; + node.listenTransition(onEnd); + } + ui.click.scene2=restoreScene; + var createScene=function(name){ + var scene=lib.tafang.map[name]; + var node=ui.create.div('.scene',clickScene); + node.style.transform='perspective(1600px) rotateY(0deg) scale(0.7)'; + node.name=name; + node.bgnode=ui.create.div('.background.player',node); + node.info=scene; + ui.create.div('.avatar.menu',node.bgnode); + node.namenode=ui.create.div('.name',node,(scene.name)); + if(lib.storage.map.contains(name)){ + if(lib.storage.newmap.contains(name)){ + node.classList.add('glow3'); + } + node.namenode.dataset.nature='soilm'; + } + else{ + node.classList.add('unselectable'); + node.namenode.innerHTML=('未开启'); + } + var content=ui.create.div('.menu',node); + lib.setScroll(content); + node.content=content; + sceneview.appendChild(node); + return node; + } + event.custom.add.window=function(){ + var current=document.querySelector('.flipped.scene'); + if(current){ + restoreScene(current); + } + } + for(var i in lib.tafang.map){ + createScene(i); + } + ui.window.appendChild(sceneview.animate('start')); + game.pause(); + }); + }, + }, + skill:{ + tafang_mech_weixingxianjing_skill:{ + filter:function(player){ + for(var i=0;i<_status.enemies.length;i++){ + if(!_status.enemies[i].isTurnedOver()&& + get.chessDistance(player,_status.enemies[i])<=2){ + return true; + } + } + return false; + }, + content:function(){ + var list=[]; + for(var i=0;i<_status.enemies.length;i++){ + if(!_status.enemies[i].isTurnedOver()&& + get.chessDistance(player,_status.enemies[i])<=2){ + list.push(_status.enemies[i]); + } + } + if(list.length){ + game.log('小型陷阱发动'); + var target=list.randomGet(); + target.turnOver(); + game.logv(player,'tafang_mech_weixingxianjing_skill',[target]).node.text.style.display='none'; + player.line(target,'green'); + } + } + }, + tafang_mech_nengliangqiu_skill:{ + filter:function(player){ + for(var i=0;i<_status.friends.length;i++){ + if(get.chessDistance(player,_status.friends[i])<=3){ + return true; + } + } + return false; + }, + content:function(){ + var list1=[],list2=[]; + for(var i=0;i<_status.friends.length;i++){ + if(get.chessDistance(player,_status.friends[i])<=1){ + list2.push(_status.friends[i]); + } + else if(get.chessDistance(player,_status.friends[i])<=3){ + list1.push(_status.friends[i]); + } + // else if(get.chessDistance(player,_status.friends[i])<=4){ + // list2.push(_status.friends[i]); + // } + } + if(list2.length){ + game.asyncDraw(list2,2); + player.line(list2,'green'); + } + if(list1.length){ + game.asyncDraw(list1); + player.line(list1,'green'); + } + if(list1.length||list2.length){ + game.log('能量球发动'); + game.logv(player,'tafang_mech_nengliangqiu_skill',list1.concat(list2)).node.text.style.display='none'; + } + } + }, + tafang_mech_mutong_skill:{ + filter:function(player){ + for(var i=0;i<_status.enemies.length;i++){ + if(get.chessDistance(player,_status.enemies[i])<=3){ + return true; + } + } + return false; + }, + content:function(){ + var list=[]; + for(var i=0;i<_status.enemies.length;i++){ + if(get.chessDistance(player,_status.enemies[i])<=3){ + list.push(_status.enemies[i]); + } + } + if(list.length){ + game.log('木桶发动'); + var targets=list.randomGets(1); + game.logv(player,'tafang_mech_mutong_skill',targets).node.text.style.display='none'; + player.line(targets,'green'); + for(var i=0;i
  • 阻上敌人到达最下方的出口,坚持到给定的回合数即获得胜利
  • '+ + '每轮可获得10个行动点,用来布置机关、招募武将。场上每有一个友方武将,行动点数-1。游戏难度将影响不同操作消耗的行动点数。未用完的行动点将减半(向下取整)并累积到下一轮
  • '+ + '每一轮在最上方的一个随机位置增加一名敌人,若最上方已有角色,则将其下移一格
  • '+ + '战场上最多出现3个相同的机关,每个机关在置入战场3轮后消失。战场上最多招募5名友方角色。
  • '+ + '敌方角色到达底部出口时游戏失败,已方角色到达底部出口,将被移出游戏', + }, + }; +});