Skip to main content

neon_crisp / Modules / gameContextManger/gameContext/gameContext / GameContext

Class: GameContext

gameContextManger/gameContext/gameContext.GameContext

Table of contents​

Constructors​

Properties​

Methods​

Constructors​

constructor​

• new GameContext(oldGameContext?): GameContext

Parameters​

NameType
oldGameContext?GameContext

Returns​

GameContext

Defined in​

gameContextManger/gameContext/gameContext.ts:18

Properties​

actionQue​

• actionQue: ActionIntent[]

Defined in​

gameContextManger/gameContext/gameContext.ts:16


currentAction​

• currentAction: undefined | ActionHook

Defined in​

gameContextManger/gameContext/gameContext.ts:17


deckA​

• deckA: Card[]

Defined in​

gameContextManger/gameContext/gameContext.ts:8


deckB​

• deckB: Card[]

Defined in​

gameContextManger/gameContext/gameContext.ts:9


discardA​

• discardA: Card[]

Defined in​

gameContextManger/gameContext/gameContext.ts:10


discardB​

• discardB: Card[]

Defined in​

gameContextManger/gameContext/gameContext.ts:11


handA​

• handA: Card[]

Defined in​

gameContextManger/gameContext/gameContext.ts:6


handB​

• handB: Card[]

Defined in​

gameContextManger/gameContext/gameContext.ts:7


manaA​

• manaA: number

Defined in​

gameContextManger/gameContext/gameContext.ts:12


manaB​

• manaB: number

Defined in​

gameContextManger/gameContext/gameContext.ts:13


round​

• round: number

Defined in​

gameContextManger/gameContext/gameContext.ts:14


turn​

• turn: number

Defined in​

gameContextManger/gameContext/gameContext.ts:15

Methods​

OnAfterAttack​

▸ OnAfterAttack(attackingCard, defendingCard): void

this is to handle all on after attack and should only be called by game context

Parameters​

NameType
attackingCardCard
defendingCardCard

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:245


OnBeforeAttack​

▸ OnBeforeAttack(attackingCard, defendingCard): void

this is to handle all on before attack and should only be called by game context

Parameters​

NameType
attackingCardCard
defendingCardCard

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:233


OnGameStart​

▸ OnGameStart(attackingCard, defendingCard): void

this is to handle all on game start and should only be called by game context

Parameters​

NameType
attackingCardCard
defendingCardCard

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:208


OnHeathAtOrBelowZero​

▸ OnHeathAtOrBelowZero(attackingCard, defendingCard): void

this is to handle all on health on or below zero and should only be called by game context

Parameters​

NameType
attackingCardCard
defendingCardCard

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:184


OnTargeted​

▸ OnTargeted(attackingCard, defendingCard): void

this is to handle all on targeted and should only be called by game context

Parameters​

NameType
attackingCardCard
defendingCardCard

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:220


OnTurn​

▸ OnTurn(attackingCard, defendingCard): void

this is to handle all on turn and should only be called by game context

Parameters​

NameType
attackingCardCard
defendingCardCard

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:196


addCardToDeck​

▸ addCardToDeck(deck, card): GameContext

Parameters​

NameType
deck"A" | "B"
cardCard

Returns​

GameContext

Defined in​

gameContextManger/gameContext/gameContext.ts:403


addCardToHand​

▸ addCardToHand(hand, card): GameContext

Parameters​

NameType
hand"A" | "B"
cardCard

Returns​

GameContext

Defined in​

gameContextManger/gameContext/gameContext.ts:397


addMana​

▸ addMana(amount, hand): void

Parameters​

NameType
amountnumber
hand"A" | "B"

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:66


canSpendMana​

▸ canSpendMana(cost, hand): boolean

Parameters​

NameType
costnumber
hand"A" | "B"

Returns​

boolean

Defined in​

gameContextManger/gameContext/gameContext.ts:48


drawCard​

▸ drawCard(deck): void

Parameters​

NameType
deck"A" | "B"

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:408


findCardLocation​

▸ findCardLocation(cardId): undefined | { index: number ; list: "HAND" | "DECK" | "DISCARD" ; owner: "A" | "B" }

Parameters​

NameType
cardIdstring

Returns​

undefined | { index: number ; list: "HAND" | "DECK" | "DISCARD" ; owner: "A" | "B" }

Defined in​

gameContextManger/gameContext/gameContext.ts:322


getAllCards​

▸ getAllCards(): Card[]

Returns​

Card[]

Defined in​

gameContextManger/gameContext/gameContext.ts:314


getCardInHandForId​

▸ getCardInHandForId(cardId): undefined | Card

Parameters​

NameType
cardIdstring

Returns​

undefined | Card

Defined in​

gameContextManger/gameContext/gameContext.ts:317


getDeck​

▸ getDeck(deck): Card[]

Parameters​

NameType
deck"A" | "B"

Returns​

Card[]

Defined in​

gameContextManger/gameContext/gameContext.ts:275


getHand​

▸ getHand(hand): Card[]

Parameters​

NameType
hand"A" | "B"

Returns​

Card[]

Defined in​

gameContextManger/gameContext/gameContext.ts:271


getTarget​

▸ getTarget(hand, strategy, attackingCard): Card

Parameters​

NameType
hand"A" | "B"
strategy"RANDOM"
attackingCardCard

Returns​

Card

Defined in​

gameContextManger/gameContext/gameContext.ts:417


moveCard​

▸ moveCard(hand, fromIndex, toIndex): GameContext

Parameters​

NameType
hand"A" | "B"
fromIndexnumber
toIndexnumber

Returns​

GameContext

Defined in​

gameContextManger/gameContext/gameContext.ts:279


onAttack​

▸ onAttack(attackingCard, defendingCard): void

this is to handel all on attack actions for every card and should only be called by processNextActionInQue

Parameters​

NameType
attackingCardCard
defendingCardCard

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:144


onCardStateChange​

▸ onCardStateChange(attackingCard, defendingCard): void

this is to handle all on state change actions and should only be called by game context

Parameters​

NameType
attackingCardCard
defendingCardCard

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:170


onDamage​

▸ onDamage(attackingCard, defendingCard): void

this is to handel all on damage actions for every card and should only be called by processNextActionInQue

Parameters​

NameType
attackingCardCard
defendingCardCard

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:157


processNextActionInQue​

▸ processNextActionInQue(): void

will take then next action in the action que find the correct handler for said action and call it. This is what keeps the game state moving forward should only be called by game context manager unless writing tests.

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:104


registerActionIntent​

▸ registerActionIntent(hook, attackingCard, defendingCard): void

This is how a new action is added to the game. Anything you want to do starts here. Cards can call this on the game context they have access too. But outside of the card they should be called on game context manger. Because this game context is incorporeal and a new one will be created and that one will be the main game context until another one is created.

Parameters​

NameType
hookActionHook
attackingCardCard
defendingCardCard

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:88


removeCard​

▸ removeCard(cardId): GameContext

Parameters​

NameType
cardIdstring

Returns​

GameContext

Defined in​

gameContextManger/gameContext/gameContext.ts:392


removeCardFromHand​

▸ removeCardFromHand(hand, cardId): GameContext

Parameters​

NameType
hand"A" | "B"
cardIdstring

Returns​

GameContext

Defined in​

gameContextManger/gameContext/gameContext.ts:294


spawnCard​

▸ spawnCard(hand, cardId): void

Parameters​

NameType
hand"A" | "B"
cardIdstring

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:428


spendMana​

▸ spendMana(cost, hand): boolean

Parameters​

NameType
costnumber
hand"A" | "B"

Returns​

boolean

Defined in​

gameContextManger/gameContext/gameContext.ts:55


updateRound​

▸ updateRound(newRound): GameContext

Parameters​

NameType
newRoundnumber

Returns​

GameContext

Defined in​

gameContextManger/gameContext/gameContext.ts:261


updateTurn​

▸ updateTurn(newTurn): GameContext

Parameters​

NameType
newTurnnumber

Returns​

GameContext

Defined in​

gameContextManger/gameContext/gameContext.ts:266


updateUsed​

▸ updateUsed(hand): void

Parameters​

NameType
hand"A" | "B"

Returns​

void

Defined in​

gameContextManger/gameContext/gameContext.ts:286