游戏批量合成道具算绑定道具的数量算法

来源:互联网 发布:官网下载淘宝 编辑:程序博客网 时间:2024/04/28 11:53
function CheckCompositeCommonBind(sysarg, consumes, nCount)local nMaxCount = 0local bBind = falsefor k,v in pairs(consumes)doif(v.id ~= 0)then--有多少绑定材料local haveCount = Actor.getItemCount(sysarg, v.id, 0, 0, 1) --能合成多少个绑定的道具local giveCount,fGiveCount = math.modf(haveCount / v.count)--如果获得数量大于0且有余数if(0 < haveCount and fGiveCount ~= 0)thenbBind = trueendif(nMaxCount < giveCount)thennMaxCount = giveCountend--BaseFuc_Print(haveCount,giveCount,fGiveCount)endendif(bBind == true)thennMaxCount = nMaxCount + 1endif(nCount < nMaxCount)thennMaxCount = nCountend--BaseFuc_Print("nMaxCount",bBind, nMaxCount)return nMaxCountend

0 0
原创粉丝点击