From 3f66e727935b9df6208dc12cbb1434e9f862ffcd Mon Sep 17 00:00:00 2001 From: libccy Date: Wed, 11 May 2016 23:50:00 +0800 Subject: [PATCH] c --- card/extra.js | 13 +- card/guozhan.js | 1 + card/hearth.js | 2 + card/standard.js | 4 + card/swd.js | 3 +- character/sp.js | 170 +++++++++++++++++++++++++- character/yijiang.js | 284 ++++++++++++++++++++++++++++++++++++++++++- game/game.js | 35 ++++-- 8 files changed, 490 insertions(+), 22 deletions(-) diff --git a/card/extra.js b/card/extra.js index 7744a7d63..6851cc5a3 100755 --- a/card/extra.js +++ b/card/extra.js @@ -11,6 +11,7 @@ card.extra={ }, usable:1, selectTarget:-1, + modTarget:true, filterTarget:function(card,player,target){ return target==player; }, @@ -22,18 +23,20 @@ card.extra={ } } else{ - game.broadcastAll(function(target,card){ + game.broadcastAll(function(target,card,gain2){ target.addSkill('jiu'); if(!target.node.jiu&&lib.config.jiu_effect){ target.node.jiu=ui.create.div('.playerjiu',target.node.avatar); target.node.jiu2=ui.create.div('.playerjiu',target.node.avatar2); } - if(card.clone&&(card.clone.parentNode==target.parentNode||card.clone.parentNode==ui.arena)){ + if(gain2&&card.clone&&(card.clone.parentNode==target.parentNode||card.clone.parentNode==ui.arena)){ card.clone.moveDelete(target); } - },target,card); - if(card.clone&&(card.clone.parentNode==target.parentNode||card.clone.parentNode==ui.arena)){ - game.addVideo('gain2',target,get.cardsInfo([card])); + },target,card,target==targets[0]); + if(target==targets[0]){ + if(card.clone&&(card.clone.parentNode==target.parentNode||card.clone.parentNode==ui.arena)){ + game.addVideo('gain2',target,get.cardsInfo([card])); + } } } }, diff --git a/card/guozhan.js b/card/guozhan.js index 476497489..b1247bd01 100755 --- a/card/guozhan.js +++ b/card/guozhan.js @@ -14,6 +14,7 @@ card.guozhan={ if(player.identity=='ye') return true; return player.identity!=target.identity; }, + multitarget:true, content:function(){ game.asyncDraw([target,player],[1,get.mode()=='guozhan'?3:1]); }, diff --git a/card/hearth.js b/card/hearth.js index dfefdb243..0bf3b947c 100644 --- a/card/hearth.js +++ b/card/hearth.js @@ -319,6 +319,7 @@ card.hearth={ return player==target; }, selectTarget:-1, + modTarget:true, content:function(){ target.changeHujia(); target.draw(); @@ -441,6 +442,7 @@ card.hearth={ type:'basic', enable:true, selectTarget:-1, + modTarget:true, filterTarget:function(card,player,target){return player==target}, content:function(){ target.gainMaxHp(); diff --git a/card/standard.js b/card/standard.js index 5eb58c063..a48d7ce0e 100755 --- a/card/standard.js +++ b/card/standard.js @@ -206,6 +206,9 @@ card.standard={ filterTarget:function(card,player,target){ return target==player&&target.hp0&&event.player!=player&&!player.skills.contains('zhidao2'); + }, + forced:true, + content:function(){ + var num=0; + if(trigger.player.num('h')) num++; + if(trigger.player.num('e')) num++; + if(trigger.player.num('j')) num++; + if(num){ + player.gainPlayerCard(trigger.player,num,'hej',true).set('filterButton',function(button){ + for(var i=0;idistance){ + targets.splice(i);break; + } + } + player.chooseTarget(true,function(card,player,target){ + return _status.event.targets.contains(target); + }).set('ai',function(target){ + return ai.get.attitude(_status.event.player,target); + }).set('targets',targets); + } + 'step 2' + if(!event.target){ + event.target=result.targets[0]; + player.line(result.targets,'green'); + } + if(!event.target){ + event.finish(); + return; + } + var list=['sha','shan','tao','jiu']; + if(player.storage.jiaozhao1){ + list=list.concat(['taoyuan','wugu','juedou','huogong','jiedao','tiesuo','guohe','shunshou','wuzhong','wanjian','nanman']); + } + for(var i=0;i0){ + if(game.players[i].hp<2){ + lose--; + recover+=0.5; + } + lose--; + recover++; + } + else if(ai.get.attitude(player,game.players[i])<0){ + if(game.players[i].hp<2){ + lose++; + recover-=0.5; + } + lose++; + recover--; + } + } + else{ + if(ai.get.attitude(player,game.players[i])>0){ + lose--; + } + else if(ai.get.attitude(player,game.players[i])<0){ + lose++; + } + } + } + } + if(lose>recover&&lose>0) return (button.link[2]=='nanman')?1:-1; + if(lose0) return (button.link[2]=='taoyuan')?1:-1; + return (button.link[2]=='shunshou')?1:-1; + } + }).set('att',att).set('trick',player.storage.jiaozhao1); + 'step 3' + event.target.showCards(game.createCard(result.links[0]),get.translation(event.target)+'声明了'+get.translation(result.links[0][2])); + player.storage.jiaozhao=cards[0]; + player.storage.jiaozhao_card=result.links[0][2]; + game.broadcastAll(function(name){ + lib.skill.jiaozhao2.viewAs={name:name}; + },result.links[0][2]); + }, + ai:{ + order:9, + result:{ + player:1 + } + }, + intro:{ + content:function(storage,player){ + if(player.storage.jiaozhao2){ + return '出牌阶段限一次,你可以展示一张手牌,然后你声明一张基本牌或非延时类锦囊牌的牌名。在此出牌阶段内,你可以将此手牌当声明的牌使用且你不能被选择为目标'; + } + else{ + return '出牌阶段限一次,你可以展示一张手牌,然后选择距离最近的一名其他角色,该角色声明一张基本牌或非延时类锦囊牌的牌名。在此出牌阶段内,你可以将此手牌当声明的牌使用且你不能被选择为目标'; + } + } + }, + group:['jiaozhao2','jiaozhao3'] + }, + jiaozhao2:{ + enable:'phaseUse', + filter:function(event,player){ + if(!player.storage.jiaozhao) return false; + var name=player.storage.jiaozhao_card; + if(name=='tao'||name=='shan'||name=='wuzhong'||name=='jiu') return false; + return player.get('h').contains(player.storage.jiaozhao); + }, + filterCard:function(card,player){ + return card==player.storage.jiaozhao; + }, + selectCard:-1, + popname:true, + filterTarget:function(card,player,target){ + if(player==target) return false; + return lib.filter.filterTarget({name:player.storage.jiaozhao_card},player,target); + }, + }, + jiaozhao3:{ + trigger:{player:'phaseEnd'}, + forced:true, + popup:false, + content:function(){ + delete player.storage.jiaozhao; + delete player.storage.jiaozhao2; + } + }, + danxin:{ + trigger:{player:'damageEnd'}, + frequent:true, + content:function(){ + 'step 0' + if(player.storage.jiaozhao1&&player.storage.jiaozhao2){ + player.draw(); + event.finish(); + } + else{ + var list=['draw_card','更改描述']; + var prompt; + if(player.storage.jiaozhao1){ + prompt='摸一张牌或更改矫诏的描述

更改描述:将“选择距离最近的一名其他角色,该角色”改为“你”'; + } + else{ + prompt='摸一张牌或更改矫诏的描述

更改描述:将“基本牌”改为“基本牌或非延时类锦囊牌”'; + } + player.chooseControl(list,function(){ + if(!_status.event.player.hasSkill('jiaozhao')) return 'draw_card'; + return '更改描述'; + }).set('prompt',prompt); + } + 'step 1' + if(result.control=='draw_card'){ + player.draw(); + } + else{ + game.log(player,'更改了','【矫诏】','的描述'); + player.popup('更改描述'); + player.markSkill('jiaozhao'); + if(player.storage.jiaozhao1){ + player.storage.jiaozhao2=true; + } + else{ + player.storage.jiaozhao1=true; + } + } + } + }, + zongzuo:{ + trigger:{global:'phaseBefore'}, + forced:true, + priority:10, + filter:function(event,player){ + return !player.storage.zongzuo; + }, + content:function(){ + 'step 0' + player.storage.zongzuo=true; + var list=['wei','shu','wu','qun'],num=0; + for(var i=0;iplayer.hp; + }, + filterTarget:function(card,player,target){ + return get.distance(target,player,'attack')<=1&&target.num('e')>0; + }, + content:function(){ + 'step 0' + target.chooseToUse({name:'sha'},player,-1,'止戈:使用一张杀,或将其装备区里的一张牌交给'+get.translation(player)); + 'step 1' + if(!result.bool&&target.num('e')){ + target.chooseCard('e',true,'将其装备区里的一张牌交给'+get.translation(player)); + } + else{ + event.finish(); + } + 'step 2' + if(result.bool&&result.cards&&result.cards.length){ + player.gain(result.cards); + target.$give(result.cards,player); + } + }, + ai:{ + order:5, + result:{ + target:-1, + player:function(player,target){ + if(target.num('h')==0) return 0; + if(target.num('h')==1) return -0.1; + if(player.hp<=2) return -2; + if(player.num('h','shan')==0) return -1; + return -0.5; + } + } + } + }, kuangbi:{ enable:'phaseUse', usable:1, @@ -6272,7 +6549,8 @@ character.yijiang={ liyan:'李严', jiaozhao:'矫诏', - jiaozhao_info:'出牌阶段限一次,你可以展示一张手牌,然后选择距离最近的一名其他角色,该角色声明一张基本牌的牌名。直到回合结束,你可以将此手牌当声明的牌使用且你不能被选择为目标', + jiaozhao2:'矫诏', + jiaozhao_info:'出牌阶段限一次,你可以展示一张手牌,然后选择距离最近的一名其他角色,该角色声明一张基本牌的牌名。在此出牌阶段内,你可以将此手牌当声明的牌使用且你不能被选择为目标', danxin:'殚心', danxin_info:'当你受到伤害后,你可以摸一张牌,或对“矫诏”的描述依次执行下列一项修改:1.将“基本牌”改为“基本牌或非延时类锦囊牌”;2.将“选择距离最近的一名其他角色,该角色”改为“你”', duliang:'督粮', diff --git a/game/game.js b/game/game.js index 951ea5fbe..21ae22e41 100755 --- a/game/game.js +++ b/game/game.js @@ -3828,6 +3828,8 @@ if(pilecfg){ lib.config.bannedpile=pilecfg[0]||{}; lib.config.addedpile=pilecfg[1]||{}; + lib.config.bannedpile=JSON.parse(JSON.stringify(lib.config.bannedpile)); + lib.config.addedpile=JSON.parse(JSON.stringify(lib.config.addedpile)); } } else{ @@ -5759,7 +5761,7 @@ } event.dialog.close(); "step 2" - if(game.online){ + if(game.online||!event.result.bool){ event.finish(); } "step 3" @@ -11790,6 +11792,14 @@ if(typeof filter=='boolean') return filter; if(typeof filter=='function') return filter(card,player,target); }, + targetEnabled2:function(card,player,target){ + if(lib.filter.targetEnabled(card,player,target)) return true; + if(card==undefined) return false; + var filter=get.info(card).modTarget; + if(typeof filter=='boolean') return filter; + if(typeof filter=='function') return filter(card,player,target); + return false; + }, targetInRange:function(card,player,target){ var mod=game.checkMod(card,player,target,'unchanged','targetInRange',player.get('s')); var extra=0; @@ -16814,11 +16824,11 @@ } } - var pilecfg=lib.config.customcardpile[get.config('cardpilename')]; - if(pilecfg){ - lib.config.bannedpile=pilecfg[0]||{}; - lib.config.addedpile=pilecfg[1]||{}; - } + // var pilecfg=lib.config.customcardpile[get.config('cardpilename')]; + // if(pilecfg){ + // lib.config.bannedpile=pilecfg[0]||{}; + // lib.config.addedpile=pilecfg[1]||{}; + // } try{ lib.storage=JSON.parse(localStorage.getItem(lib.configprefix+lib.config.mode)); @@ -19996,7 +20006,10 @@ var toggleCardPile=function(bool){ var name=this._link.config._name; var number=this._link.config._number; - if(!bool){ + if(!lib.config.bannedpile[name]){ + lib.config.bannedpile[name]=[]; + } + if(bool){ lib.config.bannedpile[name].remove(number); } else{ @@ -20291,8 +20304,8 @@ that.innerHTML='使用默认牌堆'; },1000); game.saveConfig('cardpilename',null,true); - game.saveConfig('bannedpile'); - game.saveConfig('addedpile'); + game.saveConfig('bannedpile',{}); + game.saveConfig('addedpile',{}); updatePileConfig(); },page); var exportCardPile; @@ -20326,8 +20339,8 @@ lib.config.customcardpile[name]=[lib.config.bannedpile,lib.config.addedpile]; game.saveConfig('cardpilename',name,true); game.saveConfig('customcardpile',lib.config.customcardpile); - game.saveConfig('bannedpile'); - game.saveConfig('addedpile'); + game.saveConfig('bannedpile',{}); + game.saveConfig('addedpile',{}); createPileNode(name); updatePileConfig(); };