孙翎鸾 AI, minus bug fix

This commit is contained in:
Spmario233 2023-08-22 22:54:05 +08:00
parent 7c5eac9734
commit 96bbe319c7
15 changed files with 92 additions and 15 deletions

BIN
audio/die/ol_zhouqun.mp3 Normal file

Binary file not shown.

BIN
audio/skill/olchenshuo1.mp3 Normal file

Binary file not shown.

BIN
audio/skill/olchenshuo2.mp3 Normal file

Binary file not shown.

BIN
audio/skill/oltianhou1.mp3 Normal file

Binary file not shown.

BIN
audio/skill/oltianhou2.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -567,8 +567,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!targets.length){ if(!targets.length){
var num=lib.skill.clanguangu_backup.num; var num=lib.skill.clanguangu_backup.num;
var cards=get.cards(num); var cards=get.cards(num);
game.cardsGotoOrdering(cards); event.cards=cards.slice(0);
event.cards=cards; while(cards.length) ui.cardPile.insertBefore(cards.pop().fix(),ui.cardPile.firstChild);
game.updateRoundNumber();
event.goto(2); event.goto(2);
} }
else{ else{
@ -644,11 +645,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
next.set('owner',owner); next.set('owner',owner);
} }
} }
'step 4'
if(!targets.length){
while(cards.length) ui.cardPile.insertBefore(cards.pop().fix(),ui.cardPile.firstChild);
game.updateRoundNumber();
}
}, },
ai:{ ai:{
order:10, order:10,

View File

@ -30,6 +30,8 @@ window.noname_character_rank={
'wanglang', 'wanglang',
'caojinyu', 'caojinyu',
'zhangmancheng', 'zhangmancheng',
'wu_zhugeliang',
'sunlingluan',
'key_mio', 'key_mio',
'key_midori', 'key_midori',
'key_yuri', 'key_yuri',
@ -120,7 +122,6 @@ window.noname_character_rank={
'key_yuuki', 'key_yuuki',
'db_key_liyingxia', 'db_key_liyingxia',
'key_kiyu', 'key_kiyu',
'wu_zhugeliang',
], ],
a:[ a:[
'diy_zaozhirenjun', 'diy_zaozhirenjun',
@ -596,6 +597,7 @@ window.noname_character_rank={
'zhoubuyi', 'zhoubuyi',
'jsrg_sunce', 'jsrg_sunce',
're_caorui', 're_caorui',
'ol_zhouqun',
], ],
bp:[ bp:[
'chess_diaochan', 'chess_diaochan',
@ -1686,6 +1688,8 @@ window.noname_character_rank={
'yue_caiwenji', 'yue_caiwenji',
'clan_zhongyan', 'clan_zhongyan',
'shen_dianwei', 'shen_dianwei',
'sunlingluan',
'ol_zhouqun',
'key_tomoya', 'key_tomoya',
'key_masato', 'key_masato',
'key_shiorimiyuki', 'key_shiorimiyuki',
@ -1926,6 +1930,8 @@ window.noname_character_rank={
'zhanghua', 'zhanghua',
'lushi', 'lushi',
'clan_zhonghui', 'clan_zhonghui',
'zhoubuyi',
'dc_wangjun',
'key_kano', 'key_kano',
'key_haruko', 'key_haruko',
'key_akiko', 'key_akiko',
@ -2457,6 +2463,7 @@ window.noname_character_rank={
'zerong', 'zerong',
'std_panfeng', 'std_panfeng',
're_caochong', 're_caochong',
're_caorui',
], ],
} }
}; };

View File

@ -765,6 +765,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
}, },
spade:{ spade:{
audio:true,
mark:true, mark:true,
marktext:'雨', marktext:'雨',
intro:{ intro:{
@ -807,6 +808,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
}, },
miehuo:{ miehuo:{
audio:'oltianhou_spade',
trigger:{global:'damageBegin2'}, trigger:{global:'damageBegin2'},
forced:true, forced:true,
logTarget:'source', logTarget:'source',
@ -818,6 +820,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
}, },
heart:{ heart:{
audio:true,
mark:true, mark:true,
marktext:'暑', marktext:'暑',
intro:{ intro:{
@ -834,6 +837,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
}, },
club:{ club:{
audio:true,
mark:true, mark:true,
marktext:'霜', marktext:'霜',
intro:{ intro:{
@ -850,6 +854,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
}, },
diamond:{ diamond:{
audio:true,
mark:true, mark:true,
marktext:'雾', marktext:'雾',
intro:{ intro:{
@ -1035,7 +1040,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 2' 'step 2'
if(player.countCards('h')%2==0){ if(player.countCards('h')%2==0){
player.draw(); player.draw();
player.chooseTarget('犷骜:令此杀对其任意个目标无效',[1,Infinity],true,(card,player,target)=>{ player.chooseTarget('犷骜:令此杀对其任意个目标无效',[1,Infinity],(card,player,target)=>{
return _status.event.targetsx.contains(target); return _status.event.targetsx.contains(target);
}).set('ai',target=>{ }).set('ai',target=>{
return 1-get.effect(target,_status.event.getTrigger().card,_status.event.player,_status.event.player); return 1-get.effect(target,_status.event.getTrigger().card,_status.event.player,_status.event.player);
@ -6240,7 +6245,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return; return;
} }
player.chooseTarget(true,'将'+get.translation(card)+'置于一名角色的装备区内',function(card,player,target){ player.chooseTarget(true,'将'+get.translation(card)+'置于一名角色的装备区内',function(card,player,target){
return target.canEquip(_status.event.card); return target.canEquip(_status.event.card,true);
}).set('card',card).set('ai',function(target){ }).set('card',card).set('ai',function(target){
var card=_status.event.getParent().card,player=_status.event.player; var card=_status.event.getParent().card,player=_status.event.player;
return get.effect(target,card,player,player); return get.effect(target,card,player,player);
@ -23999,7 +24004,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
olzhenying_info:'出牌阶段限两次。你可以选择一名手牌数不大于你的其他角色,你与其同时将手牌摸或弃置至至多两张。然后你与其中手牌数较少的角色视为对另一名角色使用一张【决斗】。', olzhenying_info:'出牌阶段限两次。你可以选择一名手牌数不大于你的其他角色,你与其同时将手牌摸或弃置至至多两张。然后你与其中手牌数较少的角色视为对另一名角色使用一张【决斗】。',
ol_wenqin:'文钦', ol_wenqin:'文钦',
olguangao:'犷骜', olguangao:'犷骜',
olguangao_info:'当你/其他角色使用【杀】时,你/该角色可以额外指定一个目标/你为目标(使用者不为你则有距离限制)。然后若你的手牌数为偶数,你摸一张牌并令此牌对任意目标无效。', olguangao_info:'当你/其他角色使用【杀】时,你/该角色可以额外指定一个目标/你为目标(使用者不为你则有距离限制)。然后若你的手牌数为偶数,你摸一张牌并令此牌对任意目标无效(可不选)。',
olhuiqi:'彗企', olhuiqi:'彗企',
olhuiqi_info:'觉醒技。一名角色回合结束后,若仅有三名角色于此回合成为过牌的目标,你获得〖偕举〗并获得一个额外的回合。', olhuiqi_info:'觉醒技。一名角色回合结束后,若仅有三名角色于此回合成为过牌的目标,你获得〖偕举〗并获得一个额外的回合。',
olxieju:'偕举', olxieju:'偕举',

View File

@ -11693,14 +11693,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){
charlotte:true, charlotte:true,
filter:function(event,player){ filter:function(event,player){
for(var i of player.getStorage('twjuezhu_restore')){ for(var i of player.getStorage('twjuezhu_restore')){
if(i[0]==event.player&&player.hasEnabledSlot(i[1])) return true; if(i[0]==event.player&&player.hasDisabledSlot(i[1])) return true;
} }
return false; return false;
}, },
content:function(){ content:function(){
var list=[]; var list=[];
for(var i of player.getStorage('twjuezhu_restore')){ for(var i of player.getStorage('twjuezhu_restore')){
if(i[0]==trigger.player&&player.hasEnabledSlot(i[1])) list.push(i[1]); if(i[0]==trigger.player&&player.hasDisabledSlot(i[1])) list.push(i[1]);
} }
player.enableEquip(list); player.enableEquip(list);
}, },

View File

@ -147,6 +147,54 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.addTempSkill('dcpandi_effect','phaseUseAfter'); player.addTempSkill('dcpandi_effect','phaseUseAfter');
} }
}, },
ai:{
threaten:4,
order:12,
result:{
player:function(player,target){
return player.getCards('hs').reduce(function(eff,card){
return Math.max(eff,lib.skill.dcpandi.getUseValue(card,target,player)-lib.skill.dcpandi.getUseValue(card,player,player))
},0)
},
},
},
getUseValue:function(card,player,viewer){
if(typeof(card)=='string'){
card={name:card,isCard:true};
}
var targets=game.filterPlayer();
var value=[];
var min=0;
var info=get.info(card);
if(!info||info.notarget) return 0;
var range;
var select=get.copy(info.selectTarget);
if(select==undefined){
if(info.filterTarget==undefined) return true;
range=[1,1];
}
else if(typeof select=='number') range=[select,select];
else if(get.itemtype(select)=='select') range=select;
else if(typeof select=='function') range=select(card,player);
if(info.singleCard) range=[1,1];
game.checkMod(card,player,range,'selectTarget',player);
if(!range) return 0;
for(var i=0;i<targets.length;i++){
if(player.canUse(card,targets[i],null,true)){
var eff=get.effect(targets[i],card,player,viewer);
value.push(eff);
}
}
value.sort(function(a,b){
return b-a;
});
for(var i=0;i<value.length;i++){
if(i==range[1]||range[1]!=-1&&value[i]<=0) break;
min+=value[i];
}
return min;
},
subSkill:{ subSkill:{
effect:{ effect:{
audio:'dcpandi', audio:'dcpandi',
@ -170,6 +218,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.removeSkill('dcpandi_effect'); player.removeSkill('dcpandi_effect');
game.delay(0.5); game.delay(0.5);
}, },
ai:{
order:function(card,player,target,current){
if(typeof card!='object') return;
var source=player.storage.dcpandi_effect;
if(!source.isIn()||get.itemtype(source)!='player'||get.itemtype(source.storage.dcpandi_effect)=='player') return;
return [0,get.effect_use(target,card,source,player),0,get.effect(target,card,source,target)]
},
},
mod:{ mod:{
selectCard:function(card,player,range){ selectCard:function(card,player,range){
var source=player.storage.dcpandi_effect; var source=player.storage.dcpandi_effect;
@ -8705,7 +8761,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
next.set('list',list); next.set('list',list);
next.set('processAI',function(list){ next.set('processAI',function(list){
var allcards=list[0][1].concat(list[1][1]),canchoose=allcards.slice(0),cards=[]; var allcards=list[0][1].slice(0),cards=[];
if(list.length>1){
allcards=allcards.concat(list[1][1]);
}
var canchoose=allcards.slice(0);
var player=_status.event.player; var player=_status.event.player;
var getv=function(button){ var getv=function(button){
if(button.name=='sha'&&allcards.filter(function(card){ if(button.name=='sha'&&allcards.filter(function(card){

View File

@ -11854,9 +11854,12 @@
}, },
cardsDiscard:function(){ cardsDiscard:function(){
game.getGlobalHistory().cardMove.push(event); game.getGlobalHistory().cardMove.push(event);
var withPile=false;
for(var i=0;i<cards.length;i++){ for(var i=0;i<cards.length;i++){
if(get.position(cards[i],true)=='c') withPile=true;
cards[i].discard(); cards[i].discard();
} }
if(withPile) game.updateRoundNumber();
}, },
orderingDiscard:function(){ orderingDiscard:function(){
var cards=event.relatedEvent.orderingCards.slice(0); var cards=event.relatedEvent.orderingCards.slice(0);
@ -11867,11 +11870,14 @@
}, },
cardsGotoOrdering:function(){ cardsGotoOrdering:function(){
game.getGlobalHistory().cardMove.push(event); game.getGlobalHistory().cardMove.push(event);
var withPile=false;
for(var i=0;i<cards.length;i++){ for(var i=0;i<cards.length;i++){
if(get.position(cards[i],true)=='c') withPile=true;
cards[i].fix(); cards[i].fix();
ui.ordering.appendChild(cards[i]); ui.ordering.appendChild(cards[i]);
} }
var evt=event.relatedEvent||event.getParent(); if(withPile) game.updateRoundNumber();
var evt=event.relatedEvent||event.getParent();
if(!evt.orderingCards) evt.orderingCards=[]; if(!evt.orderingCards) evt.orderingCards=[];
if(!evt.noOrdering&&!evt.cardsOrdered){ if(!evt.noOrdering&&!evt.cardsOrdered){
evt.cardsOrdered=true; evt.cardsOrdered=true;
@ -11883,10 +11889,13 @@
}, },
cardsGotoSpecial:function(){ cardsGotoSpecial:function(){
game.getGlobalHistory().cardMove.push(event); game.getGlobalHistory().cardMove.push(event);
var withPile=false;
for(var i=0;i<cards.length;i++){ for(var i=0;i<cards.length;i++){
if(get.position(cards[i],true)=='c') withPile=true;
cards[i].fix(); cards[i].fix();
ui.special.appendChild(cards[i]); ui.special.appendChild(cards[i]);
} }
if(withPile) game.updateRoundNumber();
if(event.toRenku){ if(event.toRenku){
_status.renku.addArray(cards); _status.renku.addArray(cards);
if(_status.renku.length>6){ if(_status.renku.length>6){