Sha256: a112c63baad8cf0e18c1e313e090d13cb4c46d49bbc2089ac309c817d6818d18

Contents?: true

Size: 722 Bytes

Versions: 2

Compression:

Stored size: 722 Bytes

Contents

require 'monotony/square'
require 'monotony/purchasable'

module Monotony
	# Represents a railway station tile.
	class Station < PurchasableProperty
		# @param [Hash] opts
		# @option opts [String] :name the name of the station.
		# @option opts [Symbol] :colour the colour to use when rendering this square on a GUI.
		def initialize(opts)
			super
			@set = :stations
			@action = Proc.new do |game, owner, player, property|
				if owner
					rent = [ 25, 50, 100, 200 ]
					multiplier = owner.properties.select { |p| p.is_a? Station }.count
					player.pay(owner, rent[multiplier - 1])
				else
					player.behaviour[:purchase_possible].call(game, player, self) if player.currency >= cost
				end
			end
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
monotony-0.0.2 lib/monotony/station.rb
monotony-0.0.1 lib/monotony/station.rb