Class: Hlockey::Mod::Immaterial

Inherits:
Object
  • Object
show all
Includes:
Moddable
Defined in:
lib/hlockey/mod/immaterial.rb

Overview

The player this mod is applied to has a chance of avoiding hits by temporarily losing their physical form

Constant Summary collapse

DESCRIPTION =
"This player may be a hallucination.".freeze

Instance Attribute Summary

Attributes included from Moddable

#game

Instance Method Summary collapse

Methods included from Moddable

#initialize, #on_action, #on_join_fight, #on_swap

Methods included from SelfDescribable

#to_s

Instance Method Details

#on_got_hit(hitting_player) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/hlockey/mod/immaterial.rb', line 14

def on_got_hit(hitting_player)
  return false if prng.rand(3).zero?

  if @game.pre_tmp_change_stats[@player].nil?
    @game.pre_tmp_change_stats[@player] = @player.stats.clone
  end
  @player.stats[:defense] += 0.5

  send_game_message(:mod_immaterial_event, hitting_player:, player: @player)

  true # Other player shouldn't take puck
end