Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef ATTACK_HPP_
00021 #define ATTACK_HPP_
00022
00023 #include "move.hpp"
00024
00025 namespace wb
00026 {
00027
00028 class attack: public move
00029 {
00030 public:
00031 friend class validate_visitor;
00032 friend class highlight_visitor;
00033
00034 attack(size_t team_index, bool hidden, unit& mover, const map_location& target_hex, int weapon_choice, const pathfind::marked_route& route,
00035 arrow_ptr arrow, fake_unit_ptr fake_unit);
00036 attack(config const&, bool hidden);
00037 virtual ~attack();
00038
00039 virtual std::ostream& print(std::ostream& s) const;
00040
00041 virtual void accept(visitor& v);
00042
00043 virtual void execute(bool& success, bool& complete);
00044
00045
00046 virtual void apply_temp_modifier(unit_map& unit_map);
00047
00048 virtual void remove_temp_modifier(unit_map& unit_map);
00049
00050
00051 virtual void draw_hex(const map_location& hex);
00052
00053 map_location const& get_target_hex() const {return target_hex_; }
00054
00055 virtual config to_config() const;
00056
00057 protected:
00058
00059 boost::shared_ptr<attack> shared_from_this() {
00060 return boost::static_pointer_cast<attack>(move::shared_from_this());
00061 }
00062
00063 private:
00064
00065 void init();
00066
00067 virtual void do_hide() {invalidate();}
00068 virtual void do_show() {invalidate();}
00069
00070
00071 void invalidate();
00072
00073
00074 map_location target_hex_;
00075
00076 int weapon_choice_;
00077 int attack_movement_cost_;
00078 int temp_movement_subtracted_;
00079 };
00080
00081
00082 std::ostream& operator<<(std::ostream &s, attack_ptr attack);
00083 std::ostream& operator<<(std::ostream &s, attack_const_ptr attack);
00084
00085 }
00086
00087 #endif