Merge branch 'libccy:PR-Branch' into PR-Branch

This commit is contained in:
157 2023-10-30 23:15:00 +08:00 committed by GitHub
commit 42838fb200
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 91 additions and 65 deletions

BIN
audio/die/tw_zhanghong.mp3 Normal file

Binary file not shown.

BIN
audio/die/tw_zhangzhao.mp3 Normal file

Binary file not shown.

BIN
audio/skill/twchungang1.mp3 Normal file

Binary file not shown.

BIN
audio/skill/twchungang2.mp3 Normal file

Binary file not shown.

BIN
audio/skill/twlijian1.mp3 Normal file

Binary file not shown.

BIN
audio/skill/twlijian2.mp3 Normal file

Binary file not shown.

BIN
audio/skill/twquanqian1.mp3 Normal file

Binary file not shown.

BIN
audio/skill/twquanqian2.mp3 Normal file

Binary file not shown.

BIN
audio/skill/twrouke1.mp3 Normal file

Binary file not shown.

BIN
audio/skill/twrouke2.mp3 Normal file

Binary file not shown.

View File

@ -4485,7 +4485,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
backup:{audio:'dcquanjian'},
damage:{
audio:'dcquanjian',
charlotte:true,
selectTarget:2,
filterTarget:function(card,player,target){
if(!ui.selected.targets.length) return target!=player;
@ -4530,7 +4529,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
draw:{
audio:'dcquanjian',
charlotte:true,
filterTarget:function(card,player,target){
if(target==player) return false;
var num=target.countCards('h');

View File

@ -2538,6 +2538,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
targets[event.num].chooseBool("是否押杀?").ai=function(event,player){
var evt=_status.event.getParent();
if(get.attitude(targets[event.num],evt.player)>0) return evt.player.countCards('h','sha')?false:true;
if(evt.player.hasKnownCards(targets[event.num],c=>{return c.name == 'sha';})){
return true;
}
return Math.random()<0.5;
};
"step 2"

View File

@ -7,13 +7,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
sp:{
sp_tianji:["sunhao","liuxie","caoang","hetaihou","sunluyu",'ol_wangrong',"zuofen","ol_bianfuren","qinghegongzhu","tengfanglan","ruiji",'caoxiancaohua'],
sp_sibi:["yangxiu","chenlin","chengyu","shixie","fuwan","wangyun","zhugejin","simalang","maliang","buzhi","dongyun","kanze","sunqian","xizhicai","sunshao",'duxi',"jianggan",'ol_dengzhi','ol_yangyi','ol_dongzhao','ol_chendeng','jin_yanghu','wangyan','xiahouxuan','quhuang','zhanghua','wangguan','sunhong','caoxi'],
sp_tianzhu:['niujin','hejin','hansui',"wutugu","yanbaihu","shamoke","panfeng","zhugedan",'huangzu','gaogan',"tadun","fanjiangzhangda","ahuinan","dongtuna",'ol_wenqin'],
sp_tianzhu:['zhangyan','niujin','hejin','hansui',"wutugu","yanbaihu","shamoke","panfeng","zhugedan",'huangzu','gaogan',"tadun","fanjiangzhangda","ahuinan","dongtuna",'ol_wenqin'],
sp_nvshi:["lingju","guanyinping","zhangxingcai","mayunlu","dongbai","zhaoxiang",'ol_zhangchangpu',"daxiaoqiao","jin_guohuai"],
sp_shaowei:["simahui","zhangbao","zhanglu","zhugeguo","xujing","zhangling",'huangchengyan','zhangzhi','lushi'],
sp_huben:['duanjiong','ol_mengda',"caohong","xiahouba","zhugeke","zumao","wenpin","litong","mazhong","heqi","quyi","luzhi","zangba","yuejin","dingfeng","wuyan","ol_zhuling","tianyu","huojun",'zhaoyǎn','dengzhong','ol_furong','macheng','ol_zhangyì','ol_zhujun','maxiumatie','luoxian','ol_huban','haopu','ol_qianzhao'],
sp_liesi:['mizhu','weizi','ol_liuba','zhangshiping'],
sp_default:["sp_diaochan","sp_zhaoyun","sp_sunshangxiang","sp_caoren","sp_jiangwei","sp_machao","sp_caiwenji","jsp_guanyu","jsp_huangyueying","sp_pangde","sp_jiaxu","yuanshu",'sp_zhangliao','sp_ol_zhanghe','sp_menghuo'],
sp_waitforsort:['ol_luyusheng','ol_pengyang','ol_tw_zhangji','ol_feiyi','lvboshe','zhangyan','ol_dingshangwan','ol_liwan'],
sp_waitforsort:['ol_luyusheng','ol_pengyang','ol_tw_zhangji','ol_feiyi','lvboshe','ol_dingshangwan','ol_liwan'],
sp_qifu:["caoying",'panshu',"caochun","yuantanyuanshang",'caoshuang','wolongfengchu','guansuo','baosanniang','fengfangnv','jin_zhouchu'],
sp_wanglang:['ol_wanglang','ol_puyuan','ol_zhouqun'],
sp_zhongdan:["cuiyan","huangfusong"],

View File

@ -2063,14 +2063,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
//卞喜
dunxi:{
audio:2,
trigger:{player:'useCardAfter'},
trigger:{player:'useCard'},
direct:true,
filter:function(event,player){
if(!get.tag(event.card,'damage')) return false;
for(var i of event.targets){
if(i!=player&&i.isIn()) return true;
}
return false;
return event.targets.some(target=>target!=player&&target.isIn());
},
content:function(){
'step 0'
@ -10527,7 +10524,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
dcbihuo_info:'①当你受到其他角色造成的伤害后,你可令一名角色下回合摸牌阶段的额定摸牌数+1。②当你对其他角色造成伤害后你可令一名角色下回合摸牌阶段的额定摸牌数-1。',
bianxi:'卞喜',
dunxi:'钝袭',
dunxi_info:'①当你使用具有伤害标签的牌结算结束后你可以令一名不为你的目标角色获得一枚“钝”。②有“钝”的角色使用基本牌或锦囊牌时若此牌目标数为1且此时没有角色处于濒死状态你令其移去一枚“钝”。系统随机选择一名角色并将此牌的目标改为该角色。若该角色和原目标相同则其失去1点体力。若其正处于出牌阶段内则结束此阶段。',
dunxi_info:'①当你使用具有伤害标签的牌你可以令一名不为你的目标角色获得一枚“钝”。②有“钝”的角色使用基本牌或锦囊牌时若此牌目标数为1且此时没有角色处于濒死状态你令其移去一枚“钝”。系统随机选择一名角色并将此牌的目标改为该角色。若该角色和原目标相同则其失去1点体力。若其正处于出牌阶段内则结束此阶段。',
niufu:'牛辅',
dcxiaoxi:'宵袭',
dcxiaoxi_info:'锁定技。出牌阶段开始时你声明X并减X点体力上限X∈[1,2]。然后你选择一名攻击范围内的其他角色并选择一项⒈获得该角色的X张牌。⒉视为对其使用X张【杀】。',

View File

@ -6257,7 +6257,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
filterCard:()=>false,
selectCard:-1,
charlotte:true,
content:function(){
'step 0'
player.addTempSkill('dcfengyan_gain','phaseUseAfter');
@ -6283,7 +6282,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
filterCard:()=>false,
selectCard:-1,
charlotte:true,
content:function(){
player.addTempSkill('dcfengyan_sha','phaseUseAfter');
player.useCard({

View File

@ -466,8 +466,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return _status.event.choice;
}).set('choice',function(){
var num=trigger.player.countCards('h',card=>get.type2(card)==type);
var knownNum = trigger.player.countKnownCards(_status.event.player,card=>get.type2(card)==type);
if(trigger.player.isAllCardsKnown(_status.event.player)){
return knownNum;
}
var restNum = num - knownNum;
var numx;
if(type=='basic') numx=num+(Math.random()<0.2?(Math.random()>0.5?1:-1):0);
if(type=='basic') numx=num+Math.floor(Math.random()*restNum+1);
else if(type=='trick'){
if(num>2) numx=2;
else numx=1;
@ -478,7 +483,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else{
numx=[0,1].randomGet();
}
if(numx<0) numx=0;
if(numx<knownNum) numx=knownNum;
else if(numx>=choices.length) numx=choices.length-1;
return numx;
}());

View File

@ -622,8 +622,8 @@
['tao',3]
]),
effect:new Map([
['sha',event=>{
if(event.step!=1) return;
['sha',(event,option)=>{
if(event.step!=0||option.state!='end') return;
game.log(event.player,'触发了强化效果');
game.log(event.card,'抵消所需要的',new lib.element.VCard({
name:'shan'
@ -636,8 +636,8 @@
else map[id].shanRequired=2;
});
}],
['shan',event=>{
if(event.step!=1) return;
['shan',(event,option)=>{
if(event.step!=0||option.state!='end') return;
game.log(event.player,'触发了强化效果');
game.log('使用',event.card,'时视为两张',new lib.element.VCard({
name:'shan'
@ -646,8 +646,8 @@
trigger.getParent(2).decrease('shanRequired',1);
});
}],
['juedou',event=>{
if(event.step!=1) return;
['juedou',(event,option)=>{
if(event.step!=0||option.state!='end') return;
game.log(event.player,'触发了强化效果');
game.log('对',event.card,'的目标造成伤害时,伤害+1');
event.player.when({
@ -656,14 +656,14 @@
trigger.increase('num');
});
}],
['huogong',event=>{
if(event.step!=1) return;
['huogong',(event,option)=>{
if(event.step!=0||option.state!='end') return;
game.log(event.player,'触发了强化效果');
game.log(event.card,'造成的伤害+1');
event.increase('baseDamage',1);
}],
['tao',event=>{
if(event.step!=1) return;
['tao',(event,option)=>{
if(event.step!=0||option.state!='end') return;
game.log(event.player,'触发了强化效果');
game.log(event.card,'回复的体力+1');
event.increase('baseDamage',1);
@ -8395,6 +8395,7 @@
var that=this;
this.timeout=setTimeout(function(){
console.log(that,that._selfDestroyed)
if(!that._selfDestroyed){
position.appendChild(that);
}
@ -8826,23 +8827,6 @@
return list[0];
}
});
/**
* @deprecated
* !!!WARNING!!!
* Will be deprecated in next verision!
* Use {@link VCard#hasNature} instead.
*/
Object.defineProperty(Object.prototype,'hasNature',{
configurable:true,
enumerable:false,
writable:true,
value:function(nature,player){
var natures=get.natureList(this,player);
if(!nature) return natures.length>0;
if(nature=='linked') return natures.some(n=>lib.linked.includes(n));
return get.is.sameNature(natures,nature);
}
});
window.onkeydown=function(e){
if(!ui.menuContainer||!ui.menuContainer.classList.contains('hidden')){
if(e.keyCode==116||((e.ctrlKey||e.metaKey)&&e.keyCode==82)){
@ -11036,7 +11020,7 @@
return;
}
if(Array.isArray(file)){
return file.forEach(value=>lib.init.js(path,value,onLoad,onError));
return file.forEach(value=>lib.init.jsSync(path,value,onLoad,onError));
}
let scriptSource;
if(!file) scriptSource=path;
@ -19316,9 +19300,15 @@
for(var num=0;num<cards.length;num++){
sort=lib.config.sort_card(cards[num]);
if(lib.config.reverse_sort) sort=-sort;
if(['o','d'].contains(get.position(cards[num],true))){
cards[num].addKnower('everyone');
}
cards[num].fix();
cards[num].style.transform='';
cards[num].addGaintag(event.gaintag);
if(event.knowers){
cards[num].addKnower(event.knowers);//添加事件设定的知情者。
}
if(_status.discarded){
_status.discarded.remove(cards[num]);
}
@ -19694,6 +19684,7 @@
else if(cards[i].hasOwnProperty('destroyed')){
if(event.getlx!==false&&event.position&&cards[i].willBeDestroyed(event.position.id,null,event)){
cards[i].selfDestroy(event);
continue;
}
}
else if(info.destroy){
@ -19779,7 +19770,7 @@
event.xs=xs;
game.clearCardKnowers(hs);
if(hs.length && !event.visible){
this.getCards('h').forEach(hcard=>{hcard.clearKnowers();});
player.getCards('h').forEach(hcard=>{hcard.clearKnowers();});
}
"step 2"
if(num<cards.length){
@ -21014,6 +21005,10 @@
return card.isKnownBy(other) && filter(card);
}) > 0;
}
//数此角色被知道的牌。
countKnownCards(other,filter){
return this.getKnownCards(other,filter).length;
}
//Execute the delay card effect
//执行延时锦囊牌效果
executeDelayCardEffect(card,target,judge,judge2){
@ -30589,6 +30584,21 @@
}
}
}
removeKnower(player){
if(!this._knowers){
return;
}
if(typeof player == 'string'){
this._knowers.remove(player);
}else{
let type = get.itemtype(player);
if(type == 'player'){
this._knowers.remove(player.playerid);
}else if(type == 'players'){
player.forEach(p=>this._knowers.remove(p.playerid));
}
}
}
//清除此牌的知情者。
clearKnowers(){
if(this._knowers)delete this._knowers;
@ -30713,7 +30723,10 @@
if(this._uncheck.length==0) this.classList.remove('uncheck');
}
discard(bool){
this.fix();
if(!this._selfDestroyed){
this.fix();
ui.discardPile.appendChild(this);
}
this.classList.remove('glow');
if(bool===false){
ui.cardPile.insertBefore(this,ui.cardPile.childNodes[Math.floor(Math.random()*ui.cardPile.childNodes.length)]);
@ -30958,17 +30971,17 @@
return this;
}
/**
* @param {Parameters<typeof this.hasHandler>[0]} [type]
* @param {GameEvent} [event]
* @param {Parameters<typeof this.hasHandler>[0]} type
* @param {GameEvent} event
* @param {{
* state?: 'begin' | 'end';
* }} option
* @returns {this}
*/
callHandler(type,event){
if(this.hasHandler(type)){
if(!event) event=this;
this.getHandler(type).forEach(handler=>{
if(typeof handler=='function') handler(event);
});
}
callHandler(type,event,option){
if(this.hasHandler(type)) this.getHandler(type).forEach(handler=>{
if(typeof handler=='function') handler(event,option);
});
return this;
}
getDefaultHandlerType(){
@ -30977,7 +30990,9 @@
}
/**
* @param {Parameters<typeof this.hasHandler>[0]} [type]
* @returns {((event: GameEvent) => void)[]}
* @returns {((event: GameEvent, option: {
* state?: 'begin' | 'end';
* }) => void)[]}
*/
getHandler(type){
if(!type) type=this.getDefaultHandlerType();
@ -30995,13 +31010,17 @@
}
/**
* @overload
* @param {...((event: GameEvent) => void)[]} handlers
* @param {...((event: GameEvent, option: {
* state?: 'begin' | 'end';
* }) => void)[]} handlers
* @returns {number}
*/
/**
* @overload
* @param {Parameters<typeof this.hasHandler>[0]} type
* @param {...((event: GameEvent) => void)[]} handlers
* @param {...((event: GameEvent, option: {
* state?: 'begin' | 'end';
* }) => void)[]} handlers
* @returns {number}
*/
pushHandler(type){
@ -33079,8 +33098,8 @@
player.changeFury(-stratagemBuff.cost.get(cardName),true);
const gameEvent=get.event(),effect=stratagemBuff.effect.get(cardName);
if(typeof effect=='function') gameEvent.pushHandler('onNextUseCard',effect);
gameEvent.pushHandler('onNextUseCard',event=>{
if(event.step==1) game.broadcastAll(cards=>cards.forEach(card=>card.clone.classList.add('stratagem-fury-glow')),event.cards);
gameEvent.pushHandler('onNextUseCard',(event,option)=>{
if(event.step==0&&option.state=='end') game.broadcastAll(cards=>cards.forEach(card=>card.clone.classList.add('stratagem-fury-glow')),event.cards);
});
},
ai:{
@ -35838,6 +35857,7 @@
for(let i=0;i<ui.discardPile.childNodes.length;i++){
var currentcard=ui.discardPile.childNodes[i];
currentcard.vanishtag.length=0;
currentcard.clearKnowers();
if(get.info(currentcard).vanish||currentcard.storage.vanish){
currentcard.remove();
continue;
@ -40882,7 +40902,9 @@
}*/
}
else{
event.callHandler();
event.callHandler(event.getDefaultHandlerType(),event,{
state:'begin'
});
if(player&&player.classList.contains('dead')&&!event.forceDie&&event.name!='phaseLoop'){
game.broadcastAll(function(){
while(_status.dieClose.length){
@ -40977,8 +40999,10 @@
}
}
event.clearStepCache();
event.callHandler(event.getDefaultHandlerType(),event,{
state:'end'
});
event.step++;
if(event.finished) event.callHandler();
}
}
}

View File

@ -8823,14 +8823,14 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
}
return false;
}
var keysArray=["length","players","player","element"];
var keysArray=["length","players","Player","element"];
for(var i=0;i<game[keysArray[1]][keysArray[0]];i++){
var node=game[keysArray[1]][i];
for(var a in lib[keysArray[3]][keysArray[2]]){
for(var a in Object.keys(lib[keysArray[3]][keysArray[2]].prototype)){
var opd=Object.getOwnPropertyDescriptor(node,a);
if (isDefined(opd)) _status.taoni_over(lib.translate[node.name] + '触发了〖讨逆〗,游戏已被终止。');
//还原函数
node[a]=lib[keysArray[3]][keysArray[2]][a];
node[a]=lib[keysArray[3]][keysArray[2]].prototype[a];
var playerKeysArray=['classList','hp','maxHp','skills'];
for(var b=0;b<playerKeysArray.length;b++){
var opd2=Object.getOwnPropertyDescriptor(node,playerKeysArray[b]);

View File

@ -192,8 +192,9 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
game.gameDraw(event.playerx);
game.broadcastAll(function(player){
for(var i=0;i<game.players.length;i++){
game.players[i].name=get.seatTranslation(get.distance(player,game.players[i],'absolute'));
game.players[i].node.name_seat=ui.create.div('.name.name_seat',get.verticalStr(lib.translate[game.players[i].name]),game.players[i]);
var seatNum=get.distance(player,game.players[i],'absolute');
game.players[i].name=`unknown${seatNum}`;
game.players[i].node.name_seat=ui.create.div('.name.name_seat',get.seatTranslation(seatNum),game.players[i]);
// if(game.players[i]==game.me){
// lib.translate[game.players[i].name]+='(你)';
// }