Skip to content

Commit

Permalink
feat: restructure Deck, improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dennyabrain committed Aug 27, 2024
1 parent 78513b8 commit b527bd2
Show file tree
Hide file tree
Showing 17 changed files with 873 additions and 34 deletions.
61 changes: 49 additions & 12 deletions lib/viral_spiral/canon.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,61 @@ defmodule ViralSpiral.Canon do
The static assets provided by the writers and illustrators are managed using Canon.
"""

alias ViralSpiral.Room.RoomCreateRequest

Check warning on line 8 in lib/viral_spiral/canon.ex

View workflow job for this annotation

GitHub Actions / build-and-deploy

unused alias RoomCreateRequest
alias ViralSpiral.Canon.Deck

# @card_data "card.ods"
# @encyclopedia "encyclopedia.ods"

def load_deck() do
@true_affinity_opts type: :affinity, veracity: true
@false_affinity_opts type: :affinity, veracity: false
@true_bias_opts type: :bias, veracity: true
@false_bias_opts type: :bias, veracity: false
@true_topical_opts type: :topical, veracity: true
@false_topical_opts type: :topical, veracity: false
@false_conflated_opts type: :conflated, veracity: false

defdelegate load_cards, to: Deck

defdelegate create_store(cards), to: Deck

defdelegate create_sets(cards), to: Deck

def draw_true_affinity_card(deck, tgb, target) do
opts = @true_affinity_opts ++ [tgb: tgb, target: target]
Deck.draw_card(deck, opts)
end

def encyclopedia() do
def draw_false_affinity_card(deck, tgb, target) do
opts = @false_affinity_opts ++ [tgb: tgb, target: target]
Deck.draw_card(deck, opts)
end
end

defmodule ViralSpiral.Canon.Encyclopedia do
@moduledoc """
Provides the in-game encyclopedia
"""
end
def draw_true_bias_card(deck, tgb, target) do
opts = @true_bias_opts ++ [tgb: tgb, target: target]
Deck.draw_card(deck, opts)
end

defmodule ViralSpiral.Canon.Deck do
@moduledoc """
Provides the game's cards
"""
def draw_false_bias_card(deck, tgb, target) do
opts = @false_bias_opts ++ [tgb: tgb, target: target]
Deck.draw_card(deck, opts)
end

def true_topical_card(deck, tgb) do
opts = @true_topical_opts ++ [tgb: tgb]
Deck.draw_card(deck, opts)
end

def false_topical_card(deck, tgb) do
opts = @false_topical_opts ++ [tgb: tgb]
Deck.draw_card(deck, opts)
end

def false_conflated_card(deck, tgb) do
opts = @false_conflated_opts ++ [tgb: tgb]
Deck.draw_card(deck, opts)
end

def encyclopedia() do
end
end
25 changes: 25 additions & 0 deletions lib/viral_spiral/canon/card/affinity.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
defmodule ViralSpiral.Canon.Card.Affinity do
defstruct id: nil,
tgb: nil,
type: :affinity,
target: nil,
veracity: nil,
polarity: nil,
headline: nil,
image: nil
end

# defmodule ViralSpiral.Canon.Card.Affinity.Cat do
# alias ViralSpiral.Canon.Card.Affinity

# def new(tgb, target, veracity, polarity, headline, image) do
# %Affinity{
# tgb: tgb,
# target: target,
# veracity: veracity,
# polarity: polarity,
# headline: headline,
# image: image
# }
# end
# end
10 changes: 10 additions & 0 deletions lib/viral_spiral/canon/card/bias.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
defmodule ViralSpiral.Canon.Card.Bias do
defstruct id: nil,
tgb: nil,
type: :bias,
target: nil,
veracity: nil,
polarity: :neutral,
headline: nil,
image: nil
end
6 changes: 6 additions & 0 deletions lib/viral_spiral/canon/card/conflated.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
defmodule ViralSpiral.Canon.Card.Conflated do
defstruct id: nil,
tgb: nil,
headline: nil,
image: nil
end
9 changes: 9 additions & 0 deletions lib/viral_spiral/canon/card/topical.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule ViralSpiral.Canon.Card.Topical do
defstruct id: nil,
tgb: nil,
type: :topical,
veracity: nil,
polarity: :neutral,
headline: nil,
image: nil
end
Loading

0 comments on commit b527bd2

Please sign in to comment.