-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support dynamic card during draw_card
- Loading branch information
1 parent
8b05201
commit a6df1ce
Showing
6 changed files
with
177 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
defmodule ViralSpiral.Room.Analytics do | ||
alias ViralSpiral.Room.State | ||
|
||
@doc """ | ||
identity of the player with most clout | ||
""" | ||
def dominant_community(%State{} = state) do | ||
end | ||
end | ||
|
||
defmodule ViralSpiral.Room.Analytics.GameState do | ||
alias ViralSpiral.Room.State | ||
|
||
def analytics(%State{} = _state) do | ||
%{ | ||
unpopular_affinity: :skub, | ||
popular_affinity: :houseboat, | ||
dominant_community: :red, | ||
other_community: :blue, | ||
oppressed_community: :yellow | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,79 @@ | ||
defmodule ViralSpiral.Room.StateTest do | ||
alias ViralSpiral.Game.State | ||
use ExUnit.Case | ||
|
||
describe "card" do | ||
setup do | ||
state = %State{ | ||
room: %Room{ | ||
id: "room_abc", | ||
name: "crazy-house-3213", | ||
state: :running, | ||
unjoined_players: [], | ||
affinities: [:skub, :houseboat], | ||
communities: [:red, :yellow, :blue], | ||
chaos: 0, | ||
chaos_counter: 10, | ||
volatality: :medium | ||
}, | ||
players: %{ | ||
"player_abc" => %Player{ | ||
id: "player_abc", | ||
name: "farah", | ||
biases: %{yellow: 0, blue: 0}, | ||
affinities: %{skub: 0, houseboat: 0}, | ||
clout: 0, | ||
identity: :red, | ||
hand: [], | ||
active_cards: [] | ||
}, | ||
"player_def" => %Player{ | ||
id: "player_def", | ||
name: "aman", | ||
biases: %{red: 0, blue: 0}, | ||
affinities: %{skub: 0, houseboat: 0}, | ||
clout: 0, | ||
identity: :yellow, | ||
hand: [], | ||
active_cards: [] | ||
}, | ||
"player_ghi" => %Player{ | ||
id: "player_ghi", | ||
name: "krys", | ||
biases: %{yellow: 0, blue: 0}, | ||
affinities: %{skub: 0, houseboat: 0}, | ||
clout: 0, | ||
identity: :red, | ||
hand: [], | ||
active_cards: [] | ||
}, | ||
"player_jkl" => %Player{ | ||
id: "player_jkl", | ||
biases: %{yellow: 0, blue: 0}, | ||
affinities: %{skub: 0, houseboat: 0}, | ||
clout: 0, | ||
name: "adhiraj", | ||
identity: :red, | ||
hand: [], | ||
active_cards: [] | ||
} | ||
}, | ||
round: %Round{ | ||
order: ["player_jkl", "player_ghi", "player_def", "player_abc"], | ||
count: 4, | ||
current: 0, | ||
skip: nil | ||
}, | ||
turn: %Turn{ | ||
card: nil, | ||
current: "player_jkl", | ||
pass_to: ["player_abc", "player_def", "player_ghi"] | ||
} | ||
} | ||
|
||
state = %{state | deck: Factory.new_deck(state.room)} | ||
|
||
%{state: state} | ||
end | ||
end | ||
end |