1 #ifndef HEADER_ONSTRONGPAD_H 2 #define HEADER_ONSTRONGPAD_H 3 4 #include "OnCondition.h" 5 #include "Cube.h" 6 7 /** 8 * Test whether model is on Wall or on powerful fish. 9 */ 10 class OnStrongPad : public OnCondition { 11 private: 12 Cube::eWeight m_weight; 13 public: OnStrongPad(Cube::eWeight weight)14 OnStrongPad(Cube::eWeight weight) { m_weight = weight; } 15 isSatisfy(Cube * model)16 virtual bool isSatisfy(Cube *model) const 17 { 18 return model->isWall() 19 || (model->isAlive() && model->getPower() >= m_weight); 20 } 21 isWrong(Cube * model)22 virtual bool isWrong(Cube *model) const 23 { 24 return model->isAlive() && model->getPower() < m_weight; 25 } 26 }; 27 28 #endif 29