Skip to content
This repository was archived by the owner on Sep 20, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#nullable enable
using BazaarGameClient.Domain.Models.Cards;
using BazaarGameShared.Domain.Cards.Item;
using BazaarGameShared.Domain.Core.Types;
using BazaarGameShared.Domain.Effect;
using BazaarGameShared.Domain.Effect.Actions;
Expand Down Expand Up @@ -70,7 +71,7 @@ internal static IReadOnlyDictionary<string, CombatImpactEntity> Read()
effectAttributes.Auras,
effectAttributes.ReferenceValuedAuraEffectIds,
card.LeftSocketId,
card.HiddenTags == null ? null : card.HiddenTags.ToArray()
ResolveHiddenTags(card)
);
}

Expand All @@ -84,6 +85,23 @@ internal static IReadOnlyDictionary<string, CombatImpactEntity> Read()
return entities;
}

internal static IReadOnlyCollection<EHiddenTag>? ResolveHiddenTags(Card card)
{
IReadOnlyCollection<EHiddenTag>? enchantmentHiddenTags = null;
if (
card is ItemCard { Enchantment: { } enchantment }
&& card.Template is TCardItem { Enchantments: not null } itemTemplate
&& itemTemplate.Enchantments.TryGetValue(enchantment, out var enchantmentTemplate)
)
enchantmentHiddenTags = enchantmentTemplate?.HiddenTags;

return CombatImpactHiddenTags.Merge(
card.HiddenTags,
card.Template?.HiddenTags,
enchantmentHiddenTags
);
}

private static EffectAttributeTypes ReadEffectAttributeTypes(Card card, ItemCard? item)
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,25 @@ internal sealed record CombatImpactEntity(
IReadOnlyCollection<EHiddenTag>? HiddenTags = null
);

internal static class CombatImpactHiddenTags
{
internal static IReadOnlyCollection<EHiddenTag>? Merge(
IReadOnlyCollection<EHiddenTag>? runtime,
IReadOnlyCollection<EHiddenTag>? template,
IReadOnlyCollection<EHiddenTag>? enchantment
)
{
var hiddenTags = new HashSet<EHiddenTag>();
if (runtime != null)
hiddenTags.UnionWith(runtime);
if (template != null)
hiddenTags.UnionWith(template);
if (enchantment != null)
hiddenTags.UnionWith(enchantment);
return hiddenTags.Count == 0 ? null : hiddenTags.ToArray();
Comment on lines +115 to +122
}
}

internal sealed record CombatImpactEvent(
CombatImpactKind Kind,
string SourceId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
using BazaarGameShared.Domain.Core.Types;
using BazaarPlusPlus.Game.PostCombatImpact.Data;
using Xunit;

namespace PostCombatImpact.Tests;

public sealed class CombatImpactEntitySnapshotReaderTests
{
[Fact]
public void Hidden_tags_fall_back_to_the_template_for_rehydrated_replay_cards()
{
var hiddenTags = CombatImpactHiddenTags.Merge(
runtime: [],
template: [EHiddenTag.Haste],
enchantment: null
);

Assert.Contains(EHiddenTag.Haste, hiddenTags!);
}

[Theory]
[InlineData("<style=Radiant>Radiant</style>\nHunter's Journal")]
[InlineData("<style=Radiant>Hunter's Journal</style>")]
Expand Down