Merge pull request #879 from PZ157/PR-Branch

修复mayHaveSha, mayHaveShan相关的严重bug
This commit is contained in:
Spmario233 2024-01-29 22:41:47 +08:00 committed by GitHub
commit 9c23d1f638
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 213 additions and 228 deletions

View File

@ -235,7 +235,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
if(get.cardtag(card,'yingbian_hit')){
hit=true;
if(targets.some(target=>{
return target.mayHaveShan(viewer,'use',target.getCards(i=>{
return target.mayHaveShan(viewer,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))&&get.attitude(viewer,target)<0&&get.damageEffect(target,player,viewer,get.natureList(card))>0;
})) base+=5;
@ -247,7 +247,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}
if(get.cardtag(card,'yingbian_damage')){
if(targets.some(target=>{
return get.attitude(player,target)<0&&(hit||!target.mayHaveShan(viewer,'use',target.getCards(i=>{
return get.attitude(player,target)<0&&(hit||!target.mayHaveShan(viewer,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))||player.hasSkillTag('directHit_ai',true,{
target:target,
@ -309,7 +309,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
if(!player.hasSkillTag('directHit_ai',true,{
target:target,
card:card,
},true)) odds-=0.7*target.mayHaveShan(player,'use',target.getCards(i=>{
},true)) odds-=0.7*target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}),'odds');
_status.event.putTempCache('sha_result','eff',{

View File

@ -3516,7 +3516,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
list.remove(player.storage.kyou_zhidian);
player.chooseControl(list).set('prompt','掷典:请为'+get.translation(trigger.card)+'选择一种效果').set('choice',function(){
if(list.includes('不计入次数')&&player.hasSha()) return '不计入次数';
if(list.includes('不可被响应')&&trigger.target.mayHaveShan(player,'use',trigger.target.getCards(i=>{
if(list.includes('不可被响应')&&trigger.target.mayHaveShan(player,'use',trigger.target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))) return '不可被响应';
if(list.includes('伤害+1')) return '伤害+1';

View File

@ -1261,7 +1261,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
}
var hasRuanshizi=game.hasPlayer(function(target){
return target!=player&&player.canUse('sha',target,null,true)&&!target.mayHaveShan(player,'use',target.getCards(i=>{
return target!=player&&player.canUse('sha',target,null,true)&&!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))&&get.attitude(player,target)<0&&get.effect(target,{name:'sha'},player,player)>0;
})

View File

@ -4843,26 +4843,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.chooseToDiscard('he',get.prompt('dccuijin',target),'弃置一张牌并令'+get.translation(trigger.player)+'使用的【杀】伤害+1但若其未造成伤害则你摸一张牌并对其造成1点伤害。').set('ai',function(card){
if(_status.event.goon) return 7-get.value(card);
return 0;
}).set('goon',function(){
var d1=true;
if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false
for(var target of trigger.targets){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))||trigger.player.hasSkillTag('directHit_ai',true,{
target:target,
card:trigger.card,
},true)){
if(!target.hasSkill('gangzhi')) d1=false;
if(!target.hasSkillTag('filterDamage',null,{
player:trigger.player,
card:trigger.card,
})&&get.attitude(player,target)<0) return true;
}
}
if(d1) return get.damageEffect(trigger.player,player,player)>0;
return false;
}()).logSkill=['dccuijin',target];
}).set('goon',lib.skill.cuijin.checkx(trigger,player)).logSkill=['dccuijin',target];
'step 1'
if(result.bool){
if(typeof trigger.baseDamage!='number') trigger.baseDamage=1;
@ -11128,7 +11109,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
let ph=player.countCards('h');
if(game.hasPlayer(i=>{
if(!player.canUse('sha',i,true,true)||get.effect(i,{name:'sha'},player,player)<=0) return false;
return !ph||!i.mayHaveShan(player,'use',i.getCards(i=>{
return !ph||!i.mayHaveShan(player,'use',i.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}));
})) return 1;

View File

@ -4270,7 +4270,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
result:{
target:function(player,target){
var eff=get.effect(target,{name:'sha',nature:'fire'},player,target)/30;
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))) eff*=2;
var del=target.countCards('h')-player.countCards('h')+1.5;
@ -7124,7 +7124,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(_status.event.all) return 1;
if(ui.selected.buttons.length) return 0;
return Math.random();
}).set('all',!target.mayHaveShan(player,'use',target.getCards(i=>{
}).set('all',!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))&&Math.random()<0.75).set('forceAuto',true);
'step 1'

View File

@ -9137,7 +9137,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
]).set('ai',function(){
var target=_status.event.getTrigger().target;
var player=_status.event.player;
var num=target.mayHaveShan(player,'use',target.getCards(i=>{
var num=target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))?0:1;
if(get.attitude(player,target)>0) num=1-num;

View File

@ -168,7 +168,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
d1=true;
if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false;
for(var target of trigger.targets){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))||trigger.player.hasSkillTag('directHit_ai',true,{
target:target,
@ -299,7 +299,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var effect=0;
for(var target of trigger.targets){
var eff=get.effect(target,trigger.card,trigger.player,player);
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))||trigger.player.hasSkillTag('directHit_ai',true,{
target:target,

View File

@ -11142,7 +11142,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!target.isHealthy()) club+=2;
if(!club&&!spade) return 1;
if(name==='sha'){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))) return;
}

View File

@ -3676,7 +3676,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
ai:{
effect:{
target:function(card,player,target,current){
if(typeof card==='object'&&get.name(card)==='sha'&&target.mayHaveShan(player,'use',target.getCards(i=>{
if(typeof card==='object'&&get.name(card)==='sha'&&target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))) return [0.6,0.75];
if(!target.hasFriend()&&!player.hasUnknown()) return;
@ -6221,7 +6221,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!target.isHealthy()) club+=2;
if(!club&&!spade) return 1;
if(card.name==='sha'){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))) return;
}
@ -7209,7 +7209,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return get.attitude(target,current)<0&&get.damageEffect(current,target,target,'thunder')>0;
})){
if(card.name==='sha'){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))) return;
}

View File

@ -5479,7 +5479,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!player.hasSkillTag('directHit_ai',true,{
target:target,
card:card,
},true)) odds-=0.7*target.mayHaveShan(player,'use',target.getCards(i=>{
},true)) odds-=0.7*target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}),'odds');
_status.event.putTempCache('sha_result','eff',{
@ -7275,7 +7275,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
else{
var target=trigger.target;
if(trigger.targets.length>1||target.mayHaveShan(player,'use',target.getCards(i=>{
if(trigger.targets.length>1||target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))) return 0;
}
@ -14777,7 +14777,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else if(get.tag(card,'respondShan')>0){
if(current<0&&used==target.getAttackRange()-1){
if(card.name==='sha'){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))) return;
}

View File

@ -5030,7 +5030,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
})) return 3;
return Math.sqrt(target.countCards('he'));
}
if(target.mayHaveShan(player,'use',target.getCards(i=>{
if(target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))&&player.countCards('hs',function(card){
return !ui.selected.cards.includes(card)&&get.name(card)=='sha'&&player.canUse(card,target)&&get.effect(target,card,player,player)!=0;
@ -5364,7 +5364,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.addSkill('mouni2');
player.chooseTarget(get.prompt2('mouni'),lib.filter.notMe).set('ai',function(target){
var player=_status.event.player,cards=player.getCards('h','sha');
if(get.attitude(player,target)>=0||!player.canUse(cards[0],target,false)||(!player.hasJudge('lebu')&&target.mayHaveShan(player,'use',target.getCards(i=>{
if(get.attitude(player,target)>=0||!player.canUse(cards[0],target,false)||(!player.hasJudge('lebu')&&target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))&&!player.hasSkillTag('directHit_ai',true,{
target:target,

View File

@ -1095,7 +1095,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}).set('goon',function(){
var d1=true;
if(player.hasSkill('jueqing')||player.hasSkill('gangzhi')) d1=false;
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))||player.hasSkillTag('directHit_ai',true,{
target:target,
@ -3697,7 +3697,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
expose:0.2,
result:{
target:function(player,target){
if(target.countCards('h')<=target.hp&&!target.mayHaveShan(player,'use',target.getCards(i=>{
if(target.countCards('h')<=target.hp&&!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))&&get.effect(target,{name:'sha',isCard:true},player,player)>0) return -1;
else if(target.countCards('h')>target.hp&&target.hp>2&&target.hasShan()) return 1;
@ -7273,7 +7273,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var player=_status.event.player;
if(player.hp+player.countCards('hs',{name:['tao','jiu']})<=1) return -1;
var num=1;
if((!target.mayHaveShan(player,'use',target.getCards(i=>{
if((!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))||player.hasSkillTag('directHit_ai',true,{
target:target,
@ -11796,7 +11796,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var d1=true;
if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false;
for(var target of trigger.targets){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))||trigger.player.hasSkillTag('directHit_ai',true,{
target:target,
@ -13986,6 +13986,31 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filter:function(event,player){
return event.card.name=='sha'&&(event.player==player||player.inRange(event.player))&&player.countCards('he')>0;
},
checkx(event,player){
let d1=true,e=false;
if(event.player.hasSkill('jueqing')||event.player.hasSkill('gangzhi')) d1=false;
for(let tar of event.targets){
if(!tar.mayHaveShan(player,'use',tar.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))||event.player.hasSkillTag('directHit_ai',true,{
target:tar,
card:event.card,
},true)){
if(!tar.hasSkill('gangzhi')) d1=false;
if(!tar.hasSkillTag('filterDamage',null,{
player:event.player,
card:event.card,
})){
let att=get.attitude(_status.event.player,tar);
if(att>0) return false;
if(att<0) e=true;
}
}
}
if(e) return true;
if(d1) return get.damageEffect(event.player,player,_status.event.player)>0;
return false;
},
content:function(){
'step 0'
if(player!=game.me&&!player.isOnline()) game.delayx();
@ -13994,26 +14019,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.chooseToDiscard('he',get.prompt('cuijin',target),'弃置一张牌并令'+get.translation(trigger.player)+'使用的【杀】伤害+1但若其未造成伤害则你对其造成1点伤害。').set('ai',function(card){
if(_status.event.goon) return 7-get.value(card);
return 0;
}).set('goon',function(){
var d1=true;
if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false
for(var target of trigger.targets){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))||trigger.player.hasSkillTag('directHit_ai',true,{
target:target,
card:trigger.card,
},true)){
if(!target.hasSkill('gangzhi')) d1=false;
if(!target.hasSkillTag('filterDamage',null,{
player:trigger.player,
card:trigger.card,
})&&get.attitude(player,target)<0) return true;
}
}
if(d1) return get.damageEffect(trigger.player,player,player)>0;
return false;
}()).logSkill=['cuijin',target];
}).set('goon',lib.skill.cuijin.checkx(trigger,player)).logSkill=['cuijin',target];
'step 1'
if(result.bool){
if(typeof trigger.baseDamage!='number') trigger.baseDamage=1;

View File

@ -2228,7 +2228,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
case 2:{
var num=1.3;
if(event.card.name=='sha'&&event.targets.filter(function(current){
if(current.mayHaveShan(player,'use',current.getCards(i=>{
if(current.mayHaveShan(player,'use',current.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))&&get.attitude(player,current)<=0){
if(current.hasSkillTag('useShan')) num=1.9;

View File

@ -3529,7 +3529,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
]).set('prompt',get.prompt('gzliegong',trigger.target)).setHiddenSkill('gzliegong').set('ai',function(){
var player=_status.event.player,target=_status.event.getTrigger().target;
if(get.attitude(player,target)>0) return 2;
return target.mayHaveShan(player,'use',target.getCards(i=>{
return target.mayHaveShan(player,'use',target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))?1:0;
});
@ -10657,7 +10657,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
goon=false;
}
else if(trigger.card.name=='sha'){
if(trigger.target.mayHaveShan(player,'use',trigger.target.getCards(i=>{
if(trigger.target.mayHaveShan(player,'use',trigger.target.getCards('h',i=>{
return i.hasGaintag('sha_notshan');
}))||trigger.target.hp>=3){
goon=false;

View File

@ -8456,7 +8456,7 @@ export class Player extends HTMLDivElement {
else if (get.itemtype(ignore) === 'card') selected.add(ignore);
if (this === viewer || get.itemtype(viewer) == 'player') cards = this.getKnownCards(viewer);
else cards = this.getShownCards();
cards = cards.filter(card => {
count += cards.filter(card => {
if (selected.includes(card)) return false;
let name = get.name(card, this);
if (name == 'sha' || name == 'hufu' || name == 'yuchanqian') {
@ -8465,8 +8465,7 @@ export class Player extends HTMLDivElement {
return true;
}
return false;
});
count += cards.length;
}).length;
if (count && rvt !== 'count') return rvt === 'odds' ? 1 : true;
let hs = this.getCards('hs').filter(i => !cards.includes(i)).length;
if (!hs) {
@ -8501,7 +8500,7 @@ export class Player extends HTMLDivElement {
else if (get.itemtype(ignore) === 'card') selected.add(ignore);
if (this === viewer || get.itemtype(viewer) == 'player') cards = this.getKnownCards(viewer);
else cards = this.getShownCards();
cards = cards.filter(card => {
count += cards.filter(card => {
if (selected.includes(card)) return false;
let name = get.name(card, this);
if (name === 'shan' || name === 'hufu') {
@ -8510,8 +8509,7 @@ export class Player extends HTMLDivElement {
return true;
}
return false;
});
count += cards.length;
}).length;
if (count && rvt !== 'count') return rvt === 'odds' ? 1 : true;
let hs = this.getCards('hs').filter(i => !cards.includes(i)).length;
if (!hs) {

View File

@ -10323,7 +10323,7 @@ export class Library extends Uninstantable {
if (game.hasPlayer(current => {
if (!player.canUse(card, current)) return false;
const storage = player.storage, zhibi = storage.zhibi;
return (zhibi && !zhibi.includes(current) || get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && current.mayHaveShan(player, 'use', current.getCards(i => {
return (zhibi && !zhibi.includes(current) || get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && current.mayHaveShan(player, 'use', current.getCards('h', i => {
return i.hasGaintag('sha_notshan');
})) && player.hasSkill('jiu');
})) return 1;
@ -10396,7 +10396,7 @@ export class Library extends Uninstantable {
if (game.hasPlayer(current => {
if (!player.canUse(card, current)) return false;
const storage = player.storage, zhibi = storage.zhibi;
return (zhibi && !zhibi.includes(current) || (get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1))) && current.mayHaveShan(player, 'use', current.getCards(i => {
return (zhibi && !zhibi.includes(current) || (get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1))) && current.mayHaveShan(player, 'use', current.getCards('h', i => {
return i.hasGaintag('sha_notshan');
}));
})) return get.order(card, player) + 0.5;