修exp,修铁锁重铸,优化卡牌点亮
This commit is contained in:
parent
9876becf2e
commit
1377d859ba
|
@ -269,7 +269,9 @@ Item {
|
|||
|
||||
if (typeof card === "number" && card !== -1 && roomScene.state === "playing") {
|
||||
let skills = JSON.parse(Backend.callLuaFunction("GetCardSpecialSkills", [card]));
|
||||
skills.unshift("_normal_use");
|
||||
if (JSON.parse(Backend.callLuaFunction("CanUseCard", [card, Self.id]))) {
|
||||
skills.unshift("_normal_use");
|
||||
}
|
||||
specialCardSkills.model = skills;
|
||||
} else {
|
||||
specialCardSkills.model = [];
|
||||
|
@ -359,7 +361,7 @@ Item {
|
|||
anchors.rightMargin: 20
|
||||
color: "#88EEEEEE"
|
||||
radius: 8
|
||||
visible: roomScene.state == "playing" && specialCardSkills.count > 1
|
||||
visible: roomScene.state == "playing" && (specialCardSkills.count > 1 || specialCardSkills.model[0] !== "_normal_use")
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height - 20
|
||||
|
||||
|
@ -680,6 +682,10 @@ Item {
|
|||
}
|
||||
|
||||
function getCurrentCardUseMethod() {
|
||||
if (specialCardSkills.count === 1 && specialCardSkills.model[0] !== "_normal_use") {
|
||||
return specialCardSkills.model[0];
|
||||
}
|
||||
|
||||
for (let i = 1; i < specialCardSkills.count; i++) {
|
||||
let item = specialCardSkills.itemAt(i);
|
||||
if (item.checked) {
|
||||
|
|
|
@ -198,8 +198,19 @@ RowLayout {
|
|||
|
||||
let ids = [], cards = handcardAreaItem.cards;
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
if (JSON.parse(Backend.callLuaFunction("CanUseCard", [cards[i].cid, Self.id])))
|
||||
if (JSON.parse(Backend.callLuaFunction("CanUseCard", [cards[i].cid, Self.id]))) {
|
||||
ids.push(cards[i].cid);
|
||||
} else {
|
||||
// cannot use? considering special_skills
|
||||
let skills = JSON.parse(Backend.callLuaFunction("GetCardSpecialSkills", [cards[i].cid]));
|
||||
for (let j = 0; j < skills.length; j++) {
|
||||
let s = skills[j];
|
||||
if (JSON.parse(Backend.callLuaFunction("ActiveCanUse", [s]))) {
|
||||
ids.push(cards[i].cid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
handcardAreaItem.enableCards(ids)
|
||||
if (pending_skill === "") {
|
||||
|
|
|
@ -196,6 +196,17 @@ function CanUseCard(card, player)
|
|||
player = ClientInstance:getPlayerById(player)
|
||||
local ret = c.skill:canUse(player, c)
|
||||
ret = ret and not player:prohibitUse(c)
|
||||
if ret then
|
||||
local min_target = c.skill:getMinTargetNum()
|
||||
if min_target > 0 then
|
||||
for _, p in ipairs(ClientInstance.players) do
|
||||
if c.skill:targetFilter(p.id, {}, {}, c) then
|
||||
return "true"
|
||||
end
|
||||
end
|
||||
return "false"
|
||||
end
|
||||
end
|
||||
return json.encode(ret)
|
||||
end
|
||||
|
||||
|
@ -298,7 +309,11 @@ function ActiveCanUse(skill_name)
|
|||
local exp = Exppattern:Parse(skill.pattern)
|
||||
local cnames = {}
|
||||
for _, m in ipairs(exp.matchers) do
|
||||
if m.name then table.insertTable(cnames, m.name) end
|
||||
if m.name then
|
||||
table.insertTable(cnames, m.name)
|
||||
elseif m.trueName then
|
||||
table.insertTable(cnames, m.trueName)
|
||||
end
|
||||
end
|
||||
for _, n in ipairs(cnames) do
|
||||
local c = Fk:cloneCard(n)
|
||||
|
|
Loading…
Reference in New Issue