为本体使用mayHaveShan响应杀的地方忽略杀命中手牌

砍非卖血将命中后,目标角色的这些手牌会加上'sha_notshan'标签,便于告知场上AI这些牌里“没有闪”
This commit is contained in:
157 2024-01-28 12:44:36 +08:00
parent 75c997b2bf
commit da415398e9
15 changed files with 212 additions and 127 deletions

View File

@ -235,7 +235,9 @@ 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')&&get.attitude(viewer,target)<0&&get.damageEffect(target,player,viewer,get.natureList(card))>0;
return target.mayHaveShan(viewer,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))&&get.attitude(viewer,target)<0&&get.damageEffect(target,player,viewer,get.natureList(card))>0;
})) base+=5;
}
if(get.cardtag(card,'yingbian_add')){
@ -245,7 +247,9 @@ 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')||player.hasSkillTag('directHit_ai',true,{
return get.attitude(player,target)<0&&(hit||!target.mayHaveShan(viewer,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))||player.hasSkillTag('directHit_ai',true,{
target:target,
card:card,
},true))&&!target.hasSkillTag('filterDamage',null,{

View File

@ -3516,7 +3516,9 @@ 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()) return '不可被响应';
if(list.includes('不可被响应')&&trigger.target.mayHaveShan(player,'use',trigger.target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))) return '不可被响应';
if(list.includes('伤害+1')) return '伤害+1';
return list.randomGet();
}()).set('ai',()=>_status.event.choice);

View File

@ -1257,7 +1257,9 @@ 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')&&get.attitude(player,target)<0&&get.effect(target,{name:'sha'},player,player)>0;
return target!=player&&player.canUse('sha',target,null,true)&&!target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))&&get.attitude(player,target)<0&&get.effect(target,{name:'sha'},player,player)>0;
})
for(var card of hs){
var name=get.name(card);

View File

@ -4847,7 +4847,9 @@ 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')||trigger.player.hasSkillTag('directHit_ai',true,{
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)){
@ -11113,7 +11115,9 @@ 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');
return !ph||!i.mayHaveShan(player,'use',i.getCards(i=>{
return i.hasGaintag('sha_notshan');
}));
})) return 1;
}
return 0;

View File

@ -4269,7 +4269,9 @@ 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')) eff*=2;
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))) eff*=2;
var del=target.countCards('h')-player.countCards('h')+1.5;
eff*=Math.sqrt(del);
return eff;
@ -7121,7 +7123,9 @@ 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')&&Math.random()<0.75).set('forceAuto',true);
}).set('all',!target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))&&Math.random()<0.75).set('forceAuto',true);
'step 1'
if(result.bool){
var cards=result.cards;

View File

@ -9137,7 +9137,9 @@ 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')?0:1;
var num=target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))?0:1;
if(get.attitude(player,target)>0) num=1-num;
return num;
});

View File

@ -168,7 +168,9 @@ 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')||trigger.player.hasSkillTag('directHit_ai',true,{
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)){
@ -297,7 +299,9 @@ 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')||trigger.player.hasSkillTag('directHit_ai',true,{
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)){

View File

@ -11141,7 +11141,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
if(!target.isHealthy()) club+=2;
if(!club&&!spade) return 1;
if(!target.mayHaveShan(player)) return 1-0.1*Math.min(5,target.countCards('hs'));
if(name==='sha'){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))) return;
}
else if(!target.mayHaveShan(player)) return 1-0.1*Math.min(5,target.countCards('hs'));
if(!target.hasSkillTag('rejudge')) return [1,(club+spade)/4];
let pos=(player==target||player.hasSkillTag('viewHandcard',null,target,true))?'hes':'e',better=club>spade?'club':'spade',max=0;
target.hasCard(function(cardx){

View File

@ -3676,7 +3676,9 @@ 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')) return [0.6,0.75];
if(typeof card==='object'&&get.name(card)==='sha'&&target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))) return [0.6,0.75];
if(!target.hasFriend()&&!player.hasUnknown()) return;
if(_status.currentPhase==target||get.type(card)==='delay') return;
if(card.name!='shuiyanqijunx'&&get.tag(card,'loseCard')&&target.countCards('he')){
@ -6218,7 +6220,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
if(!target.isHealthy()) club+=2;
if(!club&&!spade) return 1;
if(!target.mayHaveShan(player)) return 1-0.1*Math.min(5,target.countCards('hs'));
if(card.name==='sha'){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))) return;
}
else if(!target.mayHaveShan(player)) return 1-0.1*Math.min(5,target.countCards('hs'));
if(!target.hasSkillTag('rejudge')) return [1,(club+spade)/4];
let pos=player.hasSkillTag('viewHandcard',null,target,true)?'hes':'e',better=club>spade?'club':'spade',max=0;
target.hasCard(function(cardx){
@ -7201,7 +7208,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},true)&&game.hasPlayer(function(current){
return get.attitude(target,current)<0&&get.damageEffect(current,target,target,'thunder')>0;
})){
if(!target.mayHaveShan(player)) return 1-0.1*Math.min(5,target.countCards('hs'));
if(card.name==='sha'){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))) return;
}
else if(!target.mayHaveShan(player)) return 1-0.1*Math.min(5,target.countCards('hs'));
if(!target.hasSkillTag('rejudge')) return [1,1];
let pos=player.hasSkillTag('viewHandcard',null,target,true)?'hes':'e';
if(target.hasCard(function(cardx){

View File

@ -5453,25 +5453,41 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
result:{
target:function(player,target,card,isLink){
var eff = function () {
if(!isLink && player.hasSkill('jiu')) {
if(!target.hasSkillTag('filterDamage', null, {
player: player,
card: card,
jiu: true
let eff=-1.5,odds=1.35,num=1;
if(isLink){
let cache=_status.event.getTempCache('sha_result','eff');
if(typeof cache!=='object'||cache.card!==get.translation(card)) return eff;
if(cache.odds<1.35&&cache.bool) return 1.35*cache.eff;
return cache.odds*cache.eff;
}
if(player.hasSkill('jiu')||player.hasSkillTag('damageBonus',true,{
target:target,
card:card
})){
if(get.attitude(player, target) > 0) return -7;
return -4;
if(target.hasSkillTag('filterDamage',null,{
player:player,
card:card,
jiu:true,
})) eff=-0.5;
else{
num=2;
if(get.attitude(player,target)>0) eff=-7;
else eff=-4;
}
return -0.5;
}
return -1.5;
}();
if(!isLink && target.mayHaveShan(player,'use') && !player.hasSkillTag('directHit_ai', true, {
target: target,
card: card
}, true)) return eff * 0.6;
return eff;
if(!player.hasSkillTag('directHit_ai',true,{
target:target,
card:card,
},true)) odds-=0.7*target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}),'odds');
_status.event.putTempCache('sha_result','eff',{
bool:target.hp>num&&get.attitude(player,target)>0,
card:get.translation(card),
eff:eff,
odds:odds
});
return odds*eff;
}
},
respondSha:true,
@ -7258,7 +7274,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
else{
var target=trigger.target;
if(trigger.targets.length>1||target.mayHaveShan(player,'use')) return 0;
if(trigger.targets.length>1||target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))) return 0;
}
var num=trigger.getParent().baseDamage;
var map=trigger.getParent().customArgs,id=target.playerid;
@ -14756,14 +14774,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(num>=delta) return 'zeroplayertarget';
}
else if(get.tag(card,'respondShan')>0){
if(current<0&&used==target.getAttackRange()-1&&target.mayHaveShan(player)){
return 0.6;
if(current<0&&used==target.getAttackRange()-1){
if(card.name==='sha'){
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))) return;
}
else if(!target.mayHaveShan(player)) return 0.9;
return [1,(used+1)/2];
}
}
else if(get.tag(card,'respondSha')>0){
if(current<0&&used==target.getAttackRange()-1&&target.mayHaveSha(player)){
return 0.6;
}
if(current<0&&used==target.getAttackRange()-1&&target.mayHaveSha(player)) return [1,(used+1)/2];
}
},
},

View File

@ -5030,7 +5030,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
})) return 3;
return Math.sqrt(target.countCards('he'));
}
if(target.mayHaveShan(player,'use')&&player.countCards('hs',function(card){
if(target.mayHaveShan(player,'use',target.getCards(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;
})) return -Math.sqrt(Math.abs(get.attitude(player,target)))/2;
return 0.1;
@ -5362,7 +5364,9 @@ 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')&&!player.hasSkillTag('directHit_ai',true,{
if(get.attitude(player,target)>=0||!player.canUse(cards[0],target,false)||(!player.hasJudge('lebu')&&target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))&&!player.hasSkillTag('directHit_ai',true,{
target:target,
card:cards[0],
},true))) return 0;

View File

@ -384,7 +384,9 @@ 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')||player.hasSkillTag('directHit_ai',true,{
if(!target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))||player.hasSkillTag('directHit_ai',true,{
target:target,
card:trigger.card,
},true)){
@ -2984,7 +2986,9 @@ 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')&&get.effect(target,{name:'sha',isCard:true},player,player)>0) return -1;
if(target.countCards('h')<=target.hp&&!target.mayHaveShan(player,'use',target.getCards(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;
return 0;
},
@ -6558,7 +6562,9 @@ 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')||player.hasSkillTag('directHit_ai',true,{
if((!target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))||player.hasSkillTag('directHit_ai',true,{
target:target,
card:{name:'sha'},
},true))&&!target.hasSkillTag('filterDamage',null,{
@ -11075,7 +11081,9 @@ 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')||trigger.player.hasSkillTag('directHit_ai',true,{
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)){
@ -13275,7 +13283,9 @@ 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')||trigger.player.hasSkillTag('directHit_ai',true,{
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)){

View File

@ -2228,7 +2228,9 @@ 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')&&get.attitude(player,current)<=0){
if(current.mayHaveShan(player,'use',current.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))&&get.attitude(player,current)<=0){
if(current.hasSkillTag('useShan')) num=1.9;
return true;
}

View File

@ -3530,7 +3530,9 @@ 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')?1:0;
return target.mayHaveShan(player,'use',target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))?1:0;
});
'step 1'
if(result.control!='cancel2'){
@ -10656,7 +10658,9 @@ 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.hp>=3){
if(trigger.target.mayHaveShan(player,'use',trigger.target.getCards(i=>{
return i.hasGaintag('sha_notshan');
}))||trigger.target.hp>=3){
goon=false;
}
}

View File

@ -3056,11 +3056,11 @@ export class Library extends Uninstantable {
lib.init.cssstyles();
}
},
equip_span:{
equip_span: {
name: '装备牌占位',
intro:'打开后,没有装备的装备区将在装备栏占据空白位置。',
intro: '打开后,没有装备的装备区将在装备栏占据空白位置。',
init: false,
unfrequent:false,
unfrequent: false,
},
fold_card: {
name: '折叠手牌',
@ -9743,11 +9743,11 @@ export class Library extends Uninstantable {
if (info.round && (info.round - (game.roundNumber - player.storage[skill + '_roundcount']) > 0)) return false;
for (const item in player.storage) {
if (item.startsWith('temp_ban_')) {
if(player.storage[item] !== true) continue;
if (player.storage[item] !== true) continue;
const skillName = item.slice(9);
if (lib.skill[skillName]) {
const skills=game.expandSkills([skillName]);
if(skills.includes(skill)) return false;
const skills = game.expandSkills([skillName]);
if (skills.includes(skill)) return false;
}
}
}
@ -10320,7 +10320,9 @@ 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') && player.hasSkill('jiu');
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 i.hasGaintag('sha_notshan');
})) && player.hasSkill('jiu');
})) return 1;
return 0;
}
@ -10391,7 +10393,9 @@ 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');
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 i.hasGaintag('sha_notshan');
}));
})) return get.order(card, player) + 0.5;
}
else if (cardName == 'tao' && player.hp <= 2 && player.getDamagedHp() >= 2) return get.order(card, player) + 0.5;
@ -11278,7 +11282,7 @@ export class Library extends Uninstantable {
charlotte: true,
priority: -100,
lastDo: true,
silent:true,
silent: true,
content: function () {
player.removeSkill('counttrigger');
delete player.storage.counttrigger;
@ -11304,7 +11308,7 @@ export class Library extends Uninstantable {
priority: 100,
firstDo: true,
popup: false,
silent:true,
silent: true,
filter: function (event, player) {
return player.hp >= player.maxHp;
},
@ -11393,7 +11397,7 @@ export class Library extends Uninstantable {
popup: false,
priority: -100,
lastDo: true,
silent:true,
silent: true,
filter: function (event) {
return !event._cleared && event.card.name != 'wuxie';
},
@ -11410,7 +11414,7 @@ export class Library extends Uninstantable {
popup: false,
priority: -100,
lastDo: true,
silent:true,
silent: true,
filter: function (event) {
return ui.todiscard[event.discardid] ? true : false;
},
@ -11440,7 +11444,7 @@ export class Library extends Uninstantable {
priority: 5,
forced: true,
popup: false,
silent:true,
silent: true,
filter: function (event, player) {
//if(!event.player.isDying()) return false;
//if(event.source&&event.source.isIn()&&event.source!=player) return false;
@ -11594,7 +11598,7 @@ export class Library extends Uninstantable {
popup: false,
logv: false,
forceDie: true,
silent:true,
silent: true,
//priority:-5,
content: function () {
"step 0";
@ -11623,7 +11627,7 @@ export class Library extends Uninstantable {
forced: true,
popup: false,
forceDie: true,
silent:true,
silent: true,
filter: function (event, player) {
var evt = event.getParent();
return evt && evt.name == 'damage' && evt.hasNature('linked') && player.isLinked();