hlockey 4 → 6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/data/election.json +20 -0
- data/data/information.json +5 -0
- data/data/league.json +1984 -0
- data/data/links.json +5 -0
- data/data/previous_election_results.json +98 -0
- data/lib/hlockey/actions.rb +22 -0
- data/lib/hlockey/constants.rb +6 -0
- data/lib/hlockey/data.rb +6 -5
- data/lib/hlockey/game/fight.rb +35 -20
- data/lib/hlockey/game/weather/audacity.rb +20 -0
- data/lib/hlockey/game/weather/chicken.rb +57 -0
- data/lib/hlockey/game/weather/incline.rb +43 -0
- data/lib/hlockey/game/weather/stars.rb +23 -0
- data/lib/hlockey/game/weather/sunset.rb +23 -0
- data/lib/hlockey/game/weather/waves.rb +33 -0
- data/lib/hlockey/game/weather/weatherable.rb +63 -0
- data/lib/hlockey/game/weather.rb +17 -0
- data/lib/hlockey/game.rb +123 -89
- data/lib/hlockey/league.rb +68 -76
- data/lib/hlockey/message.rb +62 -62
- data/lib/hlockey/mod/fencebuilder.rb +16 -0
- data/lib/hlockey/mod/fencedestroyer.rb +16 -0
- data/lib/hlockey/mod/handholding.rb +55 -0
- data/lib/hlockey/mod/immaterial.rb +26 -0
- data/lib/hlockey/mod/locked.rb +22 -0
- data/lib/hlockey/mod/moddable.rb +49 -0
- data/lib/hlockey/mod/nonconfrontational.rb +17 -0
- data/lib/hlockey/mod/powernapper.rb +46 -0
- data/lib/hlockey/mod/punchy.rb +17 -0
- data/lib/hlockey/mod.rb +25 -0
- data/lib/hlockey/selfdescribable.rb +9 -0
- data/lib/hlockey/team/player.rb +58 -0
- data/lib/hlockey/team/stadium.rb +52 -0
- data/lib/hlockey/team.rb +66 -25
- data/lib/hlockey/utils.rb +10 -2
- data/lib/hlockey/version.rb +1 -1
- metadata +37 -19
- data/data/election.yaml +0 -21
- data/data/external/names.txt +0 -19948
- data/data/information.yaml +0 -24
- data/data/league.yaml +0 -1526
- data/data/links.yaml +0 -3
- data/data/previous_election_results.yaml +0 -59
- data/lib/hlockey/game/actions.rb +0 -27
- data/lib/hlockey/player.rb +0 -73
- data/lib/hlockey/weather.rb +0 -168
data/lib/hlockey/team.rb
CHANGED
@@ -1,40 +1,82 @@
|
|
1
|
-
require("hlockey/player")
|
1
|
+
require("hlockey/team/player")
|
2
|
+
require("hlockey/team/stadium")
|
2
3
|
|
3
4
|
module Hlockey
|
5
|
+
##
|
6
|
+
# A team in the league
|
4
7
|
# Created by League when data is loaded
|
5
8
|
class Team
|
6
|
-
attr_accessor(:wins, :losses, :roster, :shadows, :status
|
7
|
-
attr_reader(:emoji, :color, :motto)
|
9
|
+
attr_accessor(:wins, :losses, :roster, :shadows, :status)
|
10
|
+
attr_reader(:name, :emoji, :color, :motto, :stadium, :evolutions)
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
+
alias to_s name
|
13
|
+
|
14
|
+
# @param name [String]
|
15
|
+
# @param color [String]
|
16
|
+
# @param emoji [String]
|
17
|
+
# @param motto [String]
|
18
|
+
# @param stadium [Hash<:full_name, :hlockey_type, :nickname, :description => String>]
|
19
|
+
# @param roster [Hash<:lwing, :center, :rwing, :ldef, :goalie, :rdef => Hash>]
|
20
|
+
# @param shadows [Array<Hash>]
|
21
|
+
def initialize(name:, color:, emoji:, motto:, stadium:, roster:, shadows:,
|
22
|
+
evolutions: 0)
|
23
|
+
@name = name
|
12
24
|
@color = color
|
13
25
|
@emoji = emoji
|
14
|
-
@
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
@shadows = shadows.nil? ? Array.new(6) { Player.new(random) } : shadows
|
22
|
-
@wins = 0
|
23
|
-
@losses = 0
|
24
|
-
end
|
26
|
+
@motto = motto
|
27
|
+
@evolutions = evolutions
|
28
|
+
|
29
|
+
@stadium = Stadium.new(team: self, **stadium)
|
30
|
+
|
31
|
+
@roster = roster.transform_values { Player.new(team: self, **_1) }
|
32
|
+
@shadows = shadows.map { Player.new(team: self, **_1) }
|
25
33
|
|
26
|
-
|
27
|
-
|
34
|
+
@status = :in_contention
|
35
|
+
@wins = @losses = 0
|
28
36
|
end
|
29
37
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
38
|
+
# @return [Hash]
|
39
|
+
def to_h(simple: false)
|
40
|
+
res = {
|
41
|
+
name: @name,
|
42
|
+
color: @color,
|
43
|
+
emoji: @emoji,
|
44
|
+
motto: @motto,
|
45
|
+
evolutions: @evolutions,
|
46
|
+
stadium: @stadium.to_h(simple:),
|
47
|
+
roster: @roster.transform_values { _1.to_h(simple:) },
|
48
|
+
shadows: @shadows.map { _1.to_h(simple:) }
|
49
|
+
}
|
50
|
+
|
51
|
+
res.delete(:evolutions) if simple && res[:evolutions].zero?
|
52
|
+
|
53
|
+
unless simple
|
54
|
+
res[:status] = @status
|
55
|
+
res[:wins] = @wins
|
56
|
+
res[:losses] = @losses
|
57
|
+
end
|
58
|
+
|
59
|
+
res
|
34
60
|
end
|
35
61
|
|
62
|
+
# @return [String] wins/losses in string representation
|
63
|
+
def w_l = "#{@wins}-#{@losses}"
|
64
|
+
|
65
|
+
# @return [Boolean]
|
66
|
+
def positive_record? = @wins > @losses
|
67
|
+
|
68
|
+
# @return [Array<Player>]
|
69
|
+
def players = @roster.values + @shadows
|
70
|
+
|
71
|
+
# @return [Symbol] the position of the worst player on the roster
|
72
|
+
def worst_player_pos =
|
73
|
+
@roster.transform_values { _1.stats.values.sum }.min_by { _2 }.first
|
74
|
+
|
75
|
+
# @return [Hash<String => Player>] #roster, but with keys better for displaying
|
76
|
+
def roster_display = @roster.transform_keys(&self.class.method(:pos_name))
|
77
|
+
|
36
78
|
# Takes symbol from Team roster & converts it to full position name
|
37
|
-
def self.pos_name(pos)
|
79
|
+
def self.pos_name(pos) =
|
38
80
|
case pos
|
39
81
|
when :lwing
|
40
82
|
"Left wing"
|
@@ -47,6 +89,5 @@ module Hlockey
|
|
47
89
|
else
|
48
90
|
pos.capitalize.to_s
|
49
91
|
end
|
50
|
-
end
|
51
92
|
end
|
52
93
|
end
|
data/lib/hlockey/utils.rb
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
module Hlockey
|
2
|
+
##
|
3
|
+
# Utility methods to help with various Hlockey related tasks
|
2
4
|
module Utils
|
5
|
+
# Transforms hash keys to be better for displaying the information in the hash
|
6
|
+
# @param hash [Hash<#to_s => Object>]
|
7
|
+
# @return [Hash<String => Object>] the new hash
|
8
|
+
def self.hash_display_keys(hash)
|
9
|
+
hash.transform_keys { |key| key.to_s.capitalize.gsub("_", " ") }
|
10
|
+
end
|
11
|
+
|
3
12
|
# Does a weighted random with a hash,
|
4
|
-
# where the keys are elements being randomly selected
|
5
|
-
# and the values are the weights
|
13
|
+
# where the keys are elements being randomly selected and the values are the weights
|
6
14
|
# @param hash [Hash<Object => Integer>]
|
7
15
|
# @param prng [#rand]
|
8
16
|
# @return [Object]
|
data/lib/hlockey/version.rb
CHANGED
metadata
CHANGED
@@ -1,59 +1,77 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hlockey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lavender Perry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.6'
|
27
27
|
description: Hlockey library.
|
28
|
-
email:
|
28
|
+
email: lavender.perry@outlook.com
|
29
29
|
executables: []
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
-
- data/election.
|
34
|
-
- data/
|
35
|
-
- data/
|
36
|
-
- data/
|
37
|
-
- data/
|
38
|
-
- data/previous_election_results.yaml
|
33
|
+
- data/election.json
|
34
|
+
- data/information.json
|
35
|
+
- data/league.json
|
36
|
+
- data/links.json
|
37
|
+
- data/previous_election_results.json
|
39
38
|
- lib/hlockey.rb
|
39
|
+
- lib/hlockey/actions.rb
|
40
40
|
- lib/hlockey/constants.rb
|
41
41
|
- lib/hlockey/data.rb
|
42
42
|
- lib/hlockey/game.rb
|
43
|
-
- lib/hlockey/game/actions.rb
|
44
43
|
- lib/hlockey/game/fight.rb
|
44
|
+
- lib/hlockey/game/weather.rb
|
45
|
+
- lib/hlockey/game/weather/audacity.rb
|
46
|
+
- lib/hlockey/game/weather/chicken.rb
|
47
|
+
- lib/hlockey/game/weather/incline.rb
|
48
|
+
- lib/hlockey/game/weather/stars.rb
|
49
|
+
- lib/hlockey/game/weather/sunset.rb
|
50
|
+
- lib/hlockey/game/weather/waves.rb
|
51
|
+
- lib/hlockey/game/weather/weatherable.rb
|
45
52
|
- lib/hlockey/league.rb
|
46
53
|
- lib/hlockey/message.rb
|
47
|
-
- lib/hlockey/
|
54
|
+
- lib/hlockey/mod.rb
|
55
|
+
- lib/hlockey/mod/fencebuilder.rb
|
56
|
+
- lib/hlockey/mod/fencedestroyer.rb
|
57
|
+
- lib/hlockey/mod/handholding.rb
|
58
|
+
- lib/hlockey/mod/immaterial.rb
|
59
|
+
- lib/hlockey/mod/locked.rb
|
60
|
+
- lib/hlockey/mod/moddable.rb
|
61
|
+
- lib/hlockey/mod/nonconfrontational.rb
|
62
|
+
- lib/hlockey/mod/powernapper.rb
|
63
|
+
- lib/hlockey/mod/punchy.rb
|
64
|
+
- lib/hlockey/selfdescribable.rb
|
48
65
|
- lib/hlockey/team.rb
|
66
|
+
- lib/hlockey/team/player.rb
|
67
|
+
- lib/hlockey/team/stadium.rb
|
49
68
|
- lib/hlockey/utils.rb
|
50
69
|
- lib/hlockey/version.rb
|
51
|
-
|
52
|
-
homepage: https://github.com/Hlockey/lib
|
70
|
+
homepage: https://hlockey.gay
|
53
71
|
licenses:
|
54
72
|
- LicenseRef-LICENSE.md
|
55
73
|
metadata:
|
56
|
-
source_code_uri: https://
|
74
|
+
source_code_uri: https://codeberg.org/LavenderPerry/hlockey
|
57
75
|
post_install_message:
|
58
76
|
rdoc_options: []
|
59
77
|
require_paths:
|
@@ -62,7 +80,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
80
|
requirements:
|
63
81
|
- - ">="
|
64
82
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
83
|
+
version: 3.1.0
|
66
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
85
|
requirements:
|
68
86
|
- - ">="
|
@@ -72,5 +90,5 @@ requirements: []
|
|
72
90
|
rubygems_version: 3.4.10
|
73
91
|
signing_key:
|
74
92
|
specification_version: 4
|
75
|
-
summary: Hlockey season
|
93
|
+
summary: Hlockey season 6.
|
76
94
|
test_files: []
|
data/data/election.yaml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
---
|
2
|
-
:Bribery:
|
3
|
-
:Stadiums: Give each team a home.
|
4
|
-
:Lootboxes: Encourage children to gamble.
|
5
|
-
:We Do A Little Losing: Recognize the losingest teams with an Underbracket.
|
6
|
-
:Treasure:
|
7
|
-
:Dave: The worst stat on your team is set to 4.5.
|
8
|
-
:Nice: Boost your worst player by 0.69 in every stat.
|
9
|
-
:Vengabus: All your team's stats are boosted by your team's losses * 0.005.
|
10
|
-
:Unvengabus: Your division's top team has all their stats reduced by their wins * 0.005.
|
11
|
-
:Shared Training: All teams in your division get +0.3 in each stat on each player.
|
12
|
-
:Theft: Your worst player steals 0.3 in every stat from the champion team's best player.
|
13
|
-
:Coaching:
|
14
|
-
:Please Block Shots: Move your team's best defensive player to goalie.
|
15
|
-
:Please Win Faceoffs: Move your team's player best offensive player to center.
|
16
|
-
:Draft: Add a new random player to your shadows.
|
17
|
-
:Small Gamble: All your team's stats go up or down by 0.5 at random.
|
18
|
-
:Big Gamble: All your team's stats go up or down by 1.0 at random.
|
19
|
-
:Revolution: Your team's best player and worst player split their stats evenly.
|
20
|
-
:Clock Wise: Rotate each player on the roster to the position clockwise of them.
|
21
|
-
:Clock Unwise: Rotate each player on the roster to the position counterclockwise of them.
|