This commit is contained in:
libccy 2017-05-11 12:46:11 +08:00
parent b18b195947
commit f8fedc0000
5 changed files with 247 additions and 68 deletions

View File

@ -3,28 +3,149 @@ game.import('card',function(lib,game,ui,get,ai,_status){
return {
name:'gwent',
card:{
gw_xinsheng:{
fullborder:'gold',
type:'spell',
subtype:'spell_gold',
vanish:true,
enable:function(card,player){
return game.hasPlayer(function(current){
return !current.isUnseen();
});
},
notarget:true,
contentBefore:function(){
player.$skill('新生','legend','metal');
game.delay(2);
},
content:function(){
'step 0'
var target=game.findMax(game.filterPlayer(function(current){
return !current.isUnseen();
}).randomSort(),function(current){
var att=get.attitude(player,current);
var rank=get.rank(current,true);
if(current.maxHp>=3){
if(current.hp<=1){
return att*2;
}
else if(current.hp==2){
if(att>0){
att*=1.5;
}
else{
att/=1.5;
}
}
}
if(rank>=7){
if(att>0){
return att/10;
}
return -att;
}
else if(rank<=4){
if(att<0){
return -att/10;
}
return att;
}
return Math.abs(att/2);
})[0];
event.aitarget=target;
var list=[];
for(var i in lib.character){
if(!lib.filter.characterDisabled(i)&&lib.character[i][2]>=5){
list.push(i);
}
}
var players=game.players.concat(game.dead);
for(var i=0;i<players.length;i++){
list.remove(players[i].name);
list.remove(players[i].name1);
list.remove(players[i].name2);
}
var dialog=ui.create.dialog('选择一张武将牌','hidden');
dialog.add([list.randomGets(12),'character']);
player.chooseButton(dialog,true).ai=function(button){
if(get.attitude(player,event.aitarget)>0){
return get.rank(button.link,true);
}
else{
return -get.rank(button.link,true);
}
};
'step 1'
event.nametarget=result.links[0];
player.chooseTarget(true,'使用'+get.translation(event.nametarget)+'替换一名角色的武将牌',function(card,player,target){
return !target.isUnseen();
}).ai=function(target){
if(target==event.aitarget){
return 1;
}
else{
return 0;
}
}
'step 2'
var target=result.targets[0];
target.reinit(target.name,event.nametarget);
target.hp=target.maxHp;
target.update();
player.line(target,'green');
},
contentAfter:function(){
var evt=_status.event.getParent('phaseUse');
if(evt&&evt.name=='phaseUse'){
evt.skipped=true;
}
},
ai:{
value:8,
useful:[6,1],
result:{
player:1
},
order:0.5,
}
},
gw_niuquzhijing:{
fullborder:'gold',
type:'spell',
subtype:'spell_gold',
vanish:true,
enable:function(card,player){
if(game.hasPlayer(function(current){
return game.hasPlayer(function(current){
return current.hp!=player.hp;
})){
return !player.storage.spell_gold;
}
});
},
filterTarget:function(card,player,target){
return target.isHighestHp()||target.isLowestHp();
},
chongzhu:function(event,player){
return player.storage.spell_gold?true:false;
},
selectTarget:-1,
multitarget:true,
multiline:true,
notarget:true,
contentBefore:function(){
var list1=game.filterPlayer(function(current){
return current.isHighestHp();
});
var list2=game.filterPlayer(function(current){
return current.isLowestHp();
});
player.line(list1);
for(var i=0;i<list1.length;i++){
list1[i].animate('target');
}
setTimeout(function(){
var list11=list1.slice(0);
var list22=list2.slice(0);
while(list22.length>list11.length){
list11.push(list1.randomGet());
}
while(list22.length<list11.length){
list22.push(list2.randomGet());
}
list11.sortBySeat();
list22.sortBySeat();
while(list11.length){
list11.shift().line(list22.shift(),'green');
}
},500);
player.$skill('纽曲之镜','legend','metal');
game.delay(2);
},
@ -40,13 +161,16 @@ game.import('card',function(lib,game,ui,get,ai,_status){
min=game.players[i].hp;break;
}
}
var targets=game.filterPlayer();
if(max!=min&&max!=null&&min!=null){
for(var i=0;i<targets.length;i++){
if(targets[i].hp==max){
targets[i].hp=min;
targets[i].$damagepop(min-max);
}
else if(targets[i].hp==min){
targets[i].hp=max;
targets[i].$damagepop(max-min,'wood');
if(targets[i].maxHp<targets[i].hp){
targets[i].maxHp=targets[i].hp;
}
@ -56,7 +180,6 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}
},
contentAfter:function(){
player.storage.spell_gold=true;
var evt=_status.event.getParent('phaseUse');
if(evt&&evt.name=='phaseUse'){
evt.skipped=true;
@ -64,14 +187,20 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
ai:{
value:8,
useful:[6,1],
result:{
target:function(player,target){
if(target.isHighestHp) return -10;
return 10;
player:function(player,target){
return game.countPlayer(function(current){
if(current.isHighestHp()){
return -get.sgn(get.attitude(player,current));
}
if(current.isLowestHp()){
return get.sgn(get.attitude(player,current));
}
});
}
},
order:3.5,
multitarget:true,
}
},
gw_zhongmozhizhan:{
@ -79,25 +208,17 @@ game.import('card',function(lib,game,ui,get,ai,_status){
type:'spell',
subtype:'spell_gold',
vanish:true,
enable:function(card,player){
return !player.storage.spell_gold;
},
filterTarget:function(card,player,target){
return target.countCards('hej');
},
chongzhu:function(event,player){
return player.storage.spell_gold?true:false;
},
selectTarget:-1,
multitarget:true,
multiline:true,
enable:true,
notarget:true,
contentBefore:function(){
player.line(game.filterPlayer());
player.$skill('终末之战','legend','metal');
game.delay(2);
},
content:function(){
'step 0'
event.num=0;
event.targets=game.filterPlayer().sortBySeat();
'step 1'
if(event.num<targets.length){
ui.clear();
@ -113,7 +234,6 @@ game.import('card',function(lib,game,ui,get,ai,_status){
ui.clear();
},
contentAfter:function(){
player.storage.spell_gold=true;
var evt=_status.event.getParent('phaseUse');
if(evt&&evt.name=='phaseUse'){
evt.skipped=true;
@ -121,14 +241,15 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
ai:{
value:8,
useful:[6,1],
result:{
target:function(player,target){
return -Math.sqrt(target.countCards('he'));
player:function(player,target){
return -game.countPlayer(function(current){
return current.countCards('he')*get.sgn(get.attitude(player,current));
});
}
},
order:0.5,
multitarget:true,
multineg:true
}
},
gw_butianshu:{
@ -136,13 +257,8 @@ game.import('card',function(lib,game,ui,get,ai,_status){
type:'spell',
subtype:'spell_silver',
vanish:true,
enable:function(card,player){
return player.storage.spell_silver!=2;
},
enable:true,
filterTarget:true,
chongzhu:function(event,player){
return player.storage.spell_silver==2?true:false;
},
contentBefore:function(){
player.$skill('卜天术','legend','water');
game.delay(2);
@ -185,16 +301,9 @@ game.import('card',function(lib,game,ui,get,ai,_status){
'step 2'
target.addJudge(event.judgecard);
},
contentAfter:function(){
if(player.storage.spell_silver==1){
player.storage.spell_silver=2;
}
else{
player.storage.spell_silver=1;
}
},
ai:{
value:8,
useful:[5,1],
result:{
player:function(player,target){
var eff=0;
@ -240,14 +349,52 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}
},
skill:{
_gainspell:{
trigger:{player:'drawBegin'},
forced:true,
popup:false,
silent:true,
priority:-11,
filter:function(event,player){
return event.num>0&&event.parent.name=='phaseDraw';
},
content:function(){
if(!player.storage.spell_gain||Math.max.apply(null,player.storage.spell_gain)<0){
var tmp=player.storage.spell_gain2;
player.storage.spell_gain=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15].randomGets(3);
player.storage.spell_gain2=15-Math.max.apply(null,player.storage.spell_gain);
if(tmp){
for(var i=0;i<3;i++){
player.storage.spell_gain[i]+=tmp;
}
}
}
for(var i=0;i<3;i++){
if(player.storage.spell_gain[i]==0){
var list;
if(i==0){
list=get.libCard(function(info){
return info.subtype=='spell_gold';
});
}
else{
list=get.libCard(function(info){
return info.subtype=='spell_silver';
});
}
if(list&&list.length){
ui.cardPile.insertBefore(game.createCard(list.randomGet()),ui.cardPile.firstChild);
}
}
player.storage.spell_gain[i]--;
}
}
}
},
help:{
'昆特牌':'<ul><li>法术为分金、银、铜三类,金卡和银卡不出现在牌堆中<li>'+
'每局最多使用两张银卡,使用过两张银卡法术后可将多余的银卡重铸为铜卡<li>'+
'每局最多使用一张金卡,使用过金卡法术后可将多余的金卡重铸为银卡(若已使用两张银卡则改为铜卡)<li>'+
'若本局使用的银卡数不超过2摸牌阶段有一定概率摸到银卡在游戏的前10个摸牌阶段中至少会摸到2张银卡<li>'+
'若本局未使用过金卡摸牌阶段有一定概率摸到金卡在游戏的前10个摸牌阶段中至少会摸到1张金卡<li>'+
'摸牌阶段有一定概率摸到银卡在16个摸牌阶段中至少会摸到2张银卡<li>'+
'摸牌阶段有一定概率摸到金卡在16个摸牌阶段中至少会摸到1张金卡<li>'+
'进行洗牌时金卡、银卡将从弃牌堆中消失,不进入牌堆'
},
translate:{
@ -255,14 +402,16 @@ game.import('card',function(lib,game,ui,get,ai,_status){
spell_gold:'金卡法术',
spell_silver:'银卡法术',
spell_bronze:'铜卡法术',
gw_xinsheng:'新生',
gw_xinsheng_info:'结束出牌阶段随机观看12张武将牌选择一张替代一名角色的武将牌',
gw_zhongmozhizhan:'终末之战',
gw_zhongmozhizhan_info:'结束出牌阶段,将所有角色区域内的所有牌置入弃牌堆,且不触发技能(每局最多用一张金卡法术,多余的法术可重铸)',
gw_zhongmozhizhan_info:'结束出牌阶段,将所有角色区域内的所有牌置入弃牌堆,无视免疫效果且不触发技能',
gw_butianshu:'卜天术',
gw_butianshu_info:'出牌阶段对任意角色使用,将任意一张延时锦囊牌置入其判定区(每局最多用两张银卡法术,多余的法术可重铸)',
gw_butianshu_info:'出牌阶段对任意角色使用,将任意一张延时锦囊牌置入其判定区',
gw_zhihuanjun:'致幻菌',
gw_zhihuanjun_info:'出牌阶段对一名已受伤角色使用,令其减少一点体力上限',
gw_niuquzhijing:'纽曲之镜',
gw_niuquzhijing_info:'结束出牌阶段,交换全场体力值最大和最小角色的体力值,且不触发技能(每局最多用一张金卡法术,多余的法术可重铸)',
gw_niuquzhijing_info:'结束出牌阶段,交换全场体力值最大和最小角色的体力值,无视免疫效果且不触发技能',
},
cardType:{
spell:0.5,
@ -271,7 +420,8 @@ game.import('card',function(lib,game,ui,get,ai,_status){
spell_gold:0.4
},
list:[
['club',3,'gw_zhihuanjun'],
['spade',2,'gw_zhihuanjun'],
],
};
});

View File

@ -944,9 +944,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var dialog=ui.create.dialog('将武将牌替换为一名角色','hidden');
dialog.add([list.randomGets(5),'character']);
player.chooseButton(dialog,true).ai=function(button){
return get.rank(button.link,true)-lib.character[button.link][2];
return get.rank(button.link,true);
};
player.awakenSkill('fuhan');
player.awakenSkill('szbianshen');
'step 1'
player.reinit('hs_shizugui',result.links[0]);
player.hp=player.maxHp;
@ -7916,6 +7916,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
fengxing:'风行',
fengxing_info:'每当你于回合外首次失去牌,你可以弃置一张牌并摸两张牌',
xinci:'心刺',
xinci_bg:'暗',
xinci_info:'出牌阶段限一次,你可以弃置一张黑色牌令一名角色流失一点体力',
zhongjia:'战甲',
zhongjia_info:'锁定技,每当你受到一次伤害,你获得一点护甲;当你的体力值大于手牌数时,你的护甲不为你抵挡伤害',
@ -7928,7 +7929,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
zhanhou:'战吼',
zhanhou_info:'出牌阶段限一次,你可以弃置一张防具牌并获得一点护甲值',
anying:'暗影',
anying_info:'限定技,出牌阶段,你可以弃置张黑色牌,失去技能圣光,并获得技能心刺',
anying_info:'限定技,出牌阶段,你可以弃置张黑色牌,失去技能圣光,并获得技能心刺',
shijie:'视界',
shijie_info:'结束阶段,你可以获得一名其他角色的一张手牌,然后该角色摸一张牌',
shengguang:'圣光',

View File

@ -8339,6 +8339,13 @@
}
}
},
ga:function(type){
for(var i in lib.card){
if(lib.card[i].type==type||lib.card[i].subtype==type){
cheat.g(i);
}
}
},
gg:function(){
for(var i=0;i<game.players.length;i++){
for(var j=0;j<arguments.length;j++){
@ -19519,12 +19526,7 @@
}
else if(get.subtype(cards[0])=='spell_gold'){
var list=get.libCard(function(info){
if(player.storage.spell_silver==2){
return info.subtype=='spell_bronze';
}
else{
return info.subtype=='spell_silver';
}
});
if(list.length){
player.gain(game.createCard(list.randomGet()),'draw');
@ -26959,6 +26961,32 @@
}
return null;
},
findMax:function(list,func){
list=list.slice(0);
var list2=[];
list.sort(function(a,b){
return func(b)-func(a);
});
for(var i=0;i<list.length;i++){
if(func(list[i])==func(list[0])){
list2.push(list[i]);
}
}
return list2;
},
findMin:function(list,func){
list=list.slice(0);
var list2=[];
list.sort(function(a,b){
return func(a)-func(b);
});
for(var i=0;i<list.length;i++){
if(func(list[i])==func(list[0])){
list2.push(list[i]);
}
}
return list2;
},
findCards:function(func,all){
var cards=[];
for(var i in lib.card){

BIN
image/card/gw_xinsheng.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 68 KiB