Class: Hlockey::Mod::Powernapper
- Inherits:
-
Object
- Object
- Hlockey::Mod::Powernapper
- Defined in:
- lib/hlockey/mod/powernapper.rb
Overview
Player has James stats added to their own at random for 5 actions These 5 actions carry over between games
Constant Summary collapse
- DESCRIPTION =
"This player gets temporary stat boosts by powernapping.".freeze
Instance Attribute Summary
Attributes included from Moddable
Instance Method Summary collapse
-
#initialize(player) ⇒ Powernapper
constructor
A new instance of Powernapper.
- #on_action ⇒ Object
Methods included from Moddable
#on_got_hit, #on_join_fight, #on_swap
Methods included from SelfDescribable
Constructor Details
#initialize(player) ⇒ Powernapper
Returns a new instance of Powernapper.
15 16 17 18 |
# File 'lib/hlockey/mod/powernapper.rb', line 15 def initialize(player) super @currently_boosted_for = -1 end |
Instance Method Details
#on_action ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/hlockey/mod/powernapper.rb', line 20 def on_action if @currently_boosted_for.negative? return unless random_event_occurs?(prng:) change_stats end @currently_boosted_for += 1 return if @currently_boosted_for < 5 change_stats(reset: true) @currently_boosted_for = -1 end |