mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
dedde94643
* the process of using card (uncompleted) * code style: tab is 2 spaces(not \t or 4 space) * update lua54.dll to MinGW version(no cygwin1.dll required) * basic ui logic * ActiveSkill * modidy ActiveSkill defaults * todo: defaultEquipSkill * client * send use card to server * playing phase, equip Co-authored-by: Ho-spair <linyuy@163.com>
95 lines
1.8 KiB
Lua
95 lines
1.8 KiB
Lua
---@class Card : Object
|
|
---@field package Package
|
|
---@field name string
|
|
---@field suit Suit
|
|
---@field number integer
|
|
---@field trueName string
|
|
---@field color Color
|
|
---@field id integer
|
|
---@field type CardType
|
|
---@field sub_type CardSubtype
|
|
---@field area CardArea
|
|
local Card = class("Card")
|
|
|
|
---@alias Suit integer
|
|
|
|
Card.Spade = 1
|
|
Card.Club = 2
|
|
Card.Heart = 3
|
|
Card.Diamond = 4
|
|
Card.NoSuit = 5
|
|
|
|
---@alias Color integer
|
|
|
|
Card.Black = 1
|
|
Card.Red = 2
|
|
Card.NoColor = 3
|
|
|
|
---@alias CardType integer
|
|
|
|
Card.TypeBasic = 1
|
|
Card.TypeTrick = 2
|
|
Card.TypeEquip = 3
|
|
|
|
---@alias CardSubtype integer
|
|
|
|
Card.SubtypeNone = 1
|
|
Card.SubtypeDelayedTrick = 2
|
|
Card.SubtypeWeapon = 3
|
|
Card.SubtypeArmor = 4
|
|
Card.SubtypeDefensiveRide = 5
|
|
Card.SubtypeOffensiveRide = 6
|
|
Card.SubtypeTreasure = 7
|
|
|
|
---@alias CardArea integer
|
|
|
|
Card.Unknown = 0
|
|
Card.PlayerHand = 1
|
|
Card.PlayerEquip = 2
|
|
Card.PlayerJudge = 3
|
|
Card.PlayerSpecial = 4
|
|
Card.Processing = 5
|
|
Card.DrawPile = 6
|
|
Card.DiscardPile = 7
|
|
Card.Void = 8
|
|
|
|
function Card:initialize(name, suit, number, color)
|
|
self.name = name
|
|
self.suit = suit or Card.NoSuit
|
|
self.number = number or 0
|
|
self.trueName = name
|
|
|
|
if suit == Card.Spade or suit == Card.Club then
|
|
self.color = Card.Black
|
|
elseif suit == Card.Heart or suit == Card.Diamond then
|
|
self.color = Card.Red
|
|
elseif color ~= nil then
|
|
self.color = color
|
|
else
|
|
self.color = Card.NoColor
|
|
end
|
|
|
|
self.package = nil
|
|
self.id = 0
|
|
self.type = 0
|
|
self.sub_type = Card.SubTypeNone
|
|
self.skill = nil
|
|
end
|
|
|
|
function Card:getSuitString()
|
|
local suit = self.suit
|
|
if suit == Card.Spade then
|
|
return "spade"
|
|
elseif suit == Card.Heart then
|
|
return "heart"
|
|
elseif suit == Card.Club then
|
|
return "club"
|
|
elseif suit == Card.Diamond then
|
|
return "diamond"
|
|
else
|
|
return "unknown"
|
|
end
|
|
end
|
|
|
|
return Card
|