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_SPIN_ATTACK_STATE_H
18 #define SOLARUS_HERO_SPIN_ATTACK_STATE_H
19 
20 #include "solarus/core/Common.h"
21 #include "solarus/entities/EntityState.h"
22 
23 namespace Solarus {
24 
25 /**
26  * \brief The state "spin attack" of the hero.
27  */
28 class Hero::SpinAttackState: public HeroState {
29 
30   public:
31 
32     explicit SpinAttackState(Hero& hero);
33 
34     void start(const State* previous_state) override;
35     void stop(const State* next_state) override;
36     void update() override;
37     bool can_sword_hit_crystal() const override;
38     bool get_can_be_hurt(Entity* attacker) override;
39     bool get_can_pick_treasure(EquipmentItem& item) const override;
40     bool is_cutting_with_sword(Entity& entity) override;
41     int get_sword_damage_factor() const override;
42     bool is_deep_water_obstacle() const override;
43     bool is_hole_obstacle() const override;
44     bool is_lava_obstacle() const override;
45     bool is_prickle_obstacle() const override;
46     bool is_teletransporter_obstacle(Teletransporter& teletransporter) override;
47     bool is_separator_obstacle(Separator& separator) override;
48     void notify_obstacle_reached() override;
49     void notify_attacked_enemy(
50         EnemyAttack attack,
51         Enemy& victim,
52         Sprite* victim_sprite,
53         const EnemyReaction::Reaction& result,
54         bool killed
55     ) override;
56 
57   private:
58 
59     void play_spin_attack_sound();
60 
61     bool being_pushed;           /**< indicates that the hero is being pushed after hitting an enemy */
62 
63 };
64 
65 }
66 
67 #endif
68 
69