spoilerguard

package
v0.3.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package spoilerguard implements Spoiler Guard, a method of blocking cards that would be a spoiler for a Bug Fables player who has not completed the game.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, set *card.Set, remoteData []uint8, menuOnly bool)

Apply applies card restrictions and menu codes to the set.

func OnKey added in v0.2.81

func OnKey(e key.Event)

OnKey handles menu codes for spoiler guard.

func SaveData

func SaveData(d *Data)

SaveData stores the player's Spoiler Guard data in persistent storage.

func TranslatePortrait added in v0.3.19

func TranslatePortrait(ctx context.Context, portrait uint8, custom []byte) (uint8, []byte)

Types

type Data

type Data struct {
	Quest            QuestProgress `json:"q"`
	MetCarmina       bool          `json:"t"`
	CarminaApproved  bool          `json:"a"`
	Menu             uint32        `json:"m,omitempty"`
	Deck             card.Deck     `json:"d"`
	SeenSpiedEnemies []uint8       `json:"s"`
}

Data is the stored data for Spoiler Guard.

func LoadData

func LoadData() *Data

LoadData returns the player's stored Spoiler Guard data.

func ParseSaveData added in v0.3.1

func ParseSaveData(data string) (*Data, error)

func SurveyData added in v0.3.1

func SurveyData(s *gui.Scroll, runSync chan<- func()) *Data

func (*Data) State added in v0.3.1

func (d *Data) State() GuardState

State returns the GuardState for the player's stored data.

type GuardState added in v0.3.1

type GuardState uint8

GuardState is a warning level for a player with Spoiler Guard enabled. Higher numeric values correspond to less danger of encountering spoilers.

const (
	StateQuestLocked GuardState = iota
	StateQuestNotAccepted
	StateQuestNotCompleted
	StateNotMetCarmina
	StateCardsNotApproved
	StateNotAllSeen
	StateNotAllSpied
	StateDisabled
)

Constants for GuardState.

func (GuardState) Block added in v0.3.1

func (s GuardState) Block() bool

Block returns true if the player should not be allowed to play Spy Cards at all in this state.

func (GuardState) String added in v0.3.1

func (i GuardState) String() string

type QuestProgress

type QuestProgress int8

QuestProgress is a player's progress in the "Requesting Assistance" quest.

const (
	QuestUnavailable QuestProgress = -1
	QuestAvailable   QuestProgress = 0
	QuestTaken       QuestProgress = 1
	QuestComplete    QuestProgress = 2
)

Constants for QuestProgress.

func (QuestProgress) String added in v0.3.1

func (i QuestProgress) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL