Refactored code. Replaced IF and ELSE statements with Switches. Cleaner and more readable.

This commit is contained in:
Starstreak 2025-11-09 02:49:13 +00:00
parent 8b25a1f5e0
commit 1aa6704da4

304
main.go
View file

@ -49,7 +49,7 @@ var stats string // variable for stats generation output
var statsCombat string // variable used for combat stats generation during fights var statsCombat string // variable used for combat stats generation during fights
var PlayerName string // player's name... var PlayerName string // player's name...
var condoms = 0 // its better to have them and not need them var condoms = 0 // its better to have them and not need them
var diseases = 0 // what happens if you have connies var diseases = 0 // what happens if you don't have connies
var money = 1800 // not specific currency var money = 1800 // not specific currency
var days = 30 // total number of days (default 30) var days = 30 // total number of days (default 30)
var experience = 0 // your experience from combat battle fights (starts at 0) var experience = 0 // your experience from combat battle fights (starts at 0)
@ -66,6 +66,7 @@ var childsupport = 0 // default 0 but changes if you get a hoe preggers
var playerHP = 200 // default hit points for the player var playerHP = 200 // default hit points for the player
// Lipgloss - Props to // Lipgloss - Props to
// Styles for the game dialog
var border = lipgloss.NewStyle(). var border = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()). BorderStyle(lipgloss.NormalBorder()).
BorderForeground(lipgloss.Color("63")) BorderForeground(lipgloss.Color("63"))
@ -84,6 +85,14 @@ var storyStyle = lipgloss.NewStyle().
Foreground(lipgloss.Color("#ffffffff ")). Foreground(lipgloss.Color("#ffffffff ")).
Background(lipgloss.Color("#0000FF")) Background(lipgloss.Color("#0000FF"))
var propertyStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
Width(75).
BorderForeground(lipgloss.Color("228")).
BorderBackground(lipgloss.Color("#5023aaff")).
Foreground(lipgloss.Color("#ffffffff ")).
Background(lipgloss.Color("#5023aaff"))
var slutStyle = lipgloss.NewStyle(). var slutStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()). BorderStyle(lipgloss.NormalBorder()).
Width(75). Width(75).
@ -124,7 +133,7 @@ func HitTheStreets() {
choice := "" choice := ""
bumHP := 100 bumHP := 100
i := 1 i := 1
for playerHP > 0 { for playerHP >= 0 {
for i > 0 { for i > 0 {
ClearScreen() ClearScreen()
CombatStats() CombatStats()
@ -133,14 +142,20 @@ func HitTheStreets() {
fmt.Println("Your choice,") fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">") fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice) fmt.Scan(&choice)
if strings.ToUpper(choice) == "B" { switch {
case strings.ToUpper(choice) == "B":
bumHP = 100 * level 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))]
enemyName := strings.Clone(enemyNameGen)
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: outerLoop:
for bumHP > 0 { for bumHP > 0 {
ClearScreen() ClearScreen()
fmt.Println(storyStyle.Render("Bum Fight!")) fmt.Println(storyStyle.Render("Bum Fight!"))
fmt.Println() fmt.Println()
fmt.Println("You are staring at a ", red.Render("homeless piece of shit!"), "with", bumHP, " HP") fmt.Println("You are staring at a ", red.Render(enemyName), "with", bumHP, " HP")
fmt.Println("") fmt.Println("")
fmt.Println("What do you do?") fmt.Println("What do you do?")
fmt.Println("") fmt.Println("")
@ -152,20 +167,23 @@ func HitTheStreets() {
fmt.Print(green.Render(PlayerName), ">") fmt.Print(green.Render(PlayerName), ">")
homelessFight := "" homelessFight := ""
fmt.Scan(&homelessFight) fmt.Scan(&homelessFight)
if strings.ToUpper(homelessFight) == "F" { switch {
case strings.ToUpper(homelessFight) == "F":
chance := rand.IntN(100) chance := rand.IntN(100)
if chance > 40 { switch {
attack := 20 // default attack power case chance > 40:
attack := 40 // default attack power
switch { switch {
case fentanyl <= 0: case fentanyl <= 0:
attack = 20 attack = 40 * level
default: default:
modifier := attack * fentanyl // default attack power multiplied by amount of fentanyl buffs := attack * fentanyl // default attack power multiplied by amount of fentanyl
attack = attack + modifier modifier := level * 2 // double the damage based on level
attack = attack + buffs + modifier //
} }
bumHP = bumHP - attack bumHP = bumHP - attack // attack homeless person
ClearScreen() ClearScreen()
fmt.Println(red.Render("You smash the bum for "), attack, "hit points!") fmt.Println(red.Render("You smash the bum for "), attack, "hit points!")
fmt.Println("The bum has ", bumHP, " HP left") fmt.Println("The bum has ", bumHP, " HP left")
@ -173,29 +191,31 @@ func HitTheStreets() {
switch { switch {
case bumHP <= 0: case bumHP <= 0: // what happens if homeless person HP goes to or below 0
money = money + 200 money = money*level + 300
bumfights = bumfights - 1 bumfights = bumfights - 1
experienceGain := cocaines * 100 experienceGain := cocaines * 100
levelGain := level * 100 levelGain := level * 100
experience = experience + levelGain + experienceGain + 100 experience = experience + levelGain + experienceGain + levelGain
break outerLoop break outerLoop
} }
} else { default:
ClearScreen() ClearScreen()
fmt.Println(red.Render("You missed, he dodged your attack!")) fmt.Println(red.Render("You missed, he dodged your attack!"))
fmt.Println() fmt.Println()
homelessAttack := 20 homelessAttack := 20
playerHP = playerHP - homelessAttack playerHP = playerHP - homelessAttack
fmt.Println(red.Render("The homeless thug attacks you with a broken whiskey bottle for"), homelessAttack, " HP") randomAttack := attackList[rand.IntN(len(attackList))]
fmt.Println(red.Render("The "), enemyName, red.Render("attacks you with "), randomAttack, red.Render(" for"), homelessAttack, red.Render(" HP"))
fmt.Println("Perhaps you should lay off the donuts...") fmt.Println("Perhaps you should lay off the donuts...")
if playerHP < 0 { switch {
case playerHP <= 0:
bumHP = 100 bumHP = 100
break outerLoop break outerLoop
} }
MashEnterKey() MashEnterKey()
} }
} else { default:
fmt.Println("You go back to HQ.") fmt.Println("You go back to HQ.")
bumfights = bumfights - 1 bumfights = bumfights - 1
bumHP = 0 bumHP = 0
@ -204,13 +224,12 @@ func HitTheStreets() {
} }
} }
bumfights = bumfights - 1 bumfights = bumfights - 1
} else if strings.ToUpper(choice) == "R" { case strings.ToUpper(choice) == "R":
MainMachine() MainMachine()
} }
} }
}
MainMachine() MainMachine()
}
} }
func RedRoom() { func RedRoom() {
@ -222,8 +241,8 @@ func RedRoom() {
fmt.Println("Your choice,") fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">") fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice) fmt.Scan(&choice)
// buy whore switch {
if strings.ToUpper(choice) == "B" { case strings.ToUpper(choice) == "B": // buy whore
ClearScreen() ClearScreen()
fmt.Println(slutStyle.Render("Sex Slave Menu")) fmt.Println(slutStyle.Render("Sex Slave Menu"))
fmt.Println("Price: ", red.Render("$2000 per whore.")) fmt.Println("Price: ", red.Render("$2000 per whore."))
@ -233,54 +252,60 @@ func RedRoom() {
fmt.Print(green.Render(PlayerName), ">") fmt.Print(green.Render(PlayerName), ">")
slavePurchase := "" slavePurchase := ""
fmt.Scan(&slavePurchase) fmt.Scan(&slavePurchase)
if strings.ToUpper(slavePurchase) == "Y" { switch {
if money > 2000 { case strings.ToUpper(slavePurchase) == "Y":
switch {
case money >= 2000:
whores = whores + 1 whores = whores + 1
money = money - 5000 money = money - 2000 // *** BUG FIX: Changed 5000 to 2000 ***
ClearScreen() ClearScreen()
fmt.Println(slutStyle.Render("You just purchased 1 whore to be a sex slave!")) fmt.Println(slutStyle.Render("You just purchased 1 whore to be a sex slave!"))
MashEnterKey() MashEnterKey()
i = 0 i = 0
} else { default:
ClearScreen() ClearScreen()
fmt.Println(slutStyle.Render("Get some money, broke-ass!")) fmt.Println(slutStyle.Render("Get some money, broke-ass!"))
MashEnterKey() MashEnterKey()
i = 0 i = 0
} }
} else { default:
i = 0 i = 0
} }
} else if strings.ToUpper(choice) == "P" {
case strings.ToUpper(choice) == "P": // Buy Connies (Condoms)
ClearScreen() ClearScreen()
fmt.Println(slutStyle.Render("$10 to buy a five pack of connies?")) fmt.Println(slutStyle.Render("$10 to buy a five pack of connies?"))
fmt.Println("Price: ", red.Render("$10 for a five pack.")) fmt.Println("Price: ", red.Render("$10 for a five pack."))
fmt.Println("Your cash: $", strconv.Itoa(money)) fmt.Println("Your cash: $", strconv.Itoa(money))
fmt.Println("") fmt.Println("")
fmt.Println("Buy connies (Y/N)?") fmt.Println("Buy five connies (Y/N)?")
fmt.Print(green.Render(PlayerName), ">") fmt.Print(green.Render(PlayerName), ">")
lapPurchase := "" lapPurchase := ""
fmt.Scan(&lapPurchase) fmt.Scan(&lapPurchase)
if strings.ToUpper(lapPurchase) == "Y" { switch {
if money > 10 { case strings.ToUpper(lapPurchase) == "Y":
switch {
case money >= 10:
money = money - 10 money = money - 10
condoms = condoms + 5
ClearScreen() ClearScreen()
fmt.Println(slutStyle.Render("You just purchased a five pack of connies.")) fmt.Println(slutStyle.Render("You just purchased a five pack of connies."))
fmt.Println() fmt.Println()
MashEnterKey() MashEnterKey()
ClearScreen() ClearScreen()
i = 0 i = 0
} else { default:
ClearScreen() ClearScreen()
fmt.Println(slutStyle.Render("Get some money, broke-ass!")) fmt.Println(slutStyle.Render("Get some money, broke-ass!"))
MashEnterKey() MashEnterKey()
ClearScreen() ClearScreen()
i = 0 i = 0
} }
} else { default:
i = 0 i = 0
} }
} else if strings.ToUpper(choice) == "L" { case strings.ToUpper(choice) == "L": // Get Lap Dance
ClearScreen() ClearScreen()
fmt.Println(slutStyle.Render("Get a fucking lap dance!")) fmt.Println(slutStyle.Render("Get a fucking lap dance!"))
fmt.Println("Price: ", red.Render("$20 for a 3 minute song.")) fmt.Println("Price: ", red.Render("$20 for a 3 minute song."))
@ -289,8 +314,8 @@ func RedRoom() {
fmt.Println("Buy a lap dance (Y/N)?") fmt.Println("Buy a lap dance (Y/N)?")
lapPurchase := "" lapPurchase := ""
fmt.Scan(&lapPurchase) fmt.Scan(&lapPurchase)
if strings.ToUpper(lapPurchase) == "Y" { switch {
if money >= 20 { case strings.ToUpper(lapPurchase) == "Y":
money = money - 20 money = money - 20
ClearScreen() ClearScreen()
fmt.Println(slutStyle.Render("That slut grinds on your dick to the song 'I like it that way' by Backstreet Boys.")) fmt.Println(slutStyle.Render("That slut grinds on your dick to the song 'I like it that way' by Backstreet Boys."))
@ -299,18 +324,14 @@ func RedRoom() {
playerHP = playerHP + 100 playerHP = playerHP + 100
MashEnterKey() MashEnterKey()
i = 0 i = 0
} else { default:
ClearScreen() ClearScreen()
fmt.Println(slutStyle.Render("Get some money, broke-ass!")) fmt.Println(slutStyle.Render("Get some money, broke-ass!"))
MashEnterKey() MashEnterKey()
i = 0 i = 0
} }
} else {
i = 0
}
// Fuck Whore
} else if strings.ToUpper(choice) == "F" { case strings.ToUpper(choice) == "F": // Fuck Whore
ClearScreen() ClearScreen()
fmt.Println(border.Render("Get your dick wet at OPP McDick's")) fmt.Println(border.Render("Get your dick wet at OPP McDick's"))
fmt.Println("Price: ", red.Render("$100 to fuck a dirty whore for an hour.")) fmt.Println("Price: ", red.Render("$100 to fuck a dirty whore for an hour."))
@ -320,10 +341,13 @@ func RedRoom() {
fmt.Print(green.Render(PlayerName), ">") fmt.Print(green.Render(PlayerName), ">")
fuckPurchase := "" fuckPurchase := ""
fmt.Scan(&fuckPurchase) fmt.Scan(&fuckPurchase)
if strings.ToUpper(fuckPurchase) == "Y" { switch {
if money >= 100 { case strings.ToUpper(fuckPurchase) == "Y":
switch {
case money >= 100:
money = money - 100 money = money - 100
if condoms == 0 { switch {
case condoms == 0:
stdChance := rand.IntN(100) stdChance := rand.IntN(100)
preggoChance := rand.IntN(100) preggoChance := rand.IntN(100)
@ -332,7 +356,7 @@ func RedRoom() {
fmt.Println("You just fucked a dirty whore! Oh... shit, it's your cousin!") fmt.Println("You just fucked a dirty whore! Oh... shit, it's your cousin!")
MashEnterKey() MashEnterKey()
switch { switch { // This is a switch without an expression, useful for condition checking
case stdChance <= 50: case stdChance <= 50:
diseases = diseases + 1 diseases = diseases + 1
ClearScreen() ClearScreen()
@ -341,7 +365,7 @@ func RedRoom() {
MashEnterKey() MashEnterKey()
} }
switch { switch { // This is a switch without an expression, useful for condition checking
case preggoChance <= 25: case preggoChance <= 25:
ClearScreen() ClearScreen()
fmt.Println(red.Render("Uh oh!")) fmt.Println(red.Render("Uh oh!"))
@ -349,11 +373,12 @@ func RedRoom() {
fmt.Print(green.Render(PlayerName), "(Y/N) >") fmt.Print(green.Render(PlayerName), "(Y/N) >")
soccerBalls := "" soccerBalls := ""
fmt.Scan(&soccerBalls) fmt.Scan(&soccerBalls)
if strings.ToUpper(soccerBalls) == "Y" { switch {
case strings.ToUpper(soccerBalls) == "Y":
money = money + 500 money = money + 500
fmt.Println(red.Render("Bonus! You just made $500... The kid is great at sewing soccer balls!")) fmt.Println(red.Render("Bonus! You just made $500... The kid is great at sewing soccer balls!"))
MashEnterKey() MashEnterKey()
} else { default:
fmt.Println(red.Render("You have too much of a heart to sell your kid. Now you have to pay child support!")) fmt.Println(red.Render("You have too much of a heart to sell your kid. Now you have to pay child support!"))
offspring = offspring + 1 offspring = offspring + 1
fmt.Println("") fmt.Println("")
@ -361,28 +386,28 @@ func RedRoom() {
MashEnterKey() MashEnterKey()
} }
} }
default:
} else {
condoms = condoms - 1 condoms = condoms - 1
playerHP = playerHP + 200 playerHP = playerHP + 200
} }
ClearScreen() ClearScreen()
i = 0 i = 0
} else { default:
ClearScreen() ClearScreen()
fmt.Println(red.Render("Get some money, broke-ass!")) fmt.Println(red.Render("Get some money, broke-ass!"))
MashEnterKey() MashEnterKey()
i = 0 i = 0
} }
} else { default:
i = 0 i = 0
} }
// Return to HQ
} else if strings.ToUpper(choice) == "R" { case strings.ToUpper(choice) == "R": // Return to HQ
i = 1 i = 1
MainMachine()
} else { default:
i = 0 i = 0 // If any other input is given, loop again
} }
} }
} }
@ -397,7 +422,8 @@ func DoctorsOffice() {
fmt.Println("Your choice,") fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">") fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice) fmt.Scan(&choice)
if strings.ToUpper(choice) == "C" { switch {
case strings.ToUpper(choice) == "C":
ClearScreen() ClearScreen()
fmt.Println(storyStyle.Render("Doctor's Miracle STD/STI Cures")) fmt.Println(storyStyle.Render("Doctor's Miracle STD/STI Cures"))
fmt.Println() fmt.Println()
@ -409,37 +435,42 @@ func DoctorsOffice() {
fmt.Println("(N)o") fmt.Println("(N)o")
stdCure := "" stdCure := ""
fmt.Scan(&stdCure) fmt.Scan(&stdCure)
if strings.ToUpper(stdCure) == "Y" { switch {
if money > 100 { case strings.ToUpper(stdCure) == "Y":
switch {
case money >= 100:
fmt.Println("You pay the doctor $100 and you and/or your 'friends' are cured.") fmt.Println("You pay the doctor $100 and you and/or your 'friends' are cured.")
money = money - 100 money = money - 100
diseases = 0 diseases = 0
i = 1 i = 1
MashEnterKey() MashEnterKey()
} else { default:
fmt.Println("You're too poor to cure your diseases.") fmt.Println("You're too poor to cure your diseases.")
i = 1 i = 1
if diseases >= 1 { switch {
case diseases >= 1:
fmt.Println("But you still have a diseases.") fmt.Println("But you still have a diseases.")
MashEnterKey() MashEnterKey()
} else { default:
fmt.Println() fmt.Println()
MashEnterKey() MashEnterKey()
} }
} }
} else { default:
ClearScreen() ClearScreen()
fmt.Println("No cure for you. I guess.") fmt.Println("No cure for you. I guess.")
if diseases >= 0 { switch {
case diseases > 0:
fmt.Println("But you still have a disease.") fmt.Println("But you still have a disease.")
MashEnterKey() MashEnterKey()
} else { i = 1
fmt.Println() default:
MashEnterKey() i = 1
} }
i = 0 i = 0
} }
} else { default:
ClearScreen() ClearScreen()
fmt.Println("You head back to HQ.") fmt.Println("You head back to HQ.")
MashEnterKey() MashEnterKey()
@ -455,92 +486,103 @@ func PropertyRoom() {
i := 0 i := 0
choice := "" choice := ""
for i < 1 { for i < 1 {
fmt.Println(storyStyle.Render(propertyRoom)) fmt.Println(propertyStyle.Render(propertyRoom))
fmt.Println("Your choice,") fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">") fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice) fmt.Scan(&choice)
if strings.ToUpper(choice) == "C" { switch {
case strings.ToUpper(choice) == "C": // Cocaine Menu
ClearScreen() ClearScreen()
fmt.Println(border.Render("Cocaine Menu")) fmt.Println(propertyStyle.Render("Cocaine Menu"))
fmt.Println("Price: ", red.Render("$1000 per gram.")) fmt.Println("Price: ", red.Render("$1000 per gram."))
fmt.Println("Your cash: $", strconv.Itoa(money)) fmt.Println("Your cash: $", strconv.Itoa(money))
fmt.Println("") fmt.Println("")
fmt.Println("Buy one gram (Y/N)?") fmt.Println("Buy one gram (Y/N)?")
cokePurchase := "" cokePurchase := ""
fmt.Scan(&cokePurchase) fmt.Scan(&cokePurchase)
if strings.ToUpper(cokePurchase) == "Y" { switch { // Check purchase confirmation (Y/N)
if money > 1000 { case strings.ToUpper(cokePurchase) == "Y":
switch { // Check money
case money >= 1000:
cocaines = cocaines + 1 cocaines = cocaines + 1
money = money - 1000 money = money - 1000
ClearScreen() ClearScreen()
fmt.Println("You just purchased 1 gram of coke!") fmt.Println("You just purchased 1 gram of coke!")
MashEnterKey() MashEnterKey()
i = 0 i = 0
} else { default:
ClearScreen() ClearScreen()
fmt.Println(red.Render("Get some money, broke-ass!")) fmt.Println(red.Render("Get some money, broke-ass!"))
MashEnterKey() MashEnterKey()
i = 0 i = 0
} }
} else { default:
i = 0 i = 0
} }
} else if strings.ToUpper(choice) == "L" {
case strings.ToUpper(choice) == "L": // LSD Menu
ClearScreen() ClearScreen()
fmt.Println(border.Render("LSD Menu")) fmt.Println(propertyStyle.Render("LSD Menu"))
fmt.Println("Price: ", red.Render("$100 for five tabs.")) fmt.Println("Price: ", red.Render("$100 for five tabs."))
fmt.Println("Your cash: $", strconv.Itoa(money)) fmt.Println("Your cash: $", strconv.Itoa(money))
fmt.Println("") fmt.Println("")
fmt.Println("Buy six tabs (Y/N)?") fmt.Println("Buy five tabs (Y/N)?")
LSDPurchase := "" LSDPurchase := ""
fmt.Scan(&LSDPurchase) fmt.Scan(&LSDPurchase)
if strings.ToUpper(LSDPurchase) == "Y" { switch { // Check purchase confirmation (Y/N)
if money > 100 { case strings.ToUpper(LSDPurchase) == "Y":
switch {
case money >= 100: // When money is at least 100 do the following
LSD = LSD + 5 LSD = LSD + 5
money = money - 100 money = money - 100
ClearScreen() ClearScreen()
fmt.Println("You just purchased 5 tabs of LSD! Fuck yeah!") fmt.Println("You just purchased 5 tabs of LSD! Fuck yeah!")
MashEnterKey() MashEnterKey()
i = 0 i = 0
} else { default: // otherwise do this when the user doesn't have 100 dollars
ClearScreen() ClearScreen()
fmt.Println(red.Render("You don't have the greenbacks, loser! Get some money, broke-ass!")) fmt.Println(red.Render("You don't have the greenbacks, loser! Get some money, broke-ass!"))
MashEnterKey() MashEnterKey()
i = 0 i = 0
} }
} else { default:
i = 0 i = 0
} }
} else if strings.ToUpper(choice) == "F" {
case strings.ToUpper(choice) == "F": // Fentanyl Menu
ClearScreen() ClearScreen()
fmt.Println(border.Render("Fentanyl Menu")) fmt.Println(propertyStyle.Render("Fentanyl Menu"))
fmt.Println("Price: ", red.Render("$500 per hundred milligrams.")) fmt.Println("Price: ", red.Render("$500 per hundred milligrams."))
fmt.Println("Your cash: $", strconv.Itoa(money)) fmt.Println("Your cash: $", strconv.Itoa(money))
fmt.Println("") fmt.Println("")
fmt.Println("Buy 100 milligrams (Y/N)?") fmt.Println("Buy 100 milligrams (Y/N)?")
fentyPurchase := "" fentyPurchase := ""
fmt.Scan(&fentyPurchase) fmt.Scan(&fentyPurchase)
if strings.ToUpper(fentyPurchase) == "Y" { switch { // Check purchase confirmation (Y/N)
if money > 500 { case strings.ToUpper(fentyPurchase) == "Y":
switch { // Check money
case money >= 500:
fentanyl = fentanyl + 1 fentanyl = fentanyl + 1
money = money - 500 money = money - 500
ClearScreen() ClearScreen()
fmt.Println("You just purchased 1 bag of fenty!") fmt.Println("You just purchased 1 bag of fenty!")
MashEnterKey() MashEnterKey()
i = 0 i = 0
} else { default:
ClearScreen() ClearScreen()
fmt.Println(red.Render("Get some money, broke-ass!")) fmt.Println(red.Render("Get some money, broke-ass!"))
MashEnterKey() MashEnterKey()
i = 0 i = 0
} }
} else { default:
i = 0 i = 0
} }
} else if strings.ToUpper(choice) == "R" {
case strings.ToUpper(choice) == "R": // Return to Main Machine
i = 1 i = 1
MainMachine() MainMachine()
} else {
default: // Invalid input
i = 0 i = 0
} }
} }
@ -557,20 +599,21 @@ func ClockOut() {
switch choice { switch choice {
case 1: case 1:
chance := rand.IntN(100) chance := rand.IntN(100)
if chance < 50 { switch {
ClearScreen() case chance <= 50:
if cocaines > 1 { switch cocaines {
case 0:
fmt.Println(red.Render("You bust your wife right in the fucking face!"))
MashEnterKey()
default:
fmt.Println(red.Render("You pull out 1kg of cocaine and smash it open all over your face")) fmt.Println(red.Render("You pull out 1kg of cocaine and smash it open all over your face"))
fmt.Println(red.Render("You shout 'COKE SLAM!'")) fmt.Println(red.Render("You shout 'COKE SLAM!'"))
fmt.Println(red.Render("You bust your wife right in the fucking face!")) fmt.Println(red.Render("You bust your wife right in the fucking face!"))
fmt.Println(red.Render("YARRRRR! (You don't know why you're a pirate now)")) fmt.Println(red.Render("YARRRRR! (You don't know why you're a pirate now)"))
MashEnterKey() MashEnterKey()
ClearScreen() ClearScreen()
} else {
fmt.Println(red.Render("You bust your wife right in the fucking face!"))
MashEnterKey()
} }
} else { default:
ClearScreen() ClearScreen()
fmt.Println(red.Render("You try to bust your wife in the face but she dodges you and runs out the")) fmt.Println(red.Render("You try to bust your wife in the face but she dodges you and runs out the"))
fmt.Println(red.Render("front door!")) fmt.Println(red.Render("front door!"))
@ -593,20 +636,24 @@ func ClockOut() {
} }
ClearScreen() ClearScreen()
fmt.Println(border.Render("It is a new day!")) fmt.Println(border.Render("It is a new day!"))
if days == 0 { switch {
case days <= 0:
fmt.Println("You have run out of days...") fmt.Println("You have run out of days...")
MashEnterKey() MashEnterKey()
GameOver() GameOver()
} else { default:
days = days - 1 days = days - 1
if diseases >= 1 { switch {
case diseases >= 1:
bumfights = bumfightsTotal - 15 - diseases bumfights = bumfightsTotal - 15 - diseases
} else { default:
bumfights = bumfightsTotal bumfights = bumfightsTotal
} }
childsupport = offspring * 100 childsupport = offspring * 100
prostituteIncome := whores*500 - childsupport diseaseUpkeep := diseases * 25
money = money + taxes + prostituteIncome whoresProfit := whores * 500
income := whoresProfit - childsupport - diseaseUpkeep
money = money + taxes + income
fmt.Println("Cha ching! You now have ", money) fmt.Println("Cha ching! You now have ", money)
MainMachine() MainMachine()
} }
@ -630,27 +677,27 @@ func CheckStats() {
} }
func CombatStats() { func CombatStats() {
if experience == 1000 { switch {
case experience >= 1000:
level = 2 level = 2
} else if experience == 4000 { case experience >= 4000:
level = 3 level = 3
} else if experience == 8000 { case experience >= 9000:
level = 4 level = 4
} else if experience == 25000 { case experience >= 18000:
level = 5 level = 5
} else if experience == 75000 { case experience >= 30000:
level = 6 level = 6
} else if experience == 120000 { case experience >= 60000:
level = 7 level = 7
} else if experience == 175000 { case experience >= 120000:
level = 8 level = 8
} else if experience == 250000 { case experience >= 240000:
level = 9 level = 9
} else if experience == 1000000 { case experience >= 480000:
level = 10 level = 10
} else {
fmt.Println()
} }
statsCombat = "Name: " + PlayerName + "\n" + "Hit Points: " + strconv.Itoa(playerHP) + "\n" + "Level :" + strconv.Itoa(level) + "\n" + "Money: $" + strconv.Itoa(money) + "\n" + "Experience :" + strconv.Itoa(experience) + "\n" + "Bum Fights Left: " + strconv.Itoa(bumfights) // builds Combat Stats statsCombat = "Name: " + PlayerName + "\n" + "Hit Points: " + strconv.Itoa(playerHP) + "\n" + "Level :" + strconv.Itoa(level) + "\n" + "Money: $" + strconv.Itoa(money) + "\n" + "Experience :" + strconv.Itoa(experience) + "\n" + "Bum Fights Left: " + strconv.Itoa(bumfights) // builds Combat Stats
} }
@ -663,26 +710,21 @@ func MainMachine() {
fmt.Println("Your choice,") fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">") fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice) fmt.Scan(&choice)
if strings.ToUpper(choice) == "H" { switch {
case strings.ToUpper(choice) == "H":
HitTheStreets() HitTheStreets()
i = 1 case strings.ToUpper(choice) == "P":
} else if strings.ToUpper(choice) == "P" {
PropertyRoom() PropertyRoom()
i = 1 case strings.ToUpper(choice) == "B":
} else if strings.ToUpper(choice) == "B" {
breakRoom() breakRoom()
i = 1 case strings.ToUpper(choice) == "R":
} else if strings.ToUpper(choice) == "R" {
RedRoom() RedRoom()
i = 1 case strings.ToUpper(choice) == "D":
} else if strings.ToUpper(choice) == "D" {
DoctorsOffice() DoctorsOffice()
i = 1 case strings.ToUpper(choice) == "G":
} else if strings.ToUpper(choice) == "G" {
ClockOut() ClockOut()
i = 1 case strings.ToUpper(choice) == "Q":
} else { GameOver()
i = 0
} }
} }
} }