消除huicui.js的counttrigger

This commit is contained in:
Spmario233 2024-04-12 22:11:26 +08:00
parent b18458e56f
commit 7a5be391fe
1 changed files with 126 additions and 162 deletions

View File

@ -3551,57 +3551,57 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
}, },
dcrihui:{ dcrihui:{
audio:2, audio: 2,
trigger:{player:'useCardAfter'}, trigger: { player: 'useCardAfter' },
usable:1, usable: 1,
filter:function(event,player){ filter: function (event, player) {
if(!event.targets||event.targets.length!=1||event.targets[0]==player) return false; if (!event.targets || event.targets.length != 1 || event.targets[0] == player) return false;
var card=event.card; var card = event.card;
var target=event.targets[0]; var target = event.targets[0];
var marked=target.hasMark('dcjizhong'); var marked = target.hasMark('dcjizhong');
return (get.type(card)=='trick'||get.color(card)=='black'&&get.type(card)=='basic')&& return (get.type(card) == 'trick' || get.color(card) == 'black' && get.type(card) == 'basic') &&
(marked||!marked&&game.hasPlayer(current=>current.hasMark('dcjizhong'))); (marked || !marked && game.hasPlayer(current => current.hasMark('dcjizhong')));
}, },
direct:true, logTarget: event => event.targets[0],
content:function(){ prompt2(event, player) {
'step 0' const target = event.targets[0];
var target=trigger.targets[0]; if (target.hasMark('dcjizhong')) return '获得该角色区域内的一张牌';
var card={name:trigger.card.name,nature:trigger.card.nature,isCard:true}; else {
event.target=target; const card = { name: event.card.name, nature: event.card.nature, isCard: true };
event.card=card; return '令所有有“信众”的角色依次视为对其使用一张' + get.translation(card);
if(target.hasMark('dcjizhong')) player.gainPlayerCard(get.prompt('dcrihui',target),target,'hej').set('logSkill',['dcrihui',target]); }
else{ },
player.chooseBool(get.prompt('dcrihui',target),'令所有有“信众”的角色依次视为对其使用一张'+get.translation(card)).set('ai',()=>{ check(event, player) {
return _status.event.bool; const target = event.targets[0];
}).set('bool',function(){ if (target.hasMark('dcjizhong')) {
var eff=0; return get.effect(target, { name: 'shunshou_copy' }, event, player) > 0;
game.countPlayer(current=>{ }
if(!current.hasMark('dcjizhong')) return; else {
eff+=get.effect(target,card,current,player); const card = { name: event.card.name, nature: event.card.nature, isCard: true };
let eff = 0;
game.countPlayer(current => {
if (!current.hasMark('dcjizhong') || !current.canUse(card, player, false)) return;
eff += get.effect(target, card, current, player);
}); });
return eff>0; return eff > 0;
}());
} }
'step 1' },
if(!result.bool){ async content(event, trigger, player) {
player.storage.counttrigger.dcrihui--; const target = trigger.targets[0];
event.finish(); if (target.hasMark('dcjizhong')) {
return; await player.gainPlayerCard(target, 'hej', true)
} }
if(target.hasMark('dcjizhong')) event.finish(); else {
else{ const card = { name: trigger.card.name, nature: trigger.card.nature, isCard: true };
player.logSkill('dcrihui',target); const targets = game.filterPlayer(current => current.hasMark('dcjizhong')).sortBySeat(_status.currentPhase);
event.targets=game.filterPlayer(current=>current.hasMark('dcjizhong')); for (const current of targets) {
event.targets.sortBySeat(_status.currentPhase); if (target.isIn() && current.isIn() && current.canUse(card, target, false)) {
await current.useCard(card, target, false);
} }
'step 2'
var current=event.targets.shift();
if(current.canUse(card,target,false)){
current.useCard(card,target,false);
} }
if(event.targets.length) event.redo();
} }
}, },
},
dcguangshi:{ dcguangshi:{
audio:2, audio:2,
trigger:{player:'phaseZhunbeiBegin'}, trigger:{player:'phaseZhunbeiBegin'},
@ -5104,29 +5104,23 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2, audio:2,
trigger:{target:'useCardToTargeted'}, trigger:{target:'useCardToTargeted'},
usable:2, usable:2,
direct:true,
filter:function(event,player){ filter:function(event,player){
return event.player!=player&&(get.type(event.card)=='trick'||event.card.name=='sha')&&player.countCards('he')>1; return event.player!=player&&(get.type(event.card)=='trick'||event.card.name=='sha')&&player.countCards('he')>1;
}, },
content:function(){ async cost(event, trigger, player) {
'step 0' const str = ',若重铸的牌中没有' + get.translation(get.type2(trigger.card)) + '牌,你于' + get.translation(trigger.cards) + '进入弃牌堆后获得之';
var str=',若重铸的牌中没有'+get.translation(get.type2(trigger.card))+'牌,你于'+get.translation(trigger.cards)+'进入弃牌堆后获得之'; event.result = await player.chooseCard(get.prompt('dcqianzheng'), '重铸两张牌' + (trigger.cards.length ? str : '') + '。', 2, 'he', lib.filter.cardRecastable).set('ai', card => {
player.chooseCard(get.prompt('dcqianzheng'),'重铸两张牌'+(trigger.cards.length?str:'')+'。',2,'he',lib.filter.cardRecastable).set('ai',card=>{ var val = get.value(card);
var val=get.value(card); if (get.type2(card) == _status.event.type) val += 0.5;
if(get.type2(card)==_status.event.type) val+=0.5; return 6 - val;
return 6-val; }).set('type', get.type2(trigger.card)).forResult();
}).set('type',get.type2(trigger.card)); },
'step 1' async content(event, trigger, player) {
if(result.bool){ if (event.cards.every(card => get.type2(card) != get.type2(trigger.card))) {
var cards=result.cards; trigger.getParent().dcqianzheng = true;
player.logSkill('dcqianzheng');
player.recast(cards);
if(cards.every(card=>get.type2(card)!=get.type2(trigger.card))){
trigger.getParent().dcqianzheng=true;
player.addTempSkill('dcqianzheng_gain'); player.addTempSkill('dcqianzheng_gain');
} }
} await player.recast(event.cards);
else player.storage.counttrigger.dcqianzheng--;
}, },
subSkill:{ subSkill:{
gain:{ gain:{
@ -6254,24 +6248,22 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return event.player!=player&&get.color(event.card)=='black'; return event.player!=player&&get.color(event.card)=='black';
}, },
usable:2, usable:2,
direct:true, async cost(event, trigger, player) {
content:function(){ if (player.countCards('h') < player.hp) {
'step 0' event.result = await player.chooseBool(get.prompt('dcqingyan'), '将手牌摸至体力上限(摸' + get.cnNumber(player.maxHp - player.countCards('h')) + '张牌)').set('ai', () => 1).forResult();
if(player.countCards('h')<player.hp){
player.chooseBool(get.prompt('dcqingyan'),'将手牌摸至体力上限(摸'+get.cnNumber(player.maxHp-player.countCards('h'))+'张牌)').set('ai',()=>1);
}else{
player.chooseToDiscard(get.prompt('dcqingyan'),'弃置一张手牌令你的手牌上限+1').set('ai',card=>6-get.value(card)).set('logSkill','dcqingyan');
} }
'step 1' else {
if(result.bool){ event.result = await player.chooseToDiscard(get.prompt('dcqingyan'), '弃置一张手牌令你的手牌上限+1', 'chooseonly').set('ai', card => 6 - get.value(card)).forResult();
if(result.cards&&result.cards.length){ }
lib.skill.dcxieshou.change(player,1); },
}else{ async content(event, trigger, player) {
player.logSkill('dcqingyan'); if (event.cards && event.cards.length) {
await player.dicard(cards);
lib.skill.dcxieshou.change(player, 1);
} else {
player.drawTo(player.maxHp); player.drawTo(player.maxHp);
} }
} else player.storage.counttrigger.dcqingyan--; },
}
}, },
dcqizi:{ dcqizi:{
mod:{ mod:{
@ -6633,8 +6625,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
global:['gainAfter','loseAsyncAfter'], global:['gainAfter','loseAsyncAfter'],
}, },
usable:1, usable:1,
filter:function(event,player){ getIndex(event, player){
return lib.skill.dcyingtu.filterx(event,player,player.getNext())||lib.skill.dcyingtu.filterx(event,player,player.getPrevious()); var targets=[];
if(lib.skill.dcyingtu.filterx(event,player,player.getNext())) targets.add(player.getNext());
if(lib.skill.dcyingtu.filterx(event,player,player.getPrevious())) targets.add(player.getPrevious());
return targets.sortBySeat(_status.currentPhase);
}, },
filterx:function(event,player,target){ filterx:function(event,player,target){
var evt=event.getParent('phaseDraw'); var evt=event.getParent('phaseDraw');
@ -6643,41 +6638,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return lib.filter.canBeGained(card,target,player) return lib.filter.canBeGained(card,target,player)
},'he'); },'he');
}, },
logTarget:'player', logTarget(event, player, triggername, target){
direct:true, return target;
checkx:function(player,source){ },
check(event, player, triggername, source){
var target=(source==player.getNext()?player.getPrevious():player.getNext()); var target=(source==player.getNext()?player.getPrevious():player.getNext());
return Math.min(0,get.attitude(player,target))>=get.attitude(player,source); return Math.min(0,get.attitude(player,target))>=get.attitude(player,source);
}, },
prompt2:'获得该角色的一张牌,然后将一张牌交给该角色的对位角色。若你给出的是装备牌,则其使用其得到的牌。',
content:function(){ content:function(){
'step 0' 'step 0'
var targets=[]; var target=event.targets[0];
event.targets=targets;
if(lib.skill.dcyingtu.filterx(trigger,player,player.getNext())) targets.add(player.getNext());
if(lib.skill.dcyingtu.filterx(trigger,player,player.getPrevious())) targets.add(player.getPrevious());
'step 1'
var target=targets.shift();
event.target=target; event.target=target;
player.chooseBool(
get.prompt('dcyingtu',target),
'获得该角色的一张牌,然后将一张牌交给该角色的对位角色。若你给出的是装备牌,则其使用其得到的牌。'
).set('goon',lib.skill.dcyingtu.checkx(player,target)).set('ai',function(){
return _status.event.goon;
});
'step 2'
if(result.bool){
player.logSkill('dcyingtu',target);
var next=game.createEvent('dcyingtu_insert');
next.player=player;
next.target=target;
next.setContent(lib.skill.dcyingtu.contentx);
event.finish();
}
else if(targets.length>0) event.goto(1);
else player.storage.counttrigger.dcyingtu--;
},
contentx:function(){
'step 0'
event.side=(target==player.getPrevious()?'getNext':'getPrevious'); event.side=(target==player.getPrevious()?'getNext':'getPrevious');
player.gainPlayerCard(target,true,'he'); player.gainPlayerCard(target,true,'he');
'step 1' 'step 1'
@ -10395,34 +10367,35 @@ game.import('character',function(lib,game,ui,get,ai,_status){
rewangzu:{ rewangzu:{
audio:2, audio:2,
trigger:{player:'damageBegin1'}, trigger:{player:'damageBegin1'},
direct:true,
filter:function(event,player){ filter:function(event,player){
return event.source&&player!=event.source&&player.hasCard((card)=>lib.filter.cardDiscardable(card,player,'rewangzu'),'h'); return event.source&&player!=event.source&&player.hasCard((card)=>lib.filter.cardDiscardable(card,player,'rewangzu'),'h');
}, },
usable:1, usable:1,
content:function(){ async cost(event, trigger, player) {
'step 0' 'step 0'
var num=player.getFriends().length; var num = player.getFriends().length;
if(!game.hasPlayer(function(current){ if (!game.hasPlayer(function (current) {
return current!=player&&current.getFriends().length>num; return current != player && current.getFriends().length > num;
})){ })) {
player.chooseToDiscard('h',get.prompt('rewangzu'),'弃置一张牌并令伤害-1').set('ai',function(card){ player.chooseToDiscard('h', get.prompt('rewangzu'), '弃置一张牌并令伤害-1', 'chooseonly').set('ai', function (card) {
return 7-get.value(card); return 7 - get.value(card);
}).logSkill='rewangzu'; });
} }
else{ else {
player.chooseBool(get.prompt('rewangzu'),'随机弃置一张牌并令伤害-1'); player.chooseBool(get.prompt('rewangzu'), '随机弃置一张牌并令伤害-1');
} }
'step 1' 'step 1'
if(result.bool){ event.result = result;
},
async content(event, trigger, player) {
trigger.num--; trigger.num--;
if(!result.cards||!result.cards.length){ if (!event.cards || !event.cards.length) {
player.logSkill('rewangzu'); const cards = player.getCards('h', (card) => lib.filter.cardDiscardable(card, player, 'rewangzu'));
var cards=player.getCards('h',(card)=>lib.filter.cardDiscardable(card,player,'rewangzu')); if (cards.length) player.discard(cards.randomGet());
if(cards.length) player.discard(cards.randomGet());
} }
else {
player.discard(event.cards);
} }
else player.storage.counttrigger.rewangzu--;
}, },
}, },
//万年公主 //万年公主
@ -11237,48 +11210,41 @@ game.import('character',function(lib,game,ui,get,ai,_status){
spwanggui:{ spwanggui:{
audio:'wanggui', audio:'wanggui',
trigger:{source:'damageSource'}, trigger:{source:'damageSource'},
direct:true,
usable:1, usable:1,
filter:function(event,player){ filter:function(event,player){
return game.hasPlayer(function(current){ return game.hasPlayer(function(current){
return current.group!=player.group; return current.group!=player.group;
}); });
}, },
content:function(){ async cost(event, trigger, player){
'step 0' event.result = await player.chooseTarget(get.prompt('spwanggui'),'对一名势力不同的其他角色造成1点伤害',function(card,player,target){
player.chooseTarget(get.prompt('spwanggui'),'对一名势力不同的其他角色造成1点伤害',function(card,player,target){
return target.group!=player.group; return target.group!=player.group;
}).set('ai',function(target){ }).set('ai',function(target){
var player=_status.event.player; var player=_status.event.player;
return get.damageEffect(target,player,player); return get.damageEffect(target,player,player);
}); }).forResult();
'step 1' },
if(result.bool){ async content(event, trigger, player){
var target=result.targets[0]; const target = event.targets[0];
player.logSkill('spwanggui',target);
target.damage(); target.damage();
}
else player.storage.counttrigger.spwanggui--;
}, },
group:'spwanggui_draw', group:'spwanggui_draw',
subSkill:{ subSkill:{
draw:{ draw:{
trigger:{player:'damageEnd'}, trigger:{player:'damageEnd'},
direct:true, async cost(event, trigger, player){
content:function(){ event.result = await player.chooseTarget(get.prompt('spwanggui'),'令自己摸一张牌,或和一名势力相同的其他角色各摸一张牌',function(card,player,target){
'step 0'
player.chooseTarget(get.prompt('spwanggui'),'令自己摸一张牌,或和一名势力相同的其他角色各摸一张牌',function(card,player,target){
return target.group==player.group; return target.group==player.group;
}).set('ai',function(target){ }).set('ai',function(target){
var player=_status.event.player,att=get.attitude(player,target); var player=_status.event.player,att=get.attitude(player,target);
if(target!=player) att*=2; if(target!=player) att*=2;
if(target.hasSkillTag('nogain')) att/=1.7; if(target.hasSkillTag('nogain')) att/=1.7;
return att; return att;
}); }).forResult();
'step 1' },
if(result.bool){ content:function(){
var target=result.targets[0]; 'step 0'
player.logSkill('spwanggui',target); var target=targets[0];
if(player==target){ if(player==target){
player.draw(); player.draw();
event.finish(); event.finish();
@ -11287,9 +11253,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var list=[player,target].sortBySeat(); var list=[player,target].sortBySeat();
game.asyncDraw(list); game.asyncDraw(list);
} }
} 'step 1'
else event.finish();
'step 2'
game.delayx(); game.delayx();
}, },
}, },