Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --游戏循环1.2——抽卡
- function PrepareARound(teamid)
- Draw5ChessAndShow(teamid, false)
- end
- --游戏循环1.2.x——抽卡用到的方法(第二个参数可以指定下一个棋子)
- function Draw5ChessAndShow(team_id, unlock)
- local h = TeamId2Hero(team_id)
- if h.chesslock == true then
- CustomGameEventManager:Send_ServerToTeam(h:GetTeam(),"show_draw_card",{
- key = GetClientKey(h:GetTeam()),
- cards = nil,
- curr_money = h:GetMana(),
- auto_unlock = true,
- })
- h.chesslock = false
- return
- end
- --把上次剩的洗回棋库
- h.ban_chess_list = {}
- if h.curr_chess_table ~= nil then
- for _,chess in pairs(h.curr_chess_table) do
- if chess ~= nil then
- -- table.insert(h.ban_chess_list,chess)
- AddAChessToChessPool(chess)
- end
- end
- end
- h.curr_chess_table = {}
- --抽!
- local cards,curr_chess_table = RandomNDrawChessNew(team_id,5)
- h.curr_chess_table = curr_chess_table
- CustomGameEventManager:Send_ServerToTeam(team_id,"show_draw_card",{
- key = GetClientKey(team_id),
- chesses = curr_chess_table,
- cards = cards,
- curr_money = h:GetMana(),
- unlock = unlock,
- })
- end
- function RandomNDrawChessNew(team_id,n)
- local new_chess_list_str = ""
- local new_chess_list_table = {}
- local chess_count = 0
- while chess_count < n do
- local new_chess = RandomDrawChessNew(team_id)
- if new_chess ~= nil then
- new_chess_list_str = new_chess_list_str..new_chess..','
- -- table.insert(new_chess_list_table,new_chess)
- chess_count = chess_count + 1
- new_chess_list_table[chess_count] = new_chess
- end
- end
- return new_chess_list_str,new_chess_list_table
- end
- function RandomDrawChessNew(team_id)
- local h = TeamId2Hero(team_id)
- local this_chess = nil
- local ran = RandomInt(1,100)
- local chess_level = 1
- local curr_per = 0
- local hero_level = h:GetLevel()
- local table_11chess = {}
- for _,chess in pairs(GameRules:GetGameModeEntity().mychess[team_id]) do
- if string.find(chess.chess,'11') then
- table.insert(table_11chess,string.sub(chess.chess,1,-3))
- end
- end
- local ran1 = RandomInt(1,10000)
- local ran2 = RandomInt(1,10000)
- if h:GetLevel() >= 7 and ran1 <= 1 and ran2 <= 1 then
- this_chess = GameRules:GetGameModeEntity().chess_list_ssr[RandomInt(1,table.maxn(GameRules:GetGameModeEntity().chess_list_ssr))]
- elseif ran1 <= 30 then
- this_chess = 'chess_io'
- else
- --正常抽牌
- if GameRules:GetGameModeEntity().chess_gailv[hero_level] ~= nil then
- for per,lv in pairs(GameRules:GetGameModeEntity().chess_gailv[hero_level]) do
- if ran>per and curr_per<=per then
- curr_per = per
- chess_level = lv
- end
- end
- end
- -- this_chess = GameRules:GetGameModeEntity().chess_list_by_mana[chess_level][RandomInt(1,table.maxn(GameRules:GetGameModeEntity().chess_list_by_mana[chess_level]))]
- this_chess = DrawAChessFromChessPool(chess_level, table_11chess, h.ban_chess_list)
- end
- return this_chess
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement