player.getEquipRange()

This commit is contained in:
Spmario233 2023-10-04 18:50:29 +08:00
parent f4d872df68
commit d3f5fdcf4e
7 changed files with 67 additions and 73 deletions

View File

@ -14286,6 +14286,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
re_weiwenzhugezhi:'手杀卫温诸葛直',
re_weiwenzhugezhi_prefix:'手杀',
gz_re_xugong:'许贡',
re_xugong:'手杀许贡',
re_xugong_prefix:'手杀',
re_zhanggong:'手杀张恭',

View File

@ -3337,19 +3337,23 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
ai:{
effect:{
target:function(card,player,target,current){
target_use:function(card,player,target,current){
if(card.name=='sha'&&get.attitude(player,target)<0){
if(_status.event.name=='xiangle') return;
if(get.attitude(player,target)>0&&current<0) return 'zerotarget';
var bs=player.getCards('h',{type:'basic'});
if(bs.length<2) return 0;
bs.remove(card);
if(card.cards) bs.removeArray(card.cards);
else bs.removeArray(ui.selected.cards);
if(!bs.length) return 'zerotarget';
if(player.hasSkill('jiu')||player.hasSkill('tianxianjiu')) return;
if(bs.length<=3&&player.countCards('h','sha')<=1){
if(bs.length<=2){
for(var i=0;i<bs.length;i++){
if(bs[i].name!='sha'&&get.value(bs[i])<7){
if(get.value(bs[i])<7){
return [1,0,1,-0.5];
}
}
return 0;
return [1,0,0.3,0];
}
return [1,0,1,-0.5];
}

View File

@ -13403,31 +13403,42 @@ game.import('character',function(lib,game,ui,get,ai,_status){
threaten:1.8,
effect:{
target:function(card,player,target,current){
if(player!=target||!player.isPhaseUsing()) return;
let used=(target.getHistory('useCard').length+target.getHistory('respond').length);
if(get.subtype(card)=='equip1'&&!get.cardtag(card,'gifts')){
var range0=player.getAttackRange();
var range=0;
var info=get.info(card);
if(player!=target||!player.isPhaseUsing()) return;
let range0=player.getAttackRange();
let range=0;
let info=get.info(card);
if(info&&info.distance&&info.distance.attackFrom){
range-=info.distance.attackFrom;
}
if(player.getEquip(1)){
var num=0;
var info=get.info(player.getEquip(1));
let num=0;
let info=get.info(player.getEquip(1));
if(info&&info.distance&&info.distance.attackFrom){
num-=info.distance.attackFrom;
}
range0-=num;
}
range0+=range;
var delta=range0-(player.getHistory('useCard').length+player.getHistory('respond').length);
let delta=range0-used;
if(delta<0) return;
var num=player.countCards('h',function(card){
let num=player.countCards('h',function(card){
return (get.cardtag(card,'gifts')||get.subtype(card)!='equip1')&&player.getUseValue(card)>0;
});
if(delta==2&&num>0) return [1,3];
if(num>=delta) return 'zeroplayertarget';
}
else if(get.tag(card,'respondShan')>0){
if(current<0&&used==target.getAttackRange()-1&&target.mayHaveShan()){
return 0.6;
}
}
else if(get.tag(card,'respondSha')>0){
if(current<0&&used==target.getAttackRange()-1&&target.mayHaveSha()){
return 0.6;
}
}
},
},
}

View File

@ -14260,6 +14260,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
zhenshan_info:'每回合限一次,当你需要使用或打出一张基本牌时,你可以与一名手牌数少于你的角色交换手牌,视为使用或打出此牌。',
tw_tianyu:'TW田豫',
tw_tianyu_prefix:'TW',
gz_tw_tianyu:'田豫',
twzhenxi:'震袭',
twzhenxi_info:'每回合限一次。当你使用【杀】指定目标后你可选择一项⒈弃置其X张手牌X为你至其的距离⒉将其装备区或判定区内的一张牌移动到另一名角色的装备区或判定区内。若其体力值大于你或其体力值为全场最高则你可以改为依次执行以上两项。',
twyangshi:'扬师',

View File

@ -6673,15 +6673,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
content:function(){
'step 0'
var num=0,cards=player.getEquips(1);
for(var card of cards){
var numz=1;
var info=get.info(card,false);
if(info&&info.distance&&info.distance.attackFrom){
numz-=info.distance.attackFrom;
}
num+=numz;
}
var num=player.getEquipRange();
if(trigger.player.countCards('h')<num){
event.directfalse=true;
}

View File

@ -26898,51 +26898,43 @@
range+=info.globalFrom;
}
})
return (equips.reduce((range,card,index)=>{
if(index==0) range--;
let newRange=1;
const info=get.info(card,false);
if(info.distance){
//如果存在attackRange 则通过attackRange动态获取攻击范围
if(typeof info.distance.attackRange=='function'){
newRange=info.distance.attackRange(card,player);
}
//否则采用祖宗之法
else if(typeof info.distance.attackFrom=='number'){
newRange-=info.distance.attackFrom;
}
}
return Math.max(range,newRange)
},range)-range);
return (player.getEquipRange()-range);
}
let base=game.checkMod(player,'unchanged','attackRangeBase',player);
if(base!='unchanged'){
range=base;
}
else{
const equips=player.getCards('e',function(card){
return !ui.selected.cards||!ui.selected.cards.contains(card);
});
range=equips.reduce((range,card,index)=>{
if(index==0) range--;
let newRange=1;
const info=get.info(card,false);
if(info.distance){
//如果存在attackRange 则通过attackRange动态获取攻击范围
if(typeof info.distance.attackRange=='function'){
newRange=info.distance.attackRange(card,player);
}
//否则采用祖宗之法
else if(typeof info.distance.attackFrom=='number'){
newRange-=info.distance.attackFrom;
}
}
return Math.max(range,newRange);
},1);
range=player.getEquipRange();
}
range=game.checkMod(player,range,'attackRange',player);
return range;
},
getEquipRange:function(cards){
const player=this;
if(!cards) cards=player.getCards('e',function(card){
return !ui.selected.cards||!ui.selected.cards.contains(card);
});
const range=cards.reduce((range,card)=>{
let newRange=false;
const info=get.info(card,false);
if(info.distance){
//如果存在attackRange 则通过attackRange动态获取攻击范围
if(typeof info.distance.attackRange=='function'){
newRange=info.distance.attackRange(card,player);
}
//否则采用祖宗之法
else if(typeof info.distance.attackFrom=='number'){
newRange=(1-info.distance.attackFrom);
}
}
let isN1=(typeof range=='number');
let isN2=(typeof newRange=='number');
if(isN1&&isN2) return Math.max(range,newRange);
else return (isN1?range:newRange);
},false);
return (typeof range=='number')?range:1;
},
getGlobalFrom:function(){
var player=this;
var range=0;
@ -33744,6 +33736,10 @@
['经典',{
showName:'典',
}],
['君',{
color:'#fefedc',
nature:'shenmm',
}],
['骰子',{
getSpan:()=>{
return `<span style="font-family:NonameSuits">🎲</span>`;
@ -57857,22 +57853,7 @@
m=game.checkMod(from,to,m,'attackFrom',from);
m=game.checkMod(from,to,m,'attackTo',to);
return m;
const attakRange=equips1.reduce((range,card,index)=>{
if(index==0) range--;
let newRange=1;
const info=get.info(card,false);
if(info.distance){
//如果存在attackRange 则通过attackRange动态获取攻击范围
if(typeof info.distance.attackRange=='function'){
newRange=info.distance.attackRange(card,player);
}
//否则采用祖宗之法
else if(typeof info.distance.attackFrom=='number'){
newRange-=info.distance.attackFrom;
}
}
return Math.max(range,newRange)
},1);
const attakRange=from.getEquipRange();
m+=(1-attakRange);
for(let i=0;i<equips2.length;i++){
let info=get.info(equips2[i]).distance;

View File

@ -14561,6 +14561,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
gzcongjian:'从谏',
gzcongjian_info:'锁定技,当你于回合外造成伤害,或于回合内受到伤害时,此伤害+1。',
gz_jun_caocao:'君曹操',
gz_jun_caocao_prefix:'君',
jianan:'建安',
jianan_info:'君主技,只要此武将处于明置状态,你便拥有“五子良将纛”。',
g_jianan:'五子良将纛',
@ -14653,8 +14654,11 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
"_mingzhisuodingji_info":"出牌阶段,你可以明置拥有“锁定技”的武将牌。",
gz_jun_liubei:'君刘备',
gz_jun_liubei_prefix:'君',
gz_jun_zhangjiao:'君张角',
gz_jun_zhangjiao_prefix:'君',
gz_jun_sunquan:'君孙权',
gz_jun_sunquan_prefix:'君',
gz_liqueguosi:'李傕郭汜',
gz_bianfuren:'卞夫人',
gz_lvfan:'吕范',