销毁机制修改 [Experimental]

This commit is contained in:
Spmario233 2023-10-28 00:57:08 +08:00
parent c328de748f
commit e7d22b9cd1
3 changed files with 59 additions and 82 deletions

View File

@ -71,12 +71,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){
fullskin:true, fullskin:true,
type:'basic', type:'basic',
enable:false, enable:false,
global:'ying_destory', destroy:'discardPile',
getYing:function(count){ getYing:function(count){
var cards=[]; var cards=[];
if(typeof count!='number') count=1; if(typeof count!='number') count=1;
while(count--){ while(count--){
cards.push(game.createCard('ying','spade',1)); let card=game.createCard('ying','spade',1);
card.destroyed='discardPile';
cards.push(card);
} }
return cards; return cards;
}, },
@ -95,24 +97,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
skill:{ skill:{
//江山如故·转 //江山如故·转
//白牌
ying_destory:{
trigger:{
player:'loseAfter',
global:['loseAsyncAfter','cardsDiscardAfter','equipAfter'],
},
cardSkill:true,
forced:true,
popup:false,
filter:function(event,player){
return event.getd().some(i=>get.name(i,false)=='ying'&&get.position(i,true)=='d');
},
content:function(){
var cards=trigger.getd().filter(i=>get.name(i,false)=='ying'&&get.position(i,true)=='d');
game.cardsGotoSpecial(cards);
game.log(cards,'被移出了游戏');
},
},
//404郭嘉 //404郭嘉
jsrgqingzi:{ jsrgqingzi:{
audio:2, audio:2,

View File

@ -11609,7 +11609,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return 7-get.value(card); return 7-get.value(card);
}, },
content:function(){ content:function(){
player.addSkill('pyzhuren_destroy'); //player.addSkill('pyzhuren_destroy');
if(!_status.pyzhuren) _status.pyzhuren={}; if(!_status.pyzhuren) _status.pyzhuren={};
var rand=0.85; var rand=0.85;
var num=get.number(cards[0]); var num=get.number(cards[0]);
@ -11627,7 +11627,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
else{ else{
_status.pyzhuren[name]=true; _status.pyzhuren[name]=true;
player.gain(game.createCard(name,cards[0].name=='shandian'?'spade':cards[0].suit,1),'gain2') var card=game.createCard(name,cards[0].name=='shandian'?'spade':cards[0].suit,1);
card.destroyed='discardPile';
player.gain(card,'gain2')
} }
}, },
ai:{ ai:{
@ -11637,32 +11639,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
}, },
}, },
pyzhuren_destroy:{
trigger:{global:['loseEnd','cardsDiscardEnd']},
forced:true,
charlotte:true,
filter:function(event,player){
var cs=event.cards;
for(var i=0;i<cs.length;i++){
if(cs[i].name.indexOf('pyzhuren_')==0&&get.position(cs[i],true)=='d') return true;
}
return false;
},
forceDie:true,
content:function(){
if(!_status.pyzhuren) _status.pyzhuren={};
var list=[];
var cs=trigger.cards;
for(var i=0;i<cs.length;i++){
if(cs[i].name.indexOf('pyzhuren_')==0&&get.position(cs[i],true)=='d'){
_status.pyzhuren[cs[i].name]=false;
list.push(cs[i]);
}
}
game.log(list,'已被移出游戏');
game.cardsGotoSpecial(list);
},
},
pyzhuren_heart:{ pyzhuren_heart:{
audio:true, audio:true,
trigger:{source:'damageSource'}, trigger:{source:'damageSource'},

View File

@ -12744,14 +12744,9 @@
event.finish(); event.finish();
return; return;
} }
if(card.destroyed){ if(card.willBeDestroyed('equip',player,event)){
if(player.hasSkill(card.destroyed)){ event.finish();
delete card.destroyed; return;
}
else{
event.finish();
return;
}
} }
else if(event.owner){ else if(event.owner){
if(event.owner.getCards('hejsx').contains(card)){ if(event.owner.getCards('hejsx').contains(card)){
@ -13723,6 +13718,10 @@
game.getGlobalHistory().cardMove.push(event); game.getGlobalHistory().cardMove.push(event);
var withPile=false; var withPile=false;
for(var i=0;i<cards.length;i++){ for(var i=0;i<cards.length;i++){
if(cards[i].willBeDestroyed('discardPile',null,event)){
cards[i].splice(i--,1);
continue;
}
if(get.position(cards[i],true)=='c') withPile=true; if(get.position(cards[i],true)=='c') withPile=true;
cards[i].discard(); cards[i].discard();
} }
@ -13739,6 +13738,10 @@
game.getGlobalHistory().cardMove.push(event); game.getGlobalHistory().cardMove.push(event);
var withPile=false; var withPile=false;
for(var i=0;i<cards.length;i++){ for(var i=0;i<cards.length;i++){
if(cards[i].willBeDestroyed('ordering',null,event)){
cards[i].splice(i--,1);
continue;
}
if(get.position(cards[i],true)=='c') withPile=true; if(get.position(cards[i],true)=='c') withPile=true;
cards[i].fix(); cards[i].fix();
ui.ordering.appendChild(cards[i]); ui.ordering.appendChild(cards[i]);
@ -13758,6 +13761,10 @@
game.getGlobalHistory().cardMove.push(event); game.getGlobalHistory().cardMove.push(event);
var withPile=false; var withPile=false;
for(var i=0;i<cards.length;i++){ for(var i=0;i<cards.length;i++){
if(cards[i].willBeDestroyed('special',null,event)){
cards[i].splice(i--,1);
continue;
}
if(get.position(cards[i],true)=='c') withPile=true; if(get.position(cards[i],true)=='c') withPile=true;
cards[i].fix(); cards[i].fix();
ui.special.appendChild(cards[i]); ui.special.appendChild(cards[i]);
@ -19256,13 +19263,8 @@
} }
"step 1" "step 1"
for(var i=0;i<cards.length;i++){ for(var i=0;i<cards.length;i++){
if(cards[i].destroyed){ if(cards[i].willBeDestroyed('handcard',player,event)){
if(player.hasSkill(cards[i].destroyed)){ cards.splice(i--,1);
delete cards[i].destroyed;
}
else{
cards.splice(i--,1);
}
} }
else if(event.losing_map){ else if(event.losing_map){
for(var id in event.losing_map){ for(var id in event.losing_map){
@ -19455,13 +19457,8 @@
} }
"step 1" "step 1"
for(var i=0;i<cards.length;i++){ for(var i=0;i<cards.length;i++){
if(cards[i].destroyed){ if(cards[i].willBeDestroyed('expansion',player,event)){
if(player.hasSkill(cards[i].destroyed)){ cards.splice(i--,1);
delete cards[i].destroyed;
}
else{
cards.splice(i--,1);
}
} }
else if(event.losing_map){ else if(event.losing_map){
for(var id in event.losing_map){ for(var id in event.losing_map){
@ -19674,9 +19671,10 @@
cards[i].recheck(); cards[i].recheck();
var info=lib.card[cards[i].name]; var info=lib.card[cards[i].name];
if(info.destroy||cards[i]._destroy){ var destroyInfo=cards[i].hasOwnProperty('_destroy')?cards[i]._destroy:info.destroy;
if(destroyInfo){
cards[i].delete(); cards[i].delete();
cards[i].destroyed=info.destroy||cards[i]._destroy; cards[i].destroyed=destroyInfo;
} }
else if(event.position){ else if(event.position){
if(_status.discarded){ if(_status.discarded){
@ -19801,7 +19799,7 @@
"step 4" "step 4"
if(event.toRenku){ if(event.toRenku){
_status.renku.addArray(cards.filter(function(card){ _status.renku.addArray(cards.filter(function(card){
return !card.destroyed; return !card.willBeDestroyed('renku',null,event);
})); }));
if(_status.renku.length>6){ if(_status.renku.length>6){
var cards=_status.renku.splice(0,_status.renku.length-6); var cards=_status.renku.splice(0,_status.renku.length-6);
@ -20336,14 +20334,9 @@
else if(get.position(cards[0])=='c') event.updatePile=true; else if(get.position(cards[0])=='c') event.updatePile=true;
} }
"step 1" "step 1"
if(cards[0].destroyed){ if(cards[0].willBeDestroyed('judge',player,event)){
if(player.hasSkill(cards[0].destroyed)){ event.finish();
delete cards[0].destroyed; return;
}
else{
event.finish();
return;
}
} }
else if(event.relatedLose){ else if(event.relatedLose){
var owner=event.relatedLose.player; var owner=event.relatedLose.player;
@ -29910,6 +29903,26 @@
buildIntro(noclick){ buildIntro(noclick){
if(!noclick) lib.setIntro(this); if(!noclick) lib.setIntro(this);
} }
//判断一张牌进入某个区域后是否会被销毁
willBeDestroyed(targetPosition,player,event){
const destroyed=this.destroyed;
if(typeof destroyed=='function'){
return destroyed(card,targetPosition,player,event);
}
else if(lib.skill[destroyed]){
if(player){
if(player.hasSkill(destroyed)){
delete this.destroyed;
return false;
}
}
return true;
}
else if(typeof destroyed=='string'){
return (destroyed==targetPosition);
}
return destroyed;
}
hasNature(nature,player){ hasNature(nature,player){
return game.hasNature(this,nature,player); return game.hasNature(this,nature,player);
} }
@ -30511,7 +30524,7 @@
if(this._uncheck.length==0) this.classList.remove('uncheck'); if(this._uncheck.length==0) this.classList.remove('uncheck');
} }
discard(bool){ discard(bool){
if(!this.destroyed){ if(!this.willBeDestroyed('discardPile',null,event)){
ui.discardPile.appendChild(this); ui.discardPile.appendChild(this);
} }
this.fix(); this.fix();
@ -36286,6 +36299,10 @@
const cards=event.cards; const cards=event.cards;
const pile=ui.cardPile; const pile=ui.cardPile;
for(let i=0;i<cards.length;i++){ for(let i=0;i<cards.length;i++){
if(cards[i].willBeDestroyed('cardPile',null,event)){
cards[i].splice(i--,1);
continue;
}
if(event.insert_index){ if(event.insert_index){
cards[i].fix(); cards[i].fix();
pile.insertBefore(cards[i],event.insert_index(event,cards[i])); pile.insertBefore(cards[i],event.insert_index(event,cards[i]));