明忠模式

This commit is contained in:
libccy 2015-11-07 17:20:15 +08:00
parent 0764456c9e
commit a4a104675b
12 changed files with 275 additions and 124 deletions

View File

@ -1,7 +1,2 @@
1.5.0 1.5.2
录像功能 明忠模式
AI改进
Bug修复
触屏设备提示
出牌样式改进
界面调整

View File

@ -457,7 +457,7 @@ character.fire={
xueyi:{ xueyi:{
mod:{ mod:{
maxHandcard:function(player,num){ maxHandcard:function(player,num){
if(player.identity=='zhu'){ if(player.isZhu){
for(var i=0;i<game.players.length;i++){ for(var i=0;i<game.players.length;i++){
if(player!=game.players[i]&&game.players[i].group=='qun') num+=2; if(player!=game.players[i]&&game.players[i].group=='qun') num+=2;
} }

View File

@ -176,7 +176,7 @@ character.mountain={
trigger:{player:'phaseBegin'}, trigger:{player:'phaseBegin'},
forced:true, forced:true,
filter:function(event,player){ filter:function(event,player){
if(player!=game.zhu)return false; if(!player.isZhu)return false;
if(player.storage.ruoyu) return false; if(player.storage.ruoyu) return false;
for(var i=0;i<game.players.length;i++){ for(var i=0;i<game.players.length;i++){
if(game.players[i].hp<player.hp) return false; if(game.players[i].hp<player.hp) return false;
@ -641,6 +641,7 @@ character.mountain={
enable:'phaseUse', enable:'phaseUse',
filter:function(event,player){ filter:function(event,player){
if(!game.zhu) return false; if(!game.zhu) return false;
if(!game.zhu.isZhu) return false;
return (player!=game.zhu&&game.zhu.skills.contains('zhiba')&& return (player!=game.zhu&&game.zhu.skills.contains('zhiba')&&
player.group=='wu'&&player.num('h')>0&&game.zhu.num('h')>0); player.group=='wu'&&player.num('h')>0&&game.zhu.num('h')>0);
}, },

View File

@ -46,7 +46,7 @@ character.standard={
unique:true, unique:true,
trigger:{player:'chooseToRespondBegin'}, trigger:{player:'chooseToRespondBegin'},
filter:function(event,player){ filter:function(event,player){
if(player.identity!='zhu') return false; if(!player.isZhu) return false;
if(event.filterCard({name:'shan'})==false) return false; if(event.filterCard({name:'shan'})==false) return false;
for(var i=0;i<game.players.length;i++){ for(var i=0;i<game.players.length;i++){
if(game.players[i]!=player&&game.players[i].group=='wei') return true; if(game.players[i]!=player&&game.players[i].group=='wei') return true;
@ -515,7 +515,7 @@ character.standard={
audio:2, audio:2,
trigger:{player:'chooseToRespondBegin'}, trigger:{player:'chooseToRespondBegin'},
filter:function(event,player){ filter:function(event,player){
if(player.identity!='zhu') return false; if(!player.isZhu) return false;
if(event.filterCard({name:'sha'})==false) return false; if(event.filterCard({name:'sha'})==false) return false;
for(var i=0;i<game.players.length;i++){ for(var i=0;i<game.players.length;i++){
if(game.players[i]!=player&&game.players[i].group=='shu') return true; if(game.players[i]!=player&&game.players[i].group=='shu') return true;
@ -559,7 +559,7 @@ character.standard={
enable:'chooseToUse', enable:'chooseToUse',
filter:function(event,player){ filter:function(event,player){
if(event.filterCard&&!event.filterCard({name:'sha'},player)) return false; if(event.filterCard&&!event.filterCard({name:'sha'},player)) return false;
if(player!=game.zhu) return false; if(!player.isZhu) return false;
if(player!=game.me&&player.skills.contains('jijiang3')) return false; if(player!=game.me&&player.skills.contains('jijiang3')) return false;
for(var i=0;i<game.players.length;i++){ for(var i=0;i<game.players.length;i++){
if(game.players[i].group=='shu'&&game.players[i]!=player){ if(game.players[i].group=='shu'&&game.players[i]!=player){
@ -924,7 +924,7 @@ character.standard={
forced:true, forced:true,
filter:function(event,player){ filter:function(event,player){
if(event.player==player) return false; if(event.player==player) return false;
if(player.identity!='zhu') return false; if(!player.isZhu) return false;
if(player.hp>0) return false; if(player.hp>0) return false;
if(event.player.group!='wu') return false; if(event.player.group!='wu') return false;
return true; return true;

View File

@ -407,6 +407,7 @@ character.wind={
}, },
filter:function(event,player){ filter:function(event,player){
if(!game.zhu) return false; if(!game.zhu) return false;
if(!game.zhu.isZhu) return false;
return (player!=game.zhu&&game.zhu.skills.contains('huangtian')&&player.group=='qun') return (player!=game.zhu&&game.zhu.skills.contains('huangtian')&&player.group=='qun')
}, },
filterCard:function(card){ filterCard:function(card){

View File

@ -250,6 +250,7 @@ character.woods={
trigger:{player:'judgeEnd'}, trigger:{player:'judgeEnd'},
filter:function(event,player){ filter:function(event,player){
if(!game.zhu) return false; if(!game.zhu) return false;
if(!game.zhu.isZhu) return false;
return (player!=game.zhu&&game.zhu.skills.contains('songwei')&&player.group=='wei'&&get.color(event.result.card)=='black'); return (player!=game.zhu&&game.zhu.skills.contains('songwei')&&player.group=='wei'&&get.color(event.result.card)=='black');
}, },
check:function(event,player){ check:function(event,player){
@ -603,6 +604,7 @@ character.woods={
trigger:{source:'damageEnd'}, trigger:{source:'damageEnd'},
filter:function(event,player){ filter:function(event,player){
if(!game.zhu) return false; if(!game.zhu) return false;
if(!game.zhu.isZhu) return false;
return (player!=game.zhu&&game.zhu.skills.contains('baonue')&&player.group=='qun')&&game.zhu.hp<game.zhu.maxHp; return (player!=game.zhu&&game.zhu.skills.contains('baonue')&&player.group=='qun')&&game.zhu.hp<game.zhu.maxHp;
}, },
check:function(event,player){ check:function(event,player){

View File

@ -485,7 +485,7 @@
} }
}, },
show_pause:{ show_pause:{
name:'显示历史按钮', name:'显示暂停按钮',
init:true, init:true,
unfrequent:true, unfrequent:true,
onclick:function(bool){ onclick:function(bool){
@ -722,7 +722,8 @@
var node=this; var node=this;
if(node._clearing){ if(node._clearing){
localStorage.clear(); localStorage.clear();
window.location.reload(); indexedDB.deleteDatabase(lib.configprefix+'data');
game.reload();
return; return;
} }
node._clearing=true; node._clearing=true;
@ -779,6 +780,28 @@
else{ else{
map.double_nei.hide(); map.double_nei.hide();
} }
if(config.identity_mode=='zhong'){
map.player_number.hide();
map.enhance_zhu.hide();
map.double_nei.hide();
map.auto_identity.hide();
}
else{
map.player_number.show();
map.enhance_zhu.show();
map.double_nei.show();
map.auto_identity.show();
}
},
identity_mode:{
name:'游戏模式',
init:'normal',
item:{
normal:'普通',
zhong:'明忠'
},
restart:true,
frequent:true,
}, },
player_number:{ player_number:{
name:'游戏人数', name:'游戏人数',
@ -831,6 +854,7 @@
init:'off', init:'off',
onclick:function(bool){ onclick:function(bool){
game.saveConfig('auto_identity',bool,this._link.config.mode); game.saveConfig('auto_identity',bool,this._link.config.mode);
if(get.config('identity_mode')=='zhong') return;
var num; var num;
switch(bool){ switch(bool){
case '一轮':num=1;break; case '一轮':num=1;break;
@ -902,7 +926,6 @@
change_card:{ change_card:{
name:'开启手气卡', name:'开启手气卡',
init:false, init:false,
frequent:true
}, },
dierestart:{ dierestart:{
name:'死亡后显示重来', name:'死亡后显示重来',
@ -998,6 +1021,7 @@
'0':'无', '0':'无',
'1':'一张', '1':'一张',
'2':'两张', '2':'两张',
'3':'三张',
}, },
init:'2', init:'2',
frequent:true, frequent:true,
@ -1066,7 +1090,6 @@
change_card:{ change_card:{
name:'开启手气卡', name:'开启手气卡',
init:false, init:false,
frequent:true
}, },
dierestart:{ dierestart:{
name:'死亡后显示重来', name:'死亡后显示重来',
@ -1436,7 +1459,29 @@
'<li>回复体力<br>player.recover(num)<li>摸牌<br>player.draw(num)<li>获得牌<br>player.gain(cards)<li>弃牌<br>player.discard(cards)'+ '<li>回复体力<br>player.recover(num)<li>摸牌<br>player.draw(num)<li>获得牌<br>player.gain(cards)<li>弃牌<br>player.discard(cards)'+
'<li>使用卡牌<br>player.useCard(card,<br>targets)<li>死亡<br>player.die()<li>复活<br>player.revive(hp)</ul>'+ '<li>使用卡牌<br>player.useCard(card,<br>targets)<li>死亡<br>player.die()<li>复活<br>player.revive(hp)</ul>'+
'<div style="margin:10px">游戏操作</div><ul style="margin-top:0"><li>在命令输入框中输出结果<br>game.print(str)<li>游戏结束<br>game.over(bool)'+ '<div style="margin:10px">游戏操作</div><ul style="margin-top:0"><li>在命令输入框中输出结果<br>game.print(str)<li>游戏结束<br>game.over(bool)'+
'<li>角色资料<br>lib.character<li>卡牌资料<br>lib.card' '<li>角色资料<br>lib.character<li>卡牌资料<br>lib.card',
'身份模式':'<div style="margin:10px">明忠</div><ul style="margin-top:0"><li>本模式需要8名玩家进行游戏使用的身份牌为1主公、2忠臣、4反贼和1内奸。游戏开始时每名玩家随机获得一个身份由系统随机选择一名忠臣身份的玩家亮出身份将忠臣牌正面朝上放在面前其他身份包括主公的玩家不亮出身份。<li>'+
'首先由亮出身份的忠臣玩家随机获得六张武将牌,挑选一名角色,并将选好的武将牌展示给其他玩家。之后其余每名玩家随机获得三张武将牌,各自从其中挑选一张同时亮出<li>'+
'亮出身份牌的忠臣增加1点体力上限。角色濒死和死亡的结算及胜利条件与普通身份局相同。',
'战棋模式':'<div style="margin:10px">对阵</div><ul style="margin-top:0"><li>n人对战n人的模式由单人控制开始游戏后随机分配位置与出牌顺序<li>'+
'每人在出牌阶段有一次移动的机会若一名角色在移动之前使用过指定其他角色为目标的牌该回合可移动的最大距离为2否则最大距离为1<li>'+
'任何卡牌或技能无法指定位置相隔8个格以上的角色为目标<li>'+
'杀死对方阵营的角色可摸一张牌,杀死本方阵营无惩罚<li>'+
'开启交替行动后在一方所有角色行动完毕进行下一轮行动时若其人数比另一方少另一方可指定至多X名角色名摸一张牌X为人数之差</ul>'+
'<div style="margin:10px">统率</div><ul style="margin-top:0"><li>收集武将进行战斗,根据战斗难度及我方出场武将的强度,战斗胜利后将获得数量不等的金钱。没有君主出场时,获得的金钱较多<li>'+
'金钱可以用来招募随机武将,招到已有武将,或遣返不需要的武将时可得到招募令<li>'+
'战斗中有君主出场时可招降敌将成功率取决于敌将的稀有度、剩余体力值以及手牌数。成功后战斗立即结束且没有金钱奖励。每发动一次招降无论成功还是失败都会扣除10招募令<li>'+
'挑战武将会与该武将以及与其强度相近的武将进行战斗敌方人数与我方出场人数相同但不少于3。胜利后可通过招募令招募该武将<li>'+
'竞技场:<br>随机选择9名武将每次派出1〜3名武将参战。战斗中阵亡的武将不能再次上场。<br><br>战斗后武将进入疲劳状态,若立即再次出场则初始体力值-1。<br><br>战斗中本方武将行动时可召唤后援,令一名未出场的已方武将加入战斗。后援武将在战斗结束后无论存活与否均不能再次出场<br><br>当取得12场胜利或所有武将全部阵亡后结束并根据胜场数获得随机奖励',
'炉石模式':'<ul><li>游戏流程类似1v1场上有两名主将进行对抗'+
'<li>主将出牌阶段的出牌数量行动值有上限先手为2后手为3装备牌不计入出牌上限<li>游戏每进行一轮,主将的出牌上限+1超过6时减至2并重新累加'+
'<li>牌堆中随机加入总量1/3的随从牌使用之可召唤一个随从随从出场时背面朝上。每一方在场的随从数不能超过4<li>随从于摸牌阶段摸牌基数为1随从的随从牌均视为闪装备牌均视为杀<li>'+
'随从与其他所有角色相互距离基数为1<li>'+
'主将杀死对方随从后获得一个额外的行动值并摸两张牌,杀死己方随从无惩罚,随从杀死随从无效果'+
'<li>牌堆中随机加入总量1/6的法术牌效果主要与随从有关法术牌根据强度不同可能会消耗额外的行动值'+
'<li>主将可重铸随从牌但回合内总的重铸次数不能超过3随从不能重铸任何牌包括铁索等默认可以重铸的牌'+
'<li>嘲讽:若一方阵营中有嘲讽角色,则同阵营的无嘲讽角色不以能成为杀或决斗的目标'+
'<li>行动顺序为先主将后随从。主将或随从死亡后立即移出游戏主将死亡后替补登场替补登场时摸2+X张牌X为对方存活的随从数无替补时游戏结束'
}, },
setPopped:function(node,func,width,height){ setPopped:function(node,func,width,height){
node._poppedfunc=func; node._poppedfunc=func;
@ -1670,10 +1715,6 @@
db.deleteObjectStore('video'); db.deleteObjectStore('video');
} }
db.createObjectStore('video',{keyPath:'time'}); db.createObjectStore('video',{keyPath:'time'});
lib.db=db;
for(var i=0;i<lib._onDB.length;i++){
lib._onDB[i]();
}
}; };
request.onsuccess=function(e){ request.onsuccess=function(e){
var db=e.target.result; var db=e.target.result;
@ -6054,8 +6095,15 @@
}, },
$rare:function(){ $rare:function(){
game.addVideo('flame',this,'rare'); game.addVideo('flame',this,'rare');
var left=this.offsetLeft-ui.arena.offsetLeft; var left,top;
var top=this.offsetTop-ui.arena.offsetTop; if(lib.config.mode=='chess'){
left=this.offsetLeft-ui.arena.offsetLeft;
top=this.offsetTop-ui.arena.offsetTop;
}
else{
left=this.offsetLeft;
top=this.offsetTop;
}
if(this.classList.contains('minskin')){ if(this.classList.contains('minskin')){
top+=15; top+=15;
} }
@ -6064,8 +6112,15 @@
}, },
$epic:function(){ $epic:function(){
game.addVideo('flame',this,'epic'); game.addVideo('flame',this,'epic');
var left=this.offsetLeft-ui.arena.offsetLeft; var left,top;
var top=this.offsetTop-ui.arena.offsetTop; if(lib.config.mode=='chess'){
left=this.offsetLeft-ui.arena.offsetLeft;
top=this.offsetTop-ui.arena.offsetTop;
}
else{
left=this.offsetLeft;
top=this.offsetTop;
}
if(this.classList.contains('minskin')){ if(this.classList.contains('minskin')){
top+=15; top+=15;
} }
@ -6074,8 +6129,15 @@
}, },
$legend:function(){ $legend:function(){
game.addVideo('flame',this,'legend'); game.addVideo('flame',this,'legend');
var left=this.offsetLeft-ui.arena.offsetLeft; var left,top;
var top=this.offsetTop-ui.arena.offsetTop; if(lib.config.mode=='chess'){
left=this.offsetLeft-ui.arena.offsetLeft;
top=this.offsetTop-ui.arena.offsetTop;
}
else{
left=this.offsetLeft;
top=this.offsetTop;
}
if(this.classList.contains('minskin')){ if(this.classList.contains('minskin')){
top+=15; top+=15;
} }
@ -7000,6 +7062,7 @@
game.log(); game.log();
game.log(get.translation(player)+'的回合开始'); game.log(get.translation(player)+'的回合开始');
game.phaseNumber++; game.phaseNumber++;
if(get.config('identity_mode')!='zhong'){
var num; var num;
switch(get.config('auto_identity')){ switch(get.config('auto_identity')){
case 'one':num=1;break; case 'one':num=1;break;
@ -7013,6 +7076,7 @@
_status.identityShown=true; _status.identityShown=true;
game.showIdentity(false); game.showIdentity(false);
} }
}
player.ai.tempIgnore=[]; player.ai.tempIgnore=[];
player.stat.push({card:{},skill:{}}); player.stat.push({card:{},skill:{}});
}, },
@ -7520,6 +7584,19 @@
console.log(player); console.log(player);
} }
}, },
playerfocus:function(player){
if(player){
player.classList.add('playerfocus');
ui.arena.classList.add('playerfocus');
setTimeout(function(){
player.classList.remove('playerfocus');
ui.arena.classList.remove('playerfocus');
},1000);
}
else{
console.log(player);
}
},
chessSwap:function(content){ chessSwap:function(content){
var me=game.playerMap[content[0]]; var me=game.playerMap[content[0]];
var player=game.playerMap[content[1]]; var player=game.playerMap[content[1]];

View File

@ -1,4 +1,7 @@
#arena.paused,#arena.right{ #arena.paused,#arena.right,#arena.menupaused{
filter:blur(3px); filter:blur(3px);
-webkit-filter:blur(3px); -webkit-filter:blur(3px);
} }
#arena.menupaused{
opacity: 0.6;
}

View File

@ -28,6 +28,9 @@ table{table-layout: fixed;}
pointer-events: none; pointer-events: none;
position: absolute; position: absolute;
} }
#arena.playerfocus>div:not(.playerfocus){
opacity: 0.3 !important;
}
#me,#mebg{width: 100%;height: 140px;top:calc(100% - 140px);left:0;} #me,#mebg{width: 100%;height: 140px;top:calc(100% - 140px);left:0;}
#mebg{z-index:-1} #mebg{z-index:-1}
#handcards1,#handcards2{width: calc(50% - 140px);height: 127px;padding: 10px;} #handcards1,#handcards2{width: calc(50% - 140px);height: 127px;padding: 10px;}
@ -709,6 +712,7 @@ div[data-nature='firem']{
rgba(232, 53, 53,1) 0 0 5px,black 0 0 1px; rgba(232, 53, 53,1) 0 0 5px,black 0 0 1px;
} }
.player .identity[data-color="zhong"], .player .identity[data-color="zhong"],
.player .identity[data-color="mingzhong"],
.player .identity[data-color="qun"], .player .identity[data-color="qun"],
div[data-nature='metal']{ div[data-nature='metal']{
text-shadow: black 0 0 1px,rgba(255, 203, 0,1) 0 0 2px,rgba(255, 203, 0,1) 0 0 5px,rgba(255, 203, 0,1) 0 0 10px, text-shadow: black 0 0 1px,rgba(255, 203, 0,1) 0 0 2px,rgba(255, 203, 0,1) 0 0 5px,rgba(255, 203, 0,1) 0 0 10px,

View File

@ -4127,16 +4127,7 @@ mode.chess={
}, },
posmap:{}, posmap:{},
help:{ help:{
'战棋模式':'<div style="margin:10px">对阵</div><ul style="margin-top:0"><li>n人对战n人的模式由单人控制开始游戏后随机分配位置与出牌顺序<li>'+
'每人在出牌阶段有一次移动的机会若一名角色在移动之前使用过指定其他角色为目标的牌该回合可移动的最大距离为2否则最大距离为1<li>'+
'任何卡牌或技能无法指定位置相隔8个格以上的角色为目标<li>'+
'杀死对方阵营的角色可摸一张牌,杀死本方阵营无惩罚<li>'+
'开启交替行动后在一方所有角色行动完毕进行下一轮行动时若其人数比另一方少另一方可指定至多X名角色名摸一张牌X为人数之差</ul>'+
'<div style="margin:10px">统率</div><ul style="margin-top:0"><li>收集武将进行战斗,根据战斗难度及我方出场武将的强度,战斗胜利后将获得数量不等的金钱。没有君主出场时,获得的金钱较多<li>'+
'金钱可以用来招募随机武将,招到已有武将,或遣返不需要的武将时可得到招募令<li>'+
'战斗中有君主出场时可招降敌将成功率取决于敌将的稀有度、剩余体力值以及手牌数。成功后战斗立即结束且没有金钱奖励。每发动一次招降无论成功还是失败都会扣除10招募令<li>'+
'挑战武将会与该武将以及与其强度相近的武将进行战斗敌方人数与我方出场人数相同但不少于3。胜利后可通过招募令招募该武将<li>'+
'竞技场:<br>随机选择9名武将每次派出1〜3名武将参战。战斗中阵亡的武将不能再次上场。<br><br>战斗后武将进入疲劳状态,若立即再次出场则初始体力值-1。<br><br>战斗中本方武将行动时可召唤后援,令一名未出场的已方武将加入战斗。后援武将在战斗结束后无论存活与否均不能再次出场<br><br>当取得12场胜利或所有武将全部阵亡后结束并根据胜场数获得随机奖励'
}, },
config:[ config:[
function(game,lib,get,ui){ function(game,lib,get,ui){

View File

@ -37,8 +37,13 @@ mode.identity={
} }
event.finish(); event.finish();
} }
else{
if(get.config('identity_mode')=='zhong'){
game.prepareArena(8);
}
else{ else{
game.prepareArena(); game.prepareArena();
}
game.delay(); game.delay();
} }
"step 1" "step 1"
@ -49,7 +54,7 @@ mode.identity={
} }
game.chooseCharacter(); game.chooseCharacter();
"step 2" "step 2"
if(get.config('ai_identity')||game.players.length==2){ if(game.players.length==2){
game.showIdentity(true); game.showIdentity(true);
} }
else{ else{
@ -58,7 +63,12 @@ mode.identity={
} }
} }
game.zhu.ai.shown=1; game.zhu.ai.shown=1;
if(get.config('enhance_zhu')&&get.population('fan')>=3){ if(game.zhu2){
game.zhong=game.zhu;
game.zhu=game.zhu2;
delete game.zhu2;
}
if(get.config('identity_mode')!='zhong'&&get.config('enhance_zhu')&&get.population('fan')>=3){
var skill; var skill;
switch(game.zhu.name){ switch(game.zhu.name){
case 'liubei':skill='jizhen';break; case 'liubei':skill='jizhen';break;
@ -101,8 +111,8 @@ mode.identity={
_status.videoInited=true, _status.videoInited=true,
game.addVideo('init',null,info); game.addVideo('init',null,info);
game.gameDraw(game.zhu); game.gameDraw(game.zhong||game.zhu);
game.phaseLoop(game.zhu); game.phaseLoop(game.zhong||game.zhu);
} }
}, },
showIdentity:function(me){ showIdentity:function(me){
@ -111,40 +121,16 @@ mode.identity={
game.players[i].identityShown=true; game.players[i].identityShown=true;
game.players[i].ai.shown=1; game.players[i].ai.shown=1;
game.players[i].setIdentity(game.players[i].identity); game.players[i].setIdentity(game.players[i].identity);
if(game.players[i].identity=='zhu'){
game.players[i].isZhu=true;
}
} }
}, },
checkResult:function(){ checkResult:function(){
if(get.population('zhong')==0||(get.population('fan')+get.population('nei')==0)){
for(var i=0;i<game.players.length;i++){
if(game.players[i].spy=='zhong'){
game.players[i].identity='zhong';
game.players[i].setIdentity();
game.players[i].draw(2);
delete game.players[i].spy;
}
}
}
if(get.population('fan')==0||game.zhu.isDead()){
for(var i=0;i<game.players.length;i++){
if(game.players[i].spy=='fan'){
game.players[i].identity='fan';
game.players[i].setIdentity();
game.players[i].draw(2);
delete game.players[i].spy;
}
}
}
if(get.population('fan')+get.population('zhong')==0&&game.zhu.isAlive()){
for(var i=0;i<game.players.length;i++){
if(game.players[i].spy=='nei'){
game.players[i].identity='nei';
game.players[i].setIdentity();
game.players[i].draw(2);
delete game.players[i].spy;
}
}
}
if(game.zhu.isAlive()&&get.population('fan')+get.population('nei')>0) return; if(game.zhu.isAlive()&&get.population('fan')+get.population('nei')>0) return;
if(game.zhong){
game.zhong.identity='zhong';
}
if(lib.storage.test){ if(lib.storage.test){
if(game.zhu.isAlive()){ if(game.zhu.isAlive()){
console.log('主忠胜利'); console.log('主忠胜利');
@ -198,10 +184,23 @@ mode.identity={
return game.players.randomGet(game.me,game.zhu); return game.players.randomGet(game.me,game.zhu);
}; };
next.ai=function(player,list,list2){ next.ai=function(player,list,list2){
if(player.identity=='zhu'){ if(_status.event.zhongmode){
if(get.config('double_character')){
player.init(list[0],list[1]);
}
else{
player.init(list[0]);
}
if(player.identity=='mingzhong'){
player.hp++;
player.maxHp++;
player.update();
}
}
else if(player.identity=='zhu'){
list2.randomSort(); list2.randomSort();
var choice,choice2; var choice,choice2;
if(Math.random()-0.8<0&&list2.length){ if(!_status.event.zhongmode&&Math.random()-0.8<0&&list2.length){
choice=list2[0]; choice=list2[0];
choice2=list[0]; choice2=list[0];
if(choice2==choice){ if(choice2==choice){
@ -253,11 +252,19 @@ mode.identity={
var list; var list;
var list2=[]; var list2=[];
var list3=[]; var list3=[];
var identityList=lib.config.mode_config.identity.identity[game.players.length-2].slice(0); var identityList;
if(get.config('identity_mode')=='zhong'){
event.zhongmode=true;
identityList=['zhu','zhong','mingzhong','nei','fan','fan','fan','fan'];
}
else{
identityList=lib.config.mode_config.identity.identity[game.players.length-2].slice(0);
if(get.config('player_number')=='8'&&get.config('double_nei')){ if(get.config('player_number')=='8'&&get.config('double_nei')){
identityList.remove('fan'); identityList.remove('fan');
identityList.push('nei'); identityList.push('nei');
} }
}
var addSetting=function(dialog){ var addSetting=function(dialog){
dialog.add('选择身份'); dialog.add('选择身份');
var table=document.createElement('table'); var table=document.createElement('table');
@ -265,8 +272,15 @@ mode.identity={
table.style.maxWidth='500px'; table.style.maxWidth='500px';
var tr=document.createElement('tr'); var tr=document.createElement('tr');
table.appendChild(tr); table.appendChild(tr);
var list=['random','zhu','zhong','nei','fan']; var list;
for(var i=0;i<5;i++){ if(event.zhongmode){
list=['random','zhu','mingzhong','zhong','nei','fan'];
}
else{
list=['random','zhu','zhong','nei','fan'];
}
for(var i=0;i<list.length;i++){
var td=document.createElement('td'); var td=document.createElement('td');
tr.appendChild(td); tr.appendChild(td);
td.style.width='40px'; td.style.width='40px';
@ -280,6 +294,7 @@ mode.identity={
if(_status.dragged) return; if(_status.dragged) return;
if(game.zhu.name){ if(game.zhu.name){
game.zhu.uninit(); game.zhu.uninit();
delete game.zhu.isZhu;
delete game.zhu.identityShown; delete game.zhu.identityShown;
} }
dialog.close(); dialog.close();
@ -362,13 +377,24 @@ mode.identity={
for(i=0;i<game.players.length;i++){ for(i=0;i<game.players.length;i++){
game.players[i].identity=identityList[i]; game.players[i].identity=identityList[i];
game.players[i].setIdentity('cai'); game.players[i].setIdentity('cai');
if(event.zhongmode){
if(identityList[i]=='mingzhong'){
game.zhu=game.players[i];
}
else if(identityList[i]=='zhu'){
game.zhu2=game.players[i];
}
}
else{
if(identityList[i]=='zhu'){ if(identityList[i]=='zhu'){
game.zhu=game.players[i]; game.zhu=game.players[i];
} }
}
game.players[i].identityShown=false; game.players[i].identityShown=false;
} }
game.zhu.setIdentity(); game.zhu.setIdentity();
game.zhu.identityShown=true; game.zhu.identityShown=true;
game.zhu.isZhu=(game.zhu.identity=='zhu');
game.me.setIdentity(); game.me.setIdentity();
for(i in lib.character){ for(i in lib.character){
if(lib.config.forbidai.contains(i)) continue; if(lib.config.forbidai.contains(i)) continue;
@ -386,15 +412,23 @@ mode.identity={
event.list.randomSort(); event.list.randomSort();
list3.randomSort(); list3.randomSort();
var num=get.config('choice')[game.me.identity]; var num=get.config('choice')[game.me.identity];
if(event.zhongmode){
num=3;
}
if(game.zhu!=game.me){ if(game.zhu!=game.me){
event.ai(game.zhu,event.list,list2) event.ai(game.zhu,event.list,list2)
event.list.remove(game.zhu.name); event.list.remove(game.zhu.name);
event.list.remove(game.zhu.name2); event.list.remove(game.zhu.name2);
list=event.list.splice(0,num); list=event.list.splice(0,num);
} }
else{
if(event.zhongmode){
list=list3.slice(0,6);
}
else{ else{
list=list3.slice(0,num).concat(list2); list=list3.slice(0,num).concat(list2);
} }
}
var dialog=ui.create.dialog('选择角色',[list,'character']); var dialog=ui.create.dialog('选择角色',[list,'character']);
if(get.config('change_identity')){ if(get.config('change_identity')){
addSetting(dialog); addSetting(dialog);
@ -485,7 +519,7 @@ mode.identity={
} }
event.list.remove(game.me.name); event.list.remove(game.me.name);
event.list.remove(game.me.name2); event.list.remove(game.me.name2);
if(game.me.identity=='zhu'&&game.players.length>4){ if(game.me==game.zhu&&game.players.length>4){
game.me.hp++; game.me.hp++;
game.me.maxHp++; game.me.maxHp++;
game.me.update(); game.me.update();
@ -502,11 +536,13 @@ mode.identity={
translate:{ translate:{
zhu:"主", zhu:"主",
zhong:"忠", zhong:"忠",
mingzhong:"忠",
nei:"内", nei:"内",
fan:"反", fan:"反",
cai:"猜", cai:"猜",
zhu2:"主公", zhu2:"主公",
zhong2:"忠臣", zhong2:"忠臣",
mingzhong2:"明忠",
nei2:"内奸", nei2:"内奸",
fan2:"反贼", fan2:"反贼",
random2:"随机", random2:"随机",
@ -540,13 +576,29 @@ mode.identity={
} }
game.checkResult(); game.checkResult();
if(this.identity=='fan'&&source) source.draw(3); if(this.identity=='fan'&&source) source.draw(3);
else if(this.identity=='zhong'&&source&&source.identity=='zhu'){ else if(this.identity=='zhong'&&source&&source.identity=='zhu'&&source.isZhu){
source.discard(source.get('he')); source.discard(source.get('he'));
} }
if(game.zhu.storage.enhance_zhu&&get.population('fan')<3){ if(game.zhu.storage.enhance_zhu&&get.population('fan')<3){
game.zhu.removeSkill(game.zhu.storage.enhance_zhu); game.zhu.removeSkill(game.zhu.storage.enhance_zhu);
delete game.zhu.storage.enhance_zhu; delete game.zhu.storage.enhance_zhu;
} }
if(this==game.zhong){
game.zhu.identityShown=true;
game.zhu.ai.shown=1;
game.zhu.setIdentity();
game.zhu.isZhu=true;
delete game.zhong;
game.zhu.$legend();
game.delay(2);
game.zhu.classList.add('playerfocus');
ui.arena.classList.add('playerfocus');
setTimeout(function(){
game.zhu.classList.remove('playerfocus');
ui.arena.classList.remove('playerfocus');
},1000);
game.addVideo('playerfocus',game.zhu);
}
}, },
logAi:function(targets,card){ logAi:function(targets,card){
if(this.ai.shown==1) return; if(this.ai.shown==1) return;
@ -630,14 +682,21 @@ mode.identity={
realAttitude:function(from,to){ realAttitude:function(from,to){
// if(_status.currentPhase==from&&from.ai.tempIgnore&&from.ai.tempIgnore.contains(to)) return 0; // if(_status.currentPhase==from&&from.ai.tempIgnore&&from.ai.tempIgnore.contains(to)) return 0;
var situation=ai.get.situation(); var situation=ai.get.situation();
var identity=from.spy||from.identity; var identity=from.identity;
var identity2=to.identity; var identity2=to.identity;
if(from==to&&from.spy) identity2=from.spy; if(identity2=='zhu'&&!to.isZhu){
identity2='zhong';
if(from==to) return 10;
}
var zhongmode=false;
if(!game.zhu.isZhu){
zhongmode=true;
}
switch(identity){ switch(identity){
case 'zhu': case 'zhu':
switch(identity2){ switch(identity2){
case 'zhu': return 10; case 'zhu': return 10;
case 'zhong': return 6; case 'zhong':case 'mingzhong': return 6;
case 'nei': case 'nei':
if(game.players.length==2) return -10; if(game.players.length==2) return -10;
if(get.population('fan')==0) return -0.5; if(get.population('fan')==0) return -0.5;
@ -646,10 +705,10 @@ mode.identity={
case 'fan': return -4; case 'fan': return -4;
} }
break; break;
case 'zhong': case 'zhong':case 'mingzhong':
switch(identity2){ switch(identity2){
case 'zhu': return 10; case 'zhu': return 10;
case 'zhong': return 4; case 'zhong':case 'mingzhong': return 4;
case 'nei': case 'nei':
if(get.population('fan')==0) return -2; if(get.population('fan')==0) return -2;
return Math.min(3,-situation); return Math.min(3,-situation);
@ -683,6 +742,18 @@ mode.identity={
else if(game.zhu&&game.zhu.hp==2) num=-1; else if(game.zhu&&game.zhu.hp==2) num=-1;
else if(game.zhu&&game.zhu.hp<=2&&situation>1) num=-1; else if(game.zhu&&game.zhu.hp<=2&&situation>1) num=-1;
else num=-2; else num=-2;
if(zhongmode&&situation<2){
num=4;
}
if(strategy==2) num--;
if(strategy==3) num++;
return num;
case 'mingzhong':
if(strategy==5) return Math.min(0,-situation);
if(strategy==6) return Math.max(-1,-situation);
if(get.population('fan')==0) num=-5;
else if(situation<=0) num=0;
else num=-3;
if(strategy==2) num--; if(strategy==2) num--;
if(strategy==3) num++; if(strategy==3) num++;
return num; return num;
@ -695,7 +766,7 @@ mode.identity={
if(strategy==5) return Math.max(-1,situation); if(strategy==5) return Math.max(-1,situation);
if(strategy==6) return Math.min(0,situation); if(strategy==6) return Math.min(0,situation);
if((game.zhu&&game.zhu.hp<=2&&situation<0)||situation<-1) num=-3; if((game.zhu&&game.zhu.hp<=2&&situation<0)||situation<-1) num=-3;
else if(situation<0||get.population('zhong')==0) num=-2; else if(situation<0||get.population('zhong')+get.population('mingzhong')==0) num=-2;
else if((game.zhu&&game.zhu.hp>=4&&situation>0)||situation>1) num=1; else if((game.zhu&&game.zhu.hp>=4&&situation>0)||situation>1) num=1;
else num=0; else num=0;
if(strategy==2) num++; if(strategy==2) num++;
@ -712,8 +783,9 @@ mode.identity={
} }
return -10; return -10;
case 'zhong': return -7; case 'zhong': return -7;
case 'mingzhong':return -5;
case 'nei': case 'nei':
if(get.population('zhong')==0) return -7; if(get.population('zhong')+get.population('mingzhong')==0) return -7;
if(game.zhu&&game.zhu.hp<=2) return -1; if(game.zhu&&game.zhu.hp<=2) return -1;
return Math.min(3,situation); return Math.min(3,situation);
case 'fan': return 5; case 'fan': return 5;
@ -735,7 +807,7 @@ mode.identity={
total+=j*1.2+5; total+=j*1.2+5;
zhu=j; zhu=j;
} }
else if(player.identity=='zhong'){ else if(player.identity=='zhong'||player.identity=='mingzhong'){
zhuzhong+=j*0.8+3; zhuzhong+=j*0.8+3;
total+=j*0.8+3; total+=j*0.8+3;
} }
@ -748,9 +820,11 @@ mode.identity={
if(absolute) return zhuzhong; if(absolute) return zhuzhong;
var result=parseInt(10*Math.abs(zhuzhong/total)); var result=parseInt(10*Math.abs(zhuzhong/total));
if(zhuzhong<0) result=-result; if(zhuzhong<0) result=-result;
if(!game.zhong){
if(zhu<12&&fan>30) result--; if(zhu<12&&fan>30) result--;
if(zhu<6&&fan>15) result--; if(zhu<6&&fan>15) result--;
if(zhu<4) result--; if(zhu<4) result--;
}
return result; return result;
}, },
population:function(identity){ population:function(identity){
@ -765,6 +839,16 @@ mode.identity={
_status.clicked=true; _status.clicked=true;
if(this.parentNode.identityShown) return; if(this.parentNode.identityShown) return;
if(this.parentNode==game.me) return; if(this.parentNode==game.me) return;
if(get.config('identity_mode')=='zhong'){
switch(this.firstChild.innerHTML){
case '猜':this.firstChild.innerHTML='反';this.dataset.color='fan';break;
case '反':this.firstChild.innerHTML='忠';this.dataset.color='zhong';break;
case '忠':this.firstChild.innerHTML='内';this.dataset.color='nei';break;
case '内':this.firstChild.innerHTML='主';this.dataset.color='zhu';break;
case '主':this.firstChild.innerHTML='猜';this.dataset.color='cai';break;
}
}
else{
switch(this.firstChild.innerHTML){ switch(this.firstChild.innerHTML){
case '猜':this.firstChild.innerHTML='反';this.dataset.color='fan';break; case '猜':this.firstChild.innerHTML='反';this.dataset.color='fan';break;
case '反':this.firstChild.innerHTML='忠';this.dataset.color='zhong';break; case '反':this.firstChild.innerHTML='忠';this.dataset.color='zhong';break;
@ -773,6 +857,7 @@ mode.identity={
} }
} }
} }
}
}, },
config:['player_number','double_character','double_hp', config:['player_number','double_character','double_hp',
'ban_weak','enhance_zhu','free_choose','change_identity', 'ban_weak','enhance_zhu','free_choose','change_identity',

View File

@ -1538,14 +1538,6 @@ mode.stone={
}, },
config:['battle_number','double_character','double_hp','ban_weak','free_choose','change_choice'], config:['battle_number','double_character','double_hp','ban_weak','free_choose','change_choice'],
help:{ help:{
'炉石模式':'<ul><li>游戏流程类似1v1场上有两名主将进行对抗'+
'<li>主将出牌阶段的出牌数量行动值有上限先手为2后手为3装备牌不计入出牌上限<li>游戏每进行一轮,主将的出牌上限+1超过6时减至2并重新累加'+
'<li>牌堆中随机加入总量1/3的随从牌使用之可召唤一个随从随从出场时背面朝上。每一方在场的随从数不能超过4<li>随从于摸牌阶段摸牌基数为1随从的随从牌均视为闪装备牌均视为杀<li>'+
'随从与其他所有角色相互距离基数为1<li>'+
'主将杀死对方随从后获得一个额外的行动值并摸两张牌,杀死己方随从无惩罚,随从杀死随从无效果'+
'<li>牌堆中随机加入总量1/6的法术牌效果主要与随从有关法术牌根据强度不同可能会消耗额外的行动值'+
'<li>主将可重铸随从牌但回合内总的重铸次数不能超过3随从不能重铸任何牌包括铁索等默认可以重铸的牌'+
'<li>嘲讽:若一方阵营中有嘲讽角色,则同阵营的无嘲讽角色不以能成为杀或决斗的目标'+
'<li>行动顺序为先主将后随从。主将或随从死亡后立即移出游戏主将死亡后替补登场替补登场时摸2+X张牌X为对方存活的随从数无替补时游戏结束'
} }
} }