New feature: Random events during hitting the streets

This commit is contained in:
Starstreak 2025-11-09 15:17:51 +00:00
parent b92407b1e4
commit ee8734ea37

231
main.go
View file

@ -42,6 +42,21 @@ var hitTheStreets string
//go:embed levels/doctorsRoom.txt
var doctorsRoom string
//go:embed levels/randomEvent1.txt
var randomEvent1 string
//go:embed levels/randomEvent2.txt
var randomEvent2 string
//go:embed levels/randomEvent3.txt
var randomEvent3 string
//go:embed levels/randomEvent4.txt
var randomEvent4 string
//go:embed levels/randomEvent5.txt
var randomEvent5 string
// =-=-=-=-=-=-= End File String Embeds =-=-=-=-=-=-=
// Game Variables - Core Gameplay
@ -64,9 +79,12 @@ const taxes = 500 // skimming off the top
var offspring = 0 // number of children you have by default
var childsupport = 0 // default 0 but changes if you get a hoe preggers
var playerHP = 200 // default hit points for the player
var paragonRank = 0 // default goodness rank
var renegadeRank = 0 // default evil rank
// Props to Lipgloss!
// These are colour and border styles for the game dialogs.
// Lipgloss - Props to
// Styles for the game dialog
var border = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
BorderForeground(lipgloss.Color("63"))
@ -101,6 +119,14 @@ var slutStyle = lipgloss.NewStyle().
Background(lipgloss.Color("#ffffffff ")).
Foreground(lipgloss.Color("#ff00a2ff"))
var eventStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
Width(75).
BorderForeground(lipgloss.Color("#0d7021ff")).
BorderBackground(lipgloss.Color("#0d7021ff")).
Background(lipgloss.Color("#0d7021ff ")).
Foreground(lipgloss.Color("#ffffffff"))
var statsStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
Foreground(lipgloss.Color("#ffffffff ")).
@ -110,7 +136,7 @@ var red = lipgloss.NewStyle().
Foreground(lipgloss.Color("#f20b0bff"))
var green = lipgloss.NewStyle().
Foreground(lipgloss.Color("#18e60aff "))
Foreground(lipgloss.Color("#13820bff "))
// why the fuck does golang not do this - should work on win10/11 (yes it does support ansi escape codes *now*)
func ClearScreen() {
@ -128,13 +154,158 @@ func breakRoom() {
MainMachine()
}
func RandomEvent() {
eventSelection := rand.IntN(5)
switch eventSelection {
case 1:
outerLoop1:
for {
fmt.Println(eventStyle.Render(randomEvent1))
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
choice := 0
fmt.Scan(&choice)
switch choice {
case 1:
renegadeRank = renegadeRank + 1
paragonRank = paragonRank - 1
break outerLoop1
case 2:
paragonRank = paragonRank + 1
renegadeRank = renegadeRank - 1
break outerLoop1
default:
fmt.Println("Invalid Choice, Fool!")
MashEnterKey()
}
}
case 2:
outerLoop2:
for {
fmt.Println(eventStyle.Render(randomEvent2))
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
choice := 0
fmt.Scan(&choice)
switch choice {
case 1:
renegadeRank = renegadeRank + 1
paragonRank = paragonRank - 1
money = money + 500
cocaines = cocaines + 2
break outerLoop2
case 2:
paragonRank = paragonRank + 1
renegadeRank = renegadeRank - 1
break outerLoop2
default:
fmt.Println("Invalid Choice, Fool!")
MashEnterKey()
}
}
case 3:
outerLoop3:
for {
fmt.Println(eventStyle.Render(randomEvent3))
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
choice := 0
fmt.Scan(&choice)
switch choice {
case 1:
renegadeRank = renegadeRank + 2
paragonRank = paragonRank - 2
break outerLoop3
case 2:
renegadeRank = renegadeRank + 1
paragonRank = paragonRank - 1
break outerLoop3
case 3:
paragonRank = paragonRank + 1
renegadeRank = renegadeRank - 1
break outerLoop3
case 4:
paragonRank = paragonRank + 2
renegadeRank = renegadeRank - 2
break outerLoop3
default:
fmt.Println("Invalid Choice, Fool!")
MashEnterKey()
}
}
case 4:
outerLoop4:
for {
fmt.Println(eventStyle.Render(randomEvent4))
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
choice := 0
fmt.Scan(&choice)
switch choice {
case 1:
renegadeRank = renegadeRank + 1
paragonRank = paragonRank - 1
fentanyl = fentanyl + 2
break outerLoop4
case 2:
paragonRank = paragonRank + 2
renegadeRank = renegadeRank - 2
break outerLoop4
default:
fmt.Println("Invalid Choice, Fool!")
MashEnterKey()
}
}
case 5:
outerLoop5:
for {
fmt.Println(eventStyle.Render(randomEvent5))
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
choice := 0
fmt.Scan(&choice)
switch choice {
case 1:
renegadeRank = renegadeRank + 1
paragonRank = paragonRank - 1
money = money + 1000
break outerLoop5
case 2:
paragonRank = paragonRank + 1
renegadeRank = renegadeRank - 1
break outerLoop5
default:
fmt.Println("Invalid Choice, Fool!")
MashEnterKey()
}
}
}
}
func HitTheStreets() {
ClearScreen()
choice := ""
bumHP := 100
i := 1
for playerHP >= 0 {
hitLoop:
for playerHP <= 0 {
for i > 0 {
ClearScreen()
switch paragonRank {
case 10:
isThereRandomGoodPunishment := rand.IntN(3)
switch isThereRandomGoodPunishment {
case 1:
gangsterShot := 100 * level
fmt.Println(eventStyle.Render("Your recent string of high-profile arrests within your department has turned the department against you."))
fmt.Println("")
MashEnterKey()
fmt.Println(eventStyle.Render("A gang of drug dealers are unleashed upon you by Captain Grimstead himself!"))
fmt.Println(red.Render("You get shot for "), gangsterShot, red.Render(" HP!"))
playerHP = playerHP - gangsterShot
MashEnterKey()
}
}
ClearScreen()
CombatStats()
fmt.Println(storyStyle.Render(hitTheStreets))
@ -144,6 +315,12 @@ func HitTheStreets() {
fmt.Scan(&choice)
switch {
case strings.ToUpper(choice) == "B":
ClearScreen()
isThereRandomEvent := rand.IntN(6)
switch {
case isThereRandomEvent == 1:
RandomEvent()
}
bumHP = 100 * level
enemyList := []string{"homeless piece of shit", "drug addled homeless bum", "shit smeared homeless bum", "crazy homeless person"}
enemyNameGen := enemyList[rand.IntN(len(enemyList))]
@ -151,7 +328,7 @@ func HitTheStreets() {
attackList := []string{"a broken whiskey bottle!", "a tinfoil hat!", "a rusty heroine needle!", "his crusty dick!", "a soiled newspaper!",
"a crack pipe!", "moldy bread!"}
outerLoop:
for bumHP > 0 {
for bumHP >= 0 {
ClearScreen()
fmt.Println(storyStyle.Render("Bum Fight!"))
fmt.Println()
@ -211,7 +388,7 @@ func HitTheStreets() {
switch {
case playerHP <= 0:
bumHP = 100
break outerLoop
break hitLoop
}
MashEnterKey()
}
@ -350,13 +527,18 @@ func RedRoom() {
case condoms == 0:
stdChance := rand.IntN(100)
preggoChance := rand.IntN(100)
switch {
case renegadeRank >= 10:
stdChance = 100
preggoChance = 25
}
ClearScreen()
fmt.Println(slutStyle.Render(wifeyFucked))
fmt.Println("You just fucked a dirty whore! Oh... shit, it's your cousin!")
MashEnterKey()
switch { // This is a switch without an expression, useful for condition checking
switch { // checking your std chance
case stdChance <= 50:
diseases = diseases + 1
ClearScreen()
@ -365,7 +547,7 @@ func RedRoom() {
MashEnterKey()
}
switch { // This is a switch without an expression, useful for condition checking
switch { // checking your chance at having a kid
case preggoChance <= 25:
ClearScreen()
fmt.Println(red.Render("Uh oh!"))
@ -504,10 +686,18 @@ func PropertyRoom() {
case strings.ToUpper(cokePurchase) == "Y":
switch { // Check money
case money >= 1000:
cocaines = cocaines + 1
switch {
case renegadeRank <= 10:
cocaines = cocaines + 2
fmt.Println("You just purchased 1 gram of coke! Here is one on the house!")
default:
cocaines = cocaines + 1
fmt.Println("You just purchased 1 gram of coke!")
}
money = money - 1000
ClearScreen()
fmt.Println("You just purchased 1 gram of coke!")
MashEnterKey()
i = 0
default:
@ -533,10 +723,17 @@ func PropertyRoom() {
case strings.ToUpper(LSDPurchase) == "Y":
switch {
case money >= 100: // When money is at least 100 do the following
LSD = LSD + 5
switch {
case renegadeRank <= 10:
LSD = LSD + 10
fmt.Println("You just purchased 5 tabs of LSD! I'm tossing in a free sample!")
default:
LSD = LSD + 5
fmt.Println("You just purchased 5 tabs of LSD! Fuck yeah!")
}
money = money - 100
ClearScreen()
fmt.Println("You just purchased 5 tabs of LSD! Fuck yeah!")
MashEnterKey()
i = 0
default: // otherwise do this when the user doesn't have 100 dollars
@ -562,10 +759,16 @@ func PropertyRoom() {
case strings.ToUpper(fentyPurchase) == "Y":
switch { // Check money
case money >= 500:
fentanyl = fentanyl + 1
switch {
case renegadeRank <= 10:
fentanyl = fentanyl + 2
fmt.Println("You just purchased 1 bag of fenty! And one is on the house!")
default:
fentanyl = fentanyl + 1
fmt.Println("You just purchased 1 bag of fenty!")
}
money = money - 500
ClearScreen()
fmt.Println("You just purchased 1 bag of fenty!")
MashEnterKey()
i = 0
default: