hlockey 5 → 7
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 +23 -0
- data/data/infinileague.json +189 -0
- data/data/information.json +6 -0
- data/data/league.json +2042 -0
- data/data/links.json +5 -0
- data/data/messages.json +46 -0
- data/data/previous_election_results.json +91 -0
- data/lib/hlockey/actions.rb +22 -0
- data/lib/hlockey/data.rb +6 -5
- data/lib/hlockey/game/fight.rb +100 -40
- data/lib/hlockey/game/weather/audacity.rb +1 -1
- data/lib/hlockey/game/weather/chicken.rb +3 -2
- data/lib/hlockey/game/weather/incline.rb +2 -1
- data/lib/hlockey/game/weather/stars.rb +1 -1
- data/lib/hlockey/game/weather/sunset.rb +2 -4
- data/lib/hlockey/game/weather/waves.rb +9 -5
- data/lib/hlockey/game/weather/weatherable.rb +9 -9
- data/lib/hlockey/game.rb +182 -116
- data/lib/hlockey/league.rb +90 -73
- data/lib/hlockey/message.rb +23 -153
- data/lib/hlockey/mod/fencebuilder.rb +15 -0
- data/lib/hlockey/mod/fencedestroyer.rb +16 -0
- data/lib/hlockey/mod/handholding.rb +57 -0
- data/lib/hlockey/mod/immaterial.rb +28 -0
- data/lib/hlockey/mod/locked.rb +28 -0
- data/lib/hlockey/mod/moddable.rb +70 -0
- data/lib/hlockey/mod/nonconfrontational.rb +17 -0
- data/lib/hlockey/mod/powernapper.rb +50 -0
- data/lib/hlockey/mod/punchy.rb +21 -0
- data/lib/hlockey/mod.rb +25 -0
- data/lib/hlockey/selfdescribable.rb +7 -0
- data/lib/hlockey/team/player.rb +40 -58
- data/lib/hlockey/team/stadium.rb +10 -7
- data/lib/hlockey/team.rb +56 -41
- data/lib/hlockey/utils.rb +36 -4
- data/lib/hlockey/version.rb +1 -1
- data/lib/hlockey.rb +15 -0
- metadata +30 -18
- data/data/election.yaml +0 -21
- data/data/external/names.txt +0 -19948
- data/data/information.yaml +0 -24
- data/data/league.yaml +0 -1694
- data/data/links.yaml +0 -3
- data/data/previous_election_results.yaml +0 -65
- data/lib/hlockey/game/actions.rb +0 -24
@@ -0,0 +1,70 @@
|
|
1
|
+
require("hlockey/message")
|
2
|
+
require("hlockey/selfdescribable")
|
3
|
+
|
4
|
+
module Hlockey
|
5
|
+
module Mod
|
6
|
+
##
|
7
|
+
# Module with needed methods for mods, that every mod includes
|
8
|
+
# All methods starting with "on" represent player events
|
9
|
+
module Moddable
|
10
|
+
include(SelfDescribable)
|
11
|
+
|
12
|
+
attr_writer(:game)
|
13
|
+
|
14
|
+
DESCRIPTION = "A mod with no description.".freeze # Default description
|
15
|
+
|
16
|
+
# If the mod has no extra parameters, same as #to_s
|
17
|
+
# If it has extra parameters, returns an array with #to_s as the first element,
|
18
|
+
# and the other parameters as the rest of the elements.
|
19
|
+
# Mods that accept parameters should implement the array version themselves,
|
20
|
+
# as in the module here it is simply an alias.
|
21
|
+
alias to_data to_s
|
22
|
+
|
23
|
+
def initialize(player)
|
24
|
+
@player = player
|
25
|
+
@team = player.team
|
26
|
+
end
|
27
|
+
|
28
|
+
def on_swap(into_roster, pos, prev_pos) end
|
29
|
+
|
30
|
+
def on_action() end
|
31
|
+
|
32
|
+
# May return truthy value to signal that hitting player should not try to take puck
|
33
|
+
def on_got_hit(hitting_player) end
|
34
|
+
|
35
|
+
# May return a different player to join the fight instead of this one
|
36
|
+
def on_join_fight() end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
# Makes a new message from params, adds it to the game stream if there is a game
|
41
|
+
def send_game_message(...)
|
42
|
+
@game.stream << Message.new(...) unless @game.nil?
|
43
|
+
end
|
44
|
+
|
45
|
+
# Handles the on_swap event for Fencebuilder, Fencedestroyer mods
|
46
|
+
# @param into_roster [Boolean]
|
47
|
+
# @param pos [Symbol]
|
48
|
+
# @param prev_pos [Symbol]
|
49
|
+
# @param type [:builder | :destroyer]
|
50
|
+
def fence_swap(into_roster, pos, prev_pos, type: :builder)
|
51
|
+
return unless into_roster
|
52
|
+
|
53
|
+
new_pos_hash = { ldef: :lwing, goalie: :center, rdef: :rwing }
|
54
|
+
new_pos_hash = new_pos_hash.invert unless type == :builder
|
55
|
+
new_pos = new_pos_hash[pos]
|
56
|
+
return if new_pos.nil?
|
57
|
+
|
58
|
+
swap_player = @team.roster[new_pos]
|
59
|
+
@team.roster[pos] = @team.shadows[prev_pos]
|
60
|
+
@team.shadows[prev_pos] = swap_player
|
61
|
+
@team.roster[new_pos] = @player
|
62
|
+
|
63
|
+
send_game_message(:mod_fence_event, type:, player: @player, swap_player:)
|
64
|
+
end
|
65
|
+
|
66
|
+
# @return [Utils::Rng, Random] the object to use for RNG
|
67
|
+
def prng = @game&.prng || Random.new
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require("hlockey/mod/moddable")
|
2
|
+
|
3
|
+
module Hlockey
|
4
|
+
module Mod
|
5
|
+
##
|
6
|
+
# The first player in the shadows will join fights instead of this player,
|
7
|
+
# if they do not also have the mod.
|
8
|
+
class Nonconfrontational
|
9
|
+
include(Moddable)
|
10
|
+
|
11
|
+
DESCRIPTION = "This player tries to avoid fights.".freeze
|
12
|
+
|
13
|
+
def on_join_fight =
|
14
|
+
@team.shadows.select { |player| player.mods.none? { _1.is_a?(self.class) } }.first
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require("hlockey/mod/moddable")
|
2
|
+
require("hlockey/actions")
|
3
|
+
|
4
|
+
module Hlockey
|
5
|
+
module Mod
|
6
|
+
##
|
7
|
+
# Player has James stats added to their own at random for 5 actions
|
8
|
+
# These 5 actions carry over between games
|
9
|
+
class Powernapper
|
10
|
+
include(Moddable)
|
11
|
+
include(Actions)
|
12
|
+
|
13
|
+
DESCRIPTION = "This player gets temporary stat boosts by powernapping.".freeze
|
14
|
+
|
15
|
+
def initialize(player)
|
16
|
+
super
|
17
|
+
@currently_boosted_for = -1
|
18
|
+
end
|
19
|
+
|
20
|
+
def on_action
|
21
|
+
if @currently_boosted_for.negative?
|
22
|
+
return unless random_event_occurs?(prng:)
|
23
|
+
|
24
|
+
change_stats
|
25
|
+
end
|
26
|
+
@currently_boosted_for += 1
|
27
|
+
return if @currently_boosted_for < 5
|
28
|
+
|
29
|
+
change_stats(reset: true)
|
30
|
+
@currently_boosted_for = -1
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def change_stats(reset: false)
|
36
|
+
stat_change = { offense: 0.5, defense: 1.0 } # James stats (excluding 0 agility)
|
37
|
+
stat_change.transform_values!(&:-@) if reset
|
38
|
+
|
39
|
+
pre_tmp_change_stats = @game.pre_tmp_change_stats[@player]
|
40
|
+
stat_change.each do |stat, change|
|
41
|
+
@player.stats[stat] += change
|
42
|
+
pre_tmp_change_stats[stat] += change unless pre_tmp_change_stats.nil?
|
43
|
+
end
|
44
|
+
|
45
|
+
send_game_message(reset ? :mod_powernap_end : :mod_powernap_start,
|
46
|
+
player: @player)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require("hlockey/mod/moddable")
|
2
|
+
|
3
|
+
module Hlockey
|
4
|
+
module Mod
|
5
|
+
##
|
6
|
+
# Player can get into a fight at any time
|
7
|
+
class Punchy
|
8
|
+
include(Moddable)
|
9
|
+
include(Actions)
|
10
|
+
|
11
|
+
DESCRIPTION = "This player may randomly start fights.".freeze
|
12
|
+
|
13
|
+
def on_action
|
14
|
+
return unless random_event_occurs?(prng:)
|
15
|
+
|
16
|
+
send_game_message(:mod_punchy_event, player: @player)
|
17
|
+
@game.start_fight(@player)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/hlockey/mod.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require("hlockey/mod/fencebuilder")
|
2
|
+
require("hlockey/mod/fencedestroyer")
|
3
|
+
require("hlockey/mod/handholding")
|
4
|
+
require("hlockey/mod/immaterial")
|
5
|
+
require("hlockey/mod/locked")
|
6
|
+
require("hlockey/mod/powernapper")
|
7
|
+
require("hlockey/mod/punchy")
|
8
|
+
require("hlockey/mod/nonconfrontational")
|
9
|
+
|
10
|
+
module Hlockey
|
11
|
+
##
|
12
|
+
# A mod changes how a Player interacts with/responds to events
|
13
|
+
module Mod
|
14
|
+
MODS = [
|
15
|
+
Fencebuilder,
|
16
|
+
Fencedestroyer,
|
17
|
+
Handholding,
|
18
|
+
Immaterial,
|
19
|
+
Locked,
|
20
|
+
Powernapper,
|
21
|
+
Punchy,
|
22
|
+
Nonconfrontational
|
23
|
+
].freeze
|
24
|
+
end
|
25
|
+
end
|
data/lib/hlockey/team/player.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require("hlockey/mod")
|
1
2
|
require("hlockey/utils")
|
2
3
|
|
3
4
|
module Hlockey
|
@@ -5,74 +6,55 @@ module Hlockey
|
|
5
6
|
##
|
6
7
|
# A player on a team
|
7
8
|
class Player
|
8
|
-
attr_accessor(:team, :stats)
|
9
|
-
attr_reader(:
|
9
|
+
attr_accessor(:team, :mods, :stats)
|
10
|
+
attr_reader(:name)
|
10
11
|
|
11
|
-
|
12
|
+
alias to_s name
|
12
13
|
|
14
|
+
# @param name [String]
|
13
15
|
# @param team [Team]
|
14
|
-
# @param
|
15
|
-
|
16
|
-
|
16
|
+
# @param stats [Hash<:offense, :defense, :agility => Numeric>]
|
17
|
+
# @param mods [Array]
|
18
|
+
def initialize(name:, team:, stats:, mods: [])
|
19
|
+
@name = name
|
17
20
|
@team = team
|
18
|
-
|
19
|
-
@
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
)
|
21
|
+
@stats = stats
|
22
|
+
@mods = mods.map do |mod|
|
23
|
+
if mod.is_a?(Array)
|
24
|
+
Mod::MODS.find { _1.to_s == "Hlockey::Mod::#{mod.first}" }.new(self,
|
25
|
+
*mod[1..])
|
26
|
+
else
|
27
|
+
Mod::MODS.find { _1.to_s == "Hlockey::Mod::#{mod}" }.new(self)
|
28
|
+
end
|
29
|
+
end
|
28
30
|
end
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
10.times do
|
39
|
-
next_letters = name_chain[combination]
|
40
|
-
break if next_letters.nil?
|
32
|
+
# @return [Hash]
|
33
|
+
def to_h(simple: false)
|
34
|
+
res = {
|
35
|
+
name: @name,
|
36
|
+
stats: @stats
|
37
|
+
}
|
38
|
+
res[:team] = @team.to_s unless simple
|
39
|
+
res[:mods] = @mods.map(&:to_data) unless simple && @mods.empty?
|
41
40
|
|
42
|
-
|
43
|
-
next_letters.each_value do |v|
|
44
|
-
cumulative_weights << v + (cumulative_weights.last or 0)
|
45
|
-
end
|
46
|
-
|
47
|
-
next_letter = Utils.weighted_random(next_letters, prng)
|
48
|
-
break if next_letter == "_"
|
49
|
-
|
50
|
-
result += next_letter
|
51
|
-
combination = combination[1] + next_letter
|
52
|
-
end
|
53
|
-
|
54
|
-
result
|
55
|
-
end.join(" ")
|
41
|
+
res
|
56
42
|
end
|
57
43
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
).each do |n|
|
64
|
-
name = "__#{n.chomp}__"
|
65
|
-
(name.length - 3).times do |i|
|
66
|
-
combination = name[i, 2]
|
67
|
-
next_letter = name[i + 2]
|
68
|
-
@@cached_chain[combination] ||= {}
|
69
|
-
@@cached_chain[combination][next_letter] ||= 0
|
70
|
-
@@cached_chain[combination][next_letter] += 1
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
44
|
+
# @return [Hash<String => String>] #stats but better for displaying
|
45
|
+
def stat_display =
|
46
|
+
Utils.hash_display_keys(
|
47
|
+
@stats.transform_values { _1.round(2).to_s.ljust(4, "0") }
|
48
|
+
)
|
74
49
|
|
75
|
-
|
50
|
+
# Calls a method on every mod this player has
|
51
|
+
# @param action [Symbol] method to call on each mod
|
52
|
+
# @param *args [Object] any arguments to pass to the mods
|
53
|
+
# @return [Object] the first non-nil return value given from a mod, if any
|
54
|
+
def mods_do(action, *args)
|
55
|
+
res = nil
|
56
|
+
@mods.each { res ||= _1.send(action, *args) }
|
57
|
+
res
|
76
58
|
end
|
77
59
|
end
|
78
60
|
end
|
data/lib/hlockey/team/stadium.rb
CHANGED
@@ -17,7 +17,8 @@ module Hlockey
|
|
17
17
|
# @param nickname [String, nil]
|
18
18
|
# @param description [String, nil]
|
19
19
|
# @param team [Team, nil]
|
20
|
-
def initialize(full_name
|
20
|
+
def initialize(full_name:, hlockey_type:,
|
21
|
+
nickname: nil, description: nil, team: nil)
|
21
22
|
@full_name = full_name
|
22
23
|
@hlockey_type = hlockey_type
|
23
24
|
@nickname = nickname
|
@@ -25,17 +26,19 @@ module Hlockey
|
|
25
26
|
@team = team
|
26
27
|
end
|
27
28
|
|
28
|
-
# The Stadium as a Hash.
|
29
|
-
# nil properties are removed, as well as #team
|
30
|
-
# Intended to be used as an easy way to get all relevant stadium info at once.
|
31
29
|
# @return [Hash]
|
32
|
-
def to_h
|
33
|
-
{
|
30
|
+
def to_h(simple: false)
|
31
|
+
res = {
|
34
32
|
nickname: @nickname,
|
35
33
|
full_name: @full_name,
|
36
34
|
description: @description,
|
37
35
|
hlockey_type: @hlockey_type
|
38
|
-
}
|
36
|
+
}
|
37
|
+
return res.compact if simple
|
38
|
+
|
39
|
+
res[:team] = @team.to_s
|
40
|
+
|
41
|
+
res
|
39
42
|
end
|
40
43
|
|
41
44
|
# The name (and nickname, if it exists) of the stadium
|
data/lib/hlockey/team.rb
CHANGED
@@ -6,61 +6,77 @@ module Hlockey
|
|
6
6
|
# A team in the league
|
7
7
|
# Created by League when data is loaded
|
8
8
|
class Team
|
9
|
-
attr_accessor(:wins, :losses, :roster, :shadows, :status
|
10
|
-
attr_reader(:emoji, :color, :motto, :stadium)
|
9
|
+
attr_accessor(:wins, :losses, :roster, :shadows, :status)
|
10
|
+
attr_reader(:name, :emoji, :color, :motto, :stadium, :evolutions)
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
16
24
|
@color = color
|
17
25
|
@emoji = emoji
|
26
|
+
@motto = motto
|
27
|
+
@evolutions = evolutions
|
18
28
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
+
@stadium = Stadium.new(team: self, **stadium)
|
30
|
+
|
31
|
+
@roster = roster.transform_values { Player.new(**_1, team: self) }
|
32
|
+
@shadows = shadows.map { Player.new(**_1, team: self) }
|
33
|
+
|
34
|
+
@status = :in_contention
|
35
|
+
@wins = @losses = 0
|
36
|
+
end
|
37
|
+
|
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
|
29
57
|
end
|
30
58
|
|
31
|
-
|
32
|
-
# randomly generate roster
|
33
|
-
%i[lwing center rwing ldef goalie rdef].each_with_object({}) do |pos, h|
|
34
|
-
h[pos] = Player.new(self, random)
|
35
|
-
end
|
36
|
-
else
|
37
|
-
roster
|
38
|
-
end
|
39
|
-
@shadows = shadows.nil? ? Array.new(3) { Player.new(self, random) } : shadows
|
40
|
-
|
41
|
-
@wins = 0
|
42
|
-
@losses = 0
|
59
|
+
res
|
43
60
|
end
|
44
61
|
|
45
62
|
# @return [String] wins/losses in string representation
|
46
|
-
def w_l
|
47
|
-
|
48
|
-
|
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
|
49
70
|
|
50
71
|
# @return [Symbol] the position of the worst player on the roster
|
51
|
-
def worst_player_pos
|
52
|
-
@roster.transform_values { |
|
53
|
-
.min_by { |_, v| v }
|
54
|
-
.first
|
55
|
-
end
|
72
|
+
def worst_player_pos =
|
73
|
+
@roster.transform_values { |v| v.stats.values.sum }.min_by { |_, v| v }.first
|
56
74
|
|
57
75
|
# @return [Hash<String => Player>] #roster, but with keys better for displaying
|
58
|
-
def roster_display
|
59
|
-
@roster.transform_keys(&Hlockey::Team.method(:pos_name))
|
60
|
-
end
|
76
|
+
def roster_display = @roster.transform_keys(&self.class.method(:pos_name))
|
61
77
|
|
62
78
|
# Takes symbol from Team roster & converts it to full position name
|
63
|
-
def self.pos_name(pos)
|
79
|
+
def self.pos_name(pos) =
|
64
80
|
case pos
|
65
81
|
when :lwing
|
66
82
|
"Left wing"
|
@@ -73,6 +89,5 @@ module Hlockey
|
|
73
89
|
else
|
74
90
|
pos.capitalize.to_s
|
75
91
|
end
|
76
|
-
end
|
77
92
|
end
|
78
93
|
end
|
data/lib/hlockey/utils.rb
CHANGED
@@ -1,13 +1,45 @@
|
|
1
1
|
module Hlockey
|
2
2
|
##
|
3
|
-
#
|
3
|
+
# Utilities to help with various Hlockey related tasks
|
4
4
|
module Utils
|
5
|
+
##
|
6
|
+
# Lehmer random number generator,
|
7
|
+
# to avoid incompatabilities in RNG between Ruby implementations.
|
8
|
+
# From https://en.wikipedia.org/wiki/Lehmer_random_number_generator#Sample_C99_code.
|
9
|
+
class Rng
|
10
|
+
MOD_VAL = 0x7fffffff
|
11
|
+
|
12
|
+
# @return [Integer]
|
13
|
+
attr_reader(:state)
|
14
|
+
|
15
|
+
# @param seed [Integer]
|
16
|
+
def initialize(seed)
|
17
|
+
seed = seed.zero? ? 1 : seed.abs
|
18
|
+
seed %= MOD_VAL if seed >= MOD_VAL
|
19
|
+
|
20
|
+
@state = seed
|
21
|
+
end
|
22
|
+
|
23
|
+
# @param upper_bound [Numeric, Range, nil] max value from RNG
|
24
|
+
# @return [Numeric]
|
25
|
+
def rand(bound = nil)
|
26
|
+
if bound.is_a?(Range)
|
27
|
+
start = bound.begin || 0
|
28
|
+
return rand(bound.end.nil? ? nil : bound.end - start) + start
|
29
|
+
end
|
30
|
+
|
31
|
+
@state = @state * 48_271 % MOD_VAL
|
32
|
+
return @state if bound.nil? || bound.zero?
|
33
|
+
|
34
|
+
@state % bound
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
5
38
|
# Transforms hash keys to be better for displaying the information in the hash
|
6
39
|
# @param hash [Hash<#to_s => Object>]
|
7
40
|
# @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
|
41
|
+
def self.hash_display_keys(hash) =
|
42
|
+
hash.transform_keys { |key| key.to_s.capitalize.gsub("_", " ") }.compact
|
11
43
|
|
12
44
|
# Does a weighted random with a hash,
|
13
45
|
# where the keys are elements being randomly selected and the values are the weights
|
data/lib/hlockey/version.rb
CHANGED
data/lib/hlockey.rb
CHANGED
@@ -1 +1,16 @@
|
|
1
1
|
require("hlockey/league")
|
2
|
+
|
3
|
+
##
|
4
|
+
# All Hlockey library code lives here.
|
5
|
+
module Hlockey
|
6
|
+
# @return [League]
|
7
|
+
def self.new_current_league
|
8
|
+
league_hash = Data.league
|
9
|
+
league_start_time = Time.utc(*league_hash[:start_time])
|
10
|
+
one_week = 604_800 # In seconds, to add/subtract with Time objects
|
11
|
+
|
12
|
+
return League.new(**Data.infinileague) if Time.now < league_start_time - one_week
|
13
|
+
|
14
|
+
League.new(**league_hash)
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,46 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hlockey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lavender Perry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-23 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/information.
|
36
|
-
- data/league.
|
37
|
-
- data/links.
|
38
|
-
- data/
|
33
|
+
- data/election.json
|
34
|
+
- data/infinileague.json
|
35
|
+
- data/information.json
|
36
|
+
- data/league.json
|
37
|
+
- data/links.json
|
38
|
+
- data/messages.json
|
39
|
+
- data/previous_election_results.json
|
39
40
|
- lib/hlockey.rb
|
41
|
+
- lib/hlockey/actions.rb
|
40
42
|
- lib/hlockey/constants.rb
|
41
43
|
- lib/hlockey/data.rb
|
42
44
|
- lib/hlockey/game.rb
|
43
|
-
- lib/hlockey/game/actions.rb
|
44
45
|
- lib/hlockey/game/fight.rb
|
45
46
|
- lib/hlockey/game/weather.rb
|
46
47
|
- lib/hlockey/game/weather/audacity.rb
|
@@ -52,16 +53,27 @@ files:
|
|
52
53
|
- lib/hlockey/game/weather/weatherable.rb
|
53
54
|
- lib/hlockey/league.rb
|
54
55
|
- lib/hlockey/message.rb
|
56
|
+
- lib/hlockey/mod.rb
|
57
|
+
- lib/hlockey/mod/fencebuilder.rb
|
58
|
+
- lib/hlockey/mod/fencedestroyer.rb
|
59
|
+
- lib/hlockey/mod/handholding.rb
|
60
|
+
- lib/hlockey/mod/immaterial.rb
|
61
|
+
- lib/hlockey/mod/locked.rb
|
62
|
+
- lib/hlockey/mod/moddable.rb
|
63
|
+
- lib/hlockey/mod/nonconfrontational.rb
|
64
|
+
- lib/hlockey/mod/powernapper.rb
|
65
|
+
- lib/hlockey/mod/punchy.rb
|
66
|
+
- lib/hlockey/selfdescribable.rb
|
55
67
|
- lib/hlockey/team.rb
|
56
68
|
- lib/hlockey/team/player.rb
|
57
69
|
- lib/hlockey/team/stadium.rb
|
58
70
|
- lib/hlockey/utils.rb
|
59
71
|
- lib/hlockey/version.rb
|
60
|
-
homepage: https://
|
72
|
+
homepage: https://hlockey.gay
|
61
73
|
licenses:
|
62
74
|
- LicenseRef-LICENSE.md
|
63
75
|
metadata:
|
64
|
-
source_code_uri: https://
|
76
|
+
source_code_uri: https://codeberg.org/LavenderPerry/hlockey
|
65
77
|
post_install_message:
|
66
78
|
rdoc_options: []
|
67
79
|
require_paths:
|
@@ -70,15 +82,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
82
|
requirements:
|
71
83
|
- - ">="
|
72
84
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
85
|
+
version: 3.1.0
|
74
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
87
|
requirements:
|
76
88
|
- - ">="
|
77
89
|
- !ruby/object:Gem::Version
|
78
90
|
version: '0'
|
79
91
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
92
|
+
rubygems_version: 3.5.9
|
81
93
|
signing_key:
|
82
94
|
specification_version: 4
|
83
|
-
summary: Hlockey season
|
95
|
+
summary: Hlockey season 7.
|
84
96
|
test_files: []
|
data/data/election.yaml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
---
|
2
|
-
:Bribery:
|
3
|
-
:Mods Help: Add player modifications.
|
4
|
-
:Lootboxes: Allow gambling for votes.
|
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.
|