Fix recasting and gifting, and deprecate lib.card[card].chongzhu.

This commit is contained in:
Tipx-L 2023-08-29 01:45:58 -07:00
parent 924a3b8d54
commit fc285396d7
16 changed files with 106 additions and 43 deletions

View File

@ -281,7 +281,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
content:function(){
target.link();
},
chongzhu:true,
recastable:true,
ai:{
wuxie:function(target,card,player,viewer){
if(_status.event.getRand()<0.5) return 0;

View File

@ -556,7 +556,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
mode:['guozhan','versus'],
filterTarget:true,
chongzhu:true,
recastable:true,
changeTarget:function(player,targets){
var target=targets[0];
game.filterPlayer(function(current){
@ -921,7 +921,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
fullskin:true,
type:'trick',
enable:true,
chongzhu:true,
recastable:true,
filterTarget:function(card,player,target){
if(player==target) return false;
return (target.countCards('h')||target.isUnseen(2));

View File

@ -447,7 +447,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
fullskin:true,
type:'trick',
enable:true,
// chongzhu:true,
// recastable:true,
filterTarget:function(card,player,target){
return target==player;
},

View File

@ -259,7 +259,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
enable:function(){
return game.countPlayer()>2;
},
chongzhu:function(){
recastable:function(){
return game.countPlayer()<=2;
},
singleCard:true,

View File

@ -266,7 +266,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
fullskin:true,
type:'trick',
nodelay:true,
// chongzhu:true,
// recastable:true,
global:'g_shencaojie',
content:function(){
var evt=event.getParent('g_shencaojie')._trigger;

View File

@ -399,10 +399,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
'step 1'
if(result.bool){
player.logSkill('taigongyinfu_skill');
player.lose(result.cards,ui.discardPile,'visible');
player.$throw(result.cards,1000);
game.log(player,'将',result.cards,'置入了弃牌堆');
player.draw();
player.recast(result.cards);
}
},
},

View File

@ -613,10 +613,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
ai:{expose:0.1},
},
_yongjian_zengyu:{
_gifting:{
enable:'phaseUse',
forceLoad:true,
filter:(event,player)=>player.hasCard(card=>lib.skill._yongjian_zengyu.filterCard(card,player),lib.skill._yongjian_zengyu.position),
filter:(event,player)=>player.hasCard(card=>lib.skill._gifting.filterCard(card,player),lib.skill._gifting.position),
filterCard:(card,player)=>game.hasPlayer(current=>player.canGift(card,current,true)),
filterTarget:(card,player,target)=>ui.selected.cards.every(value=>player.canGift(value,target,true)),
position:'he',
@ -677,8 +677,8 @@ game.import('card',function(lib,game,ui,get,ai,_status){
xinge_info:'出牌阶段限一次。你可以将一张手牌交给一名其他角色。',
xinge_append:'<span class="text" style="font-family: yuanli">咕咕咕。</span>',
_yongjian_zengyu:'赠予',
_yongjian_zengyu_info:'出牌阶段,你可将一张拥有“赠”标签的手牌区装备牌置于一名其他角色的装备区内,或将一张拥有“赠”标签的手牌区非装备牌正面朝上交给一名其他角色。',
_gifting:'赠予',
_gifting_info:'出牌阶段,你可将一张拥有“赠”标签的手牌区装备牌置于一名其他角色的装备区内,或将一张拥有“赠”标签的手牌区非装备牌正面朝上交给一名其他角色。',
},
list:[
['spade',1,'guaguliaodu'],

View File

@ -276,7 +276,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
enable:function(){
return game.countPlayer()>2;
},
chongzhu:function(){
recastable:function(){
return game.countPlayer()<=2;
},
multicheck:function(card,player){

View File

@ -5,7 +5,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
card:{
pozhenjue:{
type:'zhenfa',
chongzhu:true,
recastable:true,
enable:true,
notarget:true,
content:function(){
@ -25,7 +25,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
changshezhen:{
type:'zhenfa',
chongzhu:true,
recastable:true,
enable:function(card,player){
if(player.inline()) return true;
if(player.identity=='unknown'||player.identity=='ye') return false;
@ -68,7 +68,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
tianfuzhen:{
type:'zhenfa',
chongzhu:true,
recastable:true,
enable:function(){
return game.hasPlayer(function(current){
return current.isMajor();
@ -94,7 +94,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
dizaizhen:{
type:'zhenfa',
chongzhu:true,
recastable:true,
enable:function(){
return game.hasPlayer(function(current){
return current.isNotMajor();
@ -121,7 +121,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
fengyangzhen:{
type:'zhenfa',
chongzhu:true,
recastable:true,
enable:true,
filterTarget:function(card,player,target){
return target.sieged();
@ -142,7 +142,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
yunchuizhen:{
type:'zhenfa',
chongzhu:true,
recastable:true,
enable:true,
filterTarget:function(card,player,target){
return target.siege();
@ -163,7 +163,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
qixingzhen:{
type:'zhenfa',
chongzhu:true,
recastable:true,
enable:function(card,player){
return player.siege()||player.sieged();
},
@ -202,7 +202,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
shepanzhen:{
type:'zhenfa',
chongzhu:true,
recastable:true,
enable:function(card,player){
if(player.identity=='unknown'||player.identity=='ye') return false;
if(get.population(player.identity)<=1) return false;
@ -231,7 +231,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
longfeizhen:{
type:'zhenfa',
chongzhu:true,
recastable:true,
enable:function(card,player){
return player.next.siege(player);
},
@ -261,7 +261,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
huyizhen:{
type:'zhenfa',
chongzhu:true,
recastable:true,
enable:function(card,player){
return player.siege(player.next)||player.siege(player.previous);
},
@ -309,7 +309,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
niaoxiangzhen:{
type:'zhenfa',
chongzhu:true,
recastable:true,
enable:true,
filterTarget:function(card,player,target){
if(player.identity==target.identity) return false;

View File

@ -3647,7 +3647,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
result:{player:1},
effect:{
target:function(card,player,target){
if(card&&get.type(card)=='equip'&&_status.event.skill=='_yongjian_zengyu') return 0;
if(card&&get.type(card)=='equip'&&_status.event.skill=='_gifting') return 0;
},
},
},

View File

@ -6147,7 +6147,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
return true;
},
chongzhu:true,
recastable:true,
selectTarget:2,
postAi:()=>true,
contentBefore:function(){

View File

@ -10783,7 +10783,7 @@
eight:'八',
nine:'九',
ten:'十',
_chongzhu:'重铸',
_recasting:'重铸',
_lianhuan:'连环',
_lianhuan2:'连环',
_kamisha:'神杀',
@ -28649,8 +28649,8 @@
if(!mod) return false;
if(strict&&mod=='unchanged'){
if(get.position(card)!='h') return false;
const info=get.info(card);
return typeof info.chongzhu=='function'?info.chongzhu(_status.event,player):info.chongzhu;
const info=get.info(card),recastable=info.recastable||info.chongzhu;
return Boolean(typeof recastable=='function'?recastable(_status.event,player):recastable);
}
return true;
},
@ -30274,18 +30274,17 @@
}
}
},
_chongzhu:{
_recasting:{
enable:'phaseUse',
logv:false,
visible:true,
prompt:'将要重铸的牌置入弃牌堆并摸一张牌',
filter:(event,player)=>player.hasCard(card=>lib.skill._chongzhu.filterCard(card,player),'he'),
filter:(event,player)=>player.hasCard(card=>lib.skill._recasting.filterCard(card,player),lib.skill._recasting.position),
position:'he',
filterCard:(card,player)=>player.canRecast(card,null,true),
discard:false,
lose:false,
delay:false,
content:function(){
content:()=>{
player.recast(cards,null,(player,cards)=>{
var numberOfCardsToDraw=cards.length;
cards.forEach(value=>{
@ -30369,6 +30368,71 @@
player.link();
if(trigger.getParent().notLink()) trigger.getParent().lianhuanable=true;
}
},
//Deprecated skills
_chongzhu:{
get filter(){
return lib.skill._recasting.filter;
},
set filter(filter){
lib.skill._recasting.filter=filter;
},
get filterCard(){
return lib.skill._recasting.filterCard;
},
set filterCard(filterCard){
lib.skill._recasting.filterCard=filterCard;
},
get content(){
return lib.skill._recasting.content;
},
set content(content){
lib.skill._recasting.content=content;
},
get ai(){
return lib.skill._recasting.ai;
},
set ai(ai){
lib.skill._recasting.ai=ai;
}
},
_yongjian_zengyu:{
get filter(){
return lib.skill._gifting.filter;
},
set filter(filter){
lib.skill._gifting.filter=filter;
},
get filterCard(){
return lib.skill._gifting.filterCard;
},
set filterCard(filterCard){
lib.skill._gifting.filterCard=filterCard;
},
get filterTarget(){
return lib.skill._gifting.filterTarget;
},
set filterTarget(filterTarget){
lib.skill._gifting.filterTarget=filterTarget;
},
get check(){
return lib.skill._gifting.check;
},
set check(check){
lib.skill._gifting.check=check;
},
get content(){
return lib.skill._gifting.content;
},
set content(content){
lib.skill._gifting.content=content;
},
get ai(){
return lib.skill._gifting.ai;
},
set ai(ai){
lib.skill._gifting.ai=ai;
}
}
},
character:{},

View File

@ -4536,11 +4536,13 @@ div[data-decoration="bronze"]::after{
right: 6px;
}
.card .tempname {
top: 6px;
left: 6px;
font-size: 22px;
color: white !important;
font-size: 22px;
left: 8px;
pointer-events: none;
top: 4px;
writing-mode: vertical-rl;
-webkit-writing-mode: vertical-rl;
}
/*.card.equip1 .wunature,
.card.equip3 .wunature,

View File

@ -8359,7 +8359,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
}
});
for(var i in lib.card){
if(lib.card[i].subtype=='equip1') lib.card[i].chongzhu=true;
if(lib.card[i].subtype=='equip1') lib.card[i].recastable=true;
}
}
},

View File

@ -480,7 +480,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
hhzz_toulianghuanzhu:{
enable:true,
cardimage:"toulianghuanzhu",
chongzhu:true,
recastable:true,
type:'trick',
filterTarget:function(card,player,target){
return target.skillH.length>0;

View File

@ -583,7 +583,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
enable:function(event,player){
return player.canAddFellow();
},
chongzhu:function(event,player){
recastable:function(event,player){
return !player.isMin()&&!player.canAddFellow();
},
notarget:true,
@ -1424,7 +1424,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
lib.card.list.randomSort();
}
lib.skill._chongzhu.usable=3;
lib.skill._recasting.usable=3;
for(i in lib.skill){
if(lib.skill[i].changeSeat){
lib.skill[i]={};
@ -2366,7 +2366,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
type:'stonecard',
stoneact:2,
career:'priest',
chongzhu:true,
recastable:true,
enable:function(event,player){
if(player.career!='priest') return false;
return !player.storage.anyingxingtai||player.storage.anyingxingtai<2;