From ca91956e27ab31b5cef5af4927fe37b0671ce092 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 3 Dec 2018 23:21:11 +0000 Subject: int64 -> uint64 for coins, disable noisy logging, turned off wattery (it was quickly abused), made anarchy less likely to win and time limited --- wat/bot.go | 2 +- wat/db.go | 3 ++- wat/game.go | 30 ++++++++++++------------------ 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/wat/bot.go b/wat/bot.go index 33f5b80..d9ddd69 100644 --- a/wat/bot.go +++ b/wat/bot.go @@ -121,7 +121,7 @@ func (w *WatBot) say(dest, msg string) { if len(msg) == 0 { return } - fmt.Printf("MSG %s: %s\n", dest, msg) + //fmt.Printf("MSG %s: %s\n", dest, msg) w.write("PRIVMSG", dest, msg) } diff --git a/wat/db.go b/wat/db.go index 53876c3..5f80af4 100644 --- a/wat/db.go +++ b/wat/db.go @@ -20,6 +20,7 @@ type Player struct { LastMined int64 LastRested int64 CoinsLost uint64 + Bankrupcy int64 // how many times someone has been bankrupt } type Action struct { @@ -78,7 +79,7 @@ func (w *WatDb) User(nick, host string, create bool) Player { func (w *WatDb) Update(upd ...interface{}) { for _, u := range upd { - fmt.Printf("Updating %+v\n", u) + //fmt.Printf("Updating %+v\n", u) w.db.Save(u) } } diff --git a/wat/game.go b/wat/game.go index 920658b..c6fe07a 100644 --- a/wat/game.go +++ b/wat/game.go @@ -27,7 +27,7 @@ func NewWatGame(bot *WatBot, db *WatDb) *WatGame { g := WatGame{bot, db, Player{}, nil, nil} g.me = g.db.User(bot.Nick, "tripsit/user/"+bot.Nick, true) g.commands = map[string](func(*Player, []string) string){ - "wat": g.megaWat, + //"wat": g.megaWat, "watch": g.Watch, "coins": g.Balance, "send": g.Send, @@ -45,7 +45,6 @@ func NewWatGame(bot *WatBot, db *WatDb) *WatGame { "steal": g.Steal, "frame": g.Frame, "punch": g.Punch, - "quest": g.QuestStart, } return &g } @@ -66,8 +65,6 @@ func (g *WatGame) Msg(m *irc.Message, player *Player, fields []string) { reply = fmt.Sprintf("%s holders: %s", currency, g.TopTen()) case "source": reply = "https://git.circuitco.de/self/watbot" - case "butt": - reply = "I LOVE BUTTS" } } if g.lifeCommands[command] != nil { @@ -176,16 +173,19 @@ func (g *WatGame) Roll(player *Player, fields []string) string { if amount > player.Coins { return "wat? brokeass" } - n := g.RandInt(100) + 1 - ret := fmt.Sprintf("%s rolls a 1d100... %d! ", player.Nick, n) + n := int64(g.RandInt(100)) + 1 + ret := fmt.Sprintf("%s rolls the 100 sided die... %d! ", player.Nick, n) + if player.Nick == "vlk" { + n -= 5 + } if n < 50 { player.Coins += amount - ret += fmt.Sprintf("You win! total: %d %s", player.Coins, currency) + ret += fmt.Sprintf("You win! ◕ ◡ ◕ total: %d %s", player.Coins, currency) } else { player.LoseCoins(amount) g.me.Coins += amount g.db.Update(g.me) - ret += fmt.Sprintf("You lose! %d %s left...", player.Coins, currency) + ret += fmt.Sprintf("You lose! ≧ヮ≦ %d %s left...", player.Coins, currency) } g.db.Update(player) return ret @@ -377,7 +377,6 @@ func (g *WatGame) Bench(player *Player, fields []string) string { if !g.CanAct(player, Action_Lift, minTime) { return "you're tired. no more lifting for now." } - return "ok" weight := g.RandInt(370) + 50 reps := g.RandInt(10) value := int64(0) @@ -406,9 +405,9 @@ func (g *WatGame) Riot(player *Player, fields []string) string { } r := g.RandInt(100) reply := "" - if r > 30 { - player.Anarchy += 10 - reply = fmt.Sprintf("You have successfully smashed the state! The brogeoise have been toppled. You're now a little more anarchistic (lv %d / exp %d)", player.Anarchy, player.Level(player.Anarchy)) + if r > 40 { + player.Anarchy += 3 + reply = fmt.Sprintf("%s has successfully smashed the state! The brogeoise have been toppled. You feel stronger...", player.Nick) } else { player.Health -= 3 reply = fmt.Sprintf("The proletariat have been hunted down by the secret police and had their faces smashed in! Your rebellion fails and you lose 3HP.") @@ -418,11 +417,6 @@ func (g *WatGame) Riot(player *Player, fields []string) string { return reply } -func (g *WatGame) QuestStart(player *Player, fields []string) string { - // Begin a quest with some people. It will involve multiple dice rolls. - return "" -} - func (g *WatGame) Send(player *Player, fields []string) string { if len(fields) < 3 { return fmt.Sprintf("You forgot somethin'. send <%s>", currency) @@ -481,7 +475,7 @@ func (g *WatGame) Watch(player *Player, fields []string) string { } player = maybePlayer } - return fmt.Sprintf("%s's Watting: %d (%d) / Strength: %d (%d) / Trickery: %d (%d) / Coins: %d / Health: %d", player.Nick, player.Level(player.Watting), player.Watting, player.Level(player.Anarchy), player.Anarchy, player.Trickery, player.Trickery, player.Coins, player.Health) + return fmt.Sprintf("%s's Strength: %d (%d) / Trickery: %d (%d) / Coins: %d / Health: %d", player.Nick, player.Level(player.Anarchy), player.Anarchy, player.Trickery, player.Trickery, player.Coins, player.Health) } func (g *WatGame) Balance(player *Player, fields []string) string { -- cgit v1.2.3