From 67832986ef5229631d53f770caf4939062f9df8b Mon Sep 17 00:00:00 2001 From: Skullheadx Date: Sat, 16 May 2026 23:44:49 -0400 Subject: [PATCH] utility --- game/color.go | 8 ++++---- game/game.go | 13 ++++++++++++- game/utility.go | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 game/utility.go diff --git a/game/color.go b/game/color.go index 1354782..55c3ed4 100644 --- a/game/color.go +++ b/game/color.go @@ -1,10 +1,10 @@ package game func processOwnedColors() { - for _, ocv := range OwnedColorVisitors { - visitorID := ocv.visitorID - ownerID := ocv.ownerID - colorID := ocv.colorID + for _, oCV := range OwnedColorVisitors { + visitorID := oCV.visitorID + ownerID := oCV.ownerID + colorID := oCV.colorID prop := ColorProperties[colorID] prices := ColorPropertyRents[colorID] diff --git a/game/game.go b/game/game.go index b137ba9..7c6cfc8 100644 --- a/game/game.go +++ b/game/game.go @@ -3,7 +3,7 @@ package game var Users []User var DebtEvents []int32 -func HasMonopoly(playerID int32, targetGroup ColorGroup) bool { +func HasColorMonopoly(playerID int32, targetGroup ColorGroup) bool { var ownedCount int32 for colorID, ownerID := range PropertyOwners { if ownerID == playerID && ColorProperties[colorID].GroupID == targetGroup { @@ -14,6 +14,17 @@ func HasMonopoly(playerID int32, targetGroup ColorGroup) bool { return ownedCount == ColorGroupSizes[targetGroup] } +func HasUtiltyMonopoly(playerID int32) bool { + var ownedCount int32 + for _, ownerID := range PropertyOwners { + if ownerID == playerID { + ownedCount++ + } + } + + return ownedCount == int32(len(UtilityProperties)) +} + func IsInDebt(playerID int32) (bool, int32) { for i, pID := range DebtEvents { if pID == playerID { diff --git a/game/utility.go b/game/utility.go new file mode 100644 index 0000000..292a7d2 --- /dev/null +++ b/game/utility.go @@ -0,0 +1,15 @@ +package game + +func processOwnedUtility() { + for _, oUV := range OwnedUtilityVisitors { + visitorID := oUV.visitorID + ownerID := oUV.ownerID + // utilityID := oUV.utilityID + diceRoll := oUV.diceRoll + + var rent int32 = UtilityRentMult[HasUtiltyMonopoly(ownerID)] * diceRoll + + AdjustPlayerMoney(visitorID, -rent) + AdjustPlayerMoney(ownerID, rent) + } +} -- 2.54.0