大幅调整杀order和酒result,bug修复
杀的order时间复杂度降下来了,基本可以避免用一卡一的情况了; 同时也降低了酒的result时间复杂度
This commit is contained in:
parent
d51551f734
commit
b9d27a128a
|
@ -123,34 +123,58 @@ game.import('card',function(lib,game,ui,get,ai,_status){
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
result:{
|
result:{
|
||||||
target:(player,target)=>{
|
target:(player,target,card)=>{
|
||||||
if(target&&target.isDying()) return 2;
|
if(target&&target.isDying()) return 2;
|
||||||
if(!target || target._jiu_temp || !target.isPhaseUsing()) return 0;
|
if(!target || target._jiu_temp || !target.isPhaseUsing()) return 0;
|
||||||
if(!target.getCardUsable('sha') || lib.config.mode==='stone'&&!player.isMin()&&player.getActCount()+1>=player.actcount) return 0;
|
let usable=target.getCardUsable('sha');
|
||||||
let shas = player.getCards('hs',card=>get.name(card)==='sha'&&!ui.selected.cards.includes(card)), card;
|
if(!usable || lib.config.mode==='stone'&&!player.isMin()&&player.getActCount()+1>=player.actcount || !target.mayHaveSha(player,'use',card)) return 0;
|
||||||
if(!shas.length || !target.hasSha() || shas.length>1&&(target.getCardUsable('sha')>1 || target.countCards('hs','zhuge'))) return 0;
|
let effs=_status.event.getTempCache('jiu_result','effs');
|
||||||
target._jiu_temp = true;
|
if(effs&&effs[card.cardid]){
|
||||||
shas.sort((a,b)=>get.order(b)-get.order(a));
|
for(let i in effs){
|
||||||
for(let i=0; i<shas.length; i++){
|
if(effs[i].target&&effs[i].target.isIn()&&effs[i].eff>0) return 1;
|
||||||
let tars = [];
|
}
|
||||||
if(lib.filter.filterCard(shas[i],target)) tars = game.filterPlayer(current=>{
|
return 0;
|
||||||
return get.attitude(target,current)<0&&target.canUse(shas[i],current,null,true)&&!current.hasSkillTag('filterDamage',null,{
|
}
|
||||||
|
effs={};
|
||||||
|
let shas=target.getCards('hs',i=>{
|
||||||
|
if(get.name(i)!=='sha' || ui.selected.cards.includes(i)) return false;
|
||||||
|
effs[i.cardid]={
|
||||||
|
target:null,
|
||||||
|
eff:0
|
||||||
|
};
|
||||||
|
return true;
|
||||||
|
}),eff,id;
|
||||||
|
for(let i of shas){
|
||||||
|
id=i.cardid;
|
||||||
|
if(!lib.filter.filterCard(i,target)) continue;
|
||||||
|
game.filterPlayer(current=>{
|
||||||
|
if(get.attitude(target,current)>=0 || !target.canUse(i,current,null,true) || current.hasSkillTag('filterDamage',null,{
|
||||||
player:target,
|
player:target,
|
||||||
card:shas[i],
|
card:i,
|
||||||
jiu:true
|
jiu:true
|
||||||
})&&get.effect(current,shas[i],target)>0;
|
})) return false;
|
||||||
|
eff=get.effect(current,i,target,player);
|
||||||
|
if(eff<=effs[id].eff) return false;
|
||||||
|
effs[id].target=current;
|
||||||
|
effs[id].eff=eff;
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
if(!tars.length) continue;
|
if(effs[id].target&&(target.hasSkillTag('directHit_ai',true,{
|
||||||
tars.sort((a,b)=>{
|
target:effs[id].target,
|
||||||
return get.effect(b,shas[i],target)-get.effect(a,shas[i],target);
|
card:i
|
||||||
});
|
},true) || target.needsToDiscard()>Math.max(0,3-target.hp) || !effs[id].target.mayHaveShan(player,'use'))){
|
||||||
if(!tars[0].mayHaveShan(player,'use') || target.hasSkillTag('directHit_ai',true,{
|
if(card.cardid){
|
||||||
target:tars[0],
|
effs[card.cardid]={target:null};
|
||||||
card:shas[i]
|
_status.event.putTempCache('jiu_result','effs',effs);
|
||||||
},true) || target.needsToDiscard()>Math.max(0,3-target.hp)){
|
}
|
||||||
delete target._jiu_temp;
|
delete target._jiu_temp;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
delete effs[id];
|
||||||
|
}
|
||||||
|
if(card.cardid){
|
||||||
|
effs[card.cardid]={target:null};
|
||||||
|
_status.event.putTempCache('jiu_result','effs',effs);
|
||||||
}
|
}
|
||||||
delete target._jiu_temp;
|
delete target._jiu_temp;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -263,23 +263,25 @@ game.import('card',function(lib,game,ui,get,ai,_status){
|
||||||
let res=3.2;
|
let res=3.2;
|
||||||
if(player.hasSkillTag('presha',true,null,true)) res=10;
|
if(player.hasSkillTag('presha',true,null,true)) res=10;
|
||||||
if(get.itemtype(player)!=='player') return res;
|
if(get.itemtype(player)!=='player') return res;
|
||||||
let uv=player.getUseValue(item,true);
|
/*let uv=player.getUseValue(item,true);
|
||||||
if(uv<=0) return res;
|
if(uv<=0) return res;*/
|
||||||
let ignore=get.copy(ui.selected.cards),used=player.getCardUsable('sha')-1.5,ph=player.getCards('hs');
|
let ignore=get.copy(ui.selected.cards),used=player.getCardUsable('sha')-1.5,ph=player.getCards('hs');
|
||||||
ignore.add(item);
|
ignore.add(item);
|
||||||
if(typeof item==='object'&&item.cards) ignore.addArray(item.cards);
|
if(typeof item==='object'&&item.cards) ignore.addArray(item.cards);
|
||||||
|
let na=get.natureList(item),number=get.number(item),natures=['thunder','fire','ice','kami'],nb;
|
||||||
for(let i of ph){
|
for(let i of ph){
|
||||||
if(ignore.includes(i)||get.name(i)!=='sha'||!lib.filter.cardEnabled(i,player)) continue;
|
if(ignore.includes(i)||get.name(i)!=='sha'||!lib.filter.cardEnabled(i,player)) continue;
|
||||||
let usev=player.getUseValue(i,true);
|
nb=get.natureList(i);
|
||||||
if(usev<=0||used*(usev-uv)>0) continue;
|
if(na.length===nb.length&&(!na.length||na[0]===nb[0])){
|
||||||
if(used*(uv-usev)!==0) return res-0.15;
|
if(number>get.number(i)) return res-0.15;
|
||||||
let na=get.natureList(uv),nb=get.natureList(usev);
|
continue;
|
||||||
|
}
|
||||||
if(used*(na.length-nb.length)>0) return res-0.15;
|
if(used*(na.length-nb.length)>0) return res-0.15;
|
||||||
if(na.length&&na.length===nb.length&&na[0]!==nb[0]){
|
if(na.length===nb.length){
|
||||||
let natures=['thunder','fire','ice','kami'];
|
|
||||||
if(used*(natures.indexOf(na[0])-natures.indexOf(nb[0]))>0) return res-0.15;
|
if(used*(natures.indexOf(na[0])-natures.indexOf(nb[0]))>0) return res-0.15;
|
||||||
}
|
}
|
||||||
if(get.number(item)>get.number(i)) return res-0.15;
|
/*usev=player.getUseValue(i,true);
|
||||||
|
if(usev>0&&used*(uv-usev)>0) return res-0.15;*/
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
@ -304,6 +306,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
|
||||||
if(zhu) eff*=Math.max(1,9/target.hp/target.hp);
|
if(zhu) eff*=Math.max(1,9/target.hp/target.hp);
|
||||||
if(isLink){
|
if(isLink){
|
||||||
let rate=_status.event.getTempCache('sha_result','mayShan');
|
let rate=_status.event.getTempCache('sha_result','mayShan');
|
||||||
|
if(rate&&rate.card===card) rate=rate.rate;
|
||||||
delete target._sha_result_temp;
|
delete target._sha_result_temp;
|
||||||
if(typeof rate==='boolean'||typeof rate==='number'){
|
if(typeof rate==='boolean'||typeof rate==='number'){
|
||||||
if(!rate) return basic*eff*1.3;
|
if(!rate) return basic*eff*1.3;
|
||||||
|
@ -326,7 +329,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){
|
||||||
})) mayShan=true;
|
})) mayShan=true;
|
||||||
else mayShan=1-Math.pow(0.7,(target.hasSkillTag('respondShan',true,'use',true)?1:0)+target.countCards('hs')-temp.length);
|
else mayShan=1-Math.pow(0.7,(target.hasSkillTag('respondShan',true,'use',true)?1:0)+target.countCards('hs')-temp.length);
|
||||||
}
|
}
|
||||||
_status.event.putTempCache('sha_result','mayShan',mayShan);
|
_status.event.putTempCache('sha_result','mayShan',{
|
||||||
|
card:card,
|
||||||
|
rate:mayShan
|
||||||
|
});
|
||||||
delete target._sha_result_temp;
|
delete target._sha_result_temp;
|
||||||
if(!mayShan) return basic*eff;
|
if(!mayShan) return basic*eff;
|
||||||
if(mayShan>=1) return eff;
|
if(mayShan>=1) return eff;
|
||||||
|
@ -1875,12 +1881,12 @@ game.import('card',function(lib,game,ui,get,ai,_status){
|
||||||
return num+get.value(i,player);
|
return num+get.value(i,player);
|
||||||
},0);
|
},0);
|
||||||
},
|
},
|
||||||
target:(player,target)=>{
|
target:(player,target,card)=>{
|
||||||
let targets=get.copy(ui.selected.targets);
|
let targets=get.copy(ui.selected.targets);
|
||||||
if(_status.event.preTarget) targets.add(_status.event.preTarget);
|
if(_status.event.preTarget) targets.add(_status.event.preTarget);
|
||||||
if(targets.length){
|
if(targets.length){
|
||||||
let preTarget=targets.lastItem,pre=_status.event.getTempCache('jiedao_result',preTarget);
|
let preTarget=targets.lastItem,pre=_status.event.getTempCache('jiedao_result',preTarget.playerid);
|
||||||
if(pre&&pre.target.isIn()) return target===pre.target?pre.eff:0;
|
if(pre&&pre.card===card&&pre.target.isIn()) return target===pre.target?pre.eff:0;
|
||||||
return get.effect(target,{name:'sha'},preTarget,player)/get.attitude(player,target);
|
return get.effect(target,{name:'sha'},preTarget,player)/get.attitude(player,target);
|
||||||
}
|
}
|
||||||
let arms=(target.hasSkillTag('noe')?0.32:-0.15)*target.getEquips(1).reduce((num,i)=>{
|
let arms=(target.hasSkillTag('noe')?0.32:-0.15)*target.getEquips(1).reduce((num,i)=>{
|
||||||
|
@ -1896,7 +1902,8 @@ game.import('card',function(lib,game,ui,get,ai,_status){
|
||||||
},-100);
|
},-100);
|
||||||
if(!addTar) return arms;
|
if(!addTar) return arms;
|
||||||
sha/=get.attitude(player,target);
|
sha/=get.attitude(player,target);
|
||||||
_status.event.putTempCache('jiedao_result',target,{
|
_status.event.putTempCache('jiedao_result',target.playerid,{
|
||||||
|
card:card,
|
||||||
target:addTar,
|
target:addTar,
|
||||||
eff:sha
|
eff:sha
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue