Daddy32 - Tasks
Reward tweaks, fixes, spelling fix, one minor task subtype added, removed debug options.
This commit is contained in:
@@ -57,7 +57,6 @@ enum
|
||||
SUBMENUITEM_CLASSIC,
|
||||
SUBMENUITEM_RANDOM1,
|
||||
SUBMENUITEM_RANDOM2,
|
||||
SUBMENUITEM_QUICK_TEST, //!!
|
||||
};
|
||||
|
||||
|
||||
@@ -569,9 +568,8 @@ JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||
subMenuController->Add(SUBMENUITEM_CANCEL, "Cancel");
|
||||
#ifdef TESTSUITE
|
||||
subMenuController->Add(SUBMENUITEM_TESTSUITE, "Test Suite");
|
||||
#endif
|
||||
subMenuController->Add(SUBMENUITEM_QUICK_TEST, "Quick test"); //!!
|
||||
currentState = MENU_STATE_MAJOR_SUBMENU | MENU_STATE_MINOR_NONE;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case MENUITEM_DECKEDITOR:
|
||||
@@ -644,30 +642,11 @@ JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||
break;
|
||||
#endif
|
||||
case SUBMENUITEM_QUICK_TEST: //!!
|
||||
subMenuController->Close();
|
||||
runTest();
|
||||
currentState = MENU_STATE_MAJOR_MAINMENU | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GameStateMenu::runTest() { //!!
|
||||
/*TaskList *tlist = new TaskList();
|
||||
TaskWinAgainst *t1 = new TaskWinAgainst((rand()%10)+1);
|
||||
TaskWinAgainst *t2 = new TaskWinAgainst((rand()%10)+1);
|
||||
t1->setExpiration((rand()%5)+1);
|
||||
t2->setExpiration((rand()%5)+1);
|
||||
tlist->passOneDay();
|
||||
tlist->addTask(t1);
|
||||
tlist->addTask(t2);
|
||||
tlist->save();
|
||||
SAFE_DELETE(tlist);
|
||||
//SAFE_DELETE(t);*/
|
||||
}
|
||||
|
||||
ostream& GameStateMenu::toString(ostream& out) const
|
||||
{
|
||||
return out << "GameStateMenu ::: scroller : " << scroller
|
||||
|
||||
@@ -157,6 +157,7 @@ void GameStateShop::Update(float dt)
|
||||
mStage = STAGE_SHOP_SHOP;
|
||||
return;
|
||||
}
|
||||
#ifdef TESTSUITE
|
||||
if ((mEngine->GetButtonClick(PSP_CTRL_SQUARE)) && (taskList)) {
|
||||
taskList->passOneDay();
|
||||
if (taskList->getTaskCount() < 6) {
|
||||
@@ -165,6 +166,7 @@ void GameStateShop::Update(float dt)
|
||||
}
|
||||
taskList->save();
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (mEngine->GetButtonClick(PSP_CTRL_SQUARE)){
|
||||
load();
|
||||
|
||||
@@ -224,6 +224,9 @@ Task* Task::createFromStr(string params, bool rand) {
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("\nTask::createFromStr: Failed to create task\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -256,13 +259,16 @@ int TaskList::save(string _fileName) {
|
||||
fileName = _fileName;
|
||||
}
|
||||
if (fileName == "") {
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("\nTaskList::save: No filename specified\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::ofstream file(fileName.c_str());
|
||||
if (file){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("\nsaving\n");
|
||||
OutputDebugString("\nsaving tasks\n");
|
||||
#endif
|
||||
|
||||
file << "# Format: <Type>|<Expiration>|<Accepted>|<Opponent>|<Reward>|<Description>[|Additional attributes]\n";
|
||||
@@ -282,6 +288,9 @@ int TaskList::load(string _fileName) {
|
||||
fileName = _fileName;
|
||||
}
|
||||
if (fileName == "") {
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("\nTaskList::load: No filename specified\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -307,6 +316,9 @@ int TaskList::load(string _fileName) {
|
||||
}
|
||||
file.close();
|
||||
} else {
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("\nTaskList::load: Failed to open file\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -380,7 +392,7 @@ void TaskList::Render() {
|
||||
posY += 20;
|
||||
|
||||
if (0 == tasks.size()) {
|
||||
f->DrawString(_("These are no tasks that need to be done. Come again tomorrow.").c_str(), posX, posY);
|
||||
f->DrawString(_("There are no tasks that need to be done. Come again tomorrow.").c_str(), posX, posY);
|
||||
posY += 20;
|
||||
return;
|
||||
}
|
||||
@@ -473,12 +485,15 @@ TaskSlaughter::TaskSlaughter(int _opponent, int _targetLife) : TaskWinAgainst(_o
|
||||
}
|
||||
|
||||
int TaskSlaughter::computeReward() {
|
||||
return 2*TaskWinAgainst::computeReward() - targetLife*9;
|
||||
return 2*TaskWinAgainst::computeReward() - 9*targetLife*(targetLife<-50 ? 2 : 1);
|
||||
}
|
||||
|
||||
void TaskSlaughter::randomize() {
|
||||
Task::randomize();
|
||||
targetLife = -15 - rand()%10;
|
||||
if (!(rand()%7)) {
|
||||
targetLife *= 5;
|
||||
}
|
||||
}
|
||||
|
||||
string TaskSlaughter::createDesc() {
|
||||
@@ -526,7 +541,7 @@ TaskDelay::TaskDelay(int _opponent, int _turn) : TaskWinAgainst(_opponent) {
|
||||
}
|
||||
|
||||
int TaskDelay::computeReward() {
|
||||
return TaskWinAgainst::computeReward() + (afterTurn ? turn*30 : (17-turn)*(17-turn)*24);
|
||||
return TaskWinAgainst::computeReward() + (afterTurn ? turn*30 : (17-turn)*(17-turn)*20);
|
||||
}
|
||||
|
||||
void TaskDelay::randomize() {
|
||||
@@ -778,8 +793,10 @@ string TaskXX::getShortDesc(){
|
||||
}
|
||||
|
||||
bool TaskXX::isDone(Player * _p1, Player * _p2, GameApp * _app) {
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
// TODO: Implement
|
||||
return TRUE;
|
||||
return (!_p1->isAI()) && (_p2->isAI()) && (g->gameOver != _p1) // Human player wins
|
||||
&& ;
|
||||
}
|
||||
|
||||
void TaskXX::storeCustomAttribs() {
|
||||
|
||||
Reference in New Issue
Block a user