forked from mendicant-original/s6-e2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e3e442
commit cff3769
Showing
17 changed files
with
128 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
require_relative "ivory_tower/allowed_units" | ||
require_relative "ivory_tower/base" | ||
require_relative "ivory_tower/rally_point" | ||
require_relative "ivory_tower/meadow" | ||
require_relative "ivory_tower/mountain" | ||
require_relative "ivory_tower/forest" | ||
require_relative "ivory_tower/tile" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require_relative "tile/base" | ||
require_relative "tile/rally_point" | ||
require_relative "tile/meadow" | ||
require_relative "tile/mountain" | ||
require_relative "tile/forest" | ||
|
||
module IvoryTower | ||
module Tile | ||
extend self | ||
|
||
def base(*a,&b) | ||
IvoryTower::Tile::Base.new(*a,&b) | ||
end | ||
|
||
def rally_point(*a, &b) | ||
IvoryTower::Tile::RallyPoint.new(*a,&b) | ||
end | ||
|
||
def meadow(*a, &b) | ||
IvoryTower::Tile::Meadow.new(*a,&b) | ||
end | ||
|
||
def mountain(*a, &b) | ||
IvoryTower::Tile::Meadow.new(*a,&b) | ||
end | ||
|
||
def forest(*a, &b) | ||
IvoryTower::Tile::Forest.new(*a,&b) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module IvoryTower | ||
module Tile | ||
class Base | ||
extend AllowedUnits::ClassMethods | ||
|
||
allows :air_units, :ground_units, :sea_units | ||
|
||
def initialize(health) | ||
@health = health | ||
end | ||
|
||
attr_accessor :health | ||
|
||
def <<(monster) | ||
@health -= 1 | ||
end | ||
|
||
def destroyed? | ||
@health == 0 | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module IvoryTower | ||
module Tile | ||
class Forest | ||
include AllowedUnits | ||
allows :ground_units, :air_units, :towers | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module IvoryTower | ||
module Tile | ||
class Meadow | ||
include AllowedUnits | ||
allows :ground_units, :air_units | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module IvoryTower | ||
module Tile | ||
class Mountain | ||
include AllowedUnits | ||
allows :air_units | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module IvoryTower | ||
module Tile | ||
class RallyPoint | ||
include AllowedUnits | ||
allows :ground_units, :sea_units, :air_units | ||
|
||
def initialize(name) | ||
@name = name | ||
end | ||
|
||
attr_reader :name | ||
|
||
def <<(monster) | ||
occupants << monster | ||
|
||
self | ||
end | ||
|
||
def delete(monster) | ||
occupants.delete(monster) | ||
end | ||
|
||
def empty? | ||
occupants.empty? | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters