太阳神三国杀lua吧 关注:2,637贴子:73,375
  • 3回复贴,共1

请问如何捕捉:“当你手牌数量变成3张”这个时机?

只看楼主收藏回复

各位大佬好,如题,个人想到的入手角度是参考老版连营。由于“手牌变成3张”有两个情况,第一个是失去手牌后变成3张,另一个是得到手牌后,变成3张。 于是写了以下的代码:(huan是武将名称)
yhuanbian = sgs.CreateTriggerSkill{
name = "yhuanbian" ,
frequency = sgs.Skill_Frequent ,
events = {sgs.CardsMoveOneTime} ,
on_trigger = function(self, event, huan, data)
local room = huan:getRoom()
local move = data:toMoveOneTime()
if ((move.from:objectName() == huan:objectName() and move.from_places:contains(sgs.Player_PlaceHand) and huan:getHandcardNum()==3) or (move.to:objectName() == huan:objectName() and move.to_places:contains(sgs.Player_PlaceHand) and move.card_ids:length()+huan:getHandcardNum()==3)) then
huan:gainMark("@huanbian")
end
return false
end
}
实际运行情况,失去手牌后,如果剩余手牌3张,能触发。但在得到手牌后,如果手牌总数是3张,不会触发。想请大神帮帮忙de个bug,谢谢!


IP属地:中国香港1楼2019-07-26 14:51回复
    CardsMoveOneTime是已经完成了移动,所以
    move.card_ids:length()+huan:getHandcardNum()==3里的move.card_ids:length()是多余的


    IP属地:广西2楼2019-07-26 14:57
    收起回复