LogEdit, Card.Void, aux_skills (#147)

Card.Void, aux_skills, move card reason, clone card attackrange
This commit is contained in:
RalphRad 2023-05-13 14:16:09 +08:00 committed by GitHub
parent 8d87fbbf09
commit 5e9505d18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 15 deletions

View File

@ -137,6 +137,7 @@ function Card:clone(suit, number)
newCard.skill = self.skill newCard.skill = self.skill
newCard.special_skills = self.special_skills newCard.special_skills = self.special_skills
newCard.equip_skill = self.equip_skill newCard.equip_skill = self.equip_skill
newCard.attack_range = self.attack_range
newCard.is_damage_card = self.is_damage_card newCard.is_damage_card = self.is_damage_card
return newCard return newCard
end end

View File

@ -210,7 +210,7 @@ GameEvent.cleaners[GameEvent.UseCard] = function(self)
self:moveCards({ self:moveCards({
ids = leftRealCardIds, ids = leftRealCardIds,
toArea = Card.DiscardPile, toArea = Card.DiscardPile,
moveReason = fk.ReasonPutIntoDiscardPile, moveReason = fk.ReasonUse,
}) })
end end
end end
@ -271,7 +271,7 @@ GameEvent.cleaners[GameEvent.RespondCard] = function(self)
self:moveCards({ self:moveCards({
ids = realCardIds, ids = realCardIds,
toArea = Card.DiscardPile, toArea = Card.DiscardPile,
moveReason = fk.ReasonPutIntoDiscardPile, moveReason = fk.ReasonResonpse,
}) })
end end
end end

View File

@ -249,7 +249,7 @@ local fireAttackSkill = fk.CreateActiveSkill{
from = from, from = from,
to = to, to = to,
card = cardEffectEvent.card, card = cardEffectEvent.card,
damage = 1, damage = 1 + (cardEffectEvent.additionalDamage or 0),
damageType = fk.FireDamage, damageType = fk.FireDamage,
skillName = self.name skillName = self.name
}) })

View File

@ -70,8 +70,39 @@ local choosePlayersSkill = fk.CreateActiveSkill{
max_target_num = function(self) return self.num end, max_target_num = function(self) return self.num end,
} }
local maxCardsSkill = fk.CreateMaxCardsSkill{
name = "max_cards_skill",
global = true,
correct_func = function(self, player)
return player:getMark("AddMaxCards") + player:getMark("AddMaxCards-turn") - player:getMark("MinusMaxCards") - player:getMark("MinusMaxCards-turn")
end,
}
local moveTokenSkill = fk.CreateTriggerSkill{
name = "move_token_skill",
global = true,
refresh_events = {fk.GameStart}, --refresh优先于on_use不要在正常的游戏开始发牌技能refresh中拿牌
can_refresh = function(self, event, target, player, data)
return player.seat == 1
end,
on_refresh = function(self, event, target, player, data)
local room = player.room
for i = #room.draw_pile, 1, -1 do
if Fk:getCardById(room.draw_pile[i]).name[1] == "&" then
local id = room.draw_pile[i]
table.removeOne(room.draw_pile, id)
table.insert(room.void, id)
room:setCardArea(id, Card.Void, nil)
end
end
end,
}
AuxSkills = { AuxSkills = {
discardSkill, discardSkill,
chooseCardsSkill, chooseCardsSkill,
choosePlayersSkill, choosePlayersSkill,
maxCardsSkill,
moveTokenSkill,
} }

View File

@ -22,7 +22,7 @@ Rectangle {
id: chatLogBox id: chatLogBox
anchors.fill: parent anchors.fill: parent
anchors.margins: 10 anchors.margins: 10
font.pixelSize: 14 //font.pixelSize: 14
} }
} }

View File

@ -3,16 +3,16 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
Flickable { ListView {
id: root id: root
property alias font: textEdit.font //property alias font: textEdit.font
property alias text: textEdit.text //property alias text: textEdit.text
property alias color: textEdit.color //property alias color: textEdit.color
property alias textFormat: textEdit.textFormat //property alias textFormat: textEdit.textFormat
flickableDirection: Flickable.VerticalFlick //flickableDirection: Flickable.VerticalFlick
contentWidth: textEdit.width //contentWidth: textEdit.width
contentHeight: textEdit.height //contentHeight: textEdit.height
clip: true clip: true
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
parent: root.parent parent: root.parent
@ -21,9 +21,11 @@ Flickable {
anchors.bottom: root.bottom anchors.bottom: root.bottom
} }
TextEdit { model: ListModel { id: logModel }
delegate: TextEdit {
id: textEdit id: textEdit
text: logText
width: root.width width: root.width
clip: true clip: true
readOnly: true readOnly: true
@ -36,7 +38,7 @@ Flickable {
function append(text) { function append(text) {
let autoScroll = atYEnd; let autoScroll = atYEnd;
textEdit.append(text); logModel.append({ logText: text });
if (autoScroll && contentHeight > contentY + height) { if (autoScroll && contentHeight > contentY + height) {
contentY = contentHeight - height; contentY = contentHeight - height;
} }

View File

@ -146,7 +146,7 @@ function getPhotoOrDashboard(id) {
function getAreaItem(area, id) { function getAreaItem(area, id) {
if (area === Card.DrawPile) { if (area === Card.DrawPile) {
return drawPile; return drawPile;
} else if (area === Card.DiscardPile || area === Card.Processing) { } else if (area === Card.DiscardPile || area === Card.Processing || area === Card.Void) {
return tablePile; return tablePile;
} else if (area === Card.AG) { } else if (area === Card.AG) {
return popupBox.item; return popupBox.item;