/// <summary> /// Shifts the colour of the given bodypart on the given character to the given colour. /// </summary> /// <param name="invokingUser">The user that's performing the action.</param> /// <param name="character">The character to shift.</param> /// <param name="bodyPart">The bodypart to shift.</param> /// <param name="colour">The colour to shift it into.</param> /// <param name="chirality">The chirality of the bodypart.</param> /// <param name="ct">The cancellation token in use.</param> /// <returns>A shifting result which may or may not have succeeded.</returns> public async Task <Result <ShiftBodypartResult> > ShiftBodypartColourAsync ( Snowflake invokingUser, Character character, Bodypart bodyPart, Colour colour, Chirality chirality = Chirality.Center, CancellationToken ct = default ) { var canTransformResult = await CanUserTransformUserAsync ( character.Server.DiscordID, invokingUser, character.Owner.DiscordID, ct ); if (!canTransformResult.IsSuccess) { return(Result <ShiftBodypartResult> .FromError(canTransformResult)); } if (bodyPart.IsChiral() && chirality == Chirality.Center) { return(new UserError ( $"Please specify if it's the left or right {bodyPart.Humanize().ToLower()}." )); } var getCurrentAppearance = await GetOrCreateCurrentAppearanceAsync(character, ct); if (!getCurrentAppearance.IsSuccess) { return(Result <ShiftBodypartResult> .FromError(getCurrentAppearance)); } var appearance = getCurrentAppearance.Entity; var colourShifter = new ColourShifter(appearance, colour, _descriptionBuilder); var shiftResult = await colourShifter.ShiftAsync(bodyPart, chirality); if (shiftResult.IsSuccess) { await _database.SaveChangesAsync(ct); } return(shiftResult); }
/// <summary> /// Shifts the colour of the given bodypart on the given character to the given colour. /// </summary> /// <param name="context">The command context.</param> /// <param name="character">The character to shift.</param> /// <param name="bodyPart">The bodypart to shift.</param> /// <param name="colour">The colour to shift it into.</param> /// <param name="chirality">The chirality of the bodypart.</param> /// <returns>A shifting result which may or may not have succeeded.</returns> public async Task <ShiftBodypartResult> ShiftBodypartColourAsync ( ICommandContext context, Character character, Bodypart bodyPart, Colour colour, Chirality chirality = Chirality.Center ) { var discordUser = await context.Guild.GetUserAsync((ulong)character.Owner.DiscordID); var canTransformResult = await CanUserTransformUserAsync(context.Guild, context.User, discordUser); if (!canTransformResult.IsSuccess) { return(ShiftBodypartResult.FromError(canTransformResult)); } if (bodyPart.IsChiral() && chirality == Chirality.Center) { return(ShiftBodypartResult.FromError ( $"Please specify if it's the left or right {bodyPart.Humanize().ToLower()}." )); } var getCurrentAppearance = await GetOrCreateCurrentAppearanceAsync(character); if (!getCurrentAppearance.IsSuccess) { return(ShiftBodypartResult.FromError(getCurrentAppearance)); } var appearance = getCurrentAppearance.Entity; var colourShifter = new ColourShifter(appearance, colour, _descriptionBuilder); var shiftResult = await colourShifter.ShiftAsync(bodyPart, chirality); if (shiftResult.IsSuccess) { await _database.SaveChangesAsync(); } return(shiftResult); }
/// <inheritdoc /> protected override Task <string> GetNoChangeMessageAsync(Bodypart bodypart) { var character = this.Appearance.Character; var bodypartHumanized = bodypart.Humanize(); if (bodypart == Bodypart.Full) { var fullMessage = $"{character.Nickname} doesn't have any patterns."; fullMessage = fullMessage.Transform(To.LowerCase, To.SentenceCase); return(Task.FromResult(fullMessage)); } var message = $"{character.Name}'s {bodypartHumanized} doesn't have any pattern."; message = message.Transform(To.LowerCase, To.SentenceCase); return(Task.FromResult(message)); }
/// <inheritdoc /> protected override Task <string> GetNoChangeMessageAsync(Bodypart bodypart) { var character = this.Appearance.Character; var bodypartHumanized = bodypart.Humanize(); if (bodypart == Bodypart.Full) { var fullMessage = $"{character.Nickname} is already that colour."; fullMessage = fullMessage.Transform(To.LowerCase, To.SentenceCase); return(Task.FromResult(fullMessage)); } var message = $"{character.Name}'s {bodypartHumanized} " + $"{(bodypartHumanized.EndsWith("s") ? "are" : "is")} already that colour."; message = message.Transform(To.LowerCase, To.SentenceCase); return(Task.FromResult(message)); }
public string BuildRemoveMessage([NotNull] Appearance appearanceConfiguration, Bodypart bodypart) { string removalText; switch (bodypart) { case Bodypart.Hair: { removalText = "{@target}'s hair becomes dull and colourless. Strand by strand, tuft by tuft, " + "it falls out, leaving an empty scalp."; break; } case Bodypart.Face: { removalText = "{@target}'s face begins to warp strangely. Slowly, their features smooth and " + "vanish, leaving a blank surface."; break; } case Bodypart.Ear: { removalText = $"{{@target}}'s {{@side}} {bodypart.Humanize().Transform(To.LowerCase)} shrivels " + $"and vanishes."; break; } case Bodypart.Eye: { removalText = $"{{@target}}'s {{@side}} {bodypart.Humanize().Transform(To.LowerCase)} deflates " + $"as their eye socket closes, leaving nothing behind."; break; } case Bodypart.Teeth: { removalText = "With a strange popping sound, {@target}'s teeth retract and disappear."; break; } case Bodypart.Leg: case Bodypart.Arm: { removalText = $"{{@target}}'s {{@side}} {bodypart.Humanize().Transform(To.LowerCase)} shrivels " + $"and retracts, vanishing."; break; } case Bodypart.Tail: { removalText = "{@target}'s tail flicks and thrashes for a moment, before it thins out and " + "disappears into nothing."; break; } case Bodypart.Wing: { removalText = $"{{@target}}'s {{@side}} {bodypart.Humanize().Transform(To.LowerCase)} stiffens " + $"and shudders, before losing cohesion and disappearing into their body."; break; } case Bodypart.Penis: { removalText = "{@target}'s shaft twitches and shudders, as it begins to shrink and retract. In " + "mere moments, it's gone, leaving nothing."; break; } case Bodypart.V****a: { removalText = "{@target}'s slit contracts and twitches. A strange sensation rushes through " + "{@f|them} as the opening zips up and fills out, leaving nothing."; break; } case Bodypart.Head: { removalText = "{@target}'s head warps strangely before it deflates like a balloon, disappearing."; break; } case Bodypart.Legs: case Bodypart.Arms: { removalText = $"{{@target}}'s {bodypart.Humanize().Transform(To.LowerCase)} shrivel and " + $"retract, vanishing."; break; } case Bodypart.Body: { removalText = "{@target}'s torso crumples into itself as their main body collapses, shifting " + "and vanishing."; break; } case Bodypart.Wings: { removalText = $"{{@target}}'s {bodypart.Humanize().Transform(To.LowerCase)} stiffen and shudder, " + $"before losing cohesion and disappearing into their body."; break; } default: { throw new ArgumentOutOfRangeException(); } } return(ReplaceTokensWithContent(removalText, appearanceConfiguration, null)); }