From c77990865c60195e824e78e3853c96fe20af6e1f Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Fri, 14 Sep 2018 09:44:59 -0400 Subject: [PATCH] implement wild card multiplier (demo machines don't use it) for 'n' wilds that contribute to a win, multiply the line win * n * wild multiplier value --- README.txt | 2 ++ minislots_engine/engine.lua | 11 ++++++++++- minislots_golden7s/init.lua | 3 +++ minislots_golden7s_deluxe/init.lua | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.txt b/README.txt index 83b3689..d334795 100644 --- a/README.txt +++ b/README.txt @@ -221,6 +221,8 @@ winning combination is in your machine, that doesn't also contain any symbols in the wild_doesnt_match table (three or five [777]'s in the Golden 7's example machines). +If a wild multiplier is in effect, it'll be applied to the final value for a +given match. DISCLAIMER: =========== diff --git a/minislots_engine/engine.lua b/minislots_engine/engine.lua index a1df228..8d50282 100644 --- a/minislots_engine/engine.lua +++ b/minislots_engine/engine.lua @@ -110,11 +110,13 @@ function minislots.check_win(spin, def, maxlines) for payline,paylineoffsets in ipairs(def.lines) do local highestwin = nil + local wildcount = 0 if payline > maxlines then break end paylinecontent[payline] = {} for _,m in ipairs(def.matches) do local matchwin = true + local wc = 0 for reel = 1, def.constants.numreels do local row = paylineoffsets[reel]+2 if not m[reel+1] or type(m[reel+1]) == "string" then @@ -128,6 +130,7 @@ function minislots.check_win(spin, def, maxlines) matchwin = false break end + if spin[row][reel][2] == "wild" then wc = wc + 1 end else local sublistmatch = false for e in ipairs(m[reel+1]) do @@ -139,15 +142,21 @@ function minislots.check_win(spin, def, maxlines) sublistmatch = true end end - if not sublistmatch then matchwin = false break end + if not sublistmatch then + matchwin = false + break + end + if spin[row][reel][2] == "wild" then wc = wc + 1 end end end if matchwin then + wildcount = wc highestwin = m[1] end end if highestwin then + if wildcount > 0 then highestwin = highestwin * wildcount * def.wild_multiplier end table.insert(allwins, { payline = payline, value = highestwin, symbols = paylinecontent[payline]}) end end diff --git a/minislots_golden7s/init.lua b/minislots_golden7s/init.lua index ed0eee6..53d2b7b 100644 --- a/minislots_golden7s/init.lua +++ b/minislots_golden7s/init.lua @@ -115,6 +115,9 @@ minislots.register_machine({ wild_doesnt_match = { jackpot = true }, + wild_multiplier = 1, -- For every wild that contributes to a line win, multiply win by this + -- (so one wild mult. by this, two mult. by twice this, etc) + geometry = { -- all measures are in Minetest formspec "inventory slots" units base_user_interface_width = 13, -- width of the user interface diff --git a/minislots_golden7s_deluxe/init.lua b/minislots_golden7s_deluxe/init.lua index 81d10d6..79a2cc3 100644 --- a/minislots_golden7s_deluxe/init.lua +++ b/minislots_golden7s_deluxe/init.lua @@ -146,6 +146,9 @@ minislots.register_machine({ wild_doesnt_match = { jackpot = true }, + wild_multiplier = 1, -- For every wild that contributes to a line win, multiply win by this + -- (so one wild mult. by this, two mult. by twice this, etc) + geometry = { -- all measures are in Minetest formspec "inventory slots" units base_user_interface_width = 14.667, -- width of the user interface