This commit is contained in:
libccy 2018-03-05 10:13:03 +08:00
parent abbe8b9cde
commit 6550bff7b5
2 changed files with 94 additions and 15 deletions

View File

@ -260,38 +260,98 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{player:'phaseUseBegin'}, trigger:{player:'phaseUseBegin'},
forced:true, forced:true,
video:function(player,data){ video:function(player,data){
var skill=data[0]; var skills=data[0];
var name=data[1]; var name=data[1];
lib.skill.hsnitai.process(skill,name); lib.skill.hsnitai.process(skills,name);
}, },
onremove:function(player){ onremove:function(player){
player.removeSkill('hsnitai_card'); player.removeSkill('hsnitai_card');
}, },
process:function(skill,name){ process:function(skills,name){
var cardname='hsnitai_'+skill; var cardname='hsnitai_'+name;
lib.translate[cardname]=lib.translate[skill]; lib.translate[cardname]=lib.translate[name];
lib.translate[cardname+'_info']='出牌阶段对自己使用,获得技能'+lib.translate[skill]+'替换前一个以此法获得的技能效果持续2回合'; lib.translate[cardname+'_info']='出牌阶段对自己使用,获得'+get.translation(name)+'的一个技能替换前一个以此法获得的技能效果持续2回合';
lib.translate[cardname+'_append']='<div class="skill">【'+lib.translate[skill]+'】</div><div>'+ lib.translate[cardname+'_append']='';
get.skillInfoTranslation(skill)+'</div>'; for(var i=0;i<skills.length;i++){
lib.translate[cardname+'_append']+='<div class="skill">【'+lib.translate[skills[i]]+'】</div><div>'+
get.skillInfoTranslation(skills[i])+'</div>';
if(i<skills.length){
lib.translate[cardname+'_append']+='<br>'
}
}
lib.card[cardname]=lib.card[cardname]||{ lib.card[cardname]=lib.card[cardname]||{
enable:true, enable:true,
type:'character', type:'character',
image:'character/'+name, image:'character/'+name,
fullimage:true, fullimage:true,
vanish:true, vanish:true,
skills:skills,
derivation:'hs_barnes', derivation:'hs_barnes',
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
return player==target; return player==target;
}, },
selectTarget:-1, selectTarget:-1,
content:function(){ content:function(){
var skill=card.name.slice(8); 'step 0'
var list=lib.card[card.name].skills;
for(var i=0;i<list.length;i++){
if(target.hasSkill(list[i])){
list.splice(i--,1);
}
}
if(!list.length){
event.finish();
return;
}
if(list.length==1){
event._result=list[0];
}
else if(event.isMine()){
var dialog=ui.create.dialog('forcebutton');
dialog.add('选择获得一项技能');
var clickItem=function(){
_status.event._result=this.link;
dialog.close();
game.resume();
};
for(var i=0;i<list.length;i++){
if(lib.translate[list[i]+'_info']){
var translation=get.translation(list[i]);
if(translation[0]=='新'&&translation.length==3){
translation=translation.slice(1,3);
}
else{
translation=translation.slice(0,2);
}
var item=dialog.add('<div class="popup pointerdiv" style="width:80%;display:inline-block"><div class="skill">【'+
translation+'】</div><div>'+lib.translate[list[i]+'_info']+'</div></div>');
item.firstChild.addEventListener('click',clickItem);
item.firstChild.link=list[i];
}
}
dialog.add(ui.create.div('.placeholder'));
event.switchToAuto=function(){
event._result=event.skillai();
dialog.close();
game.resume();
};
_status.imchoosing=true;
game.pause();
}
else{
event._result=event.skillai();
}
'step 1'
var skill=result;
if(!target.hasSkill(skill)){ if(!target.hasSkill(skill)){
player.popup(skill);
target.$gain2(card); target.$gain2(card);
target.removeSkill('hsnitai_card'); target.removeSkill('hsnitai_card');
target.storage.hsnitai_card=card; target.storage.hsnitai_card=card;
target.storage.hsnitai_card_count=1; target.storage.hsnitai_card_count=1;
target.storage.hsnitai_card_skill=skill;
player.syncStorage('hsnitai_card'); player.syncStorage('hsnitai_card');
player.syncStorage('hsnitai_card_skill');
target.addAdditionalSkill('hsnitai_card',skill); target.addAdditionalSkill('hsnitai_card',skill);
target.addSkill('hsnitai_card'); target.addSkill('hsnitai_card');
game.log(target,'获得技能','【'+get.translation(skill)+'】'); game.log(target,'获得技能','【'+get.translation(skill)+'】');
@ -331,17 +391,25 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return; return;
} }
var name=source.randomGet(); var name=source.randomGet();
game.addVideo('skill',player,['hsnitai',[skill,name]]); var skills=[skill];
lib.skill.hsnitai.process(skill,name); var nameskills=lib.characterPack.hearth[name][3]
player.gain(game.createCard('hsnitai_'+skill),'gain2'); for(var i=0;i<nameskills.length;i++){
if(list.contains(nameskills[i])){
skills.add(nameskills[i]);
}
}
game.addVideo('skill',player,['hsnitai',[skills,name]]);
lib.skill.hsnitai.process(skills,name);
player.gain(game.createCard('hsnitai_'+name),'gain2');
}, },
subSkill:{ subSkill:{
card:{ card:{
mark:'card', mark:'card',
onremove:['hsnitai_card','hsnitai_card_count'], onremove:['hsnitai_card','hsnitai_card_count','hsnitai_card_skill'],
intro:{ intro:{
content:function(storage){ content:function(storage,player){
var skill=storage.name.slice(8); var skill=player.storage.hsnitai_card_skill;
// var skill=storage.name.slice(8);
return '<div class="skill">【'+lib.translate[skill]+'】</div><div>'+ return '<div class="skill">【'+lib.translate[skill]+'】</div><div>'+
get.skillInfoTranslation(skill)+'</div>'; get.skillInfoTranslation(skill)+'</div>';
} }

View File

@ -44000,6 +44000,17 @@
} }
return str2; return str2;
}, },
rawName2:function(str){
var str2=lib.translate[str];
if(!str2) return '';
if(str2.indexOf('sp')==0){
str2=str2.slice(2);
}
else if(str2.indexOf('界sp')==0){
str2=str2.slice(3);
}
return str2;
},
slimName:function(str){ slimName:function(str){
var str2=lib.translate[str]; var str2=lib.translate[str];
if(!str2) return ''; if(!str2) return '';