1 /*
2  * Copyright (C) 2006-2019 Christopho, Solarus - http://www.solarus-games.org
3  *
4  * Solarus is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Solarus is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef SOLARUS_HERO_SWORD_SWINGING_STATE_H
18 #define SOLARUS_HERO_SWORD_SWINGING_STATE_H
19 
20 #include "solarus/hero/HeroState.h"
21 
22 namespace Solarus {
23 
24 /**
25  * \brief The state "sword swinging" of the hero.
26  */
27 class Hero::SwordSwingingState: public HeroState {
28 
29   public:
30 
31     explicit SwordSwingingState(Hero& hero);
32 
33     void start(const State* previous_state) override;
34     void stop(const State* next_state) override;
35     void update() override;
36     bool get_can_start_sword() const override;
37     bool get_can_be_hurt(Entity* attacker) override;
38     bool get_can_pick_treasure(EquipmentItem& item) const override;
39     bool get_can_use_shield() const override;
40     bool can_sword_hit_crystal() const override;
41     bool is_cutting_with_sword(Entity& entity) override;
42     bool is_teletransporter_obstacle(Teletransporter& teletransporter) override;
43     void notify_obstacle_reached() override;
44     void notify_attacked_enemy(
45         EnemyAttack attack,
46         Enemy& victim,
47         Sprite* victim_sprite,
48         const EnemyReaction::Reaction& result,
49         bool killed
50     ) override;
51 
52   private:
53 
54     bool attacked;               /**< indicates that at least one enemy was attacked */
55     bool sword_finished;         /**< indicates that the sword animation is finished */
56 
57 };
58 
59 }
60 
61 #endif
62 
63