为本体使用mayHaveShan响应杀的地方忽略杀命中手牌
砍非卖血将命中后,目标角色的这些手牌会加上'sha_notshan'标签,便于告知场上AI这些牌里“没有闪”
This commit is contained in:
parent
75c997b2bf
commit
da415398e9
|
@ -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,{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -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)){
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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
|
||||
})){
|
||||
if(get.attitude(player, target) > 0) return -7;
|
||||
return -4;
|
||||
}
|
||||
return -0.5;
|
||||
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(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 -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];
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)){
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -307,22 +307,22 @@ export class Library extends Uninstantable {
|
|||
|
||||
/**
|
||||
* **无名杀频道推送机制**
|
||||
*
|
||||
*
|
||||
* 鉴于`Javascript`的特性及自身对所需功能的思考,这是一个参考`Golang`的`channel`设计的、完全和`go channel`不一样的异步消息传递对象
|
||||
*
|
||||
*
|
||||
* 当且仅当接收方和发送方均存在时进行消息传递,完全保证信息传递的单一性(发送方/接收方一旦确定则无法更改)和准确性(发送方必然将消息发送给接收方)
|
||||
*
|
||||
*
|
||||
* 若存在发送方/接收方时调用`send`/`receive`,将报错
|
||||
*
|
||||
*
|
||||
* 若需要异步/不报错发送信息,请等待`lib.actor`
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* // 创建一个频道
|
||||
* const channel = new lib.channel();
|
||||
*
|
||||
*
|
||||
* // 从某个角落接收channel发出的消息,若无消息则等待
|
||||
* const message = await channel.receive();
|
||||
*
|
||||
*
|
||||
* // 从某个角落向channel发消息,若无消息接收则等待
|
||||
* await channel.send(item);
|
||||
*/
|
||||
|
@ -330,12 +330,12 @@ export class Library extends Uninstantable {
|
|||
|
||||
/**
|
||||
* **无名杀消息推送库**
|
||||
*
|
||||
*
|
||||
* 通过`EventTarget`机制,实现消息推送和接收的解耦,
|
||||
* 从而使消息接收方无需依赖发布方,发布方也无需考虑接收方
|
||||
*
|
||||
*
|
||||
* > `lib.announce`不是`actor`模型,若不存在订阅者,则消息发送将无意义
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* // 甲扩展(如《千幻聆音》)在角色皮肤切换后,调用:
|
||||
* lib.announce.publish("skinChange", {
|
||||
|
@ -344,12 +344,12 @@ export class Library extends Uninstantable {
|
|||
* originSkin: "image/xxx.jpg",
|
||||
* currentSkin: "image/yyy.jpg"
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // 乙扩展监听此`skinChange`事件,并修改自己扩展相关界面的图片:
|
||||
* const method = lib.announce.subscribe("skinChange", (e) => {
|
||||
* div.setBackgroundImage(e.currentSkin);
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // 若此时乙扩展不想继续订阅`skinChange`事件,可以通过`unsubscribe`解除订阅
|
||||
* lib.announce.unsubscribe("skinChange", method);
|
||||
*/
|
||||
|
@ -389,7 +389,7 @@ export class Library extends Uninstantable {
|
|||
};
|
||||
/**
|
||||
* Yingbian
|
||||
*
|
||||
*
|
||||
* 应变
|
||||
*/
|
||||
static yingbian = {
|
||||
|
@ -565,7 +565,7 @@ export class Library extends Uninstantable {
|
|||
};
|
||||
/**
|
||||
* Stratagem buff
|
||||
*
|
||||
*
|
||||
* 谋攻强化
|
||||
*/
|
||||
static stratagemBuff = {
|
||||
|
@ -655,7 +655,7 @@ export class Library extends Uninstantable {
|
|||
};
|
||||
/**
|
||||
* The actual card name
|
||||
*
|
||||
*
|
||||
* 实际的卡牌名称
|
||||
*/
|
||||
static actualCardName = new Map([
|
||||
|
@ -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: '折叠手牌',
|
||||
|
@ -8312,7 +8312,7 @@ export class Library extends Uninstantable {
|
|||
static cheat = {
|
||||
/**
|
||||
* 将游戏内部的对象暴露到全局中
|
||||
*
|
||||
*
|
||||
* lib.cheat, game, ui, get, ai, lib, _status
|
||||
*/
|
||||
i() {
|
||||
|
@ -8339,15 +8339,15 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 在控制台输出每个扩展文件夹内的所有文件
|
||||
*
|
||||
*
|
||||
* 需要node环境
|
||||
*
|
||||
*
|
||||
* @param { ...string } args 只需要显示的文件夹首字符
|
||||
*/
|
||||
x(...args) {
|
||||
/**
|
||||
* @param { string } dir
|
||||
* @param { (folders: string[], files: string[]) => any } callback
|
||||
* @param { string } dir
|
||||
* @param { (folders: string[], files: string[]) => any } callback
|
||||
*/
|
||||
const gl = function (dir, callback) {
|
||||
const files = [], folders = [];
|
||||
|
@ -8494,10 +8494,10 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 将卡牌的样式在simple和default之间切换
|
||||
*
|
||||
*
|
||||
* 有参数时改为获得指定的牌
|
||||
*
|
||||
* @param { ...string } args
|
||||
*
|
||||
* @param { ...string } args
|
||||
*/
|
||||
q(...args) {
|
||||
// if(lib.config.layout!='mobile') lib.init.layout('mobile');
|
||||
|
@ -8753,7 +8753,7 @@ export class Library extends Uninstantable {
|
|||
/**
|
||||
* 炉石模式可用,使用`spell_${name}`卡牌
|
||||
* @param { string } [name]
|
||||
* @param { boolean } [act]
|
||||
* @param { boolean } [act]
|
||||
*/
|
||||
gs(name = 'yexinglanghun', act) {
|
||||
const card = game.createCard('spell_' + name);
|
||||
|
@ -8770,7 +8770,7 @@ export class Library extends Uninstantable {
|
|||
/**
|
||||
* 炉石模式可用,获得`stone_${name}_stonecharacter`卡牌
|
||||
* @param { string } [name]
|
||||
* @param { boolean } [act]
|
||||
* @param { boolean } [act]
|
||||
*/
|
||||
gc(name = 'falifulong', act) {
|
||||
var card = game.createCard('stone_' + name + '_stonecharacter');
|
||||
|
@ -8786,7 +8786,7 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 进入/关闭快速自动测试模式(游戏速度最快),只有游戏记录界面
|
||||
* @param { boolean | string } [bool]
|
||||
* @param { boolean | string } [bool]
|
||||
*/
|
||||
a(bool) {
|
||||
if (lib.config.test_game) {
|
||||
|
@ -8809,7 +8809,7 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 临时去掉“自动测试模式”带来的css效果,
|
||||
*
|
||||
*
|
||||
* 如果要彻底关闭,需要再执行一次lib.cheat.a
|
||||
*/
|
||||
as() {
|
||||
|
@ -8828,8 +8828,8 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 下家对你使用一张牌
|
||||
* @param {...Player | Player[] | string | VCard } args
|
||||
*
|
||||
* @param {...Player | Player[] | string | VCard } args
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* // 传入player是卡牌的使用者
|
||||
|
@ -8912,14 +8912,14 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 打印目标玩家的手牌
|
||||
* @param { Player } player
|
||||
* @param { Player } player
|
||||
*/
|
||||
h(player) {
|
||||
console.log(get.translation(player.getCards('h')));
|
||||
},
|
||||
/**
|
||||
* 给自己立刻添加手牌
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* // 获得3张杀和1张闪
|
||||
|
@ -8940,10 +8940,10 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 立即获得指定类型的牌各一张
|
||||
*
|
||||
*
|
||||
* 会添加到不属于当前模式的牌和某些角色专属牌
|
||||
*
|
||||
* @param { string } type
|
||||
*
|
||||
* @param { string } type
|
||||
*/
|
||||
ga(type) {
|
||||
for (let i in lib.card) {
|
||||
|
@ -8954,7 +8954,7 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 给所有玩家立刻添加一张或多张指定的牌
|
||||
* @param {...string} args
|
||||
* @param {...string} args
|
||||
* @example
|
||||
* ```js
|
||||
* // 给所有玩家立刻添加一张杀和一张闪
|
||||
|
@ -8970,7 +8970,7 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 给目标立即添加一张手牌
|
||||
* @param { string } name
|
||||
* @param { string } name
|
||||
* @param { Player } target
|
||||
*/
|
||||
gx(name, target = game.me) {
|
||||
|
@ -8986,10 +8986,10 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 创建卡牌
|
||||
*
|
||||
*
|
||||
* 如果lib.card里没有对应卡牌名返回null
|
||||
*
|
||||
* @param { string } name
|
||||
*
|
||||
* @param { string } name
|
||||
* @returns { Card }
|
||||
* @example
|
||||
* ```js
|
||||
|
@ -9041,7 +9041,7 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 指定的玩家或自己立即获得诸葛连弩,青龙刀,八卦阵,的卢,赤兔,木牛
|
||||
* @param { Player } [target]
|
||||
* @param { Player } [target]
|
||||
*/
|
||||
ge(target) {
|
||||
if (target) {
|
||||
|
@ -9084,8 +9084,8 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 自己立刻获取牌堆顶num张牌
|
||||
* @param { number } [num]
|
||||
* @param { Player } [target]
|
||||
* @param { number } [num]
|
||||
* @param { Player } [target]
|
||||
*/
|
||||
d(num = 1, target) {
|
||||
const cards = get.cards(num);
|
||||
|
@ -9115,10 +9115,10 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 弃置指定位置玩家的所有牌
|
||||
*
|
||||
*
|
||||
* 不传入num默认为弃置所有玩家的所有牌
|
||||
*
|
||||
* @param { number | Player } [num]
|
||||
*
|
||||
* @param { number | Player } [num]
|
||||
*/
|
||||
t(num) {
|
||||
if (game.players.includes(num)) {
|
||||
|
@ -9161,7 +9161,7 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 重新设置当前的主公的武将牌,且血量上限+1(不论当局人数是否大于3)
|
||||
* @param { string } name
|
||||
* @param { string } name
|
||||
*/
|
||||
z(name) {
|
||||
switch (name) {
|
||||
|
@ -9640,21 +9640,21 @@ export class Library extends Uninstantable {
|
|||
none: () => false,
|
||||
/**
|
||||
* Check if the card does not count toward the player's hand limit
|
||||
*
|
||||
*
|
||||
* 检测此牌是否不计入此角色的手牌上限
|
||||
* @param { Card } card
|
||||
* @param { Player } player
|
||||
* @param { Player } player
|
||||
* @returns { boolean }
|
||||
*/
|
||||
ignoredHandcard: (card, player) => game.checkMod(card, player, false, 'ignoredHandcard', player),
|
||||
/**
|
||||
* Check if the card is giftable
|
||||
*
|
||||
*
|
||||
* 检测此牌是否可赠予
|
||||
* @param { Card } card
|
||||
* @param { Player } player
|
||||
* @param { Player } target
|
||||
* @param { boolean } [strict]
|
||||
* @param { Card } card
|
||||
* @param { Player } player
|
||||
* @param { Player } target
|
||||
* @param { boolean } [strict]
|
||||
*/
|
||||
cardGiftable: (card, player, target, strict) => {
|
||||
const mod = game.checkMod(card, player, target, 'unchanged', 'cardGiftable', player);
|
||||
|
@ -9663,12 +9663,12 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* Check if the card is recastable
|
||||
*
|
||||
*
|
||||
* 检查此牌是否可重铸
|
||||
* @param { Card } card
|
||||
* @param { Player } player
|
||||
* @param { Player } [source]
|
||||
* @param { boolean } [strict]
|
||||
* @param { Card } card
|
||||
* @param { Player } player
|
||||
* @param { Player } [source]
|
||||
* @param { boolean } [strict]
|
||||
*/
|
||||
cardRecastable: (card, player = get.owner(card), source, strict) => {
|
||||
// if (typeof player == 'undefined') player = get.owner(card);
|
||||
|
@ -9706,11 +9706,11 @@ export class Library extends Uninstantable {
|
|||
return savable;
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {GameEvent} event
|
||||
* @param {Player} player
|
||||
* @param {string} triggername
|
||||
* @param {string} skill
|
||||
*
|
||||
* @param {GameEvent} event
|
||||
* @param {Player} player
|
||||
* @param {string} triggername
|
||||
* @param {string} skill
|
||||
* @returns {boolean}
|
||||
*/
|
||||
filterTrigger: function (event, player, triggername, skill) {
|
||||
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue