# Class Challenge`Abstract`

A challenge object. Exists only to serve as a base class.

#### Hierarchy (view full)

- Challenge
  - SingleGenerationChallenge
  - SingleTypeChallenge
  - FreshStartChallenge
  - LowerStarterMaxCostChallenge
  - LowerStarterPointsChallenge

- Defined in src/data/challenge.ts:52

#####
Index

### Constructors

constructor

### Properties

challengeTypes
conditions
id
maxSeverity
maxValue
severity
value

### Methods

addChallengeType
apply
condition
decreaseSeverity
decreaseValue
getDescription
getDifficulty
getMinDifficulty
getName
getValue
geti18nKey
hasSeverity
increaseSeverity
increaseValue
isOfType
isUnlocked
reset
loadChallenge

## Constructors

### constructor

- new Challenge(id, maxValue?): Challenge

- #### Parameters

  - id: Challenges

    The enum value for the challenge

  - maxValue: number = Number.MAX_SAFE_INTEGER

  #### Returns Challenge

  - Defined in src/data/challenge.ts:66

## Properties

### challengeTypes

challengeTypes: ChallengeType []

- Defined in src/data/challenge.ts:61

### conditions

conditions: ChallengeCondition[]

- Defined in src/data/challenge.ts:60

### id

id: Challenges

- Defined in src/data/challenge.ts:53

### maxSeverity

maxSeverity: number

- Defined in src/data/challenge.ts:58

### maxValue

maxValue: number

- Defined in src/data/challenge.ts:56

### severity

severity: number

- Defined in src/data/challenge.ts:57

### value

value: number

- Defined in src/data/challenge.ts:55

## Methods

### addChallengeType

- addChallengeType(challengeType): Challenge

- Adds a challenge type to this challenge.

  #### Parameters

  - challengeType: ChallengeType

    The challenge type to add.

  #### Returns Challenge

  This challenge

  - Defined in src/data/challenge.ts:127

### `Abstract` apply

- apply(challengeType, args): boolean

- Modifies the data or game state in some way to apply the challenge.

  #### Parameters

  - challengeType: ChallengeType

    Which challenge type this is being applied for.

  - args: any[]

    Irrelevant. See the specific challenge's apply function for additional information.

  #### Returns boolean

  - Defined in src/data/challenge.ts:240

### condition

- condition(condition): Challenge

- Adds an unlock condition to this challenge.

  #### Parameters

  - condition: ChallengeCondition

    The condition to add.

  #### Returns Challenge

  This challenge

  - Defined in src/data/challenge.ts:107

### decreaseSeverity

- decreaseSeverity(): boolean

- Decrease the severity of the challenge

  #### Returns boolean

  Returns true if the value changed

  - Defined in src/data/challenge.ts:199

### decreaseValue

- decreaseValue(): boolean

- Decrease the value of the challenge

  #### Returns boolean

  Returns true if the value changed

  - Defined in src/data/challenge.ts:180

### getDescription

- getDescription(overrideValue?): string

- Returns the description of a challenge's current value.

  #### Parameters

  - `Optional` overrideValue: number

    The value to check for. If undefined, gets the current value.

  #### Returns string

  The localised description for the current value.

  - Defined in src/data/challenge.ts:157

### getDifficulty

- getDifficulty(): number

- Gets the "difficulty" value of this challenge.

  #### Returns number

  The difficulty value.

  - Defined in src/data/challenge.ts:223

### getMinDifficulty

- getMinDifficulty(): number

- Gets the minimum difficulty added by this challenge.

  #### Returns number

  The difficulty value.

  - Defined in src/data/challenge.ts:231

### getName

- getName(): string

- #### Returns string

  The localised name of this challenge.

  - Defined in src/data/challenge.ts:136

### getValue

- getValue(overrideValue?): string

- Returns the textual representation of a challenge's current value.

  #### Parameters

  - `Optional` overrideValue: number

    The value to check for. If undefined, gets the current value.

  #### Returns string

  The localised name for the current value.

  - Defined in src/data/challenge.ts:145

### geti18nKey

- geti18nKey(): string

- Gets the localisation key for the challenge

  #### Returns string

  The i18n key for this challenge

  - Defined in src/data/challenge.ts:89

### hasSeverity

- hasSeverity(): boolean

- Whether to allow choosing this challenge's severity.

  #### Returns boolean

  - Defined in src/data/challenge.ts:191

### increaseSeverity

- increaseSeverity(): boolean

- Increase the severity of the challenge

  #### Returns boolean

  Returns true if the value changed

  - Defined in src/data/challenge.ts:211

### increaseValue

- increaseValue(): boolean

- Increase the value of the challenge

  #### Returns boolean

  Returns true if the value changed

  - Defined in src/data/challenge.ts:168

### isOfType

- isOfType(challengeType): boolean

- If this challenge is of a particular type

  #### Parameters

  - challengeType: ChallengeType

    The challenge type to check.

  #### Returns boolean

  This challenge

  - Defined in src/data/challenge.ts:118

### isUnlocked

- isUnlocked(data): boolean

- Used for unlockable challenges to check if they're unlocked.

  #### Parameters

  - data: GameData

    The save data.

  #### Returns boolean

  Whether this challenge is unlocked.

  - Defined in src/data/challenge.ts:98

### reset

- reset(): void

- Reset the challenge to a base state.

  #### Returns void

  - Defined in src/data/challenge.ts:80

### `Static` loadChallenge

- loadChallenge(source): Challenge

- Clones a challenge, either from another challenge or json. Chainable.

  #### Parameters

  - source: any

    The source challenge of json.

  #### Returns Challenge

  This challenge.

  - Defined in src/data/challenge.ts:247