2 #include "AttackAction.h"
4 #include "BattlerGroup.h"
5 #include "DataBasedBattler.h"
6 #include "DataBasedAction.h"
8 et::NormalAI::NormalAI(mof::DataResourceManager* pDataResourceManager)
9 : BattleAI(pDataResourceManager)
13 et::NormalAI::~NormalAI(){
18 et::Action* et::NormalAI::createAction(DataBasedBattler* pOwn , BattlerGroup* pGroup){
19 mof::DataRow targetRow = pOwn->getDataRow();
20 //
\91I
\91ð
\89Â
\94\
\82È
\83A
\83N
\83V
\83\87\83\93\82Ì
\92\86\82Å
\8dÅ
\82à
\8aú
\91Ò
\92l
\82Ì
\8d\82\82¢
\82à
\82Ì
\82ð
\91I
\82Ô
21 mof::DataResource monsterAction = m_pDataResourceManager->getResource(_T("data/monster.action.csv"));
22 const TCHAR* const table[] = {_T("DirectAttack1") , _T("DirectAttack2") , _T("SpecialAttack1") , _T("SpecialAttack1")};
23 int ap = pOwn->getParameter().actionPoint;
26 int selectedIndex = -1;
27 mof::DataRow selectedAction;
28 mof::DataRow targetAction;
30 for(int i = 0 ; i < sizeof(table)/sizeof(table[0]) ; i++){
31 mof::tstring action = targetRow.getData(table[i]);
32 if(action == _T(""))continue;
33 targetAction = mof::DataRow(monsterAction , action.c_str());
35 int cost = targetAction.getIntegerData( _T("Cost"));
37 int tmpCoefficient = targetAction.getIntegerData( _T("Coefficient"));
38 if(coefficient < tmpCoefficient){
39 //
\91I
\91ð
\83A
\83N
\83V
\83\87\83\93\82ð
\8dX
\90V
40 coefficient = tmpCoefficient;
42 selectedAction = targetAction;
47 if(selectedIndex == -1)return NULL;
49 return new DataBasedAction(pOwn , pGroup->getHeroBattler() , selectedAction , selectedIndex);
53 et::Action* et::NormalAI::createAction(DataBasedBattler* pOwn , BattlerGroup* pGroup){
54 mof::DataRow targetRow = pOwn->getDataRow();
56 //
\91I
\91ð
\89Â
\94\
\82È
\83A
\83N
\83V
\83\87\83\93\82Ì
\92\86\82©
\82ç
\83\89\83\93\83_
\83\80\82Å
\91I
\82Ô
57 mof::DataResource monsterAction = m_pDataResourceManager->getResource(_T("data/monster.action.csv"));
58 const TCHAR* const table[] = {_T("DirectAttack1") , _T("DirectAttack2") , _T("SpecialAttack1") , _T("SpecialAttack1")};
59 int ap = pOwn->getParameter().actionPoint;
61 mof::DataRow targetAction;
63 std::vector<int> selectableList;
65 for(int i = 0 ; i < sizeof(table)/sizeof(table[0]) ; i++){
66 mof::tstring action = targetRow.getData(table[i]);
67 if(action == _T(""))continue;
68 targetAction = mof::DataRow(monsterAction , action.c_str());
70 int cost = targetAction.getIntegerData( _T("Cost"));
72 if(ap >= cost)selectableList.push_back(i);
74 if(selectableList.size() == 0)return NULL;
76 int selectedIndex = rand() % selectableList.size();
77 return new DataBasedAction(pOwn , pGroup->getHeroBattler() ,
78 mof::DataRow(monsterAction , targetRow.getData(table[selectedIndex]).c_str()) , selectedIndex);