Merge pull request #241 from Tipx-L/PR-Branch

The Use of Spies, and various fix.
This commit is contained in:
Spmario233 2023-08-28 23:33:55 +08:00 committed by GitHub
commit 970dddb1e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 250 additions and 264 deletions

View File

@ -501,7 +501,6 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}
if(cardsToGain.length) player.gain(cardsToGain,'draw');
if(cards.length-cardsToGain.length) player.draw(cards.length-cardsToGain.length).log=false;
return cardsToGain;
});
},
ai:{

View File

@ -274,30 +274,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
type:'equip',
subtype:'equip5',
loseDelay:false,
onEquip:function(){
if(player.countCards('he',function(cardx){
return cardx!=card;
})>0){
player.logSkill('tianjitu_skill');
player.chooseToDiscard(true,function(card){
return card!=_status.event.card;
},'he').set('card',card);
}
},
onLose:function(){
var next=game.createEvent('tianjitu_lose');
event.next.remove(next);
var evt=event.getParent();
if(evt.getlx===false) evt=evt.getParent();
evt.after.push(next);
next.player=player;
next.setContent(function(){
if(player.countCards('h')<5){
player.logSkill('tianjitu_skill');
player.drawTo(5);
}
});
},
global:'tianjitu_skill',
ai:{
value:function(card,player){
if(player.countCards('h')>3||get.position(card)!='e') return 0.5;
@ -439,6 +416,14 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
tianjitu_skill:{
audio:true,
trigger:{player:['equipBegin','loseBegin']},
forced:true,
equipSkill:true,
filter:(event,player,name)=>name=='equipBegin'?event.card.name=='tianjitu'&&player.hasCard(card=>card!=event.card):event.cards.some(value=>value.name=='tianjitu')&&player.countCards('h')<5,
content:()=>{
if(event.triggername=='loseBegin') player.drawTo(5);
else player.chooseToDiscard(true,card=>card!=_status.event.getTrigger().card,'he');
}
},
taigongyinfu_skill:{
equipSkill:true,
@ -689,7 +674,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
var info=get.info(trigger.card);
if(info&&info.yingbian) info.yingbian(trigger);
player.addTempSkill('yingbian_changeTarget');
},
}
},
yingbian_changeTarget:{
trigger:{player:'useCard2'},
@ -820,7 +805,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
tongque_info:'锁定技,你于一回合内使用的第一张带有“应变”效果的牌无视条件直接生效。',
tianjitu:'天机图',
tianjitu_skill:'天机图',
tianjitu_info:'锁定技,当此牌进入你的装备区时,你弃置一张不为此【天机图】的牌。当此牌离开你的装备区,你将手牌摸至五张。',
tianjitu_info:'锁定技,当此牌进入你的装备区时,你弃置一张不为此【天机图】的牌。当此牌离开你的装备区,你将手牌摸至五张。',
taigongyinfu:'太公阴符',
taigongyinfu_info:'出牌阶段开始时,你可以横置或重置一名角色。出牌阶段结束时,你可以重铸一张手牌。',
taigongyinfu_skill:'太公阴符',

View File

@ -76,7 +76,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}
else event.finish();
'step 2'
if(result.index==0) player.gain(event.show_card,target,'give','bySelf');
if(result.index==0) target.give(event.show_card,player);
else target.damage();
},
ai:{
@ -157,8 +157,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
subtype:'equip1',
distance:{attackFrom:-1},
fullskin:true,
skills:['qixingbaodao'],
selectTarget:[-1,-2],
global:'qixingbaodao',
ai:{
order:9,
value:function(card,player){
@ -404,14 +403,15 @@ game.import('card',function(lib,game,ui,get,ai,_status){
audio:true,
equipSkill:true,
forced:true,
trigger:{target:'_yongjian_zengyuBegin'},
content:function(){
trigger._zengyu_denied=true;
game.log(player,'拒绝了',trigger.player,'发起的赠予');
trigger:{target:'gift'},
filter:(event,player)=>event.target!=player,
logTarget:'player',
content:()=>{
trigger.deniedGift.add(trigger.card);
},
ai:{
refuseGifts:true,
},
refuseGifts:true
}
},
xinge:{
audio:true,
@ -449,7 +449,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}
},
qixingbaodao:{
trigger:{player:'equipAfter'},
trigger:{player:'equipBegin'},
forced:true,
equipSkill:true,
filter:function(event,player){
@ -595,6 +595,13 @@ game.import('card',function(lib,game,ui,get,ai,_status){
map.push([source,event.given_map[i]]);
cards.addArray(event.given_map[i]);
}
player.showCards(cards,`${get.translation(player)}${(targets=>{
if(get.itemtype(targets)=='player') targets=[targets];
if(targets[0]!=player) return get.translation(targets);
const selfTargets=targets.slice();
selfTargets[0]='自己';
return get.translation(selfTargets);
})(logs)}发动了${get.skillTranslation(event.name,player)}`);
game.loseAsync({
gain_list:map,
player:player,
@ -609,79 +616,37 @@ game.import('card',function(lib,game,ui,get,ai,_status){
_yongjian_zengyu:{
enable:'phaseUse',
forceLoad:true,
filter:function(event,player){
return player.hasCard((card)=>lib.skill._yongjian_zengyu.filterCard(card,player),'he');
},
filterCard:function(card,player){
var mod=game.checkMod(card,player,'unchanged','cardZengyuable',player);
if(mod!='unchanged') return mod;
return get.position(card)=='h'&&get.cardtag(card,'gifts');
},
filterTarget:function(card,player,target){
if(player==target) return false;
var card=ui.selected.cards[0];
if(get.type(card,false)=='equip'){
return target.canEquip(card,true);
}
return true;
},
filter:(event,player)=>player.hasCard(card=>lib.skill._yongjian_zengyu.filterCard(card,player),lib.skill._yongjian_zengyu.position),
filterCard:(card,player)=>game.hasPlayer(current=>player.canGift(card,current,true)),
filterTarget:(card,player,target)=>ui.selected.cards.every(value=>player.canGift(value,target,true)),
position:'he',
discard:false,
lose:false,
delay:false,
check:function(card){
var player=_status.event.player;
if(get.cardtag(card,'gifts')&&get.type(card,false)=='equip'&&game.hasPlayer(function(current){
return current!=player&&current.canEquip(card,true)&&!current.hasSkillTag('refuseGifts')&&get.effect(current,card,player,player)>0;
})) return 2;
check:card=>{
const player=_status.event.player;
if(game.hasPlayer(current=>player.canGift(card,current,true)&&!current.refuseGifts(card,player)&&get.effect(current,card,player,player)>0)) return 2;
if(!player.needsToDiscard()&&get.position(card)=='h') return 0;
return 1+Math.random();
},
content:function(){
'step 0'
if(event._zengyu_denied){
player.loseToDiscardpile(cards);
}
else{
if(get.type(cards[0],false)=='equip'){
player.$give(cards[0],target,false);
game.delay(0.5);
target.equip(cards[0]);
}
else{
target.gain(cards,player,'give');
event.finish();
}
}
'step 1'
game.delayx();
content:()=>{
player.gift(cards,target);
},
ai:{
order:function(item,player){
if(player.hasCard(function(card){
return get.cardtag(card,'gifts')&&get.type(card,false)=='equip'&&game.hasPlayer(function(current){
return current!=player&&current.canEquip(card,true)&&!current.hasSkillTag('refuseGifts')&&get.effect(current,card,player,player)>0;
});
},'h')) return 7;
return 0.51;
},
order:(item,player)=>player.hasCard(card=>game.hasPlayer(current=>player.canGift(card,current,true)&&!current.refuseGifts(card,player)&&get.effect(current,card,player,player)>0),'h')?7:0.51,
result:{
target:function(player,target){
var card=ui.selected.cards[0];
if(!card||target.hasSkillTag('refuseGifts')) return 0;
if(get.type(card,false)=='equip') return get.effect(target,card,target,target);
if(card.name=='du') return player.hp>target.hp?-1:0;
if(target.hasSkillTag('nogain')) return 0;
return Math.max(1,get.value(card,player)-get.value(card,target));
},
},
},
},
target:(player,target)=>{
const result=ui.selected.cards.map(value=>player.getGiftAIResultTarget(value,target));
return result.reduce((previousValue,currentValue)=>previousValue+currentValue,0)/result.length;
}
}
}
}
},
translate:{
gifts_tag:'赠',
du:'毒',
du_info:'①当此牌正面向上离开你的手牌区或作为你的拼点牌而亮出时你失去1点体力。②当你因摸牌或分发起始手牌而获得【毒】后你可将其分配给其他角色(正面朝上移动,且不触发〖毒①〗)。',
du_info:'①当此牌正面向上离开你的手牌区或作为你的拼点牌而亮出时你失去1点体力。②当你因摸牌或分发起始手牌而获得【毒】后你可展示之并交给其他角色不触发〖毒①〗。',
g_du:'毒',
g_du_give:'赠毒',
du_given:'已分配',
@ -694,7 +659,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
yitianjian:'倚天剑',
yitianjian_info:'当你因执行【杀】的效果而造成伤害后若你已受伤则你可弃置一张手牌然后回复1点体力。',
qixingbaodao:'七星宝刀',
qixingbaodao_info:'锁定技。当此牌进入你的装备区,你弃置装备区和判定区内的所有其他牌。',
qixingbaodao_info:'锁定技。当此牌进入你的装备区,你弃置装备区和判定区内的所有其他牌。',
duanjian:'断剑',
duanjian_info:'这是一把坏掉的武器…',
duanjian_append:'<span class="text" style="font-family: yuanli">不要因为手快而装给自己。</span>',
@ -707,7 +672,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
yonglv_info:'锁定技。①你至其他角色的距离-1。②其他角色至你的距离视为1。',
yonglv_append:'<span class="text" style="font-family: yuanli">它旁边的就是王仲宣。</span>',
zhanxiang:'战象',
zhanxiang_info:'锁定技。①其他角色至你的距离+1。②当你成为〖赠予〗的目标后,你将此次赠予的效果改为“将赠予牌移动至弃牌堆”。',
zhanxiang_info:'锁定技。①其他角色至你的距离+1。②其他角色对你赠予的牌视为赠予失败。',
xinge:'信鸽',
xinge_info:'出牌阶段限一次。你可以将一张手牌交给一名其他角色。',
xinge_append:'<span class="text" style="font-family: yuanli">咕咕咕。</span>',

View File

@ -982,7 +982,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
content:function(){
if(trigger.name=='lose'){
trigger.cards.remove(player.getEquips('ruyijingubang'));
trigger.cards.removeArray(player.getEquips('ruyijingubang'));
}
else{
while(trigger.slots.contains('equip1')) trigger.slots.remove('equip1');

View File

@ -117,7 +117,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
target.useCard(result.targets,card,event.links);
}
else{
target.recast(event.links,(player,cards)=>game.cardsDiscard(cards).cards);
target.recast(event.links,(player,cards)=>game.cardsDiscard(cards));
}
'step 4'
for(var card of cards){
@ -3864,17 +3864,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
discard:function(){
"step 0"
game.log(player,'进入了弃牌阶段');
event.num=(function(){
var num=0;
var hs=player.getCards('he');
num+=hs.length;
for(var i=0;i<hs.length;i++){
if(game.checkMod(hs[i],player,false,'ignoredHandcard',player)==true){
num--;
}
}
return Math.max(0,num-player.getHandcardLimit());
})();
event.num=Math.max(0,player.countCards('he',card=>!player.canIgnoreHandcard(card))-player.getHandcardLimit());
if(event.num<=0) event.finish();
else{
if(lib.config.show_phase_prompt){

View File

@ -1243,20 +1243,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
lose:false,
delay:false,
promptfunc:()=>'出牌阶段你可以赠予一张“米券”然后执行一项本回合内未被选择过的效果⒈对其造成1点伤害⒉摸两张牌⒊弃置其的两张牌⒋亮出牌堆顶的一张牌然后你可以使用之。',
check:function(card){
var player=_status.event.player;
if(get.cardtag(card,'gifts')&&get.type(card,false)=='equip'&&game.hasPlayer(function(current){
return current!=player&&current.canEquip(card,true)&&!current.hasSkillTag('refuseGifts')&&get.effect(current,card,player,player)>0;
})) return 2;
return 1+Math.random();
check:card=>{
const player=_status.event.player;
return get.type(card,false)=='equip'&&game.hasPlayer(current=>player.canGift(card,current,true)&&!current.refuseGifts(card,player)&&get.effect(current,card,player,player)>0)?2:1+Math.random();
},
content:function(){
'step 0'
var next=game.createEvent('_yongjian_zengyu');
next.player=player;
next.target=target;
next.cards=cards;
next.setContent(lib.skill._yongjian_zengyu.content);
player.gift(cards,target);
'step 1'
var list=player.getStorage('minagi_peiquan_yukito');
if(list.length>=4) event.finish();
@ -1300,12 +1293,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
ai:{
order:4,
result:{
player:function(player,target){
var baseEffect=Math.min(3,get.effect(target,'_yongjian_zengyu',player,player));
var choices=['damage','draw','discard','use'];
player:(player,target)=>{
const giftEffects=ui.selected.cards.map(value=>player.getGiftEffect(value,target));
const baseEffect=Math.min(3,giftEffects.reduce((previousValue,currentValue)=>previousValue+currentValue,0)/giftEffects.length);
const choices=['damage','draw','discard','use'];
choices.removeArray(player.getStorage('minagi_peiquan_yukito'));
if(choices.length<=0) return baseEffect;
var eff=Math.max.apply(Math,choices.map(function(choice){
return baseEffect+Math.max(...choices.map(choice=>{
switch(choice){
case 'damage':return get.damageEffect(target,player,player);
case 'draw':return get.effect(player,{name:'wuzhong'},player,player);
@ -1313,9 +1307,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
case 'use':return _status.event.getRand('minagi_peiquan')*4;
}
}));
return baseEffect+eff;
},
},
}
}
},
group:'minagi_peiquan_umareta',
subSkill:{
@ -6265,16 +6258,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
phaseDiscardContent:function(){
"step 0"
var num=0;
var hs=player.getCards('he');
num+=hs.length;
for(var i=0;i<hs.length;i++){
if(game.checkMod(hs[i],player,false,'ignoredHandcard',player)==true){
num--;
}
}
num=Math.max(0,num-player.getHandcardLimit());
event.num=num;
event.num=Math.max(0,player.countCards('he',card=>!player.canIgnoreHandcard(card))-player.getHandcardLimit());
if(event.num<=0) event.finish();
else{
if(lib.config.show_phase_prompt){
@ -8523,7 +8507,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return true;
}
else if(event.name=='gain'){
if(event.giver||event.getParent().name=='_yongjian_zengyu') return false;
if(event.giver||event.getParent().name=='gift') return false;
var cards=event.getg(event.player);
if(!cards.length) return false;
return game.hasPlayer(function(current){

View File

@ -8470,22 +8470,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 1'
if(result.bool&&result.cards.length){
target.recast(result.cards,null,(player,cards)=>{
var type=get.type(result.cards[0],'trick');
var name=result.cards[0].name;
var card2=get.cardPile(function(card){
return get.type(card,'trick')==type&&card.name!=name;
});
if(!card2){
card2=get.cardPile(function(card){
return get.type(card,'trick')==type;
});
}
if(card2){
target.gain(card2,'draw');
}
else{
target.draw().log=false;
}
var type=get.type(cards[0],'trick'),name=cards[0].name,card2=get.cardPile(card=>get.type(card,'trick')==type&&card.name!=name);
if(!card2) card2=get.cardPile(card=>get.type(card,'trick')==type);
if(card2) player.gain(card2,'draw');
else player.draw().log=false;
});
var clone=game.createCard(card);
player.gain(clone,'gain2');

View File

@ -3652,7 +3652,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
},
mod:{
cardZengyuable:function(card,player){
cardGiftable:function(card,player){
return get.type(card)=='equip';
}
}
@ -3786,19 +3786,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
//群曹操
yjxiandao:{
trigger:{player:'_yongjian_zengyuEnd'},
trigger:{player:'giftAccepted'},
usable:1,
forced:true,
locked:false,
filter:function(event,player){
return !event._zengyu_denied&&event.target.isIn();
},
filter:(event,player)=>event.target!=player&&event.target.isIn(),
logTarget:'target',
content:function(){
'step 0'
event.target=trigger.target;
event.card=trigger.cards[0];
event.target.markAuto('yjxiandao',[get.suit(event.card,false)])
event.card=trigger.card;
event.target.markAuto('yjxiandao_block',[get.suit(event.card,false)]);
event.target.addTempSkill('yjxiandao_block');
'step 1'
var type=get.type(card,false);
@ -3859,14 +3857,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
});
'step 2'
if(result.bool){
player.line(result.targets[0],'green');
var next=game.createEvent('_yongjian_zengyu');
next.player=player;
next.target=result.targets[0];
next.cards=result.cards;
next.setContent(lib.skill._yongjian_zengyu.content);
var target=result.targets[0];
player.line(target,'green');
player.gift(result.cards,target);
}
},
}
},
yjyibing:{
trigger:{
@ -3875,7 +3870,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
direct:true,
filter:function(event,player){
if(event.getParent().name=='_yongjian_zengyu') return false;
if(event.getParent().name=='gift') return false;
if(event.getParent('yjyibing').player==player) return false;
var evt=event.getParent('phaseDraw'),hs=player.getCards('h'),cards=event.getg(player);
return cards.length>0&&(!evt||evt.player!=player)&&cards.filter(function(card){
@ -6403,11 +6398,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
//用间
yj_caocao:'SP曹操',
yjxiandao:'献刀',
yjxiandao_info:'每回合限一次。当你对其他角色发动〖赠予〗你令其不能使用或打出与本次赠予移动的牌A花色相同的牌直到回合结束。然后若牌A为锦囊牌你摸两张牌。为装备牌你获得其一张不为A的牌。为武器牌你对其造成1点伤害。',
yjxiandao_info:'每回合限一次。当你赠予其他角色一张牌你令其不能使用或打出与本次赠予移动的牌A花色相同的牌直到回合结束。然后若牌A为锦囊牌你摸两张牌。为装备牌你获得其一张不为A的牌。为武器牌你对其造成1点伤害。',
yjsancai:'散财',
yjsancai_info:'出牌阶段限一次,你可以展示所有手牌。若这些牌的类别均相同,则你可以发动一次〖赠予〗(可以选择任意手牌)。',
yjsancai_info:'出牌阶段限一次,你可以展示所有手牌。若这些牌的类别均相同,则你可以赠予一名其他角色一张手牌。',
yjyibing:'义兵',
yjyibing_info:'当你不因赠予且不因〖义兵〗的嵌套结算而于摸牌阶段外获得牌时,你可以将此次获得的所有牌当做【杀】使用(无距离限制且不计入使用次数)。',
yjyibing_info:'当你不因赠予且不因〖义兵〗的嵌套结算而于摸牌阶段外获得牌时,你可以将此次获得的所有牌当做【杀】使用(无距离限制且不计入使用次数)。',
yj_caohong:'用间曹洪',
yj_caohong_ab:'曹洪',
yjlifeng:'厉锋',

View File

@ -7023,7 +7023,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return true;
}
else if(event.name=='gain'){
if(event.giver||event.getParent().name=='_yongjian_zengyu') return false;
if(event.giver||event.getParent().name=='gift') return false;
var cards=event.getg(event.player);
if(!cards.length) return false;
return game.hasPlayer(function(current){

View File

@ -4884,7 +4884,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
else if(evt.type=='gain'){
var evtx=evt.getParent();
if(evtx.giver||evtx.getParent().name=='_yongjian_zengyu') return false;
if(evtx.giver||evtx.getParent().name=='gift') return false;
var cards=evtx.getg(target);
if(!cards.length) return false;
var cards2=evtx.getl(current).cards2;
@ -4895,7 +4895,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return false;
})) guojue=true;
if(!renzhi&&current.hasHistory('gain',evt=>{
if(evt.giver!=target||evt.getParent().name=='_yongjian_zengyu') return false;
if(evt.giver!=target||evt.getParent().name=='gift') return false;
return evt.cards.length;
})) renzhi=true;
});
@ -4927,7 +4927,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
else if(evt.type=='gain'){
var evtx=evt.getParent();
if(evtx.giver||evtx.getParent().name=='_yongjian_zengyu') return false;
if(evtx.giver||evtx.getParent().name=='gift') return false;
var cards=evtx.getg(target);
if(!cards.length) return false;
var cards2=evtx.getl(current).cards2;
@ -4938,7 +4938,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return false;
})) guojue=true;
if(!renzhi&&current.hasHistory('gain',evt=>{
if(evt.giver!=target||evt.getParent().name=='_yongjian_zengyu') return false;
if(evt.giver!=target||evt.getParent().name=='gift') return false;
return evt.cards.length;
})) renzhi=true;
});

View File

@ -1,5 +1,5 @@
"use strict";
(function(){
(()=>{
if(!localStorage.getItem('gplv3_noname_alerted')){
if(confirm('①无名杀是一款基于GPLv3协议的开源软件\n你可以在遵守GPLv3协议的基础上任意使用修改并转发《无名杀》以及所有基于《无名杀》开发的拓展。\n点击“确定”即代表您认可并接受GPLv3协议↓\nhttps://www.gnu.org/licenses/gpl-3.0.html\n②无名杀官方发布地址仅有GitHub仓库\n其他所有的所谓“无名杀”社群包括但不限于绝大多数“官方”QQ群、QQ频道等均为玩家自发组织与无名杀官方无关')){
localStorage.setItem('gplv3_noname_alerted',true);
@ -7899,40 +7899,44 @@
}
}
}
var loadPack=function(){
var toLoad=lib.config.all.cards.length+lib.config.all.characters.length+1;
if(_status.jsExt){
toLoad += _status.jsExt.length;
}
var packLoaded=function(){
const loadPack=()=>{
let toLoad=lib.config.all.cards.length+lib.config.all.characters.length+1;
if(_status.jsExt) toLoad+=_status.jsExt.length;
const packLoaded=()=>{
toLoad--;
if(toLoad==0){
if(_status.windowLoaded){
delete _status.windowLoaded;
lib.init.onload();
}
else{
_status.packLoaded=true;
}
if(toLoad) return;
if(_status.windowLoaded){
delete _status.windowLoaded;
lib.init.onload();
}
else _status.packLoaded=true;
};
if(localStorage.getItem(lib.configprefix+'playback')){
if(localStorage.getItem(`${lib.configprefix}playback`)){
toLoad++;
lib.init.js(lib.assetURL+'mode',lib.config.mode,packLoaded,packLoaded);
lib.init.js(`${lib.assetURL}mode`,lib.config.mode,packLoaded,packLoaded);
}
else if((localStorage.getItem(lib.configprefix+'directstart')||!show_splash)&&
lib.config.all.mode.indexOf(lib.config.mode)!=-1){
else if((localStorage.getItem(`${lib.configprefix}directstart`)||!show_splash)&&lib.config.all.mode.indexOf(lib.config.mode)!=-1){
toLoad++;
lib.init.js(lib.assetURL+'mode',lib.config.mode,packLoaded,packLoaded);
lib.init.js(`${lib.assetURL}mode`,lib.config.mode,packLoaded,packLoaded);
}
lib.init.js(lib.assetURL+'card',lib.config.all.cards,packLoaded,packLoaded);
lib.init.js(lib.assetURL+'character',lib.config.all.characters,packLoaded,packLoaded);
lib.init.js(lib.assetURL+'character','rank',packLoaded,packLoaded);
if(_status.jsExt){
for(var i=0;i<_status.jsExt.length;i++){
lib.init.js(lib.assetURL+_status.jsExt[i].path,_status.jsExt[i].name,packLoaded,packLoaded);
lib.init.js(`${lib.assetURL}card`,lib.config.all.cards,packLoaded,packLoaded);
lib.init.js(`${lib.assetURL}character`,lib.config.all.characters,packLoaded,packLoaded);
lib.init.js(`${lib.assetURL}character`,'rank',packLoaded,packLoaded);
if(!_status.jsExt) return;
const loadJSExt=(jsExt,pathArray,nameArray,index)=>{
if(!pathArray&&!nameArray){
lib.init.js(jsExt.path,jsExt.name,packLoaded,packLoaded);
return;
}
}
if(typeof index!='number') index=0;
if(pathArray&&index>=jsExt.path.length||nameArray&&index>=jsExt.name.length) return;
const path=pathArray?jsExt.path[index]:jsExt.path,name=nameArray?jsExt.name[index]:jsExt.name,jsExtLoaded=()=>{
loadJSExt(jsExt,pathArray,nameArray,index+1);
packLoaded();
};
lib.init.js(path,name,jsExtLoaded,jsExtLoaded);
};
_status.jsExt.forEach(value=>loadJSExt(value,Array.isArray(value.path),Array.isArray(value.name)));
// if(lib.device!='ios'&&lib.config.enable_pressure) lib.init.js(lib.assetURL+'game','pressure');
};
@ -9478,11 +9482,14 @@
return style;
},
//在扩展的precontent中调用用于加载扩展必需的JS文件。
addJsForExtension:function(path,name){
if(!_status.jsExt){
_status.jsExt = [];
}
_status.jsExt.add({path:path,name:name});
//If any of the parameters is an Array, corresponding files will be loaded in order
//如果任意参数为数组,则按顺序加载加载相应的文件
jsForExtension:(path,name)=>{
if(!_status.jsExt) _status.jsExt=[];
_status.jsExt.add({
path:path,
name:name
});
},
js:function(path,file,onload,onerror){
if(path[path.length-1]=='/'){
@ -10711,25 +10718,54 @@
emptyEvent:function(){
event.trigger(event.name);
},
//Gift
//赠予
gift:()=>{
'step 0'
event.num=0;
'step 1'
if(num<cards.length){
event.card=cards[num];
event.trigger('gift');
}
else event.finish();
'step 2'
if(event.deniedGifts.includes(card)){
game.log(target,'拒绝了',player,'赠予的',card);
event.trigger('giftDeny');
player.loseToDiscardpile(card).log=false;
event.trigger('giftDenied');
return;
}
game.log(player,'将',card,'赠予了',target);
player.$give(card,target,false);
game.delay(0.5);
event.trigger('giftAccept');
if(get.type(card,false)=='equip') target.equip(card).log=false;
else target.gain(card,player).visible=true;
event.trigger('giftAccepted');
'step 3'
event.num++;
event.goto(1);
},
//Recast
//重铸
recast:()=>{
'step 0'
game.log(player,'重铸了',cards);
if(typeof event.recastingLose=='function') event.recastingLostCards=event.recastingLose(player,cards);
if(typeof event.recastingLose!='function') return;
event.trigger('recastingLose');
event.recastingLose(player,cards);
event.trigger('recastingLost');
event.recastingLosingEvents.push(...event.next.filter(value=>value.name!='arrangeTrigger'));
'step 1'
event.trigger('recast');
'step 2'
if(typeof event.recastingGain!='function') return;
event.recastingGainedCards=event.recastingGain(player,cards);
if(get.itemtype(event.recastingGainedCards)=='card') event.recastingGainedCards=[event.recastingGainedCards];
'step 3'
event.result=[];
if(get.itemtype(event.recastingGainedCards)=='cards') event.result.addArray(event.recastingGainedCards);
if(get.itemtype(result.cards)=='card') event.result.push(result.cards);
else if(get.itemtype(result.cards)=='cards') event.result.addArray(result.cards);
if(get.itemtype(result)=='card') event.result.push(result);
else if(get.itemtype(result)=='cards') event.result.addArray(result);
event.trigger('recastingGain');
event.recastingGain(player,cards);
event.trigger('recastingGained');
event.recastingGainingEvents.push(...event.next.filter(value=>value.name!='arrangeTrigger'));
},
//装备栏相关
disableEquip:function(){
@ -10939,7 +10975,7 @@
},subtype);
player.$equip(card);
game.addVideo('equip',player,get.cardInfo(card));
game.log(player,'装备了',card);
if(event.log!=false) game.log(player,'装备了',card);
if(event.updatePile) game.updateRoundNumber();
"step 6"
var info=get.info(card,false);
@ -10958,7 +10994,7 @@
next.player=player;
next.card=card;
}
if(info.equipDelay!='false') game.delayx();
if(info.equipDelay!=false) game.delayx();
}
delete player.equiping;
if(event.delay){
@ -17064,7 +17100,7 @@
},get.delayx(500,500));
}
else if(event.animate=='gain'){
player.$gain(cards);
player.$gain(cards,event.log);
game.pause();
setTimeout(function(){
addv();
@ -17078,7 +17114,7 @@
}
else if(event.animate=='gain2'||event.animate=='draw2'){
var gain2t=300;
if(player.$gain2(cards)&&player==game.me){
if(player.$gain2(cards,event.log)&&player==game.me){
gain2t=500;
}
game.pause();
@ -17097,14 +17133,14 @@
if(event.animate=='give'){
for(var i in evtmap){
var source=(_status.connectMode?lib.playerOL:game.playerMap)[i];
source.$give(evtmap[i][0],player)
source.$give(evtmap[i][0],player,event.log)
}
}
else{
for(var i in evtmap){
var source=(_status.connectMode?lib.playerOL:game.playerMap)[i];
if(evtmap[i][1].length) source.$giveAuto(evtmap[i][1],player);
if(evtmap[i][2].length) source.$give(evtmap[i][2],player);
if(evtmap[i][1].length) source.$giveAuto(evtmap[i][1],player,event.log);
if(evtmap[i][2].length) source.$give(evtmap[i][2],player,event.log);
}
}
game.pause();
@ -17140,9 +17176,6 @@
broadcast();
event.finish();
}
if(event.log){
game.log(player,'获得了',cards);
}
"step 4"
game.delayx();
if(event.updatePile) game.updateRoundNumber();
@ -18279,30 +18312,74 @@
},
player:{
//新函数
//Check if the card does not count toward hand limit
//检测此牌是否不计入手牌上限
canIgnoreHandcard:function(card){
return lib.filter.ignoredHandcard(card,this);
},
//Gift
//赠予
gift:function(cards,target){
const gift=game.createEvent('gift');
gift.player=this;
gift.target=target;
const isArray=Array.isArray(cards);
if(cards&&!isArray) gift.cards=[cards];
else if(isArray&&cards.length) gift.cards=cards;
else _status.event.next.remove(gift);
gift.deniedGifts=[];
gift.setContent('gift');
gift._args=Array.from(arguments);
return gift;
},
//Check if the player can gift the card
//检测角色是否能赠予此牌
canGift:function(card,target,strict){
return lib.filter.cardGiftable(card,this,target,strict);
},
//Check if the player refuses gifts
//检测角色是否拒绝赠予
refuseGifts:function(card,player){
return this.hasSkillTag('refuseGifts',null,{
player:player,
card:card
});
},
//Gift AI related
//赠予AI相关
getGiftAIResultTarget:function(card,target){
if(!card||target.refuseGifts(card,this)) return 0;
if(get.type(card,false)=='equip') return get.effect(target,card,target,target);
if(card.name=='du') return this.hp>target.hp?-1:0;
if(target.hasSkillTag('nogain')) return 0;
return Math.max(1,get.value(card,this)-get.value(card,target));
},
getGiftEffect:function(card,target){
return this.getGiftAIResultTarget(card,target)*get.attitude(this,target);
},
//Recast
//重铸
recast:function(cards,recastingLose,recastingGain){
const recast=game.createEvent('recast');
recast.player=this;
if(get.itemtype(cards)=='card') recast.cards=[cards];
else if(get.itemtype(cards)=='cards'&&cards.length) recast.cards=cards;
const isArray=Array.isArray(cards);
if(cards&&!isArray) recast.cards=[cards];
else if(isArray&&cards.length) recast.cards=cards;
else _status.event.next.remove(recast);
if(typeof recastingLose!='function') recastingLose=(player,cards)=>player.loseToDiscardpile(cards).set("log",false).cards;
if(typeof recastingLose!='function') recastingLose=(player,cards)=>player.loseToDiscardpile(cards).log=false;
recast.recastingLose=recastingLose;
recast.recastingLosingEvents=[];
if(typeof recastingGain!='function') recastingGain=(player,cards)=>player.draw(cards.length).log=false;
recast.recastingGain=recastingGain;
recast.recastingGainingEvents=[];
recast.setContent('recast');
recast._args=Array.from(arguments);
return recast;
},
//Check if the player can recast the card
//检查角色是否能重铸此牌
//检角色是否能重铸此牌
canRecast:function(card,source,strict){
const cardRecastable=lib.filter.cardRecastable(card,this,source,strict);
if(cardRecastable!='unchanged') return cardRecastable;
if(get.position(card)!='h') return false;
const info=get.info(card);
return typeof info.chongzhu=='function'?info.chongzhu(_status.event,this):info.chongzhu;
return lib.filter.cardRecastable(card,this,source,strict);
},
//装备栏相关
//判断一名角色的某个区域是否被废除
@ -25114,14 +25191,7 @@
},
needsToDiscard:function(num){
if(typeof num!='number') num=0;
var hs=this.getCards('h');
num+=hs.length;
for(var i=0;i<hs.length;i++){
if(game.checkMod(hs[i],this,false,'ignoredHandcard',this)==true){
num--;
}
}
return Math.max(0,num-this.getHandcardLimit());
return Math.max(0,num+this.countCards('h',card=>!this.canIgnoreHandcard(card))-this.getHandcardLimit());
},
distanceTo:function(target,method){
return get.distance(this,target,method);
@ -28396,11 +28466,28 @@
all:function(){
return true;
},
//Check if the card does not count toward the player's hand limit
//检测此牌是否不计入此角色的手牌上限
ignoredHandcard:(card,player)=>game.checkMod(card,player,false,'ignoredHandcard',player),
//Check if the card is giftable
//检测此牌是否可赠予
cardGiftable:(card,player,target,strict)=>{
const mod=game.checkMod(card,player,target,'unchanged','cardGiftable',player);
if(!mod||strict&&(mod=='unchanged'&&(get.position(card)!='h'||!get.cardtag(card,'gifts'))||player==target)) return false;
return get.type(card,false)!='equip'||target.canEquip(card,true);
},
//Check if the card is recastable
//检查此牌是否可重铸
cardRecastable:(card,player,source,raw)=>{
cardRecastable:(card,player,source,strict)=>{
if(typeof player=='undefined') player=get.owner(card);
return game.checkMod(card,player,source,!raw||'unchanged','cardRecastable',player);
const mod=game.checkMod(card,player,source,'unchanged','cardRecastable',player);
if(!mod) return false;
if(strict&&mod=='unchanged'){
if(get.position(card)!='h') return false;
const info=get.info(card);
return typeof info.chongzhu=='function'?info.chongzhu(_status.event,player):info.chongzhu;
}
return true;
},
//装备栏相关
canBeReplaced:function(card,player){
@ -28601,7 +28688,7 @@
}
var num=info.usable;
if(typeof num=='function') num=num(card,player);
num=game.checkMod(card,player,num,event,'cardUsable',player);
num=game.checkMod(card,player,num,'cardUsable',player);
if(typeof num!='number') return true;
else return(player.countUsed(card)<num);
},
@ -30035,15 +30122,13 @@
delay:false,
content:function(){
player.recast(cards,null,(player,cards)=>{
var numberOfCardsToDraw=cards.length, cardsToGain=[];
var numberOfCardsToDraw=cards.length;
cards.forEach(value=>{
if(lib.config.mode=='stone'&&_status.mode=='deck'&&!player.isMin()&&get.type(value).indexOf('stone')==0){
var stonecard=get.stonecard(1,player.career);
if(stonecard.length){
numberOfCardsToDraw-=stonecard.length;
var card=game.createCard(stonecard.randomGet());
player.gain(card,'draw');
cardsToGain.push(card);
player.gain(game.createCard(stonecard.randomGet()),'draw');
}
else player.draw({
drawDeck:1
@ -30053,21 +30138,16 @@
var libCard=get.libCard(info=>info.subtype=='spell_silver');
if(!libCard.length) return;
numberOfCardsToDraw--;
var card=game.createCard(libCard.randomGet());
player.gain(card,'draw');
cardsToGain.push(card);
player.gain(game.createCard(libCard.randomGet()),'draw');
}
else if(get.subtype(value)=='spell_silver'){
var libCard=get.libCard(info=>info.subtype=='spell_bronze');
if(!libCard.length) return;
numberOfCardsToDraw--;
var card=game.createCard(libCard.randomGet());
player.gain(card,'draw');
cardsToGain.push(card);
player.gain(game.createCard(libCard.randomGet()),'draw');
}
});
if(numberOfCardsToDraw) player.draw(numberOfCardsToDraw).log=false;
return cardsToGain;
});
},
ai:{
@ -54162,7 +54242,7 @@
},
verticalStr:function(str,sp){
if(typeof str!='string') return '';
return str.split('').filter(value=>value!='`').join('');
return [...str].filter(value=>value!='`').join('');
},
numStr:function(num,method){
if(num==Infinity){
@ -57333,4 +57413,4 @@
get:get
};
lib.init.init();
}());
})();