diff --git a/card/standard.js b/card/standard.js index 6351e587c..356fd2d5c 100644 --- a/card/standard.js +++ b/card/standard.js @@ -268,7 +268,9 @@ game.import('card',function(lib,game,ui,get,ai,_status){ let ignore=get.copy(ui.selected.cards),used=player.getCardUsable('sha')-1.5,ph=player.getCards('hs'); ignore.add(item); 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; + let na=get.natureList(item),number,natures=['thunder','fire','ice','kami'],nb; + if(typeof item==='object') number=get.number(item); + else number=0; for(let i of ph){ if(ignore.includes(i)||get.name(i)!=='sha'||!lib.filter.cardEnabled(i,player)) continue; nb=get.natureList(i); diff --git a/character/collab.js b/character/collab.js index b5dc6b50d..72983f488 100644 --- a/character/collab.js +++ b/character/collab.js @@ -95,34 +95,33 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(player._dcsantou_temp) return; if(get.tag(card,'damage')){ const hp=target.getHp(); + player._dcsantou_temp=true; + const losehp=get.effect(target,{name:'losehp'},target,target)/get.attitude(target,target); + delete player._dcsantou_temp; if(hp>=3){ - if(target.hasHistory('useSkill',evt=>evt.skill=='dcsantou'&&evt.event.getTrigger().source==player)) return [1,-2]; + if(target.hasHistory('useSkill',evt=>evt.skill=='dcsantou'&&evt.event.getTrigger().source==player)) return [0,losehp,0,0]; else if(get.attitude(player,target)<0){ - if(card.name=='sha') return; - let sha=false; - player._dcsantou_temp=true; - let num=player.countCards('h',card=>{ - if(card.name=='sha'){ - if(sha) return false; - else sha=true; + let hs=player.getCards('hs',i=>{ + return i!==card&&(!card.cards||!card.cards.includes(i)); + }),num=player.getCardUsable('sha'); + if(card.name==='sha') num--; + hs=hs.filter(i=>{ + if(!player.canUse(i,target)) return false; + if(get.tag(card,'damage')&&get.name(i,player)!=='sha') return true; + if(num){ + num--; + return true; } - return get.tag(card,'damage')&&player.canUse(card,target)&&get.effect(target,card,player,player)>0; - }); - delete player._dcsantou_temp; - if(player.hasSkillTag('damage')){ - num++; - } - if(num<2){ - var enemies=player.getEnemies(); - if(enemies.length==1&&enemies[0]==target&&player.needsToDiscard()){ - return; - } - return 0; - } + return false; + }).length; + if(player.hasSkillTag('damage',null,{target:target})) hs++; + if(!hs) return 'zeroplayertarget'; + num=1-2/3/hs; + return [num,0,num,0]; } } - else if(hp==2&&get.tag(card,'natureDamage')||hp==1&&get.color(card)=='red'&&get.itemtype(card)=='card') return [1,-2]; - else return 0; + if(hp==2&&get.tag(card,'natureDamage')||hp==1&&typeof card=='object'&&get.color(card)=='red') return [0,losehp,0,0]; + return 'zeroplayertarget'; } } } @@ -160,6 +159,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } } else event.finish(); + }, + ai:{ + reverseEquip:true } }, //隅泣曹操 diff --git a/character/jsrg.js b/character/jsrg.js index 6f2be31c4..adcc07082 100644 --- a/character/jsrg.js +++ b/character/jsrg.js @@ -1563,9 +1563,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ prompt2:`${undamaged.length?'选择一张牌弃置并选择一名未对你造成过伤害的角色,你对其造成1点伤害':''}${undamaged.length&&damaged.length?';
或':''}${damaged.length?'仅选择一名对你造成过伤害的角色,你令其摸两张牌':''}。`, damaged:damaged, aiTarget:(()=>{ + if(!undamaged.some(i=>{ + if(get.attitude(player,i)>0) return true; + if(i.getHp(true)+i.hujia<2) return true; + return false; + })&&(player.hp>2||get.damageEffect(player,player,player)>=0)) return player; var info=game.filterPlayer().map(current=>{ - var damage=undamaged.includes(current); - var card={name:damage?'damage':'wuzhong'}; + let damage=undamaged.includes(current),card={name:damage?'damage':'wuzhong'}; return [current,get.effect(current,card,player,player)/(damage?1.5:1)]; }).sort((a,b)=>b[1]-a[1])[0]; if(info[1]>0) return info[0]; @@ -1626,6 +1630,35 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ trigger.num++; }, + ai:{ + damageBonus:true, + skillTagFilter:(player,tag,arg)=>{ + if(tag==='damageBonus'&&arg&&arg.target){ + const history=_status.globalHistory; + for(let i=history.length-1;i>=0;i--){ + let evts=history[i]['useCard']; + for(let j=evts.length-1;j>=0;j--){ + var evt=evts[j]; + let card=evt.card,targets=evt.targets; + if(!get.tag(card,'damage')||!targets.includes(player)) continue; + return arg.target===evt.player; + } + } + return false; + } + }, + effect:{ + player:(card,player,target)=>{ + if(get.tag(card,'damage')&&target&&lib.skill.jsrghuchou.ai.skillTagFilter(player,'damageBonus',{ + card:card, + target:target + })&&!target.hasSkillTag('filterDamage',null,{ + player:player, + card:card + })) return [1,0,2,0]; + } + } + } }, jsrgjiemeng:{ audio:2, diff --git a/character/sp.js b/character/sp.js index d427f1676..bfb7f3d3e 100755 --- a/character/sp.js +++ b/character/sp.js @@ -3388,8 +3388,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return !_status.event.sourcex.contains(target)&&player.canUse(_status.event.card,target); }).set('sourcex',trigger.targets).set('ai',function(target){ var player=_status.event.player; + if(player.countCards('h')%2==0) return true; var eff=get.effect(target,_status.event.card,player,player); - if(player.countCards('h')%2==0&&player.hasSkill('olxieju')&&player.isPhaseUsing()&&!player.getStat().skill.olxieju) return 1-eff; + if(player.hasSkill('olxieju')&&player.isPhaseUsing()&&!player.getStat().skill.olxieju&&get.attitude(player,target)>0&&!game.hasGlobalHistory('useCard',evt=>{ + return evt.targets&&evt.targets.includes(target); + })) return 6+eff; return eff; }).set('card',trigger.card); } @@ -3398,9 +3401,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return _status.event.bool; }).set('bool',function(){ var att=get.attitude(trigger.player,player); - var eff=get.effect(player,trigger.card,trigger.player,trigger.player); - if(player.countCards('h')%2==0&&att>0) return true; - if(eff>0) return true; + if(player.countCards('h')%2==0){ + if(att>0) return true; + return false; + } + if(get.effect(player,trigger.card,trigger.player,trigger.player)>0) return true; return false; }()); } diff --git a/noname/library/index.js b/noname/library/index.js index 0baf21c73..fdc22f49d 100644 --- a/noname/library/index.js +++ b/noname/library/index.js @@ -1666,6 +1666,7 @@ export class Library extends Uninstantable { }, splash_style: { name: '启动页', + init: 'style1', item: { style1: '样式一', style2: '样式二', @@ -28643,6 +28644,11 @@ export class Library extends Uninstantable { return false; } needsToDiscard(filter, add) { + /** + * filter: typeof 'number' -> 额外摸等量牌(逻辑上) + * typeof 'function' -> 只考虑符合函数筛选的牌 + * add: 额外获得这张/些牌(逻辑上) + */ let cards = this.getCards('h', card => !this.canIgnoreHandcard(card)), num = 0; if (get.itemtype(add) === 'cards') cards.addArray(add); else if (get.itemtype(add) === 'card') cards.push(add); @@ -28812,7 +28818,11 @@ export class Library extends Uninstantable { return this.hasUsableCard('shan'); } mayHaveSha(viewer, type, ignore, rvt) { - //rvt: return value type 'count', 'odds', 'bool'(default) + /** + * type: skill tag type 'use', 'respond' + * ignore: ignore cards, ui.selected.cards added + * rvt: return value type 'count', 'odds', 'bool'(default) + */ let count = 0; if ((this.hp > 2 || !this.isZhu && this.hp > 1) && this.hasSkillTag('respondSha', true, type, true)) { if (rvt === 'count') count++; @@ -28850,7 +28860,11 @@ export class Library extends Uninstantable { return count > _status.event.getRand('mayHaveSha' + hs + this.playerid); } mayHaveShan(viewer, type, ignore, rvt) { - //rvt: return value type 'count', 'odds', 'bool'(default) + /** + * type: skill tag type 'use', 'respond' + * ignore: ignore cards, ui.selected.cards added + * rvt: return value type 'count', 'odds', 'bool'(default) + */ let count = 0; if ((this.hp > 2 || !this.isZhu && this.hp > 1) && this.hasSkillTag('respondShan', true, type, true)) { if (rvt === 'count') count++;