-#include "FixedBattler.h"\r
-#include "mof/KeyFrameAnimation.h"\r
-#include "AttackAction.h"\r
-#include "SpecialAction.h"\r
-#include "BattlerGroup.h"\r
-#include "GameData.h"\r
-#include "AttackAction.h"\r
-#include "SpecialAction.h"\r
-\r
-et::FixedBattler::FixedBattler(BattlerType type , et::BattlerParameter& parameter , mof::TextureManager* pTextureManager , et::GameData* pGameData)\r
-: BattlerFacade(type) , m_pGameData(pGameData)\r
-{\r
- m_command.type = et::BattleAction::NONE;\r
- setParameter(parameter);\r
- \r
- if(getType() == et::HERO){\r
- m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/hero0.png")));\r
- }\r
- else if(getType() == et::ENEMY){\r
- m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/hd.png")));\r
- }\r
- else if(getType() == et::IDEAL){\r
- m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/ideal.png")));\r
- }\r
-\r
- mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();\r
- pAnimation->setScale(0 , mof::Vector3D(0.3f , 0.3f , 0.3f));\r
- pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64));\r
- getGraphicsObject()->setAnimation( 0 , mof::AnimationResource(pAnimation));\r
- \r
- \r
-}\r
-\r
-\r
-\r
-\r
-mof::AnimationResource et::FixedBattler::setMovingAnimation(mof::Vector3D& goal , int nFrame){\r
- mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();\r
- pAnimation->setPosition(0 , getPosition());\r
- pAnimation->setPosition(nFrame-1 , goal);\r
- mof::AnimationResource resource(pAnimation);\r
- getGraphicsObject()->setAnimation( 1 , resource);\r
- return resource;\r
-}\r
-\r
-mof::AnimationResource et::FixedBattler::setAidlingAnimation(mof::Vector3D& position ){\r
- if(!getParameter().alive){\r
- //\89½\82à\95\\8e¦\82µ\82È\82¢\r
- mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true);\r
- pAnimation->setPosition(0 , position);\r
- pAnimation->setTextureRectangle(0 , mof::Line2D(1 , 1 , 1 , 1));\r
- mof::AnimationResource resource(pAnimation);\r
- getGraphicsObject()->setAnimation( 1 , resource);\r
- return resource;\r
- }\r
- else if(getParameter().guard && getType() == et::HERO){\r
- //\83K\81[\83h\r
- mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true);\r
- pAnimation->setPosition(0 , position);\r
- pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 64*2 , 64 , 64*3));\r
- mof::AnimationResource resource(pAnimation);\r
- getGraphicsObject()->setAnimation( 1 , resource);\r
- return resource;\r
- }\r
- else {\r
- mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true);\r
- pAnimation->setPosition(0 , position);\r
- pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64));\r
- pAnimation->setTextureRectangle(15 , mof::Line2D(0 , 64 , 64 , 64*2));\r
- pAnimation->setTextureRectangle(30-1 , mof::Line2D(0 , 0 , 64 , 64));\r
- mof::AnimationResource resource(pAnimation);\r
- getGraphicsObject()->setAnimation( 1 , resource);\r
- return resource;\r
- }\r
-}\r
-\r
-mof::AnimationResource et::FixedBattler::setCastAnimation(int category){\r
- mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();\r
- \r
- if(category == 0){\r
- //\92Ê\8fí\8dU\8c\82\r
- pAnimation->setPosition(0 , getPosition());\r
- pAnimation->setTextureRectangle(0 , mof::Line2D(64 , 0 , 128 , 64));\r
- pAnimation->setTextureRectangle(10 , mof::Line2D(64 , 64 , 128 , 64*2));\r
- pAnimation->setTextureRectangle(20 , mof::Line2D(64 , 128 , 128 , 64*3));\r
- pAnimation->setFinalKey(20);\r
- }\r
- else if(category == 1){\r
- pAnimation->setPosition(0 , getPosition());\r
- pAnimation->setTextureRectangle(0 , mof::Line2D(64*2 , 0 , 64*3 , 64));\r
- pAnimation->setTextureRectangle(40 , mof::Line2D(0 , 0 , 64 , 64));\r
- pAnimation->setFinalKey(20);\r
- }\r
- mof::AnimationResource resource(pAnimation);\r
- getGraphicsObject()->setAnimation( 1 , resource);\r
- return resource;\r
- \r
-}\r
-\r
-mof::AnimationResource et::FixedBattler::setDamagedAnimation(int level){\r
- mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();\r
- if(level == 0){\r
- //\92Ê\8fí\r
- mof::Vector3D backPosition = getPosition();\r
- backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f;\r
- pAnimation->setPosition(0 , getPosition());\r
- pAnimation->setPosition(10 , backPosition);\r
- pAnimation->setPosition(40 , backPosition);\r
- pAnimation->setPosition(60 , getPosition());\r
- \r
- pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64));\r
- pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64));\r
- pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1));\r
- pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64));\r
- pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1));\r
- pAnimation->setTextureRectangle(16 , mof::Line2D(1 , 1 , 1 , 1));\r
- pAnimation->setTextureRectangle(26 , mof::Line2D(0 , 0 , 64 , 64));\r
- \r
- }\r
- else if(level == 1){\r
- //\8e\80\96S\r
- \r
- mof::Vector3D backPosition = getPosition();\r
- backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f;\r
- pAnimation->setPosition(0 , getPosition());\r
- pAnimation->setPosition(10 , backPosition);\r
- \r
- pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64));\r
- pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64));\r
- pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1));\r
- pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64));\r
- pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1));\r
- pAnimation->setTextureRectangle(25 , mof::Line2D(1 , 1 , 1 , 1));\r
- \r
- }\r
- mof::AnimationResource resource(pAnimation);\r
- getGraphicsObject()->setAnimation( 1 , resource);\r
- return resource;\r
-}\r
-\r
-void et::FixedBattler::setBattleCommand(BattleAction& action){\r
- m_command = action;\r
-}\r
-\r
-et::Action* et::FixedBattler::createAction(BattlerGroup* pGroup ){\r
- \r
- if(m_command.type == et::BattleAction::ATTACK_WEAPON){\r
- return new AttackAction(this , m_command.pTarget , 3);\r
- }\r
- else if(m_command.type == et::BattleAction::WAIT || m_command.type == et::BattleAction::GUARD){\r
- return NULL;\r
- }\r
- else if(m_command.type == et::BattleAction::CAST){\r
- et::BattlerFacade* pIdeal = pGroup->getIdealBattlerAt(m_command.idealIndex);\r
- et::BattlerParameter parameter = pIdeal->getParameter();\r
- parameter.dActionPoint -= 5;\r
- pIdeal->setParameter(parameter);\r
- std::vector<et::BattlerFacade*> targetList;\r
- if(m_command.pTarget != NULL)targetList.push_back(m_command.pTarget);\r
- else targetList = pGroup->getEnemyBattlerListAlive();\r
- \r
- //\93Á\8eê\8bZ\82Ì\8eí\97Þ\82ð\93¾\82é\r
- return new SpecialAction(this , targetList , 5 , m_command.idealIndex);\r
- }\r
- else if(m_command.type == et::BattleAction::USE_ITEM){\r
- //\83A\83C\83e\83\80\82ð\82È\82\82·\r
- std::list<et::ItemData> &refList = m_pGameData->getBattleItemList();\r
- for(std::list<et::ItemData>::iterator itr = refList.begin() ; itr != refList.end() ; ++itr){\r
- if(m_command.pTargetItem == &(*itr)){\r
- refList.erase(itr);\r
- break;\r
- }\r
- }\r
- std::vector<et::BattlerFacade*> targetList;\r
- if(m_command.pTarget != NULL)targetList.push_back(m_command.pTarget);\r
- else targetList = pGroup->getEnemyBattlerListAlive();\r
-\r
- //\93Á\8eê\8bZ\82Ì\8eí\97Þ\82ð\93¾\82é\r
- return new SpecialAction(this , targetList , 2 , 3);\r
- }\r
- else return NULL;\r
-}\r
-/*et::Action* et::FixedBattler::createNextAction(std::list<BattlerFacade*>& enemy , std::list<BattlerFacade*>& ally){\r
-//if(pBattler->getParameter().actionPoint >= 3)return new AttackAction(pBattler , getHeroBattler() , 3 , 1.0f);\r
- //else return NULL;\r
- return NULL;\r
+#include "FixedBattler.h"
+#include "mof/KeyFrameAnimation.h"
+#include "AttackAction.h"
+#include "SpecialAction.h"
+#include "BattlerGroup.h"
+#include "GameData.h"
+#include "AttackAction.h"
+#include "SpecialAction.h"
+
+et::FixedBattler::FixedBattler(BattlerType type , et::BattlerParameter& parameter , mof::TextureManager* pTextureManager , et::GameData* pGameData)
+: BattlerFacade(type) , m_pGameData(pGameData)
+{
+ m_command.type = et::BattleAction::NONE;
+ setParameter(parameter);
+
+ if(getType() == et::HERO){
+ m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/hero0.png")));
+ }
+ else if(getType() == et::ENEMY){
+ m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/hd.png")));
+ }
+ else if(getType() == et::IDEAL){
+ m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/ideal.png")));
+ }
+
+ mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();
+ pAnimation->setScale(0 , mof::Vector3D(0.3f , 0.3f , 0.3f));
+ pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64));
+ getGraphicsObject()->setAnimation( 0 , mof::AnimationResource(pAnimation));
+
+
+}
+
+
+
+
+mof::AnimationResource et::FixedBattler::setMovingAnimation(mof::Vector3D& goal , int nFrame){
+ mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();
+ pAnimation->setPosition(0 , getPosition());
+ pAnimation->setPosition(nFrame-1 , goal);
+ mof::AnimationResource resource(pAnimation);
+ getGraphicsObject()->setAnimation( 1 , resource);
+ return resource;
+}
+
+mof::AnimationResource et::FixedBattler::setAidlingAnimation(mof::Vector3D& position ){
+ if(!getParameter().alive){
+ //\89½\82à\95\\8e¦\82µ\82È\82¢
+ mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true);
+ pAnimation->setPosition(0 , position);
+ pAnimation->setTextureRectangle(0 , mof::Line2D(1 , 1 , 1 , 1));
+ mof::AnimationResource resource(pAnimation);
+ getGraphicsObject()->setAnimation( 1 , resource);
+ return resource;
+ }
+ else if(getParameter().guard && getType() == et::HERO){
+ //\83K\81[\83h
+ mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true);
+ pAnimation->setPosition(0 , position);
+ pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 64*2 , 64 , 64*3));
+ mof::AnimationResource resource(pAnimation);
+ getGraphicsObject()->setAnimation( 1 , resource);
+ return resource;
+ }
+ else {
+ mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true);
+ pAnimation->setPosition(0 , position);
+ pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64));
+ pAnimation->setTextureRectangle(15 , mof::Line2D(0 , 64 , 64 , 64*2));
+ pAnimation->setTextureRectangle(30-1 , mof::Line2D(0 , 0 , 64 , 64));
+ mof::AnimationResource resource(pAnimation);
+ getGraphicsObject()->setAnimation( 1 , resource);
+ return resource;
+ }
+}
+
+mof::AnimationResource et::FixedBattler::setCastAnimation(int category){
+ mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();
+
+ if(category == 0){
+ //\92Ê\8fí\8dU\8c\82
+ pAnimation->setPosition(0 , getPosition());
+ pAnimation->setTextureRectangle(0 , mof::Line2D(64 , 0 , 128 , 64));
+ pAnimation->setTextureRectangle(10 , mof::Line2D(64 , 64 , 128 , 64*2));
+ pAnimation->setTextureRectangle(20 , mof::Line2D(64 , 128 , 128 , 64*3));
+ pAnimation->setFinalKey(20);
+ }
+ else if(category == 1){
+ pAnimation->setPosition(0 , getPosition());
+ pAnimation->setTextureRectangle(0 , mof::Line2D(64*2 , 0 , 64*3 , 64));
+ pAnimation->setTextureRectangle(40 , mof::Line2D(0 , 0 , 64 , 64));
+ pAnimation->setFinalKey(20);
+ }
+ mof::AnimationResource resource(pAnimation);
+ getGraphicsObject()->setAnimation( 1 , resource);
+ return resource;
+
+}
+
+mof::AnimationResource et::FixedBattler::setDamagedAnimation(int level){
+ mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();
+ if(level == 0){
+ //\92Ê\8fí
+ mof::Vector3D backPosition = getPosition();
+ backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f;
+ pAnimation->setPosition(0 , getPosition());
+ pAnimation->setPosition(10 , backPosition);
+ pAnimation->setPosition(40 , backPosition);
+ pAnimation->setPosition(60 , getPosition());
+
+ pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64));
+ pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64));
+ pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1));
+ pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64));
+ pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1));
+ pAnimation->setTextureRectangle(16 , mof::Line2D(1 , 1 , 1 , 1));
+ pAnimation->setTextureRectangle(26 , mof::Line2D(0 , 0 , 64 , 64));
+
+ }
+ else if(level == 1){
+ //\8e\80\96S
+
+ mof::Vector3D backPosition = getPosition();
+ backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f;
+ pAnimation->setPosition(0 , getPosition());
+ pAnimation->setPosition(10 , backPosition);
+
+ pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64));
+ pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64));
+ pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1));
+ pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64));
+ pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1));
+ pAnimation->setTextureRectangle(25 , mof::Line2D(1 , 1 , 1 , 1));
+
+ }
+ mof::AnimationResource resource(pAnimation);
+ getGraphicsObject()->setAnimation( 1 , resource);
+ return resource;
+}
+
+void et::FixedBattler::setBattleCommand(BattleAction& action){
+ m_command = action;
+}
+
+et::Action* et::FixedBattler::createAction(BattlerGroup* pGroup ){
+
+ if(m_command.type == et::BattleAction::ATTACK_WEAPON){
+ return new AttackAction(this , m_command.pTarget , 3);
+ }
+ else if(m_command.type == et::BattleAction::WAIT || m_command.type == et::BattleAction::GUARD){
+ return NULL;
+ }
+ else if(m_command.type == et::BattleAction::CAST){
+ et::BattlerFacade* pIdeal = pGroup->getIdealBattlerAt(m_command.idealIndex);
+ et::BattlerParameter parameter = pIdeal->getParameter();
+ parameter.dActionPoint -= 5;
+ pIdeal->setParameter(parameter);
+ std::vector<et::BattlerFacade*> targetList;
+ if(m_command.pTarget != NULL)targetList.push_back(m_command.pTarget);
+ else targetList = pGroup->getEnemyBattlerListAlive();
+
+ //\93Á\8eê\8bZ\82Ì\8eí\97Þ\82ð\93¾\82é
+ return new SpecialAction(this , targetList , 5 , m_command.idealIndex);
+ }
+ else if(m_command.type == et::BattleAction::USE_ITEM){
+ //\83A\83C\83e\83\80\82ð\82È\82\82·
+ std::list<et::ItemData> &refList = m_pGameData->getBattleItemList();
+ for(std::list<et::ItemData>::iterator itr = refList.begin() ; itr != refList.end() ; ++itr){
+ if(m_command.pTargetItem == &(*itr)){
+ refList.erase(itr);
+ break;
+ }
+ }
+ std::vector<et::BattlerFacade*> targetList;
+ if(m_command.pTarget != NULL)targetList.push_back(m_command.pTarget);
+ else targetList = pGroup->getEnemyBattlerListAlive();
+
+ //\93Á\8eê\8bZ\82Ì\8eí\97Þ\82ð\93¾\82é
+ return new SpecialAction(this , targetList , 2 , 3);
+ }
+ else return NULL;
+}
+/*et::Action* et::FixedBattler::createNextAction(std::list<BattlerFacade*>& enemy , std::list<BattlerFacade*>& ally){
+//if(pBattler->getParameter().actionPoint >= 3)return new AttackAction(pBattler , getHeroBattler() , 3 , 1.0f);
+ //else return NULL;
+ return NULL;
}*/
\ No newline at end of file