给无名杀贴吧吧友设计的设伏
skill=
{
trigger:
{
player:
"phaseJieshuBegin",
},
direct:
true,
audio:"ext:九州录:2",
init:function(player) {
if (!player.storage.shefu) player.storage.shefu =[];
if (!player.storage.shefu2) player.storage.shefu2 =[];
},
filter:
function(event, player) {
return player.countCards('he') > 0;
},
onremove:
function(player, skill) {
var cards = player.getExpansions(skill);
if (cards.length) player.loseToDiscardpile(cards);
},
intro:
{
content:
"cards",
onunmark:function(storage, player) {
player.storage.shefu =[];
player.storage.shefu2 =[];
},
mark:
function(dialog, content, player) {
if (content && content.length) {
dialog.addAuto(content);
if (player.isUnderControl(true)) {
var str = '';
for (var i = 0; i < player.storage.shefu2.length; i++) {
str += get.translation(player.storage.shefu2[i]);
if (i < player.storage.shefu2.length - 1) {
str += '、';
}
}
dialog.add('<div class="text center">' + str + '</div>')
}
}
},
},
content:
function() {
'step 0'
event.num = player.hp - 1;
'step 1'
var list1 =[],list2 =[],list3 =[];
for (var i = 0; i < lib.inpile.length; i++) {
var type = get.type(lib.inpile[i]);
if (type == 'basic') {
list1.push(['基本', '', lib.inpile[i]]);
} else if (type == 'trick') {
list2.push(['锦囊', '', lib.inpile[i]]);
} else if (type == 'delay') {
list3.push(['锦囊', '', lib.inpile[i]]);
}
}
player.chooseButton([get.prompt('shefu'),[list1.concat(list2).concat(list3), 'vcard']]).
set('filterButton', function(button) {
var player = _status.event.player;
if (player.storage.shefu2 && player.storage.shefu2.contains(button.link[2])) return false;
return true;
}).set('ai', function(button) {
var rand = _status.event.rand;
switch (button.link[2]) {
case 'sha':
return 5 + rand[1];
case 'tao':
return 4 + rand[2];
case 'lebu':
return 3 + rand[3];
case 'shan':
return 4.5 + rand[4];
case 'wuzhong':
return 4 + rand[5];
case 'shunshou':
return 3 + rand[6];
case 'nanman':
return 2 + rand[7];
case 'wanjian':
return 2 + rand[8];
default:
return rand[0];
}
}).set('rand',[Math.random(), Math.random(), Math.random(), Math.random(),
Math.random(), Math.random(), Math.random(), Math.random(), Math.random()]);
'step 2'
if (result.bool) {
event.cardname = result.links[0][2];
player.logSkill('shefu');
player.chooseCard('he', '选择一张牌作为“伏兵”', true);
} else {
event.finish();
}
'step 3'
if (result.bool) {
var card = result.cards[0];
event.card = card;
player.addToExpansion(card, player, 'give').gaintag.add('shefu');
}
'step 4'
if (player.getExpansions('shefu').contains(event.card)) {
player.storage.shefu.push(card);
player.storage.shefu2.push(event.cardname);
if (player.isOnline2()) {
player.send(function(storage) {
game.me.storage.shefu2 = storage;
},player.storage.shefu2);
}
player.syncStorage('shefu');
player.markSkill('shefu');
}
'step 5'
if (event.num != 0) {
event.num--;
event.goto(1);
}
},
group:["shefu2"],
}