Fixbug (#102)
修复了势力没有实际赋值给Player的bug 修复了装备牌图标的存放位置 增加了mod中拓展势力的支持(其实就是加载图的位置罢了)
|
@ -68,13 +68,6 @@ end
|
|||
function GameLogic:chooseGenerals()
|
||||
local room = self.room
|
||||
local generalNum = room.settings.generalNum
|
||||
local function setPlayerGeneral(player, general)
|
||||
if Fk.generals[general] == nil then return end
|
||||
player.general = general
|
||||
player.gender = Fk.generals[general].gender
|
||||
self.room:notifyProperty(player, player, "general")
|
||||
self.room:broadcastProperty(player, "gender")
|
||||
end
|
||||
local lord = room:getLord()
|
||||
local lord_general = nil
|
||||
if lord ~= nil then
|
||||
|
@ -84,7 +77,7 @@ function GameLogic:chooseGenerals()
|
|||
generals[i] = generals[i].name
|
||||
end
|
||||
lord_general = room:askForGeneral(lord, generals)
|
||||
setPlayerGeneral(lord, lord_general)
|
||||
room:setPlayerGeneral(lord, lord_general, true)
|
||||
room:broadcastProperty(lord, "general")
|
||||
end
|
||||
|
||||
|
@ -105,9 +98,9 @@ function GameLogic:chooseGenerals()
|
|||
for _, p in ipairs(nonlord) do
|
||||
if p.general == "" and p.reply_ready then
|
||||
local general = json.decode(p.client_reply)[1]
|
||||
setPlayerGeneral(p, general)
|
||||
room:setPlayerGeneral(p, general, true)
|
||||
else
|
||||
setPlayerGeneral(p, p.default_reply)
|
||||
room:setPlayerGeneral(p, p.default_reply, true)
|
||||
end
|
||||
p.default_reply = ""
|
||||
end
|
||||
|
|
|
@ -378,6 +378,22 @@ function Room:removeTag(tag_name)
|
|||
self.tag[tag_name] = nil
|
||||
end
|
||||
|
||||
---@param player ServerPlayer
|
||||
---@param general string
|
||||
---@param changeKingdom boolean
|
||||
function Room:setPlayerGeneral(player, general, changeKingdom)
|
||||
if Fk.generals[general] == nil then return end
|
||||
player.general = general
|
||||
player.gender = Fk.generals[general].gender
|
||||
self:notifyProperty(player, player, "general")
|
||||
self:broadcastProperty(player, "gender")
|
||||
|
||||
if changeKingdom then
|
||||
player.kingdom = Fk.generals[general].kingdom
|
||||
self:broadcastProperty(player, "kingdom")
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- network functions, notify function
|
||||
------------------------------------------------------------------------
|
||||
|
|
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 380 B |
|
@ -188,6 +188,18 @@ local ironChainEffect = fk.CreateTriggerSkill{
|
|||
end,
|
||||
}
|
||||
Fk:addSkill(ironChainEffect)
|
||||
|
||||
local recast = fk.CreateActiveSkill{
|
||||
name = "recast",
|
||||
target_num = 0,
|
||||
on_use = function(self, room, effect)
|
||||
local from = room:getPlayerById(effect.from)
|
||||
room:throwCard(effect.cards, self.name, from)
|
||||
room:drawCards(from, #effect.cards, self.name)
|
||||
end
|
||||
}
|
||||
Fk:addSkill(recast)
|
||||
|
||||
local ironChainCardSkill = fk.CreateActiveSkill{
|
||||
name = "iron_chain_skill",
|
||||
min_target_num = 1,
|
||||
|
@ -198,11 +210,11 @@ local ironChainCardSkill = fk.CreateActiveSkill{
|
|||
to:setChainState(not to.chained)
|
||||
end,
|
||||
}
|
||||
|
||||
local ironChain = fk.CreateTrickCard{
|
||||
name = "iron_chain",
|
||||
skill = ironChainCardSkill,
|
||||
-- FIXME! FIXME! FIXME!
|
||||
special_skills = { "zhiheng" },
|
||||
special_skills = { "recast" },
|
||||
}
|
||||
extension:addCards{
|
||||
ironChain:clone(Card.Spade, 11),
|
||||
|
|
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 380 B |
Before Width: | Height: | Size: 624 B After Width: | Height: | Size: 624 B |
Before Width: | Height: | Size: 512 B After Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 267 B After Width: | Height: | Size: 267 B |
Before Width: | Height: | Size: 335 B After Width: | Height: | Size: 335 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 371 B |
Before Width: | Height: | Size: 273 B After Width: | Height: | Size: 273 B |
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 289 B |
|
@ -86,6 +86,8 @@ local test_active = fk.CreateActiveSkill{
|
|||
-- room:closeAG(from)
|
||||
local cards = room:askForCardsChosen(from, from, 2, 3, "hej", "")
|
||||
from:addToPile(self.name, cards)
|
||||
from.kingdom = "wei"
|
||||
room:broadcastProperty(from, "kingdom")
|
||||
-- p(cards)
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ CardItem {
|
|||
}
|
||||
|
||||
Image {
|
||||
source: SkinBank.GENERALCARD_DIR + kingdom
|
||||
source: SkinBank.getGeneralCardDir(kingdom) + kingdom
|
||||
}
|
||||
|
||||
Row {
|
||||
|
@ -40,7 +40,7 @@ CardItem {
|
|||
Repeater {
|
||||
model: (hp > 5 || hp !== maxHp) ? 1 : hp
|
||||
Image {
|
||||
source: SkinBank.GENERALCARD_DIR + kingdom + "-magatama"
|
||||
source: SkinBank.getGeneralCardDir(kingdom) + kingdom + "-magatama"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ Item {
|
|||
|
||||
Image {
|
||||
id: back
|
||||
source: SkinBank.PHOTO_BACK_DIR + root.kingdom
|
||||
source: SkinBank.getPhotoBack(root.kingdom)
|
||||
}
|
||||
|
||||
Text {
|
||||
|
@ -525,8 +525,8 @@ Item {
|
|||
generalName.text = text;
|
||||
longGeneralName.text = "";
|
||||
}
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [general]));
|
||||
kingdom = data.kingdom;
|
||||
// let data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [general]));
|
||||
// kingdom = data.kingdom;
|
||||
}
|
||||
|
||||
function chat(msg) {
|
||||
|
|
|
@ -19,7 +19,7 @@ Item {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: 3
|
||||
|
||||
source: icon ? SkinBank.EQUIP_ICON_DIR + icon : ""
|
||||
source: icon ? SkinBank.getEquipIcon(cid, icon) : ""
|
||||
}
|
||||
|
||||
Image {
|
||||
|
|
|
@ -42,3 +42,45 @@ function getCardPicture(cid) {
|
|||
}
|
||||
return CARD_DIR + "unknown.png";
|
||||
}
|
||||
|
||||
function getEquipIcon(cid, icon) {
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
|
||||
let extension = data.extension;
|
||||
let name = icon || data.name;
|
||||
let path = AppPath + "/packages/" + extension + "/image/card/equipIcon/" + name + ".png";
|
||||
if (Backend.exists(path)) {
|
||||
return path;
|
||||
} else {
|
||||
for (let dir of Backend.ls(AppPath + "/packages/")) {
|
||||
path = AppPath + "/packages/" + dir + "/image/card/equipIcon/" + name + ".png";
|
||||
if (Backend.exists(path)) return path;
|
||||
}
|
||||
}
|
||||
return EQUIP_ICON_DIR + "unknown.png";
|
||||
}
|
||||
|
||||
function getPhotoBack(kingdom) {
|
||||
let path = PHOTO_BACK_DIR + kingdom + ".png";
|
||||
if (!Backend.exists(path)) {
|
||||
for (let dir of Backend.ls(AppPath + "/packages/")) {
|
||||
path = AppPath + "/packages/" + dir + "/image/kingdom/" + kingdom + "-back.png";
|
||||
if (Backend.exists(path)) return path;
|
||||
}
|
||||
} else {
|
||||
return path;
|
||||
}
|
||||
return PHOTO_BACK_DIR + "qun";
|
||||
}
|
||||
|
||||
function getGeneralCardDir(kingdom) {
|
||||
let path = GENERALCARD_DIR + kingdom + ".png";
|
||||
if (!Backend.exists(path)) {
|
||||
for (let dir of Backend.ls(AppPath + "/packages/")) {
|
||||
path = AppPath + "/packages/" + dir + "/image/kingdom/" + kingdom + "-back.png";
|
||||
if (Backend.exists(path))
|
||||
return AppPath + "/packages/" + dir + "/image/kingdom/";
|
||||
}
|
||||
} else {
|
||||
return GENERALCARD_DIR;
|
||||
}
|
||||
}
|
||||
|
|