Merge branch 'PR-Branch' into PR-Branch

This commit is contained in:
157 2023-10-08 23:19:42 +08:00 committed by GitHub
commit e9266c8eeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 197 additions and 143 deletions

View File

@ -497,6 +497,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
lib.translate['yichong_'+player.playerid+'_bg']='雀';
}
},
getLimit:1,
audio:2,
trigger:{player:'phaseZhunbeiBegin'},
direct:true,
@ -560,7 +561,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!player.storage.yichong) return false;
return game.hasPlayer(function(current){
if(!event.getg(current).length||!current.hasSkill('yichong_'+player.playerid)) return false;
if(current.countMark('yichong_'+player.playerid)>=5) return false;
if(current.countMark('yichong_'+player.playerid)>=lib.skill.yichong.getLimit) return false;
return event.getg(current).some(card=>get.suit(card,current)==player.storage.yichong&&lib.filter.canBeGained(card,current,player));
});
},
@ -569,14 +570,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 0'
var target=game.findPlayer(function(current){
if(!trigger.getg(current).length||!current.hasSkill('yichong_'+player.playerid)) return false;
if(current.countMark('yichong_'+player.playerid)>=5) return false;
if(current.countMark('yichong_'+player.playerid)>=lib.skill.yichong.getLimit) return false;
return trigger.getg(current).some(card=>get.suit(card,current)==player.storage.yichong&&lib.filter.canBeGained(card,current,player));
});
event.target=target;
var cards=trigger.getg(target).filter(card=>get.suit(card,target)==player.storage.yichong&&lib.filter.canBeGained(card,target,player));
if(cards.length<=5-target.countMark('yichong_'+player.playerid)) event._result={bool:true,links:cards};
if(cards.length<=lib.skill.yichong.getLimit-target.countMark('yichong_'+player.playerid)) event._result={bool:true,links:cards};
else{
var num=(5-target.countMark('yichong_'+player.playerid));
var num=(lib.skill.yichong.getLimit-target.countMark('yichong_'+player.playerid));
player.chooseButton(['易宠:获得其中的'+get.cnNumber(num)+'张牌',cards],num,true).set('ai',function(button){
return get.value(button.link);
});
@ -613,7 +614,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var target=game.findPlayer(current=>current.hasSkill('yichong_'+player.playerid));
event.target=target;
if(trigger.name=='damage'){
player.chooseBool(get.prompt('wufei',target),''+get.translation(target)+'造成1点伤害').set('choice',get.damageEffect(target,player,player)>0);
player.chooseBool(get.prompt('wufei',target),''+get.translation(target)+'受到1点无来源伤害').set('choice',get.damageEffect(target,player,player)>0);
}
else{
player.logSkill('wufei',target);
@ -625,7 +626,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 1'
if(result.bool){
player.logSkill('wufei',target);
target.damage();
target.damage('nosource');
}
},
subSkill:{
@ -14851,9 +14852,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
xin_guozhao:'手杀郭照',
xin_guozhao_prefix:'手杀',
yichong:'易宠',
yichong_info:'①准备阶段,你可以选择一名其他角色并选择一个花色,然后你获得其所有此花色的牌,移除场上的所有“雀”标记,令其获得“雀”标记直到你的下个回合开始。②拥有“雀”标记的角色获得你最后一次发动〖易宠①〗选择的花色的牌后,你获得这些牌(你至多通过每个“雀”得到张牌)。',
yichong_info:'①准备阶段,你可以选择一名其他角色并选择一个花色,然后你获得其所有此花色的牌,移除场上的所有“雀”标记,令其获得“雀”标记直到你的下个回合开始。②拥有“雀”标记的角色获得你最后一次发动〖易宠①〗选择的花色的牌后,你获得这些牌(你至多通过每个“雀”得到张牌)。',
wufei:'诬诽',
wufei_info:'若场上存在拥有“雀”标记的角色A①当你使用【杀】或伤害类锦囊牌指定第一个目标后你令A成为此牌伤害来源。②当你受到伤害后若A的体力值大于1且A的体力值大于你则你可以对A造成1点伤害。',
wufei_info:'若场上存在拥有“雀”标记的角色A①当你使用【杀】或伤害类锦囊牌指定第一个目标后你令A成为此牌伤害来源。②当你受到伤害后若A的体力值大于1且A的体力值大于你则你可以令A受到1点无来源伤害。',
yj_zhoubuyi:'☆周不疑',
yj_zhoubuyi_prefix:'☆',
mbhuiyao:'慧夭',

View File

@ -240,7 +240,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 0'
player.chooseTarget(get.prompt('sbzaiqi'),'选择任意名角色并消耗等量蓄力值令这些角色选择一项1.令你摸一张牌2.弃置一张牌然后你回复1点体力',[1,player.countMark('charge')]).set('ai',function(target){
var player=_status.event.player;
return get.attitude(player,target)+player.getDamagedHp()*3.5;
var att=get.attitude(player,target);
return 3-get.sgn(att)+Math.abs(att/1000);
});
'step 1'
if(result.bool){
@ -280,14 +281,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){
global:'phaseBefore',
},
usable:1,
forced:true,
locked:false,
filter:function(event,player){
if(event.name=='damage') return true;
return (event.name!='phase'||game.phaseNumber==0);
},
forced:true,
locked:false,
content:function(){
player.addMark('charge',1);
player.addMark('charge',trigger.name=='damage'?1:3);
}
}
}
@ -333,7 +334,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var target=trigger.card.storage.sblieren[1];
player.chooseTarget('烈刃:是否对除'+get.translation(target)+'外的一名其他角色造成1点伤害',(card,player,target)=>{
return target!=_status.event.targeted&&target!=player;
}).set('targeted',target).set('ai',(tar)=>get.damageEffect(tar,player,_status.event.player));
}).set('targeted',target).set('ai',targetx=>get.damageEffect(targetx,_status.event.player,_status.event.player));
'step 1'
if(result.bool){
var target=result.targets[0];
@ -4931,7 +4932,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
sbhuoshou:'祸首',
sbhuoshou_info:'锁定技。①【南蛮入侵】对你无效。②当其他角色使用【南蛮入侵】指定第一个目标后,你代替其成为此牌的伤害来源。③出牌阶段开始时,你随机获得弃牌堆中的一张【南蛮入侵】。④出牌阶段,若你于此阶段使用过【南蛮入侵】,你不能使用【南蛮入侵】。',
sbzaiqi:'再起',
sbzaiqi_info:'蓄力技(1/7。①弃牌阶段结束时你可以消耗任意点蓄力值并选择等量名角色然后令这些角色选择一项1.令你摸一张牌2.弃置一张牌然后你回复1点体力。②每回合限一次。当你造成伤害后你获得1点蓄力值。',
sbzaiqi_info:'蓄力技(3/7。①弃牌阶段结束时你可以消耗任意点蓄力值并选择等量名角色然后令这些角色选择一项1.令你摸一张牌2.弃置一张牌然后你回复1点体力。②每回合限一次。当你造成伤害后你获得1点蓄力值。',
sb_zhanghe:'谋张郃',
sbqiaobian:'巧变',
sbqiaobian_info:'每回合限一次。①你可以失去1点体力并跳过判定阶段将判定区的所有牌移动给一名其他角色无法置入其判定区的牌改为弃置之。②你可以跳过摸牌阶段于下个准备阶段摸两张牌并回复1点体力。③你可以将手牌数弃置至六张若手牌数少于六张则跳过之并跳过出牌阶段和弃牌阶段然后移动场上的一张牌。',

View File

@ -41,7 +41,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
qiuliju:['male','qun','4/6',['koulve','qljsuiren']],
re_hucheer:['male','qun',4,['redaoji','fuzhong']],
re_dongcheng:['male','qun',4,['xuezhao']],
tangji:['female','qun',3,['jielie','kangge']],
tangji:['female','qun',3,['kangge','jielie']],
zhangheng:['male','qun',8,['dangzai','liangjue']],
duanwei:['male','qun',4,['langmie']],
re_niujin:['male','wei',4,['recuorui','reliewei']],
@ -4545,12 +4545,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
},
//唐姬
jielie:{
kangge:{
audio:2,
trigger:{player:'phaseBegin'},
direct:true,
filter:function(event,player){
return player.phaseNumber==1&&!player.storage.jielie&&game.hasPlayer(current=>current!=player);
return player.phaseNumber==1&&!player.storage.kangge&&game.hasPlayer(current=>current!=player);
},
content:function(){
'step 0'
@ -4560,31 +4560,31 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 1'
if(result.bool){
var target=result.targets[0];
player.logSkill('jielie',target);
player.addSkill('jielie_clear');
player.storage.jielie=target;
player.markSkill('jielie');
player.logSkill('kangge',target);
player.addSkill('kangge_clear');
player.storage.kangge=target;
player.markSkill('kangge');
game.delayx();
}
},
intro:{content:'已指定$为目标'},
group:['jielie_draw','jielie_dying','jielie_die'],
group:['kangge_draw','kangge_dying','kangge_die'],
subSkill:{
draw:{
audio:'jielie',
audio:'kangge',
trigger:{
global:['gainAfter','loseAsyncAfter'],
},
forced:true,
filter:function(event,player){
if(player.countMark('jielie_draw')>=3) return false;
var target=player.storage.jielie;
if(player.countMark('kangge_draw')>=3) return false;
var target=player.storage.kangge;
return target&&target!=_status.currentPhase&&event.getg(target).length>0;
},
logTarget:'player',
content:function(){
var num=Math.min(3-player.countMark('jielie_draw'),trigger.getg(player.storage.jielie).length);
player.addMark('jielie_draw',num,false);
var num=Math.min(3-player.countMark('kangge_draw'),trigger.getg(player.storage.kangge).length);
player.addMark('kangge_draw',num,false);
player.draw(num);
},
},
@ -4595,18 +4595,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){
popup:false,
charlotte:true,
filter:function(event,player){
return player.countMark('jielie_draw')>0;
return player.countMark('kangge_draw')>0;
},
content:function(){
player.removeMark('jielie_draw',player.countMark('jielie_draw'),false);
player.removeMark('kangge_draw',player.countMark('kangge_draw'),false);
},
},
dying:{
audio:'jielie',
audio:'kangge',
trigger:{global:'dying'},
logTarget:'player',
filter:function(event,player){
return event.player==player.storage.jielie&&event.player.hp<1&&!player.hasSkill('jielie_temp');
return event.player==player.storage.kangge&&event.player.hp<1&&!player.hasSkill('kangge_temp');
},
check:function(event,player){
return get.attitude(player,event.player)>0;
@ -4614,15 +4614,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
prompt2:'令其将体力值回复至1点',
content:function(){
trigger.player.recover(1-trigger.player.hp);
player.addTempSkill('jielie_temp','roundStart');
player.addTempSkill('kangge_temp','roundStart');
},
},
temp:{},
die:{
audio:'jielie',
audio:'kangge',
trigger:{global:'dieAfter'},
filter:function(event,player){
return event.player==player.storage.jielie;
return event.player==player.storage.kangge;
},
forced:true,
content:function(){
@ -4636,24 +4636,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){
threaten:2,
},
},
kangge:{
jielie:{
audio:2,
trigger:{player:'damageBegin4'},
direct:true,
filter:function(event,player){
return ((!event.source)||(event.source!=player&&event.source!=player.storage.jielie))&&player.storage.jielie&&player.storage.jielie.isIn();
return ((!event.source)||(event.source!=player&&event.source!=player.storage.kangge))&&player.storage.kangge&&player.storage.kangge.isIn();
},
content:function(){
'step 0'
player.chooseControl(lib.suit.slice(0),'cancel2').set('prompt',get.prompt('kangge')).set('prompt2','防止伤害并改为失去等量体力,且令'+get.translation(player.storage.jielie)+'从弃牌堆中获得等量的花色牌').set('ai',function(){
player.chooseControl(lib.suit.slice(0),'cancel2').set('prompt',get.prompt('jielie')).set('prompt2','防止伤害并改为失去等量体力,且令'+get.translation(player.storage.kangge)+'从弃牌堆中获得等量的花色牌').set('ai',function(){
var player=_status.event.player;
if(get.attitude(player,player.storage.jielie)<=0) return 'cancel2';
if(get.attitude(player,player.storage.kangge)<=0) return 'cancel2';
return lib.suit.randomGet();
});
'step 1'
if(result.control!='cancel2'){
event.suit=result.control;
player.logSkill('kangge',player.storage.jielie);
player.logSkill('jielie',player.storage.kangge);
trigger.cancel();
player.loseHp(trigger.num);
}
@ -4667,7 +4667,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(card) cards.push(card);
else break;
}
if(cards.length) player.storage.jielie.gain(cards,'gain2');
if(cards.length) player.storage.kangge.gain(cards,'gain2');
},
},
//张横
@ -10450,10 +10450,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
liangjue:'粮绝',
liangjue_info:'锁定技当有黑色牌进入或者离开你的判定区或装备区后若你的体力值大于1你失去1点体力然后摸两张牌。',
tangji:'唐姬',
jielie:'抗歌',
jielie_info:'你的第一个回合开始时选择一名其他角色该角色每次于其回合外得到牌后你摸等量的牌每回合至多摸三张其进入濒死状态时你可令其回复体力至1点每轮限一次。该角色死亡时你弃置所有牌并失去1点体力。',
kangge:'节烈',
kangge_info:'当你受到除自己和“抗歌”角色以外的角色造成的伤害时你可以防止此伤害并选择一种花色然后你失去X点体力令“抗歌”角色从弃牌堆中随机获得X张此花色的牌X为伤害值。',
kangge:'抗歌',
kangge_info:'你的第一个回合开始时选择一名其他角色该角色每次于其回合外得到牌后你摸等量的牌每回合至多摸三张其进入濒死状态时你可令其回复体力至1点每轮限一次。该角色死亡时你弃置所有牌并失去1点体力。',
jielie:'节烈',
jielie_info:'当你受到除自己和“抗歌”角色以外的角色造成的伤害时你可以防止此伤害并选择一种花色然后你失去X点体力令“抗歌”角色从弃牌堆中随机获得X张此花色的牌X为伤害值。',
re_dongcheng:'董承',
xuezhao:'血诏',
xuezhao_info:'出牌阶段限一次你可弃置一张手牌并选择至多X名其他角色(X为你的体力上限。这些角色依次选择是否交给你一张牌若选择是该角色摸一张牌且你本回合可多使用一张【杀】若选择否该角色本回合无法响应你使用的牌。',

View File

@ -8417,7 +8417,7 @@
}
});
/*Map prototype end*/
Object.defineProperty(Array.prototype, "filterInD", {
Object.defineProperty(Array.prototype,"filterInD",{
configurable:true,
enumerable:false,
writable:true,
@ -8426,7 +8426,7 @@
return this.filter(card=>pos.includes(get.position(card,true)));
}
});
Object.defineProperty(Array.prototype, "someInD", {
Object.defineProperty(Array.prototype,"someInD",{
configurable:true,
enumerable:false,
writable:true,
@ -8435,132 +8435,159 @@
return this.some(card=>pos.includes(get.position(card,true)));
}
});
Object.defineProperty(Array.prototype,"everyInD",{
configurable:true,
enumerable:false,
writable:true,
value:function(pos){
if(typeof pos!='string') pos='o';
return this.every(card=>pos.includes(get.position(card,true)));
}
});
/**
* @legacy Use `Array.prototype.includes(searchElement)` instead.
*@legacy Use `Array.prototype.includes(searchElement)` instead.
*/
Object.defineProperty(Array.prototype, "contains", {
Object.defineProperty(Array.prototype,"contains",{
configurable:true,
enumerable:false,
writable:true,
value:Array.prototype.includes
});
Object.defineProperty(Array.prototype, "add", {
Object.defineProperty(Array.prototype,"containsSome",{
configurable:true,
enumerable:false,
writable:true,
value:function(){
for(var i=0;i<arguments.length;i++){
if(this.contains(arguments[i])){
return false;
}
this.push(arguments[i]);
}
return this;
return Array.from(arguments).some(i=>this.includes(i));
}
});
Object.defineProperty(Array.prototype, "addArray", {
configurable:true,
enumerable:false,
writable:true,
value:function(arr){
for(var i=0;i<arr.length;i++){
this.add(arr[i]);
}
return this;
}
});
Object.defineProperty(Array.prototype, "remove", {
configurable:true,
enumerable:false,
writable:true,
value:function(item){
/*if(Array.isArray(item)){
for(var i=0;i<item.length;i++) this.remove(item[i]);
return;
}*/
var pos=this.indexOf(item);
if(pos==-1){
return false;
}
this.splice(pos,1);
return this;
}
});
Object.defineProperty(Array.prototype, "removeArray", {
configurable:true,
enumerable:false,
writable:true,
value:function(arr){
for(var i=0;i<arr.length;i++){
this.remove(arr[i]);
}
return this;
}
});
Object.defineProperty(Array.prototype, "randomGet", {
Object.defineProperty(Array.prototype,"containsAll",{
configurable:true,
enumerable:false,
writable:true,
value:function(){
var arr=this.slice(0);
for(var i=0;i<arguments.length;i++) arr.remove(arguments[i]);
return Array.from(arguments).every(i=>this.includes(i));
}
});
Object.defineProperty(Array.prototype,"add",{
configurable:true,
enumerable:false,
writable:true,
value:function(){
for(const arg of arguments){
if(this.contains(arg)) continue;
this.push(arg);
}
return this;
}
});
Object.defineProperty(Array.prototype,"addArray",{
configurable:true,
enumerable:false,
writable:true,
value:function(){
for(const i of Array.from(arguments)) this.add(...i);
return this;
}
});
Object.defineProperty(Array.prototype,"remove",{
configurable:true,
enumerable:false,
writable:true,
value:function(){
for(const item of arguments){
const pos=this.indexOf(item);
if(pos==-1) continue;
this.splice(pos,1);
}
return this;
}
});
Object.defineProperty(Array.prototype,"removeArray",{
configurable:true,
enumerable:false,
writable:true,
value:function(){
for(const i of Array.from(arguments)) this.remove(...i);
return this;
}
});
Object.defineProperty(Array.prototype,"unique",{
configurable:true,
enumerable:false,
writable:true,
value:function(){
let uniqueArray=[...new Set(this)];
this.length=uniqueArray.length;
for(let i=0;i<uniqueArray.length;i++) this[i]=uniqueArray[i];
return this;
}
});
Object.defineProperty(Array.prototype,"toUniqued",{
configurable:true,
enumerable:false,
writable:true,
value:function(){
return [...new Set(this)];
}
});
Object.defineProperty(Array.prototype,"randomGet",{
configurable:true,
enumerable:false,
writable:true,
value:function(){
let arr=this.slice(0);
arr.removeArray(Array.from(arguments));
return arr[Math.floor(Math.random()*arr.length)];
}
});
Object.defineProperty(Array.prototype, "randomRemove", {
Object.defineProperty(Array.prototype,"randomGets",{
configurable:true,
enumerable:false,
writable:true,
value:function(num){
if(typeof num=='number'){
var list=[];
for(var i=0;i<num;i++){
if(this.length){
list.push(this.randomRemove());
}
else{
break;
}
}
return list;
}
else{
return this.splice(Math.floor(Math.random()*this.length),1)[0];
}
}
});
Object.defineProperty(Array.prototype, "randomSort", {
configurable:true,
enumerable:false,
writable:true,
value:function(){
var list=[];
while(this.length){
list.push(this.randomRemove());
}
for(var i=0;i<list.length;i++){
this.push(list[i]);
}
return this;
}
});
Object.defineProperty(Array.prototype, "randomGets", {
configurable:true,
enumerable:false,
writable:true,
value:function(num){
if(num>this.length){
num=this.length;
}
var arr=this.slice(0);
var list=[];
for(var i=0;i<num;i++){
if(num>this.length) num=this.length;
let arr=this.slice(0);
let list=[];
for(let i=0;i<num;i++){
list.push(arr.splice(Math.floor(Math.random()*arr.length),1)[0]);
}
return list;
}
});
Object.defineProperty(Array.prototype, "sortBySeat", {
Object.defineProperty(Array.prototype,"randomRemove",{
configurable:true,
enumerable:false,
writable:true,
value:function(num){
if(typeof num=='number'){
let list=[];
for(let i=0;i<num;i++){
if(!this.length) break;
list.push(this.randomRemove());
}
return list;
}
return this.splice(Math.floor(Math.random()*this.length),1)[0];
}
});
Object.defineProperty(Array.prototype,"randomSort",{
configurable:true,
enumerable:false,
writable:true,
value:function(){
let list=[];
while(this.length){
list.push(this.randomRemove());
}
for(let i=0;i<list.length;i++){
this.push(list[i]);
}
return this;
}
});
Object.defineProperty(Array.prototype,"sortBySeat",{
configurable:true,
enumerable:false,
writable:true,
@ -8571,6 +8598,31 @@
return this;
}
});
/**
*@description 从数组中寻找某个特征最大的且通过筛选的第一个元素
*/
Object.defineProperty(Array.prototype,"maxBy",{
configurable:true,
enumerable:false,
writable:true,
value:function(sortBy,filter){
let list=this.filter(filter||(()=>true));
if(sortBy&&typeof sortBy=='function') list.sort((a,b)=>sortBy(a)-sortBy(b));
else list.sort();
return list[list.length-1];
}
});
Object.defineProperty(Array.prototype,"minBy",{
configurable:true,
enumerable:false,
writable:true,
value:function(sortBy,filter){
let list=this.filter(filter||(()=>true));
if(sortBy&&typeof sortBy=='function') list.sort((a,b)=>sortBy(a)-sortBy(b));
else list.sort();
return list[0];
}
});
//!!!WARNING!!!
//Will be deprecated in next verision
Object.defineProperty(Object.prototype,'hasNature',{