为八卦阵、八阵、玲珑等增加freeShan标签用以放行,修复杀ai

This commit is contained in:
157 2024-03-11 14:55:04 +08:00
parent 74bed7b8a1
commit 04783cdf15
12 changed files with 99 additions and 30 deletions

View File

@ -155,11 +155,13 @@ game.import('card',function(lib,game,ui,get,ai,_status){
next.set('useShan',(()=>{
if(target.hasSkillTag('noShan',null,event)) return false;
if(target.hasSkillTag('useShan',null,event)) return true;
if(event.baseDamage+event.extraDamage<=0 || target.isLinked()&&game.hasNature(event.card)&&get.attitude(target,player._trueMe||player)>0) return false;
if(target.isLinked()&&game.hasNature(event.card)&&get.attitude(target,player._trueMe||player)>0) return false;
if(event.baseDamage+event.extraDamage<=0&&!game.hasNature(event.card,'ice')) return false;
if(target.hasSkillTag('freeShan',false,event,true)) return true;
if(event.shanRequired>1&&target.mayHaveShan(target,'use',null,'count')<event.shanRequired-(event.shanIgnored||0)) return false;
if(event.baseDamage+event.extraDamage>=target.hp+
((player.hasSkillTag('jueqing',false,target)||target.hasSkill('gangzhi'))?target.hujia:0)) return true;
if(!game.hasNature(event.card, 'ice')&&get.damageEffect(target,player,target,get.nature(event.card))>=0) return false;
if(!game.hasNature(event.card,'ice')&&get.damageEffect(target,player,target,get.nature(event.card))>=0) return false;
return true;
})());
//next.autochoose=lib.filter.autoRespondShan;
@ -394,7 +396,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
useful:(card,i)=>{
let player = _status.event.player, basic = [7, 5.1, 2], num = basic[Math.min(2, i)];
if(player.hp>2&&player.hasSkillTag('maixie')) num *= 0.57;
if(player.getEquip('bagua') || player.getEquip('rewrite_bagua') || player.getEquip('renwang') || player.getEquip('rewrite_renwang')) num *= 0.8;
if(player.hasSkillTag('freeShan',false,null,true) || player.getEquip('rewrite_renwang')) num *= 0.8;
return num;
},
value:[7,5.1,2],
@ -2676,6 +2678,18 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
ai:{
respondShan:true,
freeShan:true,
skillTagFilter(player,tag,arg){
if(tag!=='respondShan'&&tag!=='freeShan') return;
if(player.hasSkillTag('unequip2')) return false;
if(!arg||!arg.player) return true;
if(arg.player.hasSkillTag('unequip',false,{
target:player
})||arg.player.hasSkillTag('unequip_ai',false,{
target:player
})) return false;
return true;
},
effect:{
target:function(card,player,target,effect){
if(target.hasSkillTag('unequip2')) return;

View File

@ -2775,7 +2775,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
order:7,
result:{
target(player,target){
if(player.getEquip('tengjia')||player.getEquip('bagua')) return -1;
if(player.getEquip('tengjia')||player.hasSkillTag('freeShan',false,{
player:target,
card:new lib.element.VCard({name:'sha'})
})) return -1;
if(get.effect(player,{name:'sha'},target,player)>=0) return -1;
if(!player.hasShan()){
if(ui.selected.targets.length) return 0;

View File

@ -2346,7 +2346,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
result:{
target:function(player,target){
if(player.getStorage('dclvecheng_xiongluan').includes(target)) return 0;
if(target.getEquip('bagua')||target.getEquip('rewrite_bagua')) return -0.6;
if(target.hasSkillTag('freeShan',false,{
player:player
},true)) return -0.6;
var hs=player.countCards('h',card=>{
if(!player.canUse(card,target)) return false;
return get.name(card)=='sha'&&get.effect(target,card,player,player)>0;

View File

@ -2295,7 +2295,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
content:function(){
"step 0"
var dis=trigger.target.countCards('h','shan')||trigger.target.getEquip('bagua')||trigger.target.countCards('h')>2;
var dis=trigger.target.countCards('h','shan')||trigger.target.hasSkillTag('freeShan',false,{
player:player,
card:trigger.card
},true)||trigger.target.countCards('h')>2;
var att=get.attitude(player,trigger.target);
var next=player.chooseToDiscard(get.prompt('xiandan'));
next.ai=function(card){

View File

@ -1389,7 +1389,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
order:13,
result:{
target:(player,target)=>{
if(target.getEquip('bagua')||target.getEquip('rewrite_bagua')) return 0;
let hs=player.countCards('h',card=>{
if(!get.tag(card,'damage')||get.effect(target,card,player,player)<=0) return 0;
if(get.name(card,player)==='sha'){
@ -5435,6 +5434,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
ai:{
respondShan:true,
freeShan:true,
skillTagFilter(player,tag,arg){
if(tag!=='respondShan'&&tag!=='freeShan') return;
if(!player.hasEmptySlot(2)||player.hasSkillTag('unequip2')) return false;
if(!arg||!arg.player) return true;
if(arg.player.hasSkillTag('unequip',false,{
target:player
})||arg.player.hasSkillTag('unequip_ai',false,{
target:player
})) return false;
return true;
},
effect:{
target:function(card,player,target){
if(player==target&&get.subtype(card)=='equip2'){

View File

@ -2413,9 +2413,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
ai:{
directHit_ai:true,
skillTagFilter:function(player,tag,arg){
if(!arg||!arg.card||!arg.target||(arg.card.name!='sha'&&arg.card.name!='juedou')) return false;
if(tag!=='directHit_ai'||!arg||!arg.card||!arg.target||(arg.card.name!='sha'&&arg.card.name!='juedou')) return false;
if(player.storage.counttrigger&&player.storage.counttrigger.dbquedi&&player.storage.counttrigger.dbquedi>0) return false;
if(arg.target.countCards('h')==1&&(arg.card.name!='sha'||!arg.target.getEquip('bagua')||player.hasSkillTag('unequip',false,{
if(arg.target.countCards('h')==1&&(arg.card.name!='sha'||!arg.target.hasSkillTag('freeShan',false,{
player:player,
card:arg.card
})||player.hasSkillTag('unequip',false,{
name:arg.card?arg.card.name:null,
target:arg.target,
card:arg.card

View File

@ -15738,8 +15738,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(get.attitude(player,event.player)>=0) return false;
var e2=player.getEquip(2);
if(e2){
if(e2.name=='tengjia') return true;
if(e2.name=='bagua') return true;
if(e2.name=='tengjia'||e2.name=='rewrite_tengjia') return true;
if(e2.name=='bagua'||e2.name=='rewrite_bagua') return true;
}
return event.player.countCards('h')>event.player.hp;
},
@ -20019,6 +20019,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
ai:{
respondShan:true,
freeShan:true,
skillTagFilter(player,tag,arg){
if(tag!=='respondShan'&&tag!=='freeShan') return;
if(!player.hasEmptySlot(2)||player.hasSkillTag('unequip2')) return false;
if(!arg||!arg.player) return true;
if(arg.player.hasSkillTag('unequip',false,{
target:player
})||arg.player.hasSkillTag('unequip_ai',false,{
target:player
})) return false;
return true;
},
effect:{
target:function(card,player,target){
if(player==target&&get.subtype(card)=='equip2'){
@ -20477,8 +20489,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(get.attitude(player,event.player)>=0) return false;
var e2=player.getEquip(2);
if(e2){
if(e2.name=='tengjia') return true;
if(e2.name=='bagua') return true;
if(e2.name=='tengjia'||e2.name=='rewrite_tengjia') return true;
if(e2.name=='bagua'||e2.name=='rewrite_bagua') return true;
}
return player.countCards('h','shan')>0;
},

View File

@ -9528,7 +9528,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
content:function(){
"step 0"
var dis=trigger.target.countCards('h','shan')||trigger.target.getEquip('bagua')||trigger.target.countCards('h')>2;
var dis=trigger.target.countCards('h','shan')||trigger.target.hasSkillTag('freeShan',false,{
player:player,
card:trigger.card
},true)||trigger.target.countCards('h')>2;
var next=player.chooseToDiscard(get.prompt('shoulie',trigger.target));
next.ai=function(card){
if(dis) return 7-get.value(card);

View File

@ -10294,9 +10294,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.chooseTarget(get.prompt2('juetao'),lib.filter.notMe).set('ai',function(target){
let att=-get.attitude(_status.event.player,target);
if(att<=0) return att;
if(target.hasSkillTag('nodamage')) return 0.01*att;
if(target.getEquip('tengjia')||target.getEquip('renwang')) return 0.2*att;
if(target.getEquip('bagua')) return 0.3*att;
if(target.hasSkillTag('nodamage')||target.getEquip('qimenbagua')) return 0.01*att;
if(target.getEquip('tengjia')||target.getEquip('renwang')) return 0.3*att;
if(target.getEquip('rewrite_tengjia')||target.getEquip('rewrite_renwang')) return 0.2*att;
if(target.hasSkillTag('freeShan',false,{
player:_status.event.player
},true)) return 0.3*att;
if(target.getEquip(2)) return att/2;
return 1.2*att;
});

View File

@ -3692,11 +3692,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){
ai:{
directHit_ai:true,
skillTagFilter:function(player,tag,arg){
if(player._zhuandui_temp) return false;
if(player._zhuandui_temp||tag!=='directHit_ai') return false;
player._zhuandui_temp=true;
var bool=function(){
if(arg.card.name!='sha'||get.attitude(player,arg.target)>=0||!arg.target.countCards('h')) return false;
if(arg.target.countCards('h')==1&&(!arg.target.getEquip('bagua')||player.hasSkillTag('unequip',false,{
if(arg.target.countCards('h')==1&&(!arg.target.hasSkillTag('freeShan',false,{
player:player,
card:arg.card
},true)||player.hasSkillTag('unequip',false,{
name:arg.card?arg.card.name:null,
target:arg.target,
card:arg.card
@ -7254,7 +7257,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var trigger=_status.event.getTrigger();
if(att>0&&eff>=0) return 1;
if(att>=0&&eff>0) return 1;
if(att>0&&(trigger.player.hp>=3||trigger.player.getEquip('bagua')||trigger.player.countCards('h','shan'))){
if(att>0&&(trigger.player.hp>=3||trigger.player.hasSkillTag('freeShan',false,{
player:_status.event.player,
card:new lib.element.VCard({name:'sha',isCard:true})
})||trigger.player.countCards('h','shan'))){
if(name=='lebu'&&nh>trigger.player.hp) return 1;
if(name=='bingliang'&&nh<trigger.player.hp) return 1;
}
@ -7290,7 +7296,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var trigger=_status.event.getTrigger();
if(att>0&&eff>=0) return 1;
if(att>=0&&eff>0) return 1;
if(att>0&&(trigger.player.hp>=3||trigger.player.getEquip('bagua')||trigger.player.countCards('h','shan'))){
if(att>0&&(trigger.player.hp>=3||trigger.player.hasSkillTag('freeShan',false,{
player:_status.event.player,
card:new lib.element.VCard({name:'sha',isCard:true})
})||trigger.player.countCards('h','shan'))){
if(name=='lebu'&&nh>trigger.player.hp) return 1;
if(name=='bingliang'&&nh<trigger.player.hp) return 1;
}
@ -9895,8 +9904,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
ai:{
directHit_ai:true,
skillTagFilter:function(player,tag,arg){
if(!arg.target.hasSkill('qianxi2')) return false;
if(arg.card.name=='sha') return arg.target.storage.qianxi2=='red'&&(!arg.target.getEquip('bagua')||player.hasSkillTag('unequip',false,{
if(tag!=='directHit_ai'||!arg.target.hasSkill('qianxi2')) return false;
if(arg.card.name=='sha') return arg.target.storage.qianxi2=='red'&&(!arg.target.hasSkillTag('freeShan',false,{
player:player,
card:arg.card
},true)||player.hasSkillTag('unequip',false,{
name:arg.card?arg.card.name:null,
target:arg.target,
card:arg.card

View File

@ -1066,7 +1066,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
check:function(event,player){
if(get.attitude(player,event.target)>=0) return false;
if(event.target.getEquip('bagua')) return false;
if(event.target.hasSkillTag('freeShan',false,{
player:player,
card:event.card
},true)) return false;
if(event.target.hasSkillTag('respondShan')&&event.target.countCards('h')>=3) return false;
return true;
},
@ -2186,7 +2189,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(trigger.target.hasSkill('shanguang2')) return 0;
var equip=trigger.target.getEquip(2);
if(equip&&equip.name=='bagua') return 1;
if(equip&&(equip.name=='bagua'||equip.name=='rewrite_bagua')) return 1;
return trigger.target.countCards('h')<2?0:1;
};
"step 1"

View File

@ -8834,7 +8834,7 @@ export class Player extends HTMLDivElement {
}
mayHaveShan(viewer, type, ignore, rvt) {
/**
* type: skill tag type 'use', 'respond'
* type: skill tag type 'use', 'respond' or object
* ignore: ignore cards, ui.selected.cards added
* rvt: return value type 'count', 'odds', 'bool'(default)
*/