求助修改民间包的技能 只是改数字我却迷茫了
◎技能效果:你可以将任意于攻击范围内目标的一张牌置于其武将牌上,你的回合结束后目标取回(对同一个目标只能使用一次。若你对目标造成伤害,你获得该牌。发动时若目标有武器而你没有,你可失去一点体力来获得其武器。
◎个人目标:改成移除对象3张牌
应该仅仅是把某处的"1"改成"3"(可能没写默认为1?),
但我却不知道该从哪裡下手,求教~
原lua
goodatwepCard = sgs.CreateSkillCard{
name = "goodatwep",
target_fixed = false,
will_throw = true,
filter = function(self, targets, to_select)
return to_select:objectName() ~= sgs.Self:objectName() and sgs.Self:inMyAttackRange(to_select) and to_select:getPile("goodatwepile"):isEmpty() and not (to_select:isAllNude() or to_select:getMark("GoodatwepMark") > 0)
end,
on_use = function(self, room, source, targets)
for _, target in pairs(targets) do
local room = source:getRoom()
if target:getEquip(0) and not source:getEquip(0) then
local choice = room:askForChoice(source, "goodatwep", "gogetit+cancel")
if choice == "gogetit" then
room:loseHp(source, 1)
room:obtainCard(source, target:getEquip(0))
end
end
local card_id = room:askForCardChosen(source, target, "hej", self:objectName())
room:setPlayerMark(target, "GoodatwepMark", 1)
target:addToPile("goodatwepile", card_id, false)
end
-- local log = sgs.LogMessage()
-- log.type = "#PoisonMaggotsLogGetCard"
-- log.card_str = card:toString()
-- room:sendLog(log)
end
}
goodatwep = sgs.CreateZeroCardViewAsSkill{ -- 这样写可以直接按
name = "goodatwep",
view_as = function()
return goodatwepCard:clone()
end,
enabled_at_play = function(self,player)
-- return not player:hasUsed("#changesexual")
-- return player:getEquip(0) -- 代表有装备武器
return true
end
}
goodatwepClear = sgs.CreateTriggerSkill{
name = "#goodatwepClear" ,
events = {sgs.EventLoseSkill, sgs.Death, sgs.EventPhaseStart, sgs.Damage} ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.EventPhaseStart and player:getPhase() == sgs.Player_Finish and player:hasSkill("goodatwep") then
-- local room = player:getRoom()
for _,p in sgs.qlist(room:getOtherPlayers(player)) do
room:setPlayerMark(p, "GoodatwepMark", 0)
if not p:getPile("goodatwepile"):isEmpty() then
local thepile = p:getPile("goodatwepile")
room:obtainCard(p, thepile:first(), false)
end
end
elseif event == sgs.Death then
local death = data:toDeath()
-- if death.who:objectName() == player:objectName() then
if death.who:hasSkill("goodatwep") then
-- local room = player:getRoom()
for _,p in sgs.qlist(room:getOtherPlayers(player)) do
if not p:getPile("goodatwepile"):isEmpty() then
local thepile = p:getPile("goodatwepile")
room:obtainCard(p, thepile:first(), false)
end
end
end
elseif event == sgs.EventLoseSkill then
if data:toString() == "goodatwep" then
-- local room = player:getRoom()
for _,p in sgs.qlist(room:getOtherPlayers(player)) do
if not p:getPile("goodatwepile"):isEmpty() then
local thepile = p:getPile("goodatwepile")
room:obtainCard(p, thepile:first(), false)
end
end
end
end
if (event == sgs.Damage) then
local damage = data:toDamage()
local target = damage.to
local thePile = target:getPile("goodatwepile")
if player:hasSkill("goodatwep") and player:isAlive() and not target:getPile("goodatwepile"):isEmpty() then
local card_id = thePile:first()
local card = sgs.Sanguosha:getCard(card_id)
thePile:removeOne(card_id)
room:moveCardTo(card, player, sgs.Player_PlaceHand)
end
end
return false
end ,
can_trigger = function(self, target)
return target
end ,
}
感谢各位~
◎技能效果:你可以将任意于攻击范围内目标的一张牌置于其武将牌上,你的回合结束后目标取回(对同一个目标只能使用一次。若你对目标造成伤害,你获得该牌。发动时若目标有武器而你没有,你可失去一点体力来获得其武器。
◎个人目标:改成移除对象3张牌
应该仅仅是把某处的"1"改成"3"(可能没写默认为1?),
但我却不知道该从哪裡下手,求教~
原lua
goodatwepCard = sgs.CreateSkillCard{
name = "goodatwep",
target_fixed = false,
will_throw = true,
filter = function(self, targets, to_select)
return to_select:objectName() ~= sgs.Self:objectName() and sgs.Self:inMyAttackRange(to_select) and to_select:getPile("goodatwepile"):isEmpty() and not (to_select:isAllNude() or to_select:getMark("GoodatwepMark") > 0)
end,
on_use = function(self, room, source, targets)
for _, target in pairs(targets) do
local room = source:getRoom()
if target:getEquip(0) and not source:getEquip(0) then
local choice = room:askForChoice(source, "goodatwep", "gogetit+cancel")
if choice == "gogetit" then
room:loseHp(source, 1)
room:obtainCard(source, target:getEquip(0))
end
end
local card_id = room:askForCardChosen(source, target, "hej", self:objectName())
room:setPlayerMark(target, "GoodatwepMark", 1)
target:addToPile("goodatwepile", card_id, false)
end
-- local log = sgs.LogMessage()
-- log.type = "#PoisonMaggotsLogGetCard"
-- log.card_str = card:toString()
-- room:sendLog(log)
end
}
goodatwep = sgs.CreateZeroCardViewAsSkill{ -- 这样写可以直接按
name = "goodatwep",
view_as = function()
return goodatwepCard:clone()
end,
enabled_at_play = function(self,player)
-- return not player:hasUsed("#changesexual")
-- return player:getEquip(0) -- 代表有装备武器
return true
end
}
goodatwepClear = sgs.CreateTriggerSkill{
name = "#goodatwepClear" ,
events = {sgs.EventLoseSkill, sgs.Death, sgs.EventPhaseStart, sgs.Damage} ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.EventPhaseStart and player:getPhase() == sgs.Player_Finish and player:hasSkill("goodatwep") then
-- local room = player:getRoom()
for _,p in sgs.qlist(room:getOtherPlayers(player)) do
room:setPlayerMark(p, "GoodatwepMark", 0)
if not p:getPile("goodatwepile"):isEmpty() then
local thepile = p:getPile("goodatwepile")
room:obtainCard(p, thepile:first(), false)
end
end
elseif event == sgs.Death then
local death = data:toDeath()
-- if death.who:objectName() == player:objectName() then
if death.who:hasSkill("goodatwep") then
-- local room = player:getRoom()
for _,p in sgs.qlist(room:getOtherPlayers(player)) do
if not p:getPile("goodatwepile"):isEmpty() then
local thepile = p:getPile("goodatwepile")
room:obtainCard(p, thepile:first(), false)
end
end
end
elseif event == sgs.EventLoseSkill then
if data:toString() == "goodatwep" then
-- local room = player:getRoom()
for _,p in sgs.qlist(room:getOtherPlayers(player)) do
if not p:getPile("goodatwepile"):isEmpty() then
local thepile = p:getPile("goodatwepile")
room:obtainCard(p, thepile:first(), false)
end
end
end
end
if (event == sgs.Damage) then
local damage = data:toDamage()
local target = damage.to
local thePile = target:getPile("goodatwepile")
if player:hasSkill("goodatwep") and player:isAlive() and not target:getPile("goodatwepile"):isEmpty() then
local card_id = thePile:first()
local card = sgs.Sanguosha:getCard(card_id)
thePile:removeOne(card_id)
room:moveCardTo(card, player, sgs.Player_PlaceHand)
end
end
return false
end ,
can_trigger = function(self, target)
return target
end ,
}
感谢各位~