diff --git a/DiscordMonies/Board/Board.cs b/DiscordMonies/Board/Board.cs index 319b30f..222d68c 100644 --- a/DiscordMonies/Board/Board.cs +++ b/DiscordMonies/Board/Board.cs @@ -30,7 +30,7 @@ public sealed record LuckCard( string Description, string Command); -public record ColorSet(int Index); +public readonly record struct ColorSet(int Index); public class Space : IOwnable { diff --git a/DiscordMonies/Game/Embeds.cs b/DiscordMonies/Game/Embeds.cs index 19eb491..7ebb3a7 100644 --- a/DiscordMonies/Game/Embeds.cs +++ b/DiscordMonies/Game/Embeds.cs @@ -227,7 +227,7 @@ public static Embed Dropped(GamePlayer player, GamePlayer? transferTo, IEnumerab { var builder = new EmbedBuilder() .WithTitle("Bankruptcy") - .WithDescription($"**{player}** has declared bankruptcy and is now removed from the game. All of their remaining assets will be transferred to {$"**{transferTo?.DisplayName}**" ?? "**the bank**, where it will be auctioned off to the highest bidder"}.") + .WithDescription($"{player} has declared bankruptcy and is now removed from the game. All of their remaining assets will be transferred to {$"**{transferTo?.ToString()}**" ?? "**the bank**, where it will be auctioned off to the highest bidder"}.") .WithColour(PrettyColors.Red); var materials = billOfMaterials.ToList(); @@ -369,7 +369,7 @@ public static Embed Space(Space space) .AddField("Name", space.Info.Name, true).Get() .AddField("Position", space.PositionCode, true).Get() .AddField("Value", space.Info is ValueSpace vs ? vs.Value.MoneyString() : "N/A", true).Get() - .AddField("Owner", space.Info is PropertySpace ? space.Owner?.DisplayName ?? "Unowned" : "Not ownable", true).Get() + .AddField("Owner", space.Info is PropertySpace ? space.Owner?.ToString() ?? "Unowned" : "Not ownable", true).Get() .AddField("Mortgaged?", space.IsMortgaged ? "Yes" : "No", true).Get() .AddField("Color", space.Info is RoadSpace rs ? space.Board.GroupNames[rs.Group] : "N/A", true).Get() .AddField("Buildings", space.BuiltHouses switch diff --git a/DiscordMonies/Game/Emoji.cs b/DiscordMonies/Game/Emoji.cs index b521b81..80c295e 100644 --- a/DiscordMonies/Game/Emoji.cs +++ b/DiscordMonies/Game/Emoji.cs @@ -5,6 +5,7 @@ public static class Emoji public const string OncomingPoliceCar = "\U0001F694"; public const string CircledM = "\u24C2\uFE0F"; public const string ArrowRight = "\u27A1\uFE0F"; + public const string TwistedArrows = "\U0001F500"; public const string FlyingMoney = "\U0001F4B8"; public const string Die = "\U0001F3B2"; public const string Judge = "\U0001F9D1\u200D\u2696\uFE0F"; diff --git a/DiscordMonies/Game/GameCommands.cs b/DiscordMonies/Game/GameCommands.cs index e1d2a72..79e945d 100644 --- a/DiscordMonies/Game/GameCommands.cs +++ b/DiscordMonies/Game/GameCommands.cs @@ -3,13 +3,10 @@ using System.Diagnostics; using DiscordMonies.Board; using DiscordMonies.Extensions; -using DiscordMonies.Game.Trade; -using DiscordMonies.Game.UnresolvedMatters; using DiscordMonies.Game.UnresolvedMatters.AuctionMatter; using DiscordMonies.Game.UnresolvedMatters.DiceRoll; using DiscordMonies.Game.UnresolvedMatters.Payment; using DiscordMonies.Remora; -using OneOf.Types; using Remora.Commands.Attributes; using Remora.Commands.Groups; using Remora.Discord.API.Abstractions.Objects; @@ -18,7 +15,6 @@ using Remora.Discord.Commands.Attributes; using Remora.Discord.Commands.Contexts; using Remora.Discord.Commands.Feedback.Services; -using Remora.Discord.Extensions.Formatting; using Remora.Discord.Interactivity; using Remora.Results; @@ -106,7 +102,7 @@ public async Task Nudge() // TODO: Auctions var current = gameState.CurrentPlayer; await feedback.SendContextualAsync( - $"{Mention.User(current.Id)}, {gameState.GetById(ctx.GetUserId()).DisplayName} wished to remind you that it is your turn to play by giving you a gentle nudge. *Nudge!*"); + $"{current}, {gameState.GetById(ctx.GetUserId()).DisplayName} wished to remind you that it is your turn to play by giving you a gentle nudge. *Nudge!*"); return Result.Success; } @@ -123,7 +119,7 @@ await feedback.SendContextualAsync( return Result.Success; } - await feedback.SendContextualAsync($"Title deed for {space}", embeds: new([space.TitleDeedEmbed()])); + await feedback.SendContextualEmbedAsync(space.TitleDeedEmbed()); return Result.Success; } @@ -448,7 +444,7 @@ public async Task AuctionBidOther() public async Task AuctionTitleDeed() { var space = ((AuctionMatter)gameState.CurrentlyResolvingMatter).AuctionSpace; - await feedback.SendContextualAsync($"Title deed for {space}", embeds: new([space.TitleDeedEmbed()])); + await feedback.SendContextualEmbedAsync(space.TitleDeedEmbed()); return Result.Success; } diff --git a/DiscordMonies/Game/GameControllerService.cs b/DiscordMonies/Game/GameControllerService.cs index c7c053c..53e6966 100644 --- a/DiscordMonies/Game/GameControllerService.cs +++ b/DiscordMonies/Game/GameControllerService.cs @@ -170,8 +170,8 @@ public async Task TryPay(GamePlayer? from, GamePlayer? to, int value, bool { if (value < 0) return await TryPay(to, from, -value, bankruptcyPayment); - var payer = from?.DisplayName ?? "The Bank"; - var receiver = to?.DisplayName ?? (Random.Shared.Next(1000) == 253 ? "theBank" : "The Bank"); + var payer = from?.ToString() ?? "The Bank"; + var receiver = to?.ToString() ?? (Random.Shared.Next(1000) == 253 ? "theBank" : "The Bank"); // Decrease the money of the payer if they exist if (from != null) @@ -689,9 +689,11 @@ public IList DevelopOptions(GamePlayer player, ColorSet colorSet, out Not public async Task DevelopProperties(GamePlayer player, ColorSet colorSet, IEnumerable targets) { + string groupName = state.Board.GroupNames[colorSet.Index]; + if (ColorSetOwner(colorSet) != player) { - await service.SendContextualAsync(Strings.UnableToDevelopOnColourSet(state.Board.GroupNames[colorSet.Index])); + await service.SendContextualAsync(Strings.UnableToDevelopOnColourSet(groupName)); return; } @@ -720,8 +722,9 @@ await service.SendContextualAsync( // Everything is okay! var embedBuilder = new EmbedBuilder() - .WithTitle($"Development on {state.Board.GroupNames[colorSet.Index]}") - .WithDescription($"Development on {state.Board.GroupNames[colorSet.Index]} has been completed by **{player}**. The changes are as follows:") + .WithTitle($"Development on {groupName}") + .WithColour(PrettyColors.ColorMap[groupName]) + .WithDescription($"Development on {groupName} has been completed by {player}.") .WithImageUrl("attachment://board.png"); foreach (var (target, index) in targets.Take(spaces.Count).Select((x, i) => (x, i))) @@ -922,7 +925,7 @@ public async Task Mortgage(GamePlayer player, Space space) public async Task DropPlayer(GamePlayer player) { var transferredAssets = state.CurrentlyResolvingMatter is PaymentMatter matter ? matter.To : null; - var transferredName = transferredAssets?.DisplayName ?? "the bank"; + var transferredName = transferredAssets?.ToString() ?? "the bank"; // Transfer all of player's assets to transferredAssets List billOfMaterials = []; diff --git a/DiscordMonies/Game/GamePlayer.cs b/DiscordMonies/Game/GamePlayer.cs index 842a070..eb02228 100644 --- a/DiscordMonies/Game/GamePlayer.cs +++ b/DiscordMonies/Game/GamePlayer.cs @@ -1,11 +1,11 @@ -using System.Collections.Immutable; -using DiscordMonies.Board; +using DiscordMonies.Board; using Remora.Discord.API.Abstractions.Objects; using Remora.Rest.Core; using System.Drawing; using DiscordMonies.Game.Trade; +using Remora.Discord.Extensions.Formatting; namespace DiscordMonies.Game; @@ -42,7 +42,7 @@ public override int GetHashCode() public override string ToString() { - return DisplayName; + return Mention.User(Id); } #region IUser Implementation diff --git a/DiscordMonies/Game/Trade/TradeCommands.cs b/DiscordMonies/Game/Trade/TradeCommands.cs index 0c0337d..6772f94 100644 --- a/DiscordMonies/Game/Trade/TradeCommands.cs +++ b/DiscordMonies/Game/Trade/TradeCommands.cs @@ -35,7 +35,7 @@ public async Task Open([Description("The player to trade with")] GamePla CopyOf = null }; - await feedback.SendContextualAsync($"{player} is creating a trade...", options: MessageOptions.SuppressNotifications); + await feedback.SendContextualAsync($"{player} is creating a trade..."); await feedback.SendContextualAsync($"Opened a new trade table. Add items to the trade table, and then offer it to {Mention.User(otherPlayer)} when you're ready.", options: MessageOptions.Ephemeral); return Result.Success; } diff --git a/DiscordMonies/Game/UnresolvedMatters/Payment/PaymentMatterHandler.cs b/DiscordMonies/Game/UnresolvedMatters/Payment/PaymentMatterHandler.cs index d2b3d3f..1328689 100644 --- a/DiscordMonies/Game/UnresolvedMatters/Payment/PaymentMatterHandler.cs +++ b/DiscordMonies/Game/UnresolvedMatters/Payment/PaymentMatterHandler.cs @@ -7,8 +7,8 @@ public class PaymentMatterHandler(GameState state, IFeedbackService service, Gam { public async Task Resolve(PaymentMatter matter) { - var payer = matter.From?.DisplayName ?? "The Bank"; - var receiver = matter.To?.DisplayName ?? (Random.Shared.Next(1000) == 253 ? "theBank" : "the Bank"); + var payer = matter.From?.ToString() ?? "The Bank"; + var receiver = matter.To?.ToString() ?? (Random.Shared.Next(1000) == 253 ? "theBank" : "The Bank"); // Only process a forced payment if it has not yet been processed if (!matter.PaymentComplete)