class GeoWars::Units::Unit
- GeoWars::Units::Unit
- Reference
- Object
Direct Known Subclasses
Defined in:
geo_wars/units/unit.crConstant Summary
-
DEFAULT_ATTACK_CELLS_RELATIVE =
[0, 1, -1].permutations.map do |arr| {x: arr[0], y: arr[1]} end.select do |move| (move[:x] + move[:y]).abs == 1 end
-
DEFAULT_DAMAGE =
1
-
DISABLED_DARKNESS =
0.325
-
MAX_HIT_POINTS =
10
-
MAX_MOVEMENT =
3
-
MOVEMENT_RADIUS_COLOR =
LibRay::Color.new(r: 255, g: 255, b: 255, a: 125)
-
SELECTED_BORDER_COLOR =
LibRay::BLACK
-
SELECTED_BORDER_SIZE_RATIO =
16
-
SELECTED_BORDER_TIMER =
0.75
-
SIZE_RATIO =
0.5
Constructors
Class Method Summary
Instance Method Summary
- #add_moves(moves, moves_left, cells, cells_x, cells_y)
- #attack(unit : Units::Unit, unit_cell, current_cell)
- #attack(cursor_cell, cells)
- #attack_preview_percentage(unit : Units::Unit, unit_cell)
- #can_attack?
- #damage(unit : Units::Unit, unit_cell)
- #description
- #die
- #disable
- #disabled? : Bool?
- #draw(viewport)
- #draw_attack_radius(viewport)
- #draw_movement_radius(viewport)
- #enable
- #jump_to(x : Int32, y : Int32)
- #max_movement : Int32
- #move(cursor_cell, cells)
- #move_absolute(move)
- #player : Player
- #remove? : Bool
- #select(cells, cells_x, cells_y)
- #selectable?(turn_player)
- #selected? : Bool
- #serialize(players)
- #take_damage(damage)
- #terrain_moves(terrain)
- #turn_reset
- #unselect
- #update(frame_time)
- #update_attack_cells(cells)
- #update_moves(cells, cells_x, cells_y)
- #valid_move?(cursor_cell, moves_relative)
- #x : Int32
- #y : Int32
Constructor Detail
def self.new(x : Int32, y : Int32, player : GeoWars::Player, max_movement : Int32 = MAX_MOVEMENT, default_damage : Int32 = DEFAULT_DAMAGE, attack_cells_relative_initial : Array(NamedTuple(x: Int32, y: Int32)) = DEFAULT_ATTACK_CELLS_RELATIVE)
#