谋司马懿(无AI)

This commit is contained in:
Spmario233 2024-03-02 23:10:52 +08:00
parent 967ce19b61
commit 644a885f18
3 changed files with 294 additions and 87 deletions

View File

@ -4,6 +4,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
name:'xianding',
connect:true,
character:{
dc_sb_simayi:['male','wei',3,['dcsbquanmou','dcsbpingliao']],
chendong:['male','wu',4,['dcduanxie','fenming']],
lvfan:['male','wu',3,['diaodu','diancai']],
cuimao:['male','wei',3,['zhengbi','fengying']],
@ -113,10 +114,216 @@ game.import('character',function(lib,game,ui,get,ai,_status){
sp2_qifu:['dc_guansuo','xin_baosanniang','dc_zhaoxiang'],
sp2_gaoshan:['wanglang','liuhui','zhangjian'],
sp2_wumiao:['wu_zhugeliang','wu_luxun'],
sp2_mouding:['dc_sb_lusu','dc_sb_zhouyu'],
sp2_mouding:['dc_sb_lusu','dc_sb_zhouyu','dc_sb_simayi'],
}
},
skill:{
//谋司马懿
dcsbquanmou:{
audio:2,
zhuanhuanji:true,
marktext:'☯',
enable:'phaseUse',
filter(event,player){
const selected=player.getStorage('dcsbquanmou_selected');
return game.hasPlayer(current=>!selected.includes(current)&&player.inRange(current)&&current.countCards('he')>0);
},
filterTarget(card,player,target){
if(player===target) return false;
const selected=player.getStorage('dcsbquanmou_selected');
return !selected.includes(target)&&player.inRange(target)&&target.countCards('he')>0;
},
async content(event,trigger,player){
const target = event.targets[0];
player.changeZhuanhuanji('dcsbquanmou');
player.markAuto('dcsbquanmou_selected', [target]);
const cards = await target.chooseCard('he', true, `选择交给${get.translation(player)}一张牌`).forResultCards();
if (cards && cards.length) {
await target.give(cards, player);
const key = `dcsbquanmou_${Boolean(!player.storage.dcsbquanmou)}`;
player.addTempSkill(key, {global:['phaseUseBefore','phaseChange']});
player.markAuto(key, [target]);
target.addAdditionalSkill(`${key}_${player.playerid}`, `${key}_mark`);
}
},
onremove:true,
mark:true,
intro:{
content:'ces'
},
subSkill:{
true:{
audio:'dcsbquanmou',
charlotte:true,
trigger:{source:'damageSource'},
forced:true,
popup:false,
filter(event,player){
return player.getStorage('dcsbquanmou_true').includes(event.player);
},
async content(event, trigger, player){
const target = trigger.player;
player.getStorage('dcsbquanmou_true').remove(target);
target.removeAdditionalSkill(`dcsbquanmou_true_${player.playerid}`);
if(game.hasPlayer(current => (current != player && current != target))){
const result = await player.chooseTarget([1,3], `权谋:是否对${get.translation(target)}之外的至多三名其他角色各造成1点伤害`, (card, player, target)=>{
return target != player && target != get.event().getTrigger().player;
}).forResult();
if (result.bool) {
await player.logSkill('dcsbquanmou', result.targets);
for(let i of result.targets){
if(i.isIn()) await i.damage();
}
}
}
},
onremove(player,skill){
game.filterPlayer(current=>{
current.removeAdditionalSkill(`${skill}_${player.playerid}`);
});
delete player.storage[skill];
delete player.storage.dcquanmou_selected;
},
},
true_mark:{
charlotte:true,
mark:true,
marktext:'讨',
intro:{
name:'权谋 - 阳',
content:()=>{
return `当你下次受到${get.translation(_status.currentPhase)}造成的伤害后其可以对除你之外的至多三名其他角色各造成1点伤害。`
},
},
},
false:{
audio:'dcsbquanmou',
charlotte:true,
trigger:{source:'damageBegin2'},
forced:true,
filter(event,player){
return player.getStorage('dcsbquanmou_false').includes(event.player);
},
async content(event, trigger, player){
const target = trigger.player;
player.getStorage('dcsbquanmou_false').remove(target);
target.removeAdditionalSkill(`dcsbquanmou_false_${player.playerid}`);
trigger.cancel();
},
onremove(player,skill){
game.filterPlayer(current=>{
current.removeAdditionalSkill(`${skill}_${player.playerid}`);
});
delete player.storage[skill];
delete player.storage.dcquanmou_selected;
},
},
false_mark:{
charlotte:true,
mark:true,
marktext:'抚',
intro:{
name:'权谋 - 阴',
content:()=>{
return `当你下次受到${get.translation(_status.currentPhase)}造成的伤害时,防止此伤害。`
},
},
},
},
},
dcsbpingliao:{
audio:2,
trigger:{player:'useCard0'},
forced:true,
filter(event,player){
return event.card.name=='sha';
},
logTarget(event,player){
return game.filterPlayer(current=>player.inRange(current));
},
async content(event, trigger, player) {
trigger.hideTargets = true;
const unrespondedTargets = [];
const respondedTargets = [];
let nonnonTargetResponded = false;
const targets = game.filterPlayer().sortBySeat();
const prompt = `###是否打出红色基本牌响应${get.translation(player)}###${get.translation(player)}使用了一张不公开目标的${get.translation(trigger.card)}。若你选择响应且你不是此牌的隐藏目标,则其摸两张牌;若你选择不响应且你是此牌的隐藏目标,则你本回合内不能使用或打出手牌。`
for (let target of targets) {
if (target.isIn() && player.inRange(target)) {
const result = await target.chooseToRespond(prompt, (card,player)=>{
return get.type(card) == 'basic' && get.color(card) != 'black';
}).set('filterOk', ()=>{
const card = get.card();
if (card && get.color(card)!='red') return false;
return true;
}).set('ai',card => {
const player = get.player(), event = get.event();
const source = event.getParent().player;
//是队友且没有其他疑似队友的选手响应 那响应一下
if (get.attitude(player,source) > 0){
if(!event.respondedTargets.some(current => {
return get.attitude(player, current) > 0 || get.attitude(source, current) >= 0;
})) return get.order(card);
return -1;
}
//先用随机数凑合一下 等157优化
return event.getRand('dcsbpingliao') > 0.5 ? 0 : get.order(card);
}).set('respondedTargets', respondedTargets).forResult();
if (result.bool) {
respondedTargets.push(target);
if(!trigger.targets.includes(target)) nonnonTargetResponded = true;
await game.asyncDelay();
}
else if (trigger.targets.includes(target)) unrespondedTargets.push(target);
}
}
unrespondedTargets.forEach(current => {
current.addTempSkill('dcsbpingliao_blocker');
game.log(current,'本回合内无法使用或打出手牌');
});
if (nonnonTargetResponded) {
player.draw(2);
player.addTempSkill('dcsbpingliao_buff', {global:'phaseChange'});
player.addMark('dcsbpingliao_buff',1,false);
}
},
ai:{
ignoreLogAI:true,
skillTagFilter:function(player,tag,args){
if(args){
return args.card&&get.name(arg.card)=='sha';
}
},
},
subSkill:{
buff:{
onremove:true,
charlotte:true,
mod:{
cardUsable(card, player, num){
if(card.name=='sha') return num + player.countMark('dcsbpingliao_buff');
}
},
mark:true,
intro:{
content:'本阶段内使用【杀】的次数上限+#',
},
},
blocker:{
charlotte:true,
mod:{
cardEnabled2(card, player){
if(player.getCards('h').includes(card)) return false;
}
},
mark:true,
marktext:'封',
intro:{
content:'本回合内不能使用或打出手牌',
},
},
},
},
//陈武董袭
dcduanxie:{
audio:'duanxie',
@ -14686,6 +14893,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
chendong:'陈武董袭',
dcduanxie:'断绁',
dcduanxie_info:'出牌阶段限一次,你可以令一名其他角色横置,然后你横置。',
dc_sb_simayi:'新杀谋司马懿',
dc_sb_simayi_prefix:'新杀谋',
dcsbquanmou:'权谋',
dcsbquanmou_info:'转换技。出牌阶段每名角色限一次你可以令一名攻击范围内的其他角色交给你一张牌。阴当你于本阶段内下次对其造成伤害时取消之当你于本阶段内下次对其造成伤害后你可以选择除其外的至多三名其他角色对这些角色依次造成1点伤害。}',
dcsbpingliao:'平辽',
dcsbpingliao_info:'锁定技。当你声明使用【杀】时,你令此【杀】的目标对其他角色不可见,且你令攻击范围内的其他角色依次选择是否打出一张红色基本牌。所有角色选择完成后,此牌的目标角色中没有以此法打出牌的角色本回合内无法使用或打出手牌;若有不为此牌目标的角色以此法打出了牌,则你摸两张牌,且你本回合使用【杀】的次数上限+1。',
sp2_yinyu:'隐山之玉',
sp2_huben:'百战虎贲',

View File

@ -6144,73 +6144,7 @@ export const Content = {
}
if (cardaudio) game.broadcastAll((player, card) => {
game.playCardAudio(card, player);
/*
if(!lib.config.background_audio||get.type(card)=='equip'&&!lib.config.equip_audio) return;
const sex=player.sex=='female'?'female':'male';
var nature=get.natureList(card)[0];
if(card.name=='sha'&&['fire','thunder','ice','stab'].includes(nature)){
game.playAudio('card',sex,`${card.name}_${nature}`);
return;
}
const audio=lib.card[card.name].audio;
if(typeof audio=='string'){
const audioInfo=audio.split(':');
if(audio.startsWith('db:')) game.playAudio(`${audioInfo[0]}:${audioInfo[1]}`,audioInfo[2],`${card.name}_${sex}.${audioInfo[3]||'mp3'}`);
else if(audio.startsWith('ext:')) game.playAudio(`${audioInfo[0]}:${audioInfo[1]}`,`${card.name}_${sex}.${audioInfo[2]||'mp3'}`);
else game.playAudio('card',sex,`${audioInfo[0]}.${audioInfo[1]||'mp3'}`);
}
else game.playAudio('card',sex,card.name);*/
}, player, card);
if (event.animate != false && event.line != false) {
if (card.name == 'wuxie' && event.getParent()._info_map) {
var evtmap = event.getParent()._info_map;
if (evtmap._source) evtmap = evtmap._source;
var lining = (evtmap.multitarget ? evtmap.targets : evtmap.target) || event.player;
if (Array.isArray(lining) && event.getTrigger().name == 'jiedao') {
player.line(lining[0], 'green');
}
else {
player.line(lining, 'green');
}
}
else if (card.name == 'youdishenru' && event.getParent().source) {
var lining = event.getParent().sourcex || event.getParent().source2 || event.getParent().source;
if (lining == player && event.getParent().sourcex2) {
lining = event.getParent().sourcex2;
}
if (Array.isArray(lining) && event.getTrigger().name == 'jiedao') {
player.line(lining[0], 'green');
}
else {
player.line(lining, 'green');
}
}
else {
var config = {};
var nature = get.natureList(card)[0];
if (nature || card.classList && card.classList.contains(nature)) config.color = nature;
if (event.addedTarget) {
player.line2(targets.concat(event.addedTargets), config);
}
else if (get.info(card, false).multitarget && targets.length > 1 && !get.info(card, false).multiline) {
player.line2(targets, config);
}
else {
player.line(targets, config);
}
}
if (event.throw !== false) player.$throw(cards);
if (lib.config.sync_speed && cards[0] && cards[0].clone) {
var waitingForTransition = get.time();
event.waitingForTransition = waitingForTransition;
cards[0].clone.listenTransition(function () {
if (_status.waitingForTransition == waitingForTransition && _status.paused) {
game.resume();
}
delete event.waitingForTransition;
});
}
}
event.id = get.id();
if (!Array.isArray(event.excluded)) event.excluded = [];
if (!Array.isArray(event.directHit)) event.directHit = [];
@ -6248,7 +6182,64 @@ export const Content = {
}
}
}
if (targets.length) {
if (event.animate != false) {
if (event.throw !== false){
player.$throw(cards);
if (lib.config.sync_speed && cards[0] && cards[0].clone) {
var waitingForTransition = get.time();
event.waitingForTransition = waitingForTransition;
cards[0].clone.listenTransition(function () {
if (_status.waitingForTransition == waitingForTransition && _status.paused) {
game.resume();
}
delete event.waitingForTransition;
});
}
}
}
event.trigger('useCard0');
"step 1";
if (event.animate != false && event.line != false && !event.hideTargets) {
if (card.name == 'wuxie' && event.getParent()._info_map) {
var evtmap = event.getParent()._info_map;
if (evtmap._source) evtmap = evtmap._source;
var lining = (evtmap.multitarget ? evtmap.targets : evtmap.target) || event.player;
if (Array.isArray(lining) && event.getTrigger().name == 'jiedao') {
player.line(lining[0], 'green');
}
else {
player.line(lining, 'green');
}
}
else if (card.name == 'youdishenru' && event.getParent().source) {
var lining = event.getParent().sourcex || event.getParent().source2 || event.getParent().source;
if (lining == player && event.getParent().sourcex2) {
lining = event.getParent().sourcex2;
}
if (Array.isArray(lining) && event.getTrigger().name == 'jiedao') {
player.line(lining[0], 'green');
}
else {
player.line(lining, 'green');
}
}
else {
var config = {};
var nature = get.natureList(card)[0];
if (nature || card.classList && card.classList.contains(nature)) config.color = nature;
if (event.addedTarget) {
player.line2(targets.concat(event.addedTargets), config);
}
else if (get.info(card, false).multitarget && targets.length > 1 && !get.info(card, false).multiline) {
player.line2(targets, config);
}
else {
player.line(targets, config);
}
}
}
if (targets.length && !event.hideTargets) {
var str = (targets.length == 1 && targets[0] == player) ? '#b自己' : targets;
if (cards.length && !card.isCard) {
if (event.addedTarget) {
@ -6292,11 +6283,11 @@ export const Content = {
game.logv(player, [card, cards], targets);
}
event.trigger('useCard1');
"step 1";
event.trigger('yingbian');
"step 2";
event.trigger('useCard2');
event.trigger('yingbian');
"step 3";
event.trigger('useCard2');
"step 4";
event.trigger('useCard');
event._oncancel = function () {
game.broadcastAll(function (id) {
@ -6306,7 +6297,7 @@ export const Content = {
}
}, event.id);
};
"step 4";
"step 5";
event.sortTarget = function (animate, sort) {
var info = get.info(card, false);
if (num == 0 && targets.length > 1) {
@ -6333,7 +6324,7 @@ export const Content = {
}
return null;
};
"step 5";
"step 6";
if (event.all_excluded) return;
if (!event.triggeredTargets1) event.triggeredTargets1 = [];
var target = event.getTriggerTarget(targets, event.triggeredTargets1);
@ -6357,7 +6348,7 @@ export const Content = {
if (event.forceDie) next.forceDie = true;
event.redo();
}
"step 6";
"step 7";
if (event.all_excluded) return;
if (!event.triggeredTargets2) event.triggeredTargets2 = [];
var target = event.getTriggerTarget(targets, event.triggeredTargets2);
@ -6381,7 +6372,7 @@ export const Content = {
if (event.forceDie) next.forceDie = true;
event.redo();
}
"step 7";
"step 8";
var info = get.info(card, false);
if (!info.nodelay && event.animate != false) {
if (event.delayx !== false) {
@ -6394,7 +6385,7 @@ export const Content = {
}
}
}
"step 8";
"step 9";
if (event.all_excluded) return;
if (!event.triggeredTargets3) event.triggeredTargets3 = [];
var target = event.getTriggerTarget(targets, event.triggeredTargets3);
@ -6418,7 +6409,7 @@ export const Content = {
if (event.forceDie) next.forceDie = true;
event.redo();
}
"step 9";
"step 10";
if (event.all_excluded) return;
if (!event.triggeredTargets4) event.triggeredTargets4 = [];
var target = event.getTriggerTarget(targets, event.triggeredTargets4);
@ -6445,7 +6436,7 @@ export const Content = {
}
event.redo();
}
"step 10";
"step 11";
if (event.all_excluded) return;
event.effectedCount++;
event.num = 0;
@ -6486,7 +6477,7 @@ export const Content = {
next.addedTargets = event.addedTargets;
if (event.forceDie) next.forceDie = true;
}
"step 11";
"step 12";
if (event.all_excluded) return;
var info = get.info(card, false);
if (num == 0 && targets.length > 1) {
@ -6550,13 +6541,13 @@ export const Content = {
game.delayx(0.5);
}
}
"step 12";
"step 13";
if (event.all_excluded) return;
if (!get.info(event.card, false).multitarget && num < targets.length - 1 && !event.cancelled) {
event.num++;
event.goto(11);
event.goto(12);
}
"step 13";
"step 14";
if (event.all_excluded) return;
if (get.info(card, false).contentAfter) {
var next = game.createEvent(card.name + 'ContentAfter');
@ -6570,15 +6561,15 @@ export const Content = {
next.type = 'postcard';
if (event.forceDie) next.forceDie = true;
}
"step 14";
"step 15";
if (event.all_excluded) return;
if (event.effectedCount < event.effectCount) {
if (document.getElementsByClassName('thrown').length) {
if (event.delayx !== false && get.info(event.card, false).finalDelay !== false) game.delayx();
}
event.goto(10);
event.goto(11);
}
"step 15";
"step 16";
if (event.postAi) {
event.player.logAi(event.targets, event.card);
}
@ -6592,7 +6583,7 @@ export const Content = {
else {
event.finish();
}
"step 16";
"step 17";
event._oncancel();
},
useSkill: function () {

View File

@ -5024,7 +5024,10 @@ export class Player extends HTMLDivElement {
this.ai.tempIgnore.add(next.targets[i]);
}
}
if (typeof this.logAi == 'function' && !next.noai && !get.info(next.card).noai) {
if (typeof this.logAi == 'function' && !next.noai && !get.info(next.card).noai && !this.hasSkillTag(this, true, {
card: next.card,
targets: next.targets,
}, true)) {
var postAi = get.info(next.card).postAi;
if (postAi && postAi(next.targets)) {
next.postAi = true;