39 return attack->print(s);
45 return attack->print(s);
57 :
move(team_index, hidden, u, route, arrow, fake_unit),
58 target_hex_(target_hex),
59 weapon_choice_(weapon_choice),
60 attack_movement_cost_(get_unit()->attacks()[weapon_choice_].movement_used()),
61 temp_movement_subtracted_(0)
68 , target_hex_(cfg.child(
"target_hex_")[
"x"],cfg.child(
"target_hex_")[
"y"])
69 , weapon_choice_(cfg[
"weapon_choice_"].to_int(-1))
70 , attack_movement_cost_()
71 , temp_movement_subtracted_(0)
78 if(weapon_choice_ < 0 || weapon_choice_ >= static_cast<int>(
get_unit()->attacks().
size()))
124 if (
route_->steps.size() >= 2)
126 bool m_success, m_complete;
155 <<
"] has " << unit.
attacks_left() <<
" attacks, decreasing by one" <<
"\n";
161 DBG_WB <<
"Attack: Changing movement points for unit " << unit.
name() <<
" [" << unit.
id()
179 <<
"] has " << unit.
attacks_left() <<
" attacks, increasing by one" <<
"\n";
181 DBG_WB <<
"Attack: Changing movement points for unit " << unit.
name() <<
" [" << unit.
id()
208 image::get_texture(
"whiteboard/attack-indicator-src-" + direction_text +
".png",
image::SCALED_TO_HEX));
216 image::get_texture(
"whiteboard/attack-indicator-dst-" + direction_text +
".png",
image::SCALED_TO_HEX));
260 if(
get_unit()->attacks_left() <= 0) {
277 final_cfg[
"type"] =
"attack";
285 final_cfg.
add_child(
"target_hex_",target_hex_cfg);
map_location target_hex_
the target of the attack
play_controller * controller
void drawing_buffer_add(const tdrawing_layer layer, const map_location &loc, int x, int y, const surface &surf, const SDL_Rect &clip=SDL_Rect())
Add an item to the drawing buffer.
boost::shared_ptr< attack > shared_from_this()
surface get_image(const image::locator &i_locator, TYPE type)
function to get the surface corresponding to an image.
events::mouse_handler & get_mouse_handler_base()
Get a reference to a mouse handler member a derived class uses.
const std::string & id() const
virtual void apply_temp_modifier(unit_map &unit_map)
Applies temporarily the result of this action to the specified unit map.
virtual void execute(bool &success, bool &complete)
Output parameters: success: Whether or not to continue an execute-all after this execution complete: ...
Arrows destined to be drawn on the map.
virtual config to_config() const
Constructs and returns a config object representing this object.
bool invalidate(const map_location &loc)
Function to invalidate a specific tile for redrawing.
const t_string & name() const
The unit name for display.
int attack_movement_cost_
virtual map_location get_dest_hex() const
virtual void redraw()
Redrawing function, called each time the action situation might have changed.
virtual error check_validity() const
Check the validity of the action.
virtual config to_config() const
Constructs and returns a config object representing this object.
Footsteps showing path from unit to mouse.
virtual void visit(move_ptr move)=0
int get_location_x(const map_location &loc) const
Functions to get the on-screen positions of hexes.
virtual std::ostream & print(std::ostream &s) const
map_location const & get_target_hex() const
int temp_movement_subtracted_
virtual void remove_temp_modifier(unit_map &unit_map)
Removes the result of this action from the specified unit map.
Definitions for the interface to Wesnoth Markup Language (WML).
int get_location_y(const map_location &loc) const
virtual void execute(bool &success, bool &complete)
Output parameters: success: Whether or not to continue an execute-all after this execution complete: ...
tdrawing_layer
The layers to render something on.
bool valid()
Returns whether this action is valid or not.
virtual void accept(visitor &v)
bool tiles_adjacent(const map_location &a, const map_location &b)
Function which tells if two locations are adjacent.
std::vector< team > * teams
GLenum GLenum GLuint GLint GLint layer
Arrows destined to be drawn on the map.
virtual error check_validity() const
Check the validity of the action.
config & add_child(const std::string &key)
boost::scoped_ptr< pathfind::marked_route > route_
Structure which holds a single route and marks for special events.
virtual void apply_temp_modifier(unit_map &unit_map)
Applies temporarily the result of this action to the specified unit map.
int movement_left() const
Returns how far a unit can move this turn (zero if incapacitated).
void redraw()
Redrawing function, called each time the action situation might have changed.
virtual unit_ptr get_unit() const
Return the unit targeted by this action.
Encapsulates the map of the game.
virtual std::ostream & print(std::ostream &s) const
virtual void remove_temp_modifier(unit_map &unit_map)
Removes the result of this action from the specified unit map.
void attack_enemy(const map_location &attacker_loc, const map_location &defender_loc, int choice)
attack(size_t team_index, bool hidden, unit &mover, const map_location &target_hex, int weapon_choice, const pathfind::marked_route &route, arrow_ptr arrow, fake_unit_ptr fake_unit)
void set_movement(int moves, bool unit_action=false)
Set the unit's remaining movement to moves.
bool find(E event, F functor)
Tests whether an event handler is available.
Container associating units to locations.
std::ostream & operator<<(std::ostream &s, action_ptr action)
void set_attacks(int left)
unit_iterator find(size_t id)
visitor is an abstract interface : action.accept(visitor) calls visitor.visit(action) ...
A config object defines a single node in a WML file, with access to child nodes.
virtual void draw_hex(const map_location &hex)
Gets called by display when drawing a hex, to allow actions to draw to the screen.
void invalidate()
invalidates the move-destination and attack-target hexes
static std::string write_direction(DIRECTION dir)
GLsizei const GLcharARB ** string
Holds a temporary unit that can be drawn on the map without being placed in the unit_map.
A planned move, represented on the map by an arrow and a ghosted unit in the destination hex...
Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses...