๐Ÿ“ฆ sleepyfran / duets

๐Ÿ“„ Relationship.Types.fs ยท 29 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29namespace Duets.Entities

[<AutoOpen>]
module RelationshipTypes =
    /// Defines the type of relationship between the character and an NPC.
    type RelationshipType =
        | Friend
        | Bandmate

    [<Measure>]
    type relationshipLevel

    /// Defines a relationship between the main character and an NPC.
    type Relationship =
        { Character: CharacterId
          MeetingCity: CityId
          LastIterationDate: Date
          RelationshipType: RelationshipType
          Level: int<relationshipLevel> }

    type RelationshipsByCharacterId = Map<CharacterId, Relationship>
    type RelationshipsByMeetingCity = Map<CityId, Set<CharacterId>>

    /// Defines all relationships for a character. A non-existent key means
    /// that the character has no relationship with that character ID.
    type Relationships =
        { ByCharacterId: RelationshipsByCharacterId
          ByMeetingCity: RelationshipsByMeetingCity }