1 /* 2 * Copyright 2010-2014 OpenXcom Developers. 3 * 4 * This file is part of OpenXcom. 5 * 6 * OpenXcom is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * OpenXcom is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 #ifndef OPENXCOM_EXPLOSIONBSTATE_H 20 #define OPENXCOM_EXPLOSIONBSTATE_H 21 22 #include "BattleState.h" 23 #include "Position.h" 24 #include <string> 25 26 namespace OpenXcom 27 { 28 29 class BattlescapeGame; 30 class BattleUnit; 31 class BattleItem; 32 class Tile; 33 34 /** 35 * Explosion state not only handles explosions, but also bullet impacts! 36 * Refactoring tip : ImpactBState. 37 */ 38 class ExplosionBState : public BattleState 39 { 40 private: 41 BattleUnit *_unit; 42 Position _center; 43 BattleItem *_item; 44 Tile *_tile; 45 int _power; 46 bool _areaOfEffect, _lowerWeapon, _pistolWhip; 47 /// Calculates the effects of the explosion. 48 void explode(); 49 public: 50 /// Creates a new ExplosionBState class. 51 ExplosionBState(BattlescapeGame *parent, Position center, BattleItem *item, BattleUnit *unit, Tile *tile = 0, bool lowerWeapon = false); 52 /// Cleans up the ExplosionBState. 53 ~ExplosionBState(); 54 /// Initializes the state. 55 void init(); 56 /// Handles a cancel request. 57 void cancel(); 58 /// Runs state functionality every cycle. 59 void think(); 60 /// Gets the result of the state. 61 std::string getResult() const; 62 63 }; 64 65 } 66 67 #endif 68