Class: Mjai::Context

Inherits:
Object
  • Object
show all
Extended by:
WithFields
Defined in:
lib/mjai/context.rb

Overview

Context of the game which affects hora yaku and points.

Instance Attribute Summary

Attributes included from WithFields

#field_names

Instance Method Summary collapse

Methods included from WithFields

define_fields

Constructor Details

#initialize(fields) ⇒ Context

Returns a new instance of Context.



17
18
19
# File 'lib/mjai/context.rb', line 17

def initialize(fields)
  @fields = fields
end

Instance Method Details

#fanpai_fan(pai) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/mjai/context.rb', line 21

def fanpai_fan(pai)
  if pai.sangenpai?
    return 1
  else
    fan = 0
    fan += 1 if pai == self.bakaze
    fan += 1 if pai == self.jikaze
    return fan
  end
end