parent
5228991930
commit
fcddd36a6d
|
@ -306,7 +306,7 @@ function Player:getMaxCards()
|
||||||
|
|
||||||
for _, skill in ipairs(status_skills) do
|
for _, skill in ipairs(status_skills) do
|
||||||
local c = skill:getCorrect(self)
|
local c = skill:getCorrect(self)
|
||||||
baseValue = baseValue + c
|
baseValue = baseValue + (c or 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
return math.max(baseValue, 0)
|
return math.max(baseValue, 0)
|
||||||
|
|
|
@ -194,6 +194,10 @@ GameEvent.functions[GameEvent.ChangeMaxHp] = function(self)
|
||||||
|
|
||||||
player.maxHp = math.max(player.maxHp + num, 0)
|
player.maxHp = math.max(player.maxHp + num, 0)
|
||||||
self:broadcastProperty(player, "maxHp")
|
self:broadcastProperty(player, "maxHp")
|
||||||
|
if player.maxHp == 0 then
|
||||||
|
self:killPlayer({ who = player.id })
|
||||||
|
end
|
||||||
|
|
||||||
local diff = player.hp - player.maxHp
|
local diff = player.hp - player.maxHp
|
||||||
if diff > 0 then
|
if diff > 0 then
|
||||||
if not self:changeHp(player, -diff) then
|
if not self:changeHp(player, -diff) then
|
||||||
|
@ -201,10 +205,6 @@ GameEvent.functions[GameEvent.ChangeMaxHp] = function(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if player.maxHp == 0 then
|
|
||||||
self:killPlayer({ who = player.id })
|
|
||||||
end
|
|
||||||
|
|
||||||
self.logic:trigger(fk.MaxHpChanged, player, { num = num })
|
self.logic:trigger(fk.MaxHpChanged, player, { num = num })
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
|
@ -1808,7 +1808,7 @@ function Room:handleAddLoseSkills(player, skill_names, source_skill, sendlog, no
|
||||||
s.name
|
s.name
|
||||||
})
|
})
|
||||||
|
|
||||||
if sendlog then
|
if sendlog and s.visible then
|
||||||
self:sendLog{
|
self:sendLog{
|
||||||
type = "#LoseSkill",
|
type = "#LoseSkill",
|
||||||
from = player.id,
|
from = player.id,
|
||||||
|
@ -1833,7 +1833,7 @@ function Room:handleAddLoseSkills(player, skill_names, source_skill, sendlog, no
|
||||||
s.name
|
s.name
|
||||||
})
|
})
|
||||||
|
|
||||||
if sendlog then
|
if sendlog and s.visible then
|
||||||
self:sendLog{
|
self:sendLog{
|
||||||
type = "#AcquireSkill",
|
type = "#AcquireSkill",
|
||||||
from = player.id,
|
from = player.id,
|
||||||
|
|
|
@ -460,13 +460,11 @@ function ServerPlayer:addToPile(pile_name, card, visible, skillName)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ServerPlayer:bury()
|
function ServerPlayer:bury()
|
||||||
-- self:clearFlags()
|
self:setCardUseHistory("")
|
||||||
-- self:clearHistory()
|
self:setSkillUseHistory("")
|
||||||
self:throwAllCards()
|
self:throwAllCards()
|
||||||
-- self:throwAllMarks()
|
self:throwAllMarks()
|
||||||
-- self:clearPiles()
|
self:clearPiles()
|
||||||
|
|
||||||
-- self.room:clearPlayerCardLimitation(self, false)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ServerPlayer:throwAllCards(flag)
|
function ServerPlayer:throwAllCards(flag)
|
||||||
|
@ -485,6 +483,18 @@ function ServerPlayer:throwAllCards(flag)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ServerPlayer:throwAllMarks()
|
||||||
|
for name, _ in pairs(self.mark) do
|
||||||
|
self.room:setPlayerMark(self, name, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ServerPlayer:clearPiles()
|
||||||
|
for _, ids in pairs(self.special_cards) do
|
||||||
|
self.room:throwCard(ids, "", self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function ServerPlayer:addVirtualEquip(card)
|
function ServerPlayer:addVirtualEquip(card)
|
||||||
Player.addVirtualEquip(self, card)
|
Player.addVirtualEquip(self, card)
|
||||||
self.room:doBroadcastNotify("AddVirtualEquip", json.encode{
|
self.room:doBroadcastNotify("AddVirtualEquip", json.encode{
|
||||||
|
|
|
@ -149,6 +149,7 @@ Item {
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.NoButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.NoButton
|
||||||
|
gesturePolicy: TapHandler.WithinBounds
|
||||||
|
|
||||||
onTapped: (p, btn) => {
|
onTapped: (p, btn) => {
|
||||||
if (btn === Qt.LeftButton || btn === Qt.NoButton) {
|
if (btn === Qt.LeftButton || btn === Qt.NoButton) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import "../skin-bank.js" as SkinBank
|
||||||
CardItem {
|
CardItem {
|
||||||
property string kingdom
|
property string kingdom
|
||||||
property int hp
|
property int hp
|
||||||
|
property int maxHp
|
||||||
name: ""
|
name: ""
|
||||||
// description: Sanguosha.getGeneralDescription(name)
|
// description: Sanguosha.getGeneralDescription(name)
|
||||||
suit: ""
|
suit: ""
|
||||||
|
@ -36,15 +37,15 @@ CardItem {
|
||||||
y: 4
|
y: 4
|
||||||
spacing: 1
|
spacing: 1
|
||||||
Repeater {
|
Repeater {
|
||||||
model: hp > 5 ? 1 : hp
|
model: (hp > 5 || hp !== maxHp) ? 1 : hp
|
||||||
Image {
|
Image {
|
||||||
source: SkinBank.GENERALCARD_DIR + kingdom + "-magatama"
|
source: SkinBank.GENERALCARD_DIR + kingdom + "-magatama"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
visible: hp > 5
|
visible: hp > 5 || hp !== maxHp
|
||||||
text: "x" + hp
|
text: hp === maxHp ? ("x" + hp) : (" " + hp + "/" + maxHp)
|
||||||
color: "white"
|
color: "white"
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
style: Text.Outline
|
style: Text.Outline
|
||||||
|
@ -84,5 +85,6 @@ CardItem {
|
||||||
let data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
let data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
||||||
kingdom = data.kingdom;
|
kingdom = data.kingdom;
|
||||||
hp = data.hp;
|
hp = data.hp;
|
||||||
|
maxHp = data.maxHp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ Flickable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let i = 0; i < not_active_skills.count; i++) {
|
for (let i = 0; i < not_active_skills.count; i++) {
|
||||||
let item = not_active_skills.at(i);
|
let item = not_active_skills.get(i);
|
||||||
if (item.orig_skill == skill_name) {
|
if (item.orig_skill == skill_name) {
|
||||||
not_active_skills.remove(i);
|
not_active_skills.remove(i);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue