Skip to content

Commit

Permalink
free spins moved to base.
Browse files Browse the repository at this point in the history
  • Loading branch information
schwarzlichtbezirk committed Dec 3, 2024
1 parent cb2da6f commit 5d3ac44
Show file tree
Hide file tree
Showing 61 changed files with 222 additions and 906 deletions.
24 changes: 0 additions & 24 deletions game/slot/agt/aislot/aislot_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ var BetLines = slot.BetLinesAgt5x3[:15]

type Game struct {
slot.Slot5x3 `yaml:",inline"`
// free spin number
FS int `json:"fs,omitempty" yaml:"fs,omitempty" xml:"fs,omitempty"`
}

// Declare conformity with SlotGame interface.
Expand All @@ -41,7 +39,6 @@ func NewGame() *Game {
Sel: len(BetLines),
Bet: 1,
},
FS: 0,
}
}

Expand Down Expand Up @@ -107,27 +104,6 @@ func (g *Game) Spin(screen slot.Screen, mrtp float64) {
screen.Spin(reels)
}

func (g *Game) Apply(screen slot.Screen, wins slot.Wins) {
if g.FS != 0 {
g.Gain += wins.Gain()
} else {
g.Gain = wins.Gain()
}

if g.FS > 0 {
g.FS--
}
for _, wi := range wins {
if wi.Free > 0 {
g.FS += wi.Free
}
}
}

func (g *Game) FreeSpins() int {
return g.FS
}

func (g *Game) SetSel(sel int) error {
return g.SetSelNum(sel, len(BetLines))
}
24 changes: 0 additions & 24 deletions game/slot/agt/aladdin/aladdin_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ var BetLines = slot.BetLinesAgt5x4[:100]

type Game struct {
slot.Slot5x4 `yaml:",inline"`
// free spin number
FS int `json:"fs,omitempty" yaml:"fs,omitempty" xml:"fs,omitempty"`
}

// Declare conformity with SlotGame interface.
Expand All @@ -40,7 +38,6 @@ func NewGame() *Game {
Sel: len(BetLines),
Bet: 1,
},
FS: 0,
}
}

Expand Down Expand Up @@ -123,27 +120,6 @@ func (g *Game) Spin(screen slot.Screen, mrtp float64) {
screen.Spin(reels)
}

func (g *Game) Apply(screen slot.Screen, wins slot.Wins) {
if g.FS != 0 {
g.Gain += wins.Gain()
} else {
g.Gain = wins.Gain()
}

if g.FS > 0 {
g.FS--
}
for _, wi := range wins {
if wi.Free > 0 {
g.FS += wi.Free
}
}
}

func (g *Game) FreeSpins() int {
return g.FS
}

func (g *Game) SetSel(sel int) error {
return g.SetSelNum(sel, len(BetLines))
}
2 changes: 1 addition & 1 deletion game/slot/agt/iceiceice/iceiceice_calc.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func CalcStatBon(ctx context.Context, mrtp float64) float64 {
var g = NewGame()
var sln float64 = 1
g.Sel = int(sln)
g.FS = 20 // set free spins mode
g.FSR = 20 // set free spins mode
var s slot.Stat

var dur = slot.ScanReels3x(ctx, &s, g, reels,
Expand Down
7 changes: 2 additions & 5 deletions game/slot/agt/iceiceice/iceiceice_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ var BetLines = []slot.Linex{

type Game struct {
slot.Slot3x3 `yaml:",inline"`
// free spin number
FS int `json:"fs,omitempty" yaml:"fs,omitempty" xml:"fs,omitempty"`
}

// Declare conformity with SlotGame interface.
Expand All @@ -46,7 +44,6 @@ func NewGame() *Game {
Sel: len(BetLines),
Bet: 1,
},
FS: 0,
}
}

Expand All @@ -56,7 +53,7 @@ func (g *Game) Scanner(screen slot.Screen, wins *slot.Wins) {
for li := 1; li <= g.Sel; li++ {
var line = BetLines[li-1]

if g.FS > 0 {
if g.FSR > 0 {
var numl slot.Pos = 3
var syml slot.Sym
var x slot.Pos
Expand Down Expand Up @@ -84,7 +81,7 @@ func (g *Game) Scanner(screen slot.Screen, wins *slot.Wins) {
XY: line, // whole line is used
})
}
} else { // g.FS == 0
} else { // g.FSR == 0
var numl slot.Pos = 3
var syml = screen.Pos(1, line)
var x slot.Pos
Expand Down
32 changes: 4 additions & 28 deletions game/slot/agt/icequeen/icequeen_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ var BetLines = slot.BetLinesAgt5x3[:]

type Game struct {
slot.Slot5x3 `yaml:",inline"`
// free spin number
FS int `json:"fs,omitempty" yaml:"fs,omitempty" xml:"fs,omitempty"`
}

// Declare conformity with SlotGame interface.
Expand All @@ -41,7 +39,6 @@ func NewGame() *Game {
Sel: 5,
Bet: 1,
},
FS: 0,
}
}

Expand Down Expand Up @@ -85,7 +82,7 @@ func (g *Game) ScanLined(screen slot.Screen, wins *slot.Wins) {
}
if payl*mw > payw {
var mm float64 = 1 // mult mode
if g.FS > 0 {
if g.FSR > 0 {
mm = 3
}
*wins = append(*wins, slot.WinItem{
Expand All @@ -98,7 +95,7 @@ func (g *Game) ScanLined(screen slot.Screen, wins *slot.Wins) {
})
} else if payw > 0 {
var mm float64 = 1 // mult mode
if g.FS > 0 {
if g.FSR > 0 {
mm = 3
}
*wins = append(*wins, slot.WinItem{
Expand All @@ -117,7 +114,7 @@ func (g *Game) ScanLined(screen slot.Screen, wins *slot.Wins) {
func (g *Game) ScanScatters(screen slot.Screen, wins *slot.Wins) {
if count := screen.ScatNum(scat); count >= 2 {
var mm float64 = 1 // mult mode
if g.FS > 0 {
if g.FSR > 0 {
mm = 3
}
var pay, fs = ScatPay[count-1], ScatFreespin[count-1]
Expand All @@ -133,35 +130,14 @@ func (g *Game) ScanScatters(screen slot.Screen, wins *slot.Wins) {
}

func (g *Game) Spin(screen slot.Screen, mrtp float64) {
if g.FS == 0 {
if g.FSR == 0 {
var reels, _ = slot.FindReels(ReelsMap, mrtp)
screen.Spin(reels)
} else {
screen.Spin(&ReelsBon)
}
}

func (g *Game) Apply(screen slot.Screen, wins slot.Wins) {
if g.FS != 0 {
g.Gain += wins.Gain()
} else {
g.Gain = wins.Gain()
}

if g.FS > 0 {
g.FS--
}
for _, wi := range wins {
if wi.Free > 0 {
g.FS += wi.Free
}
}
}

func (g *Game) FreeSpins() int {
return g.FS
}

func (g *Game) SetSel(sel int) error {
return g.SetSelNum(sel, len(BetLines))
}
2 changes: 1 addition & 1 deletion game/slot/agt/infinitygems/infinitygems_calc.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func CalcStatBon(ctx context.Context) float64 {
var g = NewGame()
var sln float64 = 1
g.Sel = int(sln)
g.FS = 50 // set free spins mode
g.FSR = 50 // set free spins mode
var s slot.Stat

var dur = slot.ScanReels5x(ctx, &s, g, reels,
Expand Down
26 changes: 1 addition & 25 deletions game/slot/agt/infinitygems/infinitygems_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ var BetLines = slot.BetLinesAgt5x3[:20]

type Game struct {
slot.Slot5x3 `yaml:",inline"`
// free spin number
FS int `json:"fs,omitempty" yaml:"fs,omitempty" xml:"fs,omitempty"`
}

// Declare conformity with SlotGame interface.
Expand All @@ -47,7 +45,6 @@ func NewGame() *Game {
Sel: len(BetLines),
Bet: 1,
},
FS: 0,
}
}

Expand Down Expand Up @@ -127,35 +124,14 @@ func (g *Game) ScanScatters(screen slot.Screen, wins *slot.Wins) {
}

func (g *Game) Spin(screen slot.Screen, mrtp float64) {
if g.FS == 0 {
if g.FSR == 0 {
var reels, _ = slot.FindReels(ReelsMap, mrtp)
screen.Spin(reels)
} else {
screen.Spin(&ReelsBon)
}
}

func (g *Game) Apply(screen slot.Screen, wins slot.Wins) {
if g.FS != 0 {
g.Gain += wins.Gain()
} else {
g.Gain = wins.Gain()
}

if g.FS > 0 {
g.FS--
}
for _, wi := range wins {
if wi.Free > 0 {
g.FS += wi.Free
}
}
}

func (g *Game) FreeSpins() int {
return g.FS
}

func (g *Game) SetSel(sel int) error {
return g.SetSelNum(sel, len(BetLines))
}
2 changes: 1 addition & 1 deletion game/slot/agt/suncity/suncity_calc.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func CalcStatBon(ctx context.Context) (rtp, num float64) {
var g = NewGame()
var sln float64 = 1
g.Sel = int(sln)
g.FS = -1 // set free spins mode
g.FSR = -1 // set free spins mode
var s slot.Stat

var dur = slot.ScanReels5x(ctx, &s, g, reels,
Expand Down
23 changes: 10 additions & 13 deletions game/slot/agt/suncity/suncity_rule.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package suncity

// See: https://demo.agtsoftware.com/games/agt/suncity

import (
"github.com/slotopol/server/game/slot"
)
Expand All @@ -22,12 +24,10 @@ var LinePay = [13][5]float64{
}

// Bet lines
var BetLines = slot.BetLinesAgt5x3[:20]
var BetLines = slot.BetLinesAgt5x3[:30]

type Game struct {
slot.Slot5x3 `yaml:",inline"`
// free spin number
FS int `json:"fs,omitempty" yaml:"fs,omitempty" xml:"fs,omitempty"`
}

// Declare conformity with SlotGame interface.
Expand All @@ -39,7 +39,6 @@ func NewGame() *Game {
Sel: len(BetLines),
Bet: 1,
},
FS: 0,
}
}

Expand Down Expand Up @@ -114,7 +113,7 @@ func (g *Game) ScanScatters(screen slot.Screen, wins *slot.Wins) {
}

func (g *Game) Spin(screen slot.Screen, mrtp float64) {
if g.FS == 0 {
if g.FSR == 0 {
var reels, _ = slot.FindReels(ReelsMap, mrtp)
screen.Spin(reels)
} else {
Expand All @@ -123,27 +122,25 @@ func (g *Game) Spin(screen slot.Screen, mrtp float64) {
}

func (g *Game) Apply(screen slot.Screen, wins slot.Wins) {
if g.FS != 0 {
if g.FSR != 0 {
g.Gain += wins.Gain()
g.FSN++
} else {
g.Gain = wins.Gain()
g.FSN = 0
}

for _, wi := range wins {
if wi.Free != 0 {
if g.FS != 0 {
g.FS = 0 // stop free games
if g.FSR != 0 {
g.FSR = 0 // stop free games
} else {
g.FS = -1 // start free games
g.FSR = -1 // start free games
}
}
}
}

func (g *Game) FreeSpins() int {
return g.FS
}

func (g *Game) SetSel(sel int) error {
return g.SetSelNum(sel, len(BetLines))
}
2 changes: 1 addition & 1 deletion game/slot/agt/valkyrie/valkyrie_calc.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func CalcStatBon(ctx context.Context, mrtp float64) float64 {
var g = NewGame()
var sln float64 = 1
g.Sel = int(sln)
g.FS = 15 // set free spins mode
g.FSR = 15 // set free spins mode
var s slot.Stat

var ctx2, cancel2 = context.WithCancel(ctx)
Expand Down
Loading

0 comments on commit 5d3ac44

Please sign in to comment.