Skip to content

Define Rating Component and System #1

@michaeltlombardi

Description

@michaeltlombardi

A Rating is a combination of integers ranging from 1-6.

Typical ratings are measured by Tier and Degree. They may also be measured by Minute and Second.

The implementation must meet the following requirements:

  1. It must initialize without any parameters to have a Tier of 1 and a Degree of 1.
  2. It must be represented in a string as <Tier>:<Degree>[:<Minute>[:<Second]], where Minute and Second are left off if 0.
  3. If it isn't initialized with a Minute, it can't be initialized with a Second.
  4. If it isn't initialized with a Minute, one can't be set later.
  5. If it isn't initialized with a Second, one can't be set later.
  6. It must be comparable to another rating, comparing each defined property in turn. For comparing ratings a and b: - If a.Tier > b.Tier, a is greater than b.
    • If a.Tier < b.Tier, b is greater than a.
    • If a.Tier == b.Tier, compare by Degree.
    • If a.Degree == b.Degree, compare by Minute.
    • If a.Minute == b.Minute && a.Minute == 0 && b.Minute == 0, they are equal. Otherwise, compare by Second.
  7. It must be possible to add an integer to a Rating. By default, it should increment the last non-zero field by the specified. If this would make the field's value 7 or more, increase the previous field by 1 and reset the current field to 1. This behavior should cascade upward. If the addition would result in a cascade beyond tier, handle it by firing an invalid operation event or raising an error.
  8. It must be possible to subtract an integer from a Rating, following the same logic as addition but cascading if the current field's value would be less than 1 and resetting the current field to 6 before continuing.

Metadata

Metadata

Labels

corePart of the core game design

Type

No type

Projects

Status

🛠 WIP

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions