mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
初级预选
This commit is contained in:
parent
d11bf58cb4
commit
574651e91f
|
@ -522,7 +522,8 @@ function doIndicate(from, tos) {
|
|||
|
||||
function getPlayerStr(playerid) {
|
||||
const photo = getPhoto(playerid);
|
||||
if (photo.general === "anjiang" && (photo.deputyGeneral === "anjiang" || !p.deputyGeneral)) {
|
||||
if (photo.general === "anjiang" &&
|
||||
(photo.deputyGeneral === "anjiang" || !p.deputyGeneral)) {
|
||||
return luatr("seat#" + photo.seatNumber);
|
||||
}
|
||||
|
||||
|
@ -639,14 +640,20 @@ function enableTargets(card) {
|
|||
}
|
||||
|
||||
if (candidate) {
|
||||
const data = {
|
||||
ok_enabled: false,
|
||||
enabled_targets: []
|
||||
}
|
||||
const preselected_targets = lcall("CardPreselectedTarget", card,
|
||||
JSON.stringify(roomScene.extra_data));
|
||||
preselected_targets.forEach(id => {
|
||||
const photo = getPhoto(id);
|
||||
photo.selected = true;
|
||||
})
|
||||
|
||||
all_photos.forEach(photo => {
|
||||
photo.state = "candidate";
|
||||
const id = photo.playerid;
|
||||
if (photo.selected) {
|
||||
photo.selectable = false;
|
||||
return;
|
||||
}
|
||||
const ret = lcall("CanUseCardToTarget", card, id, selected_targets,
|
||||
JSON.stringify(roomScene.extra_data));
|
||||
photo.selectable = ret;
|
||||
|
@ -754,16 +761,22 @@ function updateSelectedTargets(playerid, selected) {
|
|||
|
||||
roomScene.resetPrompt(); // update prompt due to selected_targets
|
||||
const prompt = lcall("ActiveSkillPrompt",
|
||||
dashboard.pending_skill !== "" ? dashboard.pending_skill: lcall("GetCardSkill", card),
|
||||
dashboard.pending_skill !== "" ? dashboard.pending_skill:
|
||||
lcall("GetCardSkill", card),
|
||||
dashboard.pending_skill !== "" ? dashboard.pendings : [card],
|
||||
selected_targets);
|
||||
if (prompt !== "") {
|
||||
roomScene.setPrompt(Util.processPrompt(prompt));
|
||||
}
|
||||
const preselected_targets = lcall("CardPreselectedTarget", card,
|
||||
JSON.stringify(roomScene.extra_data));
|
||||
|
||||
all_photos.forEach(photo => {
|
||||
if (photo.selected) return;
|
||||
const id = photo.playerid;
|
||||
if (photo.selected) {
|
||||
if (preselected_targets.includes(id)) photo.selectable = false;
|
||||
return;
|
||||
}
|
||||
const ret = lcall("CanUseCardToTarget", card, id, selected_targets,
|
||||
JSON.stringify(roomScene.extra_data));
|
||||
photo.selectable = ret;
|
||||
|
@ -1250,7 +1263,8 @@ callbacks["AskForCardsChosen"] = (data) => {
|
|||
const reason = data._reason;
|
||||
const prompt = data._prompt;
|
||||
if (prompt === "") {
|
||||
roomScene.promptText = luatr(processPrompt("#AskForChooseCards:" + data._id))
|
||||
roomScene.promptText = luatr(processPrompt(
|
||||
"#AskForChooseCards:" + data._id))
|
||||
.arg(luatr(reason)).arg(min).arg(max);
|
||||
} else {
|
||||
roomScene.setPrompt(processPrompt(prompt), true);
|
||||
|
|
|
@ -108,19 +108,35 @@ local analepticSkill = fk.CreateActiveSkill{
|
|||
name = "analeptic_skill",
|
||||
prompt = "#analeptic_skill",
|
||||
max_turn_use_time = 1,
|
||||
mod_target_filter = function(self, to_select, _, _, card, _)
|
||||
return not table.find(Fk:currentRoom().alive_players, function(p)
|
||||
target_num = 1,
|
||||
mod_target_filter = function(self, to_select, selected, _, card, _)
|
||||
return #selected == 0 or not table.find(Fk:currentRoom().alive_players, function(p)
|
||||
return p.dying
|
||||
end)
|
||||
end,
|
||||
can_use = function(self, player, card, extra_data)
|
||||
return not player:isProhibited(player, card) and ((extra_data and (extra_data.bypass_times or extra_data.analepticRecover)) or
|
||||
self:withinTimesLimit(player, Player.HistoryTurn, card, "analeptic", player))
|
||||
end,
|
||||
on_use = function(_, _, use)
|
||||
if not use.tos or #TargetGroup:getRealTargets(use.tos) == 0 then
|
||||
use.tos = { { use.from } }
|
||||
target_filter = function(self, to_select, selected, selected_cards, card, extra_data)
|
||||
if #selected < self:getMaxTargetNum(Self, card) then
|
||||
local player = Fk:currentRoom():getPlayerById(to_select)
|
||||
return self:modTargetFilter(to_select, selected, Self.id, card) and
|
||||
(
|
||||
#selected > 0 or
|
||||
Self.phase ~= Player.Play or
|
||||
(extra_data and extra_data.bypass_times) or
|
||||
self:withinTimesLimit(Self, Player.HistoryTurn, card, "analeptic", player)
|
||||
)
|
||||
end
|
||||
end,
|
||||
preselected = function(self, selected_cards, card, player, extra_data)
|
||||
return { Self.id }
|
||||
end,
|
||||
-- can_use = function(self, player, card, extra_data)
|
||||
-- return not player:isProhibited(player, card) and ((extra_data and (extra_data.bypass_times or extra_data.analepticRecover)) or
|
||||
-- self:withinTimesLimit(player, Player.HistoryTurn, card, "analeptic", player))
|
||||
-- end,
|
||||
on_use = function(_, _, use)
|
||||
-- if not use.tos or #TargetGroup:getRealTargets(use.tos) == 0 then
|
||||
-- use.tos = { { use.from } }
|
||||
-- end
|
||||
|
||||
if use.extra_data and use.extra_data.analepticRecover then
|
||||
use.extraUse = true
|
||||
|
|
Loading…
Reference in New Issue
Block a user