| | | 1 | | <section class="panel"> |
| | | 2 | | <h2>In Raid</h2> |
| | | 3 | | |
| | | 4 | | <div class="hud"> |
| | 0 | 5 | | <span>Health: @Raid.Health / @MaxHealth</span> |
| | 0 | 6 | | <span>@AmmoHudText</span> |
| | 0 | 7 | | <span>Medkits: @Medkits</span> |
| | 0 | 8 | | <span>Loot Slots: @LootSlots / @Raid.BackpackCapacity</span> |
| | | 9 | | <span class="encumbrance-readout"> |
| | | 10 | | <span class="encumbrance-label">Encumbrance:</span> |
| | 0 | 11 | | <span class="encumbrance-value @GetEncumbranceSeverityCssClass()">@RaidEncumbranceText</span> |
| | 0 | 12 | | @if (ShouldShowEncumbranceTier()) |
| | | 13 | | { |
| | 0 | 14 | | <span class="encumbrance-tier @GetEncumbranceSeverityCssClass()">@GetEncumbranceTierLabel()</span> |
| | | 15 | | } |
| | | 16 | | </span> |
| | 0 | 17 | | <span>Challenge: @Challenge</span> |
| | 0 | 18 | | <span>Distance from Extract: @DistanceFromExtract</span> |
| | | 19 | | </div> |
| | | 20 | | |
| | | 21 | | <div class="encounter"> |
| | 0 | 22 | | <h3>@EncounterTitle</h3> |
| | 0 | 23 | | <p>@EncounterDescription</p> |
| | 0 | 24 | | @if (IsExtractHoldEffectivelyActive()) |
| | | 25 | | { |
| | 0 | 26 | | <p class="extract-hold-status">Hold active for @GetExtractHoldCountdownText()</p> |
| | | 27 | | } |
| | | 28 | | |
| | 0 | 29 | | @if (EncounterType == EncounterType.Combat) |
| | | 30 | | { |
| | 0 | 31 | | var openingPhaseSummary = GetOpeningPhaseSummary(); |
| | 0 | 32 | | if (!string.IsNullOrWhiteSpace(openingPhaseSummary)) |
| | | 33 | | { |
| | | 34 | | <div class="opening-phase"> |
| | 0 | 35 | | <p>@openingPhaseSummary</p> |
| | | 36 | | </div> |
| | | 37 | | } |
| | 0 | 38 | | <p>Enemy: @EnemyName (HP: @EnemyHealth)</p> |
| | | 39 | | <div class="actions"> |
| | 0 | 40 | | @if (CanAttack) |
| | | 41 | | { |
| | 0 | 42 | | <button class="action" disabled="@(!CanAttackEnabled)" @onclick="() => OnAttack.InvokeAsync()">Attac |
| | | 43 | | } |
| | 0 | 44 | | @if (CanBurstFire) |
| | | 45 | | { |
| | 0 | 46 | | <button class="action" disabled="@(!CanBurstFireEnabled)" @onclick="() => OnBurstFire.InvokeAsync()" |
| | | 47 | | } |
| | 0 | 48 | | @if (CanFullAuto) |
| | | 49 | | { |
| | 0 | 50 | | <button class="action" disabled="@(!CanFullAutoEnabled)" @onclick="() => OnFullAuto.InvokeAsync()">U |
| | | 51 | | } |
| | 0 | 52 | | @if (CanReload) |
| | | 53 | | { |
| | 0 | 54 | | <button class="action" @onclick="() => OnReload.InvokeAsync()">Reload</button> |
| | | 55 | | } |
| | 0 | 56 | | <button class="action" @onclick="() => OnFlee.InvokeAsync()">Flee</button> |
| | | 57 | | </div> |
| | | 58 | | } |
| | 0 | 59 | | else if (EncounterType == EncounterType.Loot) |
| | | 60 | | { |
| | 0 | 61 | | <p>Container discovered: @LootContainer</p> |
| | | 62 | | <div class="grid-two"> |
| | | 63 | | <div> |
| | 0 | 64 | | @if (DiscoveredLoot.Count == 0) |
| | | 65 | | { |
| | | 66 | | <p>Nothing useful left.</p> |
| | | 67 | | } |
| | | 68 | | else |
| | | 69 | | { |
| | | 70 | | <h4>Discovered Loot</h4> |
| | | 71 | | <ul> |
| | 0 | 72 | | @foreach (var lootItem in DiscoveredLoot) |
| | | 73 | | { |
| | | 74 | | <li> |
| | | 75 | | <div class="row-item row-item-inline"> |
| | | 76 | | <ItemTypeIcon Type="lootItem.Type" /> |
| | 0 | 77 | | <span class="item-name rarity-@lootItem.DisplayRarity.ToString().ToLower()">@Ite |
| | | 78 | | <div class="row-actions"> |
| | 0 | 79 | | @if (IsEquipable(lootItem)) |
| | | 80 | | { |
| | 0 | 81 | | <button class="action" disabled="@(!CanEquipItem(lootItem))" @onclick="( |
| | | 82 | | } |
| | 0 | 83 | | <button class="action" disabled="@(!CanLootItem(lootItem))" @onclick="() => |
| | | 84 | | </div> |
| | | 85 | | </div> |
| | | 86 | | </li> |
| | | 87 | | } |
| | | 88 | | </ul> |
| | | 89 | | } |
| | 0 | 90 | | @if (DiscoveredLoot.Any(item => IsTooHeavyToCarry(item))) |
| | | 91 | | { |
| | | 92 | | <p>Too heavy to carry.</p> |
| | | 93 | | } |
| | 0 | 94 | | @if (DiscoveredLoot.Any(IsBlockedByLootSlots)) |
| | | 95 | | { |
| | | 96 | | <p>Backpack full for some items.</p> |
| | | 97 | | } |
| | | 98 | | </div> |
| | | 99 | | <div> |
| | | 100 | | <h4>Character Inventory</h4> |
| | | 101 | | <h4>Equipped</h4> |
| | 0 | 102 | | @foreach (var equipped in EquippedItems) |
| | | 103 | | { |
| | | 104 | | <div class="row-item"> |
| | | 105 | | <ItemTypeIcon Type="equipped.Type" /> |
| | 0 | 106 | | <span class="item-name rarity-@equipped.DisplayRarity.ToString().ToLower()">@ItemPresentatio |
| | | 107 | | <div class="row-actions"> |
| | 0 | 108 | | <button class="action" @onclick="() => OnDropEquipped.InvokeAsync(equipped.Type)">Drop</ |
| | | 109 | | </div> |
| | | 110 | | </div> |
| | | 111 | | } |
| | | 112 | | |
| | | 113 | | <h4>Carried</h4> |
| | 0 | 114 | | @if (CarriedLoot.Count == 0) |
| | | 115 | | { |
| | | 116 | | <p>No carried loot.</p> |
| | | 117 | | } |
| | | 118 | | else |
| | | 119 | | { |
| | 0 | 120 | | @foreach (var carried in CarriedLoot) |
| | | 121 | | { |
| | | 122 | | <div class="row-item"> |
| | | 123 | | <ItemTypeIcon Type="carried.Type" /> |
| | 0 | 124 | | <span class="item-name rarity-@carried.DisplayRarity.ToString().ToLower()">@ItemPresenta |
| | | 125 | | <div class="row-actions"> |
| | 0 | 126 | | <button class="action" @onclick="() => OnDropCarried.InvokeAsync(carried)">Drop</but |
| | 0 | 127 | | @if (IsEquipable(carried)) |
| | | 128 | | { |
| | 0 | 129 | | <button class="action" disabled="@(!CanEquipItem(carried))" @onclick="() => OnEq |
| | | 130 | | } |
| | | 131 | | </div> |
| | | 132 | | </div> |
| | | 133 | | } |
| | 0 | 134 | | @if (CarriedLoot.Any(item => IsEquipable(item) && !CanEquipItem(item))) |
| | | 135 | | { |
| | | 136 | | <p>Too heavy to equip.</p> |
| | | 137 | | } |
| | | 138 | | } |
| | | 139 | | </div> |
| | | 140 | | </div> |
| | | 141 | | } |
| | 0 | 142 | | else if (EncounterType == EncounterType.Extraction) |
| | | 143 | | { |
| | | 144 | | <div class="actions"> |
| | 0 | 145 | | <button class="action" disabled="@IsExtractHoldEffectivelyActive()" @onclick="() => OnAttemptExtract.Inv |
| | 0 | 146 | | <button class="action" disabled="@IsExtractHoldEffectivelyActive()" @onclick="() => OnStartExtractHold.I |
| | 0 | 147 | | @if (ExtractHoldActive) |
| | | 148 | | { |
| | 0 | 149 | | <button class="action" @onclick="() => OnCancelExtractHold.InvokeAsync()">Cancel Hold</button> |
| | | 150 | | } |
| | | 151 | | </div> |
| | | 152 | | } |
| | 0 | 153 | | else if (EncounterType == EncounterType.Neutral) |
| | | 154 | | { |
| | | 155 | | <div class="actions"> |
| | 0 | 156 | | <button class="action" disabled="@IsExtractHoldEffectivelyActive()" @onclick="() => OnGoDeeper.InvokeAsy |
| | 0 | 157 | | <button class="action" disabled="@IsExtractHoldEffectivelyActive()" @onclick="() => OnMoveTowardExtract. |
| | | 158 | | </div> |
| | | 159 | | } |
| | | 160 | | |
| | 0 | 161 | | @if (AwaitingDecision || EncounterType == EncounterType.Loot) |
| | | 162 | | { |
| | | 163 | | <div class="actions top-gap"> |
| | 0 | 164 | | <button class="action" disabled="@IsExtractHoldEffectivelyActive()" @onclick="() => OnGoDeeper.InvokeAsy |
| | 0 | 165 | | <button class="action" disabled="@IsExtractHoldEffectivelyActive()" @onclick="() => OnMoveTowardExtract. |
| | | 166 | | </div> |
| | | 167 | | } |
| | | 168 | | |
| | | 169 | | <div class="actions top-gap"> |
| | 0 | 170 | | @if (CanReload) |
| | | 171 | | { |
| | 0 | 172 | | <button class="action" @onclick="() => OnReload.InvokeAsync()">Reload</button> |
| | | 173 | | } |
| | 0 | 174 | | <button class="action" disabled="@(!CanUseMedkit)" @onclick="() => OnUseMedkit.InvokeAsync()">Use Medkit</bu |
| | | 175 | | </div> |
| | | 176 | | </div> |
| | | 177 | | |
| | | 178 | | <h3>Raid Log</h3> |
| | | 179 | | <ul> |
| | 0 | 180 | | @foreach (var entry in LogEntries) |
| | | 181 | | { |
| | 0 | 182 | | <li>@entry</li> |
| | | 183 | | } |
| | | 184 | | </ul> |
| | | 185 | | </section> |
| | | 186 | | |
| | | 187 | | @code { |
| | 0 | 188 | | [Parameter, EditorRequired] public RaidState Raid { get; set; } = default!; |
| | 0 | 189 | | [Parameter, EditorRequired] public int MaxHealth { get; set; } |
| | 0 | 190 | | [Parameter, EditorRequired] public string AmmoHudText { get; set; } = string.Empty; |
| | 0 | 191 | | [Parameter, EditorRequired] public int Medkits { get; set; } |
| | 0 | 192 | | [Parameter, EditorRequired] public int LootSlots { get; set; } |
| | 0 | 193 | | [Parameter, EditorRequired] public string RaidEncumbranceText { get; set; } = string.Empty; |
| | 0 | 194 | | [Parameter, EditorRequired] public int Challenge { get; set; } |
| | 0 | 195 | | [Parameter, EditorRequired] public int DistanceFromExtract { get; set; } |
| | 0 | 196 | | [Parameter, EditorRequired] public EncounterType EncounterType { get; set; } |
| | 0 | 197 | | [Parameter, EditorRequired] public string EncounterTitle { get; set; } = string.Empty; |
| | 0 | 198 | | [Parameter, EditorRequired] public string EncounterDescription { get; set; } = string.Empty; |
| | 0 | 199 | | [Parameter] public string ContactState { get; set; } = string.Empty; |
| | 0 | 200 | | [Parameter] public string SurpriseSide { get; set; } = string.Empty; |
| | 0 | 201 | | [Parameter] public string InitiativeWinner { get; set; } = string.Empty; |
| | 0 | 202 | | [Parameter, EditorRequired] public int OpeningActionsRemaining { get; set; } |
| | 0 | 203 | | [Parameter, EditorRequired] public bool SurprisePersistenceEligible { get; set; } |
| | 0 | 204 | | [Parameter] public string EnemyName { get; set; } = string.Empty; |
| | 0 | 205 | | [Parameter, EditorRequired] public int EnemyHealth { get; set; } |
| | 0 | 206 | | [Parameter] public string LootContainer { get; set; } = string.Empty; |
| | 0 | 207 | | [Parameter, EditorRequired] public IReadOnlyList<Item> DiscoveredLoot { get; set; } = []; |
| | 0 | 208 | | [Parameter, EditorRequired] public IReadOnlyList<Item> CarriedLoot { get; set; } = []; |
| | 0 | 209 | | [Parameter, EditorRequired] public IReadOnlyList<Item> EquippedItems { get; set; } = []; |
| | 0 | 210 | | [Parameter, EditorRequired] public IReadOnlyList<string> LogEntries { get; set; } = []; |
| | 0 | 211 | | [Parameter, EditorRequired] public bool AwaitingDecision { get; set; } |
| | 0 | 212 | | [Parameter, EditorRequired] public bool CanAttack { get; set; } |
| | 0 | 213 | | [Parameter, EditorRequired] public bool CanAttackEnabled { get; set; } |
| | 0 | 214 | | [Parameter, EditorRequired] public bool CanBurstFire { get; set; } |
| | 0 | 215 | | [Parameter, EditorRequired] public bool CanBurstFireEnabled { get; set; } |
| | 0 | 216 | | [Parameter, EditorRequired] public bool CanFullAuto { get; set; } |
| | 0 | 217 | | [Parameter, EditorRequired] public bool CanFullAutoEnabled { get; set; } |
| | 0 | 218 | | [Parameter, EditorRequired] public bool CanReload { get; set; } |
| | 0 | 219 | | [Parameter, EditorRequired] public bool CanUseMedkit { get; set; } |
| | 0 | 220 | | [Parameter, EditorRequired] public Func<Item, bool> CanLootItem { get; set; } = _ => false; |
| | 0 | 221 | | [Parameter, EditorRequired] public Func<Item, bool> CanEquipItem { get; set; } = _ => false; |
| | 0 | 222 | | [Parameter, EditorRequired] public bool ExtractHoldActive { get; set; } |
| | 0 | 223 | | [Parameter] public DateTimeOffset? HoldAtExtractUntil { get; set; } |
| | 0 | 224 | | [Parameter, EditorRequired] public EventCallback OnAttack { get; set; } |
| | 0 | 225 | | [Parameter, EditorRequired] public EventCallback OnBurstFire { get; set; } |
| | 0 | 226 | | [Parameter, EditorRequired] public EventCallback OnFullAuto { get; set; } |
| | 0 | 227 | | [Parameter, EditorRequired] public EventCallback OnReload { get; set; } |
| | 0 | 228 | | [Parameter, EditorRequired] public EventCallback OnFlee { get; set; } |
| | 0 | 229 | | [Parameter, EditorRequired] public EventCallback OnUseMedkit { get; set; } |
| | 0 | 230 | | [Parameter, EditorRequired] public EventCallback<Item> OnTakeLoot { get; set; } |
| | 0 | 231 | | [Parameter, EditorRequired] public EventCallback<Item> OnDropCarried { get; set; } |
| | 0 | 232 | | [Parameter, EditorRequired] public EventCallback<ItemType> OnDropEquipped { get; set; } |
| | 0 | 233 | | [Parameter, EditorRequired] public EventCallback<Item> OnEquipFromDiscovered { get; set; } |
| | 0 | 234 | | [Parameter, EditorRequired] public EventCallback<Item> OnEquipFromCarried { get; set; } |
| | 0 | 235 | | [Parameter, EditorRequired] public EventCallback OnAttemptExtract { get; set; } |
| | 0 | 236 | | [Parameter, EditorRequired] public EventCallback OnGoDeeper { get; set; } |
| | 0 | 237 | | [Parameter, EditorRequired] public EventCallback OnStartExtractHold { get; set; } |
| | 0 | 238 | | [Parameter, EditorRequired] public EventCallback OnCancelExtractHold { get; set; } |
| | 0 | 239 | | [Parameter, EditorRequired] public EventCallback OnMoveTowardExtract { get; set; } |
| | | 240 | | |
| | | 241 | | private bool IsExtractHoldEffectivelyActive() |
| | | 242 | | { |
| | 0 | 243 | | if (!ExtractHoldActive) |
| | | 244 | | { |
| | 0 | 245 | | return false; |
| | | 246 | | } |
| | | 247 | | |
| | 0 | 248 | | return HoldAtExtractUntil is null || HoldAtExtractUntil > DateTimeOffset.UtcNow; |
| | | 249 | | } |
| | | 250 | | |
| | | 251 | | private string GetOpeningPhaseSummary() |
| | | 252 | | { |
| | 0 | 253 | | if (Matches(SurpriseSide, "Player")) |
| | | 254 | | { |
| | 0 | 255 | | return "You spotted them first."; |
| | | 256 | | } |
| | | 257 | | |
| | 0 | 258 | | if (Matches(SurpriseSide, "Enemy")) |
| | | 259 | | { |
| | 0 | 260 | | return "They ambushed you."; |
| | | 261 | | } |
| | | 262 | | |
| | 0 | 263 | | if (Matches(InitiativeWinner, "Player")) |
| | | 264 | | { |
| | 0 | 265 | | return "You won initiative."; |
| | | 266 | | } |
| | | 267 | | |
| | 0 | 268 | | if (Matches(InitiativeWinner, "Enemy")) |
| | | 269 | | { |
| | 0 | 270 | | return "Enemy won initiative."; |
| | | 271 | | } |
| | | 272 | | |
| | 0 | 273 | | if (Matches(ContactState, "PlayerAmbush")) |
| | | 274 | | { |
| | 0 | 275 | | return "You spotted them first."; |
| | | 276 | | } |
| | | 277 | | |
| | 0 | 278 | | if (Matches(ContactState, "EnemyAmbush")) |
| | | 279 | | { |
| | 0 | 280 | | return "They ambushed you."; |
| | | 281 | | } |
| | | 282 | | |
| | 0 | 283 | | return string.Empty; |
| | | 284 | | } |
| | | 285 | | |
| | | 286 | | private static bool Matches(string value, string expected) |
| | | 287 | | { |
| | 0 | 288 | | return string.Equals(value, expected, StringComparison.OrdinalIgnoreCase); |
| | | 289 | | } |
| | | 290 | | |
| | | 291 | | private static bool IsEquipable(Item item) |
| | | 292 | | { |
| | 0 | 293 | | return item.Type is ItemType.Weapon or ItemType.Armor or ItemType.Backpack; |
| | | 294 | | } |
| | | 295 | | |
| | | 296 | | private string GetExtractHoldCountdownText() |
| | | 297 | | { |
| | 0 | 298 | | if (HoldAtExtractUntil is null) |
| | | 299 | | { |
| | 0 | 300 | | return string.Empty; |
| | | 301 | | } |
| | | 302 | | |
| | 0 | 303 | | var left = HoldAtExtractUntil.Value - DateTimeOffset.UtcNow; |
| | 0 | 304 | | if (left < TimeSpan.Zero) |
| | | 305 | | { |
| | 0 | 306 | | left = TimeSpan.Zero; |
| | | 307 | | } |
| | | 308 | | |
| | 0 | 309 | | return $"{left.Minutes:D2}:{left.Seconds:D2}"; |
| | | 310 | | } |
| | | 311 | | |
| | | 312 | | private bool IsTooHeavyToCarry(Item item) |
| | | 313 | | { |
| | 0 | 314 | | return RaidEncumbrance() + Math.Max(0, item.Weight) > Raid.MaxEncumbrance; |
| | | 315 | | } |
| | | 316 | | |
| | | 317 | | private bool IsBlockedByLootSlots(Item item) |
| | | 318 | | { |
| | 0 | 319 | | return LootSlots + item.Slots > Raid.BackpackCapacity; |
| | | 320 | | } |
| | | 321 | | |
| | | 322 | | private int RaidEncumbrance() |
| | | 323 | | { |
| | 0 | 324 | | return CombatBalance.GetTotalEncumbrance(Raid.Inventory.GetExtractableItems()); |
| | | 325 | | } |
| | | 326 | | |
| | | 327 | | private EncumbranceTier GetDisplayedEncumbranceTier() |
| | | 328 | | { |
| | 0 | 329 | | if (Raid.MaxEncumbrance <= 0) |
| | | 330 | | { |
| | 0 | 331 | | return EncumbranceTier.Light; |
| | | 332 | | } |
| | | 333 | | |
| | 0 | 334 | | var carriedWeight = RaidEncumbrance(); |
| | 0 | 335 | | var lightThreshold = Raid.MaxEncumbrance / 3; |
| | 0 | 336 | | var mediumThreshold = (Raid.MaxEncumbrance * 2) / 3; |
| | | 337 | | |
| | 0 | 338 | | if (carriedWeight <= lightThreshold) |
| | | 339 | | { |
| | 0 | 340 | | return EncumbranceTier.Light; |
| | | 341 | | } |
| | | 342 | | |
| | 0 | 343 | | if (carriedWeight <= mediumThreshold) |
| | | 344 | | { |
| | 0 | 345 | | return EncumbranceTier.Medium; |
| | | 346 | | } |
| | | 347 | | |
| | 0 | 348 | | return EncumbranceTier.Heavy; |
| | | 349 | | } |
| | | 350 | | |
| | | 351 | | private bool ShouldShowEncumbranceTier() |
| | | 352 | | { |
| | 0 | 353 | | return GetDisplayedEncumbranceTier() is not EncumbranceTier.Light; |
| | | 354 | | } |
| | | 355 | | |
| | | 356 | | private string GetEncumbranceTierLabel() |
| | | 357 | | { |
| | 0 | 358 | | return GetDisplayedEncumbranceTier().ToString(); |
| | | 359 | | } |
| | | 360 | | |
| | | 361 | | private string GetEncumbranceSeverityCssClass() |
| | | 362 | | { |
| | 0 | 363 | | return GetDisplayedEncumbranceTier() switch |
| | 0 | 364 | | { |
| | 0 | 365 | | EncumbranceTier.Medium => "encumbrance-medium", |
| | 0 | 366 | | EncumbranceTier.Heavy => "encumbrance-heavy", |
| | 0 | 367 | | _ => string.Empty |
| | 0 | 368 | | }; |
| | | 369 | | } |
| | | 370 | | } |