mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
Enchance Mouxusheng (#235)
1. 谋徐盛增加大离间、复活,可以变更副将 2. 修改CardEffecting等时机的承载者 3. 修复changeHero 4. 给moveCardTo堆一个proposer 5. 修复一些标准版武将和装备
This commit is contained in:
parent
cc0228dc03
commit
35477c0ea1
|
@ -337,7 +337,11 @@ GameEvent.functions[GameEvent.CardEffect] = function(self)
|
|||
self.logic:breakEvent()
|
||||
end
|
||||
|
||||
if cardEffectEvent.from and self.logic:trigger(event, self:getPlayerById(cardEffectEvent.from), cardEffectEvent) then
|
||||
if event == fk.PreCardEffect then
|
||||
if cardEffectEvent.from and self.logic:trigger(event, self:getPlayerById(cardEffectEvent.from), cardEffectEvent) then
|
||||
self.logic:breakEvent()
|
||||
end
|
||||
elseif cardEffectEvent.to and self.logic:trigger(event, self:getPlayerById(cardEffectEvent.to), cardEffectEvent) then
|
||||
self.logic:breakEvent()
|
||||
end
|
||||
|
||||
|
|
|
@ -570,7 +570,7 @@ function Room:setDeputyGeneral(player, general)
|
|||
end
|
||||
|
||||
---@param player ServerPlayer @ 要换将的玩家
|
||||
---@param new_general string @ 要变更的武将,若不存在则变身为孙策,孙策也不存在则nil错
|
||||
---@param new_general string @ 要变更的武将,若不存在则变身为孙策,孙策不存在变身为士兵
|
||||
---@param full boolean|nil @ 是否血量满状态变身
|
||||
---@param isDeputy boolean|nil @ 是否变的是副将
|
||||
---@param sendLog boolean|nil @ 是否发Log
|
||||
|
@ -580,7 +580,7 @@ function Room:changeHero(player, new_general, full, isDeputy, sendLog)
|
|||
orig = Fk.generals[orig]
|
||||
local orig_skills = orig and orig:getSkillNameList() or Util.DummyTable
|
||||
|
||||
local new = Fk.generals[new_general] or Fk.generals["sunce"]
|
||||
local new = Fk.generals[new_general] or Fk.generals["sunce"] or Fk.generals["blank_shibing"]
|
||||
local new_skills = table.map(orig_skills, function(e)
|
||||
return "-" .. e
|
||||
end)
|
||||
|
@ -590,24 +590,16 @@ function Room:changeHero(player, new_general, full, isDeputy, sendLog)
|
|||
self:handleAddLoseSkills(player, table.concat(new_skills, "|"), nil, false)
|
||||
|
||||
if isDeputy then
|
||||
player.deputyGeneral = new_general
|
||||
self:broadcastProperty(player, "deputyGeneral")
|
||||
self:setPlayerProperty(player, "deputyGeneral", new_general)
|
||||
else
|
||||
player.general = new_general
|
||||
self:broadcastProperty(player, "general")
|
||||
self:setPlayerProperty(player, "general", new_general)
|
||||
self:setPlayerProperty(player, "gender", new.gender)
|
||||
self:setPlayerProperty(player, "kingdom", new.kingdom)
|
||||
end
|
||||
|
||||
player.gender = new.gender
|
||||
self:broadcastProperty(player, "gender")
|
||||
|
||||
player.kingdom = new.kingdom
|
||||
self:broadcastProperty(player, "kingdom")
|
||||
|
||||
player.maxHp = player:getGeneralMaxHp()
|
||||
self:broadcastProperty(player, "maxHp")
|
||||
self:setPlayerProperty(player, "maxHp", player:getGeneralMaxHp())
|
||||
if full or player.hp > player.maxHp then
|
||||
player.hp = player.maxHp
|
||||
self:broadcastProperty(player, "hp")
|
||||
self:setPlayerProperty(player, "hp", player.maxHp)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1080,7 +1072,7 @@ Room.askForUseViewAsSkill = Room.askForUseActiveSkill
|
|||
function Room:askForDiscard(player, minNum, maxNum, includeEquip, skillName, cancelable, pattern, prompt, skipDiscard, no_indicate)
|
||||
cancelable = (cancelable == nil) and true or cancelable
|
||||
no_indicate = no_indicate or false
|
||||
pattern = pattern or ""
|
||||
pattern = pattern or "."
|
||||
|
||||
local canDiscards = table.filter(
|
||||
player:getCardIds{ Player.Hand, includeEquip and Player.Equip or nil }, function(id)
|
||||
|
@ -1200,7 +1192,7 @@ function Room:askForCard(player, minNum, maxNum, includeEquip, skillName, cancel
|
|||
end
|
||||
cancelable = (cancelable == nil) and true or cancelable
|
||||
no_indicate = no_indicate or false
|
||||
pattern = pattern or ""
|
||||
pattern = pattern or "."
|
||||
|
||||
local chosenCards = {}
|
||||
local data = {
|
||||
|
@ -1305,7 +1297,7 @@ function Room:askForGeneral(player, generals, n)
|
|||
end
|
||||
|
||||
--- 询问玩家若为神将、双势力需选择一个势力。
|
||||
---@param player ServerPlayer[]|nil @ 询问目标
|
||||
---@param players ServerPlayer[]|nil @ 询问目标
|
||||
function Room:askForChooseKingdom(players)
|
||||
players = players or self.alive_players
|
||||
local specialKingdomPlayers = table.filter(players, function(p)
|
||||
|
@ -2023,7 +2015,8 @@ function Room:askForMoveCardInBoard(player, targetOne, targetTwo, skillName, fla
|
|||
fk.ReasonPut,
|
||||
skillName,
|
||||
nil,
|
||||
true
|
||||
true,
|
||||
player.id
|
||||
)
|
||||
|
||||
return { card = cardToMove, from = from.id, to = to.id }
|
||||
|
@ -2615,16 +2608,18 @@ end
|
|||
---@param skill_name string|nil @ 技能名
|
||||
---@param special_name string|nil @ 私人牌堆名
|
||||
---@param visible boolean|nil @ 是否明置
|
||||
function Room:moveCardTo(card, to_place, target, reason, skill_name, special_name, visible)
|
||||
---@param proposer integer
|
||||
function Room:moveCardTo(card, to_place, target, reason, skill_name, special_name, visible, proposer)
|
||||
reason = reason or fk.ReasonJustMove
|
||||
skill_name = skill_name or ""
|
||||
special_name = special_name or ""
|
||||
proposer = proposer or nil
|
||||
local ids = Card:getIdList(card)
|
||||
|
||||
local to
|
||||
if table.contains(
|
||||
{Card.PlayerEquip, Card.PlayerHand,
|
||||
Card.PlayerJudge, Card.PlayerSpecial}, to_place) then
|
||||
Card.PlayerJudge, Card.PlayerSpecial}, to_place) then
|
||||
to = target.id
|
||||
end
|
||||
|
||||
|
@ -2637,6 +2632,7 @@ function Room:moveCardTo(card, to_place, target, reason, skill_name, special_nam
|
|||
skillName = skill_name,
|
||||
specialName = special_name,
|
||||
moveVisible = visible,
|
||||
proposer = proposer,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@ local discardSkill = fk.CreateActiveSkill{
|
|||
return false
|
||||
end
|
||||
|
||||
if Fk:currentRoom():getCardArea(to_select) == Player.Special then
|
||||
return false
|
||||
end
|
||||
|
||||
local checkpoint = true
|
||||
local card = Fk:getCardById(to_select)
|
||||
|
||||
|
@ -46,6 +50,10 @@ local chooseCardsSkill = fk.CreateActiveSkill{
|
|||
return false
|
||||
end
|
||||
|
||||
if Fk:currentRoom():getCardArea(to_select) == Player.Special then
|
||||
return false
|
||||
end
|
||||
|
||||
local checkpoint = true
|
||||
local card = Fk:getCardById(to_select)
|
||||
|
||||
|
|
|
@ -12,13 +12,10 @@ local jianxiong = fk.CreateTriggerSkill{
|
|||
can_trigger = function(self, event, target, player, data)
|
||||
local room = target.room
|
||||
return target == player and player:hasSkill(self.name) and data.card and
|
||||
table.find(data.card:isVirtual() and data.card.subcards or {data.card.id}, function(id) return room:getCardArea(id) == Card.Processing end)
|
||||
table.every(data.card:isVirtual() and data.card.subcards or {data.card.id}, function(id) return room:getCardArea(id) == Card.Processing end)
|
||||
end,
|
||||
on_use = function(self, event, target, player, data)
|
||||
local room = player.room
|
||||
local dummy = Fk:cloneCard("jueying")
|
||||
dummy:addSubcards(table.filter(data.card:isVirtual() and data.card.subcards or {data.card.id}, function(id) return room:getCardArea(id) == Card.Processing end))
|
||||
room:obtainCard(player.id, dummy, false, fk.ReasonJustMove)
|
||||
player.room:obtainCard(player.id, data.card, true, fk.ReasonJustMove)
|
||||
end,
|
||||
}
|
||||
|
||||
|
@ -386,7 +383,7 @@ local qingguo = fk.CreateViewAsSkill{
|
|||
card_filter = function(self, to_select, selected)
|
||||
if #selected == 1 then return false end
|
||||
return Fk:getCardById(to_select).color == Card.Black
|
||||
and Fk:currentRoom():getCardArea(to_select) ~= Player.Equip
|
||||
and Fk:currentRoom():getCardArea(to_select) ~= Player.Hand
|
||||
end,
|
||||
view_as = function(self, cards)
|
||||
if #cards ~= 1 then
|
||||
|
@ -406,7 +403,7 @@ local rende = fk.CreateActiveSkill{
|
|||
name = "rende",
|
||||
anim_type = "support",
|
||||
card_filter = function(self, to_select, selected)
|
||||
return Fk:currentRoom():getCardArea(to_select) ~= Card.PlayerEquip
|
||||
return Fk:currentRoom():getCardArea(to_select) == Card.PlayerHand
|
||||
end,
|
||||
target_filter = function(self, to_select, selected)
|
||||
return #selected == 0 and to_select ~= Self.id
|
||||
|
@ -418,9 +415,7 @@ local rende = fk.CreateActiveSkill{
|
|||
local player = room:getPlayerById(effect.from)
|
||||
local cards = effect.cards
|
||||
local marks = player:getMark("_rende_cards-phase")
|
||||
local dummy = Fk:cloneCard'slash'
|
||||
dummy:addSubcards(cards)
|
||||
room:obtainCard(target.id, dummy, false, fk.ReasonGive)
|
||||
room:moveCardTo(cards, Player.Hand, target, fk.ReasonGive, self.name, nil, false, player.id)
|
||||
room:addPlayerMark(player, "_rende_cards-phase", #cards)
|
||||
if marks < 2 and marks + #cards >= 2 and player:isWounded() then
|
||||
room:recover{
|
||||
|
@ -877,20 +872,27 @@ local liuli = fk.CreateTriggerSkill{
|
|||
local ret = target == player and player:hasSkill(self.name) and
|
||||
data.card.trueName == "slash"
|
||||
if ret then
|
||||
self.target_list = {}
|
||||
local room = player.room
|
||||
for _, p in ipairs(room:getOtherPlayers(player)) do
|
||||
if p.id ~= data.from and player:inMyAttackRange(p) then
|
||||
table.insert(self.target_list, p.id)
|
||||
local from = room:getPlayerById(data.from)
|
||||
for _, p in ipairs(room.alive_players) do
|
||||
if p ~= player and p.id ~= data.from and player:inMyAttackRange(p) and not from:isProhibited(p, data.card) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return #self.target_list > 0
|
||||
end
|
||||
end,
|
||||
on_cost = function(self, event, target, player, data)
|
||||
local room = player.room
|
||||
local prompt = "#liuli-target"
|
||||
local plist, cid = room:askForChooseCardAndPlayers(player, self.target_list, 1, 1, nil, prompt, self.name, true)
|
||||
local targets = {}
|
||||
local from = room:getPlayerById(data.from)
|
||||
for _, p in ipairs(room.alive_players) do
|
||||
if p ~= player and p.id ~= data.from and player:inMyAttackRange(p) and not from:isProhibited(p, data.card) then
|
||||
table.insert(targets, p.id)
|
||||
end
|
||||
end
|
||||
if #targets == 0 then return false end
|
||||
local plist, cid = room:askForChooseCardAndPlayers(player, targets, 1, 1, nil, prompt, self.name, true)
|
||||
if #plist > 0 then
|
||||
self.cost_data = {plist[1], cid}
|
||||
return true
|
||||
|
@ -979,7 +981,7 @@ local jieyin = fk.CreateActiveSkill{
|
|||
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
|
||||
end,
|
||||
card_filter = function(self, to_select, selected)
|
||||
return #selected < 2 and Fk:currentRoom():getCardArea(to_select) ~= Player.Equip
|
||||
return #selected < 2 and Fk:currentRoom():getCardArea(to_select) == Player.Hand
|
||||
end,
|
||||
target_filter = function(self, to_select, selected)
|
||||
local target = Fk:currentRoom():getPlayerById(to_select)
|
||||
|
@ -1006,7 +1008,7 @@ local jieyin = fk.CreateActiveSkill{
|
|||
skillName = self.name
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
local sunshangxiang = General:new(extension, "sunshangxiang", "wu", 3, 3, General.Female)
|
||||
sunshangxiang:addSkill(xiaoji)
|
||||
|
@ -1019,7 +1021,7 @@ local qingnang = fk.CreateActiveSkill{
|
|||
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
|
||||
end,
|
||||
card_filter = function(self, to_select, selected, targets)
|
||||
return #selected == 0 and Fk:currentRoom():getCardArea(to_select) ~= Player.Equip
|
||||
return #selected == 0 and Fk:currentRoom():getCardArea(to_select) == Player.Hand
|
||||
end,
|
||||
target_filter = function(self, to_select, selected, cards)
|
||||
return #selected == 0 and Fk:currentRoom():getPlayerById(to_select):isWounded()
|
||||
|
|
|
@ -936,19 +936,14 @@ extension:addCards({
|
|||
local bladeSkill = fk.CreateTriggerSkill{
|
||||
name = "#blade_skill",
|
||||
attached_equip = "blade",
|
||||
events = {fk.CardUseFinished},
|
||||
events = {fk.CardEffectCancelledOut},
|
||||
can_trigger = function(self, event, target, player, data)
|
||||
if not player:hasSkill(self.name) then return end
|
||||
local use = data ---@type CardUseStruct
|
||||
if use.card.name == "jink" and use.toCard and use.toCard.trueName == "slash" then
|
||||
local effect = use.responseToEvent
|
||||
return effect.from == player.id
|
||||
end
|
||||
return player:hasSkill(self.name) and data.from == player.id and data.card.trueName == "slash" and not player.room:getPlayerById(data.to).dead
|
||||
end,
|
||||
on_cost = function(self, event, target, player, data)
|
||||
local room = player.room
|
||||
local use = room:askForUseCard(player, "slash", nil, "#blade_slash:" .. target.id,
|
||||
true, { must_targets = {target.id}, exclusive_targets = {target.id}, bypass_distances = true, bypass_times = true })
|
||||
local use = room:askForUseCard(player, "slash", nil, "#blade_slash:" .. data.to,
|
||||
true, { must_targets = {data.to}, exclusive_targets = {data.to}, bypass_distances = true, bypass_times = true })
|
||||
if use then
|
||||
use.extraUse = true
|
||||
self.cost_data = use
|
||||
|
@ -1008,7 +1003,7 @@ local axeSkill = fk.CreateTriggerSkill{
|
|||
attached_equip = "axe",
|
||||
events = {fk.CardEffectCancelledOut},
|
||||
can_trigger = function(self, event, target, player, data)
|
||||
return player:hasSkill(self.name) and data.from == player.id and data.card.trueName == "slash"
|
||||
return player:hasSkill(self.name) and data.from == player.id and data.card.trueName == "slash" and not player.room:getPlayerById(data.to).dead
|
||||
end,
|
||||
on_cost = function(self, event, target, player, data)
|
||||
local room = player.room
|
||||
|
@ -1060,10 +1055,12 @@ local halberdSkill = fk.CreateTargetModSkill{
|
|||
name = "#halberd_skill",
|
||||
attached_equip = "halberd",
|
||||
extra_target_func = function(self, player, skill, card)
|
||||
if player:hasSkill(self.name) and skill.trueName == "slash_skill"
|
||||
and #player:getCardIds(Player.Hand) == 1
|
||||
and player:getCardIds(Player.Hand)[1] == card.id then
|
||||
return 2
|
||||
if player:hasSkill(self.name) and skill.trueName == "slash_skill" then
|
||||
local cards = card:isVirtual() and card.subcards or {card.id}
|
||||
local handcards = player:getCardIds(Player.Hand)
|
||||
if #cards == #handcards and table.every(cards, function(id) return table.contains(handcards, id) end) then
|
||||
return 2
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -10,15 +10,16 @@ local cheat = fk.CreateActiveSkill{
|
|||
can_use = function(self, player)
|
||||
return true
|
||||
end,
|
||||
card_filter = function(self, card)
|
||||
return false
|
||||
end,
|
||||
target_num = 0,
|
||||
on_use = function(self, room, effect)
|
||||
local from = room:getPlayerById(effect.from)
|
||||
local cardTypeName = room:askForChoice(from, { 'BasicCard', 'TrickCard', 'Equip' }, "cheat")
|
||||
local cardType = Card.TypeBasic
|
||||
if cardTypeName == 'TrickCard' then
|
||||
cardType = Card.TypeTrick
|
||||
elseif cardTypeName == 'Equip' then
|
||||
cardType = Card.TypeEquip
|
||||
end
|
||||
local cardType = { 'basic', 'trick', 'equip' }
|
||||
local cardTypeName = room:askForChoice(from, cardType, "cheat")
|
||||
local card_types = {Card.TypeBasic, Card.TypeTrick, Card.TypeEquip}
|
||||
cardType = card_types[table.indexOf(cardType, cardTypeName)]
|
||||
|
||||
local allCardIds = Fk:getAllCardIds()
|
||||
local allCardMapper = {}
|
||||
|
@ -176,6 +177,7 @@ local test_trig = fk.CreateTriggerSkill{
|
|||
local damage_maker = fk.CreateActiveSkill{
|
||||
name = "damage_maker",
|
||||
anim_type = "offensive",
|
||||
prompt = "#damage_maker",
|
||||
can_use = function(self, player)
|
||||
return true
|
||||
end,
|
||||
|
@ -183,40 +185,65 @@ local damage_maker = fk.CreateActiveSkill{
|
|||
return false
|
||||
end,
|
||||
card_num = 0,
|
||||
target_filter = function(self)
|
||||
return true
|
||||
target_filter = function(self, to_select, selected)
|
||||
if self.interaction.data == "revive" then return false end
|
||||
return #selected < 2
|
||||
end,
|
||||
target_num = 1,
|
||||
interaction = function()return UI.ComboBox {
|
||||
choices = {"normal_damage", "thunder_damage", "fire_damage", "ice_damage", "lose_hp", "heal_hp", "lose_max_hp", "heal_max_hp"}
|
||||
}end,
|
||||
min_target_num = function(self)
|
||||
return self.interaction.data == "revive" and 0 or 1
|
||||
end,
|
||||
max_target_num = function(self)
|
||||
return self.interaction.data == "revive" and 0 or 2
|
||||
end,
|
||||
interaction = function() return UI.ComboBox {
|
||||
choices = {"normal_damage", "thunder_damage", "fire_damage", "ice_damage", "lose_hp", "heal_hp", "lose_max_hp", "heal_max_hp", "revive"}
|
||||
} end,
|
||||
on_use = function(self, room, effect)
|
||||
local from = room:getPlayerById(effect.from)
|
||||
local target = room:getPlayerById(effect.tos[1])
|
||||
local victim = #effect.tos > 0 and room:getPlayerById(effect.tos[1])
|
||||
local target = #effect.tos > 1 and room:getPlayerById(effect.tos[2])
|
||||
local choice = self.interaction.data
|
||||
local choices = {}
|
||||
for i = 1, 99 do
|
||||
table.insert(choices, tostring(i))
|
||||
local number
|
||||
if choice ~= "revive" then
|
||||
local choices = {}
|
||||
for i = 1, 99 do
|
||||
table.insert(choices, tostring(i))
|
||||
end
|
||||
number = tonumber(room:askForChoice(from, choices, self.name, nil))
|
||||
end
|
||||
local number = tonumber(room:askForChoice(from, choices, self.name, nil))
|
||||
if target then from = target end
|
||||
if choice == "heal_hp" then
|
||||
room:recover{
|
||||
who = target,
|
||||
who = victim,
|
||||
num = number,
|
||||
recoverBy = from,
|
||||
skillName = self.name
|
||||
}
|
||||
elseif choice == "heal_max_hp" then
|
||||
room:changeMaxHp(target, number)
|
||||
room:changeMaxHp(victim, number)
|
||||
elseif choice == "lose_max_hp" then
|
||||
room:changeMaxHp(target, -number)
|
||||
room:changeMaxHp(victim, -number)
|
||||
elseif choice == "lose_hp" then
|
||||
room:loseHp(target, number, self.name)
|
||||
room:loseHp(victim, number, self.name)
|
||||
elseif choice == "revive" then
|
||||
local targets = table.map(table.filter(room.players, function(p) return p.dead end), function(p) return "seat#" .. tostring(p.seat) end)
|
||||
if #targets > 0 then
|
||||
targets = room:askForChoice(from, targets, self.name, "#revive-ask")
|
||||
if targets then
|
||||
target = tonumber(string.sub(targets, 6))
|
||||
for _, p in ipairs(room.players) do
|
||||
if p.seat == target then
|
||||
room:revivePlayer(p, true)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
choices = {"normal_damage", "thunder_damage", "fire_damage", "ice_damage"}
|
||||
local choices = {"normal_damage", "thunder_damage", "fire_damage", "ice_damage"}
|
||||
room:damage({
|
||||
from = from,
|
||||
to = target,
|
||||
to = victim,
|
||||
damage = number,
|
||||
damageType = table.indexOf(choices, choice),
|
||||
skillName = self.name
|
||||
|
@ -237,15 +264,21 @@ local change_hero = fk.CreateActiveSkill{
|
|||
return #selected < 1
|
||||
end,
|
||||
target_num = 1,
|
||||
interaction = function(self)
|
||||
return UI.ComboBox {
|
||||
choices = { "mainGeneral", "deputyGeneral"},
|
||||
}
|
||||
end,
|
||||
on_use = function(self, room, effect)
|
||||
local from = room:getPlayerById(effect.from)
|
||||
local target = room:getPlayerById(effect.tos[1])
|
||||
local choice = self.interaction.data
|
||||
local generals = table.map(Fk:getGeneralsRandomly(8, Fk:getAllGenerals()), function(p) return p.name end)
|
||||
local general = room:askForGeneral(from, generals, 1)
|
||||
if general == nil then
|
||||
general = table.random(generals)
|
||||
end
|
||||
room:changeHero(target, general, false, false, true)
|
||||
room:changeHero(target, general, false, choice == "deputyGeneral", true)
|
||||
end,
|
||||
}
|
||||
local test_zhenggong = fk.CreateTriggerSkill{
|
||||
|
@ -304,6 +337,8 @@ Fk:loadTranslationTable{
|
|||
|
||||
["damage_maker"] = "制伤",
|
||||
[":damage_maker"] = "出牌阶段,你可以进行一次伤害制造器。",
|
||||
["#damage_maker"] = "制伤:选择一名小白鼠,可选另一名角色做伤害来源(默认谋徐盛)",
|
||||
["#revive-ask"] = "复活一名角色!",
|
||||
|
||||
["change_hero"] = "变更",
|
||||
[":change_hero"] = "出牌阶段,你可以变更一名角色武将牌。",
|
||||
|
|
Loading…
Reference in New Issue
Block a user