Class: GamesAndRpgParadise::MagicTheGathering::AddNLandsToTheseNNonLands

Inherits:
Object
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/games/magic_the_gathering/classes/add_n_lands_to_these_n_non_lands.rb

Overview

GamesAndRpgParadise::MagicTheGathering::AddNLandsToTheseNNonLands

Class Method Summary collapse

Class Method Details

.add_n_lands_to_these_n_non_lands(i = ARGV) ⇒ Object

#

GamesAndRpgParadise::MagicTheGathering::AddNLandsToTheseNNonLands.add_n_lands_to_these_n_non_lands

The input to this method should be the number of non-lands that you have already.

#


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/games_and_rpg_paradise/games/magic_the_gathering/classes/add_n_lands_to_these_n_non_lands.rb', line 19

def self.add_n_lands_to_these_n_non_lands(i = ARGV)
  if i.is_a? Array
    i = i.join(' ').strip
  end
  i = i.to_i # Must be a true Integer past this point.
  # ======================================================================= #
  # Calculate the remaining 40%. First, calculate 1%
  # ======================================================================= #
  one_percent_is = i / 60.0
  # ======================================================================= #
  # Calculate the 40% next.
  # ======================================================================= #
  forty_percent_is = one_percent_is * 40
  return forty_percent_is.round(2).ceil # Must round up.
end