From 8360f72c1ed8770afa7182d343cdaf4d5eabd7b0 Mon Sep 17 00:00:00 2001 From: 157 <3619242020@qq.com> Date: Sun, 17 Mar 2024 11:56:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=90=E6=9D=80=E3=80=91?= =?UTF-8?q?=E3=80=90=E5=8D=97=E8=9B=AE=E5=85=A5=E4=BE=B5=E3=80=91=E3=80=90?= =?UTF-8?q?=E4=B8=87=E7=AE=AD=E9=BD=90=E5=8F=91=E3=80=91=E3=80=90=E7=81=AB?= =?UTF-8?q?=E6=94=BB=E3=80=91=E3=80=90=E4=BB=A5=E9=80=B8=E5=BE=85=E5=8A=B3?= =?UTF-8?q?=E3=80=91ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- card/extra.js | 4 +- card/guozhan.js | 50 +++--- card/standard.js | 417 ++++++++++++++++++++++++++++++++++++++--------- character/sp.js | 12 +- 4 files changed, 378 insertions(+), 105 deletions(-) diff --git a/card/extra.js b/card/extra.js index e3dc67ed2..df068778b 100644 --- a/card/extra.js +++ b/card/extra.js @@ -229,9 +229,9 @@ game.import('card',function(lib,game,ui,get,ai,_status){ }, ai:{ basic:{ - order:4, + order:9.2, value:[3,1], - useful:1, + useful:0.6, }, wuxie:function(target,card,player,viewer,status){ if(get.attitude(viewer,player._trueMe||player)>0) return 0; diff --git a/card/guozhan.js b/card/guozhan.js index 3e5ad1a4f..86780a879 100644 --- a/card/guozhan.js +++ b/card/guozhan.js @@ -1095,30 +1095,42 @@ game.import('card',function(lib,game,ui,get,ai,_status){ target.chooseToDiscard(2,'he',true).ai=get.disvalue; }, ai:{ - wuxie:function(){ + wuxie: function () { return 0; }, - basic:{ - useful:3, - value:3, - order:5 + basic: { + order: 9, + useful: 1.5, + value: 3 }, - result:{ - target:function(player,target){ - var hs=target.getCards('h'); - if(hs.length<=1){ - if(target==player&&(hs.length==0||hs[0].name=='yiyi')){ - return 0; + result: { + target(player, target) { + let i, + add = 0, + y = 1, + tars = 0; + if (!ui.selected.cards) y = 0; + if (ui.selected.targets) tars = 0.01 * ui.selected.targets.length; + else tars = 0; + if (target == player) i = player.countCards('h', function (card) { + if (y > 0 && ui.selected.cards.includes(card)) return false; + if (!y && get.name(card) === 'yiyi') { + y = -1; + return false; } - return 0.3; - } - return Math.sqrt(target.countCards('he')); - }, + return true; + }); + else i = target.countCards('he'); + if (target.hasSkillTag('noh')) add++; + return add + Math.sqrt(i / 3.6 + tars) / 2; + } }, - tag:{ - loseCard:1, - discard:1, - norepeat:1 + tag: { + draw: 2, + loseCard: 2, + discard: 2, + multitarget: true, + norepeat: 1 } }, }, diff --git a/card/standard.js b/card/standard.js index 26c4a68ac..6c6e26e84 100644 --- a/card/standard.js +++ b/card/standard.js @@ -272,17 +272,17 @@ game.import('card',function(lib,game,ui,get,ai,_status){ useful:[5,3,1], value:[5,3,1], }, - order:function(item,player){ - if(player.hasSkillTag('presha',true,null,true)) return 10; - if(typeof item==='object'&&game.hasNature(item,'linked')){ - if(game.hasPlayer(function(current){ - return current!=player&&lib.card.sha.ai.canLink(player,current,item)&&player.canUse(item,current,null,true)&&get.effect(current,item,player,player)>0; - })&&game.countPlayer(function(current){ - return current.isLinked()&&get.damageEffect(current,player,player,get.nature(item))>0; - })>1) return 3.1; - return 3; - } - return 3.05; + order(item, player) { + let res = 3.2; + if (player.hasSkillTag('presha', true, null, true)) res = 10; + if (typeof item !== 'object' || !game.hasNature(item, 'linked') || game.countPlayer(cur => cur.isLinked()) < 2) return res; + //let used = player.getCardUsable('sha') - 1.5, natures = ['thunder', 'fire', 'ice', 'kami']; + let uv = player.getUseValue(item, true); + if (uv <= 0) return res; + let temp = player.getUseValue('sha', true) - uv; + if (temp < 0) return res + 0.15; + if (temp > 0) return res - 0.15; + return res; }, result:{ target:function(player,target,card,isLink){ @@ -995,43 +995,171 @@ game.import('card',function(lib,game,ui,get,ai,_status){ } }, ai:{ - wuxie:function(target,card,player,viewer){ - if(get.attitude(viewer,target)>0&&target.countCards('h','sha')){ - if(!target.countCards('h')||target.hp==1||Math.random()<0.7) return 0; + wuxie(target, card, player, viewer, status) { + let att = get.attitude(viewer, target), eff = get.effect(target, card, player, target); + if (Math.abs(att) < 1 || status * eff * att >= 0) return 0; + let evt = _status.event.getParent('useCard'), pri = 1, bonus = player.hasSkillTag('damageBonus', true, { + target: target, + card: card + }), damage = 1, isZhu = function (tar) { + return tar.isZhu || tar === game.boss || tar === game.trueZhu || tar === game.falseZhu; + }, canSha = function (tar, blur) { + let known = tar.getKnownCards(viewer); + if (!blur) return known.some(card => { + let name = get.name(card, tar); + return (name === 'sha' || name === 'hufu' || name === 'yuchanqian') && lib.filter.cardRespondable(card, tar); + }); + if (tar.countCards('hs', i => !known.includes(i)) > 4.67 - 2 * tar.hp / tar.maxHp) return true; + if (!tar.hasSkillTag('respondSha', true, 'respond', true)) return false; + if (tar.hp <= damage) return false; + if (tar.hp <= damage + 1) return isZhu(tar); + return true; + }, self = false; + if (canSha(target)) return 0; + if (bonus && !viewer.hasSkillTag('filterDamage', null, { + player: player, + card: card + })) damage = 2; + if ((viewer.hp <= damage || viewer.hp <= damage + 1 && isZhu(viewer)) && !canSha(viewer)) { + if (viewer === target) return status; + let fv = true; + if (evt && evt.targets) for (let i of evt.targets) { + if (fv) { + if (target === i) fv = false; + continue; + } + if (viewer == i) { + if (isZhu(viewer)) return 0; + self = true; + break; + } + } + } + let maySha = canSha(target, true); + if (bonus && !target.hasSkillTag('filterDamage', null, { + player: player, + card: card + })) damage = 2; + else damage = 1; + if (isZhu(target)) { + if (eff < 0) { + if (target.hp <= damage + 1 || !maySha && target.hp <= damage + 2) return 1; + if (maySha && target.hp > damage + 2) return 0; + else if (maySha || target.hp > damage + 2) pri = 3; + else pri = 4; + } + else if (target.hp > damage + 1) pri = 2; + else return 0; + } + else if (self) return 0; + else if (eff < 0) { + if (!maySha && target.hp <= damage) pri = 5; + else if (maySha) return 0; + else if (target.hp > damage + 1) pri = 2; + else if (target.hp === damage + 1) pri = 3; + else pri = 4; + } + else if (target.hp <= damage) return 0; + let find = false; + if (evt && evt.targets) for (let i = 0; i < evt.targets.length; i++) { + if (!find) { + if (evt.targets[i] === target) find = true; + continue; + } + let att1 = get.attitude(viewer, evt.targets[i]), eff1 = get.effect(evt.targets[i], card, player, evt.targets[i]), temp = 1; + if (Math.abs(att1) < 1 || att1 * eff1 >= 0 || canSha(evt.targets[i])) continue; + maySha = canSha(evt.targets[i], true); + if (bonus && !evt.targets[i].hasSkillTag('filterDamage', null, { + player: player, + card: card + })) damage = 2; + else damage = 1; + if (isZhu(evt.targets[i])) { + if (eff1 < 0) { + if (evt.targets[i].hp <= damage + 1 || !maySha && evt.targets[i].hp <= damage + 2) return 0; + if (maySha && evt.targets[i].hp > damage + 2) continue; + if (maySha || evt.targets[i].hp > damage + 2) temp = 3; + else temp = 4; + } + else if (evt.targets[i].hp > damage + 1) temp = 2; + else continue; + } + else if (eff1 < 0) { + if (!maySha && evt.targets[i].hp <= damage) temp = 5; + else if (maySha) continue; + else if (evt.targets[i].hp > damage + 1) temp = 2; + else if (evt.targets[i].hp === damage + 1) temp = 3; + else temp = 4; + } + else if (evt.targets[i].hp > damage + 1) temp = 2; + if (temp > pri) return 0; + } + return 1; + }, + basic: { + order: 9, + useful: [5, 1], + value: 5 + }, + result: { + player(player, target) { + if (player._nanman_temp || player.hasSkillTag('jueqing', false, target)) return 0; + player._nanman_temp = true; + let eff = get.effect(target, new lib.element.VCard({ name: 'nanman' }), player, target); + delete player._nanman_temp; + if (eff >= 0) return 0; + if (target.hp > 2 || target.hp > 1 && !target.isZhu && target != game.boss && target != game.trueZhu && target != game.falseZhu) return 0; + if (target.hp > 1 && target.hasSkillTag('respondSha', true, 'respond', true)) return 0; + let known = target.getKnownCards(player); + if (known.some(card => { + let name = get.name(card, target); + if (name === 'sha' || name === 'hufu' || name === 'yuchanqian') return lib.filter.cardRespondable(card, target); + if (name === 'wuxie') return lib.filter.cardEnabled(card, target, 'forceEnable'); + })) return 0; + if (target.hp > 1 || target.countCards('hs', i => !known.includes(i)) > 4.67 - 2 * target.hp / target.maxHp) return 0; + let res = 0, att = get.sgnAttitude(player, target); + res -= att * (0.8 * target.countCards('hs') + 0.6 * target.countCards('e') + 3.6); + if (get.mode() === 'identity' && target.identity === 'fan') res += 2.4; + if (get.mode() === 'guozhan' && player.identity !== 'ye' && player.identity === target.identity || + get.mode() === 'identity' && player.identity === 'zhu' && (target.identity === 'zhong' || target.identity === 'mingzhong')) res -= 0.8 * player.countCards('he'); + return res; + }, + target(player, target) { + let zhu = (get.mode() === 'identity' && target.isZhu) || target.identity === 'zhu'; + if (!lib.filter.cardRespondable({ name: 'sha' }, target)) { + if (zhu) { + if (target.hp < 2) return -99; + if (target.hp === 2) return -3.6; + } + return -2; + } + let known = target.getKnownCards(player); + if (known.some(card => { + let name = get.name(card, target); + if (name === 'sha' || name === 'hufu' || name === 'yuchanqian') return lib.filter.cardRespondable(card, target); + if (name === 'wuxie') return lib.filter.cardEnabled(card, target, 'forceEnable'); + })) return -1.2; + let nh = target.countCards('hs', i => !known.includes(i)); + if (zhu && target.hp <= 1) { + if (nh === 0) return -99; + if (nh === 1) return -60; + if (nh === 2) return -36; + if (nh === 3) return -12; + if (nh === 4) return -8; + return -5; + } + if (target.hasSkillTag('respondSha', true, 'respond', true)) return -1.35; + if (!nh) return -2; + if (nh === 1) return -1.8; + return -1.5; } }, - basic:{ - order:9, - useful:[5,1], - value:5 - }, - result:{ - target_use:function(player,target){ - if(player.hasUnknown(2)&&get.mode()!='guozhan') return 0; - var nh=target.countCards('h'); - if(get.mode()=='identity'){ - if(target.isZhu&&nh<=2&&target.hp<=1) return -100; - } - if(nh==0) return -2; - if(nh==1) return -1.7 - return -1.5; - }, - target:function(player,target){ - var nh=target.countCards('h'); - if(get.mode()=='identity'){ - if(target.isZhu&&nh<=2&&target.hp<=1) return -100; - } - if(nh==0) return -2; - if(nh==1) return -1.7 - return -1.5; - }, - }, - tag:{ - respond:1, - respondSha:1, - damage:1, - multitarget:1, - multineg:1, + tag: { + respond: 1, + respondSha: 1, + damage: 1, + multitarget: 1, + multineg: 1 } } }, @@ -1079,43 +1207,170 @@ game.import('card',function(lib,game,ui,get,ai,_status){ } }, ai:{ - wuxie:function(target,card,player,viewer){ - if(get.attitude(viewer,target)>0&&target.countCards('h','shan')){ - if(!target.countCards('h')||target.hp==1||Math.random()<0.7) return 0; + wuxie(target, card, player, viewer, status) { + let att = get.attitude(viewer, target), eff = get.effect(target, card, player, target); + if (Math.abs(att) < 1 || status * eff * att >= 0) return 0; + let evt = _status.event.getParent('useCard'), pri = 1, bonus = player.hasSkillTag('damageBonus', true, { + target: target, + card: card + }), damage = 1, isZhu = function (tar) { + return tar.isZhu || tar === game.boss || tar === game.trueZhu || tar === game.falseZhu; + }, canShan = function (tar, blur) { + let known = tar.getKnownCards(viewer); + if (!blur) return known.some(card => { + let name = get.name(card, tar); + return (name === 'shan' || name === 'hufu') && lib.filter.cardRespondable(card, tar); + }); + if (tar.countCards('hs', i => !known.includes(i)) > 3.67 - 2 * tar.hp / tar.maxHp) return true; + if (!tar.hasSkillTag('respondShan', true, 'respond', true)) return false; + if (tar.hp <= damage) return false; + if (tar.hp <= damage + 1) return isZhu(tar); + return true; + }, self = false; + if (canShan(target)) return 0; + if (bonus && !viewer.hasSkillTag('filterDamage', null, { + player: player, + card: card + })) damage = 2; + if ((viewer.hp <= damage || viewer.hp <= damage + 1 && isZhu(viewer)) && !canShan(viewer)) { + if (viewer === target) return status; + let fv = true; + if (evt && evt.targets) for (let i of evt.targets) { + if (fv) { + if (target === i) fv = false; + continue; + } + if (viewer == i) { + if (isZhu(viewer)) return 0; + self = true; + break; + } + } + } + let mayShan = canShan(target, true); + if (bonus && !target.hasSkillTag('filterDamage', null, { + player: player, + card: card + })) damage = 2; + else damage = 1; + if (isZhu(target)) { + if (eff < 0) { + if (target.hp <= damage + 1 || !mayShan && target.hp <= damage + 2) return 1; + if (mayShan && target.hp > damage + 2) return 0; + else if (mayShan || target.hp > damage + 2) pri = 3; + else pri = 4; + } + else if (target.hp > damage + 1) pri = 2; + else return 0; + } + else if (self) return 0; + else if (eff < 0) { + if (!mayShan && target.hp <= damage) pri = 5; + else if (mayShan) return 0; + else if (target.hp > damage + 1) pri = 2; + else if (target.hp === damage + 1) pri = 3; + else pri = 4; + } + else if (target.hp <= damage) return 0; + let find = false; + if (evt && evt.targets) for (let i = 0; i < evt.targets.length; i++) { + if (!find) { + if (evt.targets[i] === target) find = true; + continue; + } + let att1 = get.attitude(viewer, evt.targets[i]), eff1 = get.effect(evt.targets[i], card, player, evt.targets[i]), temp = 1; + if (Math.abs(att1) < 1 || att1 * eff1 >= 0 || canShan(evt.targets[i])) continue; + mayShan = canShan(evt.targets[i], true); + if (bonus && !evt.targets[i].hasSkillTag('filterDamage', null, { + player: player, + card: card + })) damage = 2; + else damage = 1; + if (isZhu(evt.targets[i])) { + if (eff1 < 0) { + if (evt.targets[i].hp <= damage + 1 || !mayShan && evt.targets[i].hp <= damage + 2) return 0; + if (mayShan && evt.targets[i].hp > damage + 2) continue; + if (mayShan || evt.targets[i].hp > damage + 2) temp = 3; + else temp = 4; + } + else if (evt.targets[i].hp > damage + 1) temp = 2; + else continue; + } + else if (eff1 < 0) { + if (!mayShan && evt.targets[i].hp <= damage) temp = 5; + else if (mayShan) continue; + else if (evt.targets[i].hp > damage + 1) temp = 2; + else if (evt.targets[i].hp === damage + 1) temp = 3; + else temp = 4; + } + else if (evt.targets[i].hp > damage + 1) temp = 2; + if (temp > pri) return 0; + } + return 1; + }, + basic: { + order: 9, + useful: 1, + value: 5 + }, + result: { + player(player, target) { + if (player._wanjian_temp || player.hasSkillTag('jueqing', false, target)) return 0; + player._wanjian_temp = true; + let eff = get.effect(target, new lib.element.VCard({ name: 'wanjian' }), player, target); + delete player._wanjian_temp; + if (eff >= 0) return 0; + if (target.hp > 2 || target.hp > 1 && !target.isZhu && target != game.boss && target != game.trueZhu && target != game.falseZhu) return 0; + if (target.hp > 1 && target.hasSkillTag('respondShan', true, 'respond', true)) return 0; + let known = target.getKnownCards(player); + if (known.some(card => { + let name = get.name(card, target); + if (name === 'shan' || name === 'hufu') return lib.filter.cardRespondable(card, target); + if (name === 'wuxie') return lib.filter.cardEnabled(card, target, 'forceEnable'); + })) return 0; + if (target.hp > 1 || target.countCards('hs', i => !known.includes(i)) > 3.67 - 2 * target.hp / target.maxHp) return 0; + let res = 0, att = get.sgnAttitude(player, target); + res -= att * (0.8 * target.countCards('hs') + 0.6 * target.countCards('e') + 3.6); + if (get.mode() === 'identity' && target.identity === 'fan') res += 2.4; + if (get.mode() === 'guozhan' && player.identity !== 'ye' && player.identity === target.identity || + get.mode() === 'identity' && player.identity === 'zhu' && (target.identity === 'zhong' || target.identity === 'mingzhong')) res -= 0.8 * player.countCards('he'); + return res; + }, + target(player, target) { + let zhu = (get.mode() === 'identity' && target.isZhu) || target.identity === 'zhu'; + if (!lib.filter.cardRespondable({ name: 'shan' }, target)) { + if (zhu) { + if (target.hp < 2) return -99; + if (target.hp === 2) return -3.6; + } + return -2; + } + let known = target.getKnownCards(player); + if (known.some(card => { + let name = get.name(card, target); + if (name === 'shan' || name === 'hufu') return lib.filter.cardRespondable(card, target); + if (name === 'wuxie') return lib.filter.cardEnabled(card, target, 'forceEnable'); + })) return -1.2; + let nh = target.countCards('hs', i => !known.includes(i)); + if (zhu && target.hp <= 1) { + if (nh === 0) return -99; + if (nh === 1) return -60; + if (nh === 2) return -36; + if (nh === 3) return -8; + return -5; + } + if (target.hasSkillTag('respondShan', true, 'respond', true)) return -1.35; + if (!nh) return -2; + if (nh === 1) return -1.65; + return -1.5; } }, - basic:{ - order:9, - useful:1, - value:5 - }, - result:{ - target_use:function(player,target){ - if(player.hasUnknown(2)&&get.mode()!='guozhan') return 0; - var nh=target.countCards('h'); - if(get.mode()=='identity'){ - if(target.isZhu&&nh<=2&&target.hp<=1) return -100; - } - if(nh==0) return -2; - if(nh==1) return -1.7 - return -1.5; - }, - target:function(player,target){ - var nh=target.countCards('h'); - if(get.mode()=='identity'){ - if(target.isZhu&&nh<=2&&target.hp<=1) return -100; - } - if(nh==0) return -2; - if(nh==1) return -1.7 - return -1.5; - }, - }, - tag:{ - respond:1, - respondShan:1, - damage:1, - multitarget:1, - multineg:1, + tag: { + respond: 1, + respondShan: 1, + damage: 1, + multitarget: 1, + multineg: 1 } } }, diff --git a/character/sp.js b/character/sp.js index 11697fb42..7ce5b7b63 100755 --- a/character/sp.js +++ b/character/sp.js @@ -18318,9 +18318,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return get.info('ollongdan').ai.skillTagFilter(player,tag); }, order:function(item,player){ - if(!player||!player.storage) return; + if(!player||!player.storage){ + player=_status.event.player; + if(!player||!player.storage) return 0; + if(Object.keys(player.storage).some(i=>{ + return typeof i=='string'&&i.indexOf('fuhan')!=-1; + })) return 4; + return 1; + } const awakened=Object.keys(player.storage).some(i=>typeof i=='string'&&i.indexOf('fuhan')!=-1); - if(player&&_status.event.type=='phase'){ + if(_status.event.type=='phase'){ var max=0; var list=['sha','tao','jiu']; var map={sha:'shan',tao:'jiu',jiu:'tao'} @@ -18334,7 +18341,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(max>0) max+=(awakened?0.3:-0.3); return max; } - if(!player) player=_status.event.player; return awakened?4:1; }, },