Block 8 — Gear & Crafting (1 day)

Goal: Player crafts equipment at Gear Bench to give raccoons stat boosts. Another resource sink and raid prep lever.

Depends on: Block 5 (scrap + currency resources), Block 2 (roster, gear slot on FRaccoonData).


Deliverables

Gear DataTable (DT_Gear)

UDataTable using row struct FGearTableRow:

USTRUCT(BlueprintType)
struct FGearTableRow : public FTableRowBase {
    UPROPERTY(EditAnywhere) FString DisplayName;
    UPROPERTY(EditAnywhere) EStatType BoostedStat;
    UPROPERTY(EditAnywhere) int32 StatModifier;
    UPROPERTY(EditAnywhere) int32 ScrapCost;
    UPROPERTY(EditAnywhere) int32 CurrencyCost;
};

MVP Items:

Row NameDisplay NameStatModifierScrapCurrency
SpeedBandanaSpeed BandanaSpeed+58$5
StealthScarfStealth ScarfStealth+58$5
StrengthVestStrength VestStrength+58$5

Values are tunable. Cunning/Luck items as stretch. DataTable at Content/TrashNTreasure/Data/Tables/DT_Gear.uasset.

Gear Inventory

Internal state (extends URaccoonSubsystemRaccoons, NamePool, OnRosterChanged, GearTable declared in prior blocks):

MemberTypePurpose
GearInventoryTArray<FName>Crafted-but-unequipped gear. Each entry is a row name from DT_Gear. Persisted in save data
FunctionSignaturePurpose
CraftGearbool (FName GearRowName)Look up FGearTableRow. Check UResourceSubsystem::CanAffordCost. Deduct scrap + currency. Add row name to inventory. Return success.
GetGearInventoryTArray<FName> ()For UI display of available gear.

URaccoonSubsystem::EquipGear / UnequipGear (C++)

Already declared in Block 2. Implementation:

EquipGear(FGuid RaccoonId, FName GearRow):

  1. Validate raccoon exists
  2. If raccoon already has gear equipped → return false (must unequip first)
  3. Validate GearRow exists in inventory
  4. Set FRaccoonData::EquippedGearRowName = GearRow
  5. Remove from inventory
  6. Broadcast OnRosterChanged
  7. Return true

UnequipGear(FGuid RaccoonId):

  1. Get current EquippedGearRowName
  2. If empty → return NAME_None
  3. Clear EquippedGearRowName
  4. Add row name back to inventory
  5. Broadcast OnRosterChanged
  6. Return row name

GetEffectiveStats — Gear Integration

Already implemented in Block 2. Now resolves gear:

FStatBlock GetEffectiveStats(FGuid Id) {
    FRaccoonData* R = GetRaccoon_Internal(Id);
    FStatBlock Result = R->BaseStats + R->TrainingBonus;  // Base + Training
 
    // Gear modifier
    if (!R->EquippedGearRowName.IsNone()) {
        FGearTableRow* Row = GearTable->FindRow<FGearTableRow>(R->EquippedGearRowName);
        if (Row) {
            Result.ModifyStat(Row->BoostedStat, Row->StatModifier);
        }
    }
 
    // Clamp to 100 per stat
    Result.ClampAll(0, 100);
 
    // Hunger penalty (from Block 6) — applied after clamp
    if (R->Status == ERaccoonStatus::Hungry) {
        Result.Speed = FMath::FloorToInt(Result.Speed * 0.8f);
        Result.Stealth = FMath::FloorToInt(Result.Stealth * 0.8f);
        // ... all stats
    }
 
    return Result;
}

Gear Bench Station UI (UTNTGearBenchUI)

UMG widget opened from Gear Bench station:

  • Craftable items list: Each row shows item name, stat bonus, cost (scrap + currency). Craft button per row. Grayed if can’t afford.
  • Inventory section: List of crafted gear not yet equipped. Text: “[Item Name] — +[N] [Stat]”
  • Equip section: Opens roster view filtered to idle raccoons. Select raccoon → select gear from inventory → equip. Shows stat change preview.

DataAsset: DA_GearBench, relevant stat TBD (Cunning or Speed for post-MVP craft quality/speed), no storage cap for MVP.

Equip Flow via Roster UI

Update UTNTRosterWidget (from Block 2):

  • Per raccoon card: gear slot now clickable
  • Click empty slot → dropdown of inventory items → select → EquipGear
  • Click equipped item → “Unequip” button → UnequipGear
  • Stat display updates immediately to show effective stats including gear bonus

Done When

  • Player crafts all 3 gear items at Gear Bench (scrap + currency deducted)
  • Crafted gear appears in inventory
  • Equip gear on raccoon → stat bonus visible in roster (effective stats include gear)
  • Equipped gear affects raid encounter checks (sum of crew effective stats includes gear bonuses)
  • Gear can be unequipped and returns to inventory
  • Gear can be re-assigned to different raccoon
  • GetEffectiveStats correctly stacks base + training + gear, clamped to 100, then hunger penalty

References

Gear Bench · Gear