Daddy32: Tasks Mode
Gives the user the opportunity to earn some credits for performing various tasks.
Known bugs removed, tested stability-wise, not so much game-wise.
Lots of to-dos and ideas still remaining, better balance between task difficulty and their rewards needed - please comment.
Usage:
Enter shop, open menu, select 'See available tasks'.
All tasks in the list are active, until they expire ('Days left'; day passes after each duel (won, lost or quited)).
You can finish any of the tasks and get bonus. For particular task, the bonus gets a bit smaller every day (until expiration).
This commit is contained in:
@@ -94,6 +94,7 @@ class AIPlayerBaka: public AIPlayer{
|
||||
float timer;
|
||||
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
|
||||
public:
|
||||
int deckId;
|
||||
AIPlayerBaka(MTGPlayerCards * deck, string deckFile, string deckfileSmall, string avatarFile);
|
||||
virtual int Act(float dt);
|
||||
void initTimer();
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
#include <string>
|
||||
#include <JGE.h>
|
||||
#include <JLBFont.h>
|
||||
#include <time.h>
|
||||
#include "../include/Player.h"
|
||||
|
||||
class GameApp;
|
||||
|
||||
using namespace std;
|
||||
@@ -22,6 +24,7 @@ public:
|
||||
|
||||
class Credits{
|
||||
private:
|
||||
time_t gameLength;
|
||||
int isDifficultyUnlocked();
|
||||
int isMomirUnlocked();
|
||||
int isEvilTwinUnlocked();
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "ReplacementEffects.h"
|
||||
#include "GuiStatic.h"
|
||||
#include <queue>
|
||||
#include <time.h>
|
||||
|
||||
class MTGGamePhase;
|
||||
class MTGAbility;
|
||||
@@ -46,6 +47,7 @@ class GameObserver{
|
||||
ReplacementEffects *replacementEffects;
|
||||
Player * gameOver;
|
||||
Player * players[2]; //created outside
|
||||
time_t startedAt;
|
||||
|
||||
TargetChooser * getCurrentTargetChooser();
|
||||
void stackObjectClicked(Interruptible * action);
|
||||
|
||||
@@ -14,6 +14,7 @@ using std::string;
|
||||
#define PLAYER_SAVEFILE "data.dat"
|
||||
#define PLAYER_SETTINGS "options.txt"
|
||||
#define PLAYER_COLLECTION "collection.dat"
|
||||
#define PLAYER_TASKS "tasks.dat"
|
||||
#define SECRET_PROFILE "Maxglee"
|
||||
|
||||
#define INVALID_OPTION -1
|
||||
|
||||
@@ -44,6 +44,7 @@ class GameStateMenu: public GameState, public JGuiListener
|
||||
string getLang(string s);
|
||||
void loadLangMenu();
|
||||
bool langChoices;
|
||||
void runTest(); //!!
|
||||
public:
|
||||
GameStateMenu(GameApp* parent);
|
||||
virtual ~GameStateMenu();
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
#include "../include/GameState.h"
|
||||
#include "../include/SimpleMenu.h"
|
||||
#include "../include/ShopItem.h"
|
||||
#include "../include/Tasks.h"
|
||||
|
||||
|
||||
#define STATE_BUY 1
|
||||
#define STATE_SELL 2
|
||||
#define STAGE_SHOP_MENU 3
|
||||
#define STAGE_SHOP_SHOP 4
|
||||
|
||||
#define STAGE_SHOP_TASKS 5
|
||||
|
||||
|
||||
class GameStateShop: public GameState, public JGuiListener
|
||||
@@ -23,6 +24,7 @@ class GameStateShop: public GameState, public JGuiListener
|
||||
JQuad * mBack;
|
||||
JQuad * mBg;
|
||||
JTexture * mBgTex;
|
||||
TaskList * taskList;
|
||||
|
||||
SimpleMenu * menu;
|
||||
int mStage;
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
#define _PLAYER_DATA_H_
|
||||
|
||||
#include "../include/MTGDeck.h"
|
||||
#include "../include/Tasks.h"
|
||||
|
||||
class PlayerData{
|
||||
protected:
|
||||
public:
|
||||
int credits;
|
||||
MTGDeck * collection;
|
||||
TaskList * taskList;
|
||||
PlayerData(MTGAllCards * allcards);
|
||||
~PlayerData();
|
||||
int save();
|
||||
|
||||
178
projects/mtg/include/Tasks.h
Normal file
178
projects/mtg/include/Tasks.h
Normal file
@@ -0,0 +1,178 @@
|
||||
#ifndef TASK_H
|
||||
#define TASK_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
// Task type constant
|
||||
|
||||
#define TASK_BASIC 'B'
|
||||
|
||||
#define TASK_WIN_AGAINST 'W'
|
||||
#define TASK_SLAUGHTER 'S'
|
||||
#define TASK_DELAY 'D'
|
||||
#define TASK_IMMORTAL 'I'
|
||||
#define TASK_MASSIVE_BURIAL 'M'
|
||||
#define TASKS_ALL "WSDIM"
|
||||
|
||||
#define ITEM_SEPARATOR "|"
|
||||
|
||||
#define COMMON_ATTRIBS_COUNT 7
|
||||
|
||||
class Task {
|
||||
protected:
|
||||
int reward; // TODO: Complex rewards. Be consistent with other planned modes with rewards.
|
||||
int opponent;
|
||||
bool accepted;
|
||||
char type;
|
||||
int expiresIn;
|
||||
string description;
|
||||
string opponentName;
|
||||
vector<string> persistentAttribs; // persistentAttributes
|
||||
|
||||
void storeCommonAttribs();
|
||||
int restoreCommonAttribs();
|
||||
string getOpponentName();
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
|
||||
virtual int computeReward() = 0;
|
||||
|
||||
public:
|
||||
// variable to store and method to obtain names of AI decks
|
||||
//!! Todo: This should _really_ be handled elsewhere (dedicated class?)
|
||||
static vector<string> AIDeckNames;
|
||||
static void loadAIDeckNames();
|
||||
static int getAIDeckCount();
|
||||
static string getAIDeckName(int id);
|
||||
// End of AI deck buffering code
|
||||
|
||||
Task(char _type = ' ');
|
||||
|
||||
static Task* createFromStr(string params, bool rand = FALSE);
|
||||
virtual string toString();
|
||||
string getDesc();
|
||||
virtual string createDesc() = 0;
|
||||
virtual string getShortDesc() = 0;
|
||||
int getExpiration();
|
||||
int getReward();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app) = 0;
|
||||
bool isExpired();
|
||||
void setExpiration(int _expiresIn);
|
||||
void passOneDay();
|
||||
};
|
||||
|
||||
class TaskList {
|
||||
protected:
|
||||
string fileName;
|
||||
|
||||
public:
|
||||
vector<Task*> tasks;
|
||||
|
||||
TaskList(string _fileName = "");
|
||||
int load(string _fileName = "");
|
||||
int save(string _fileName = "");
|
||||
void addTask(string params, bool rand = FALSE);
|
||||
void addTask(Task *task);
|
||||
void addRandomTask(int diff = 100);
|
||||
void removeTask(Task *task);
|
||||
void passOneDay();
|
||||
void getDoneTasks(Player * _p1, Player * _p2, GameApp * _app, vector<Task*>* result);
|
||||
int getTaskCount();
|
||||
|
||||
//!!virtual void Update(float dt);
|
||||
virtual void Render();
|
||||
//!!virtual void ButtonPressed(int controllerId, int controlId);
|
||||
|
||||
~TaskList();
|
||||
};
|
||||
|
||||
class TaskWinAgainst : public Task {
|
||||
protected:
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskWinAgainst(int _opponent = 0);
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
};
|
||||
|
||||
class TaskSlaughter : public TaskWinAgainst {
|
||||
protected:
|
||||
int targetLife;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskSlaughter(int _opponent = 0, int _targetLife = -15);
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskDelay : public TaskWinAgainst {
|
||||
protected:
|
||||
int turn;
|
||||
bool afterTurn;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskDelay(int _opponent = 0, int _turn = 20);
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskImmortal : public Task {
|
||||
protected:
|
||||
int targetLife;
|
||||
int level;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskImmortal(int _targetLife = 20);
|
||||
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskMassiveBurial : public Task {
|
||||
protected:
|
||||
int color;
|
||||
int bodyCount;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskMassiveBurial(int _color = 0, int _bodyCount = 0);
|
||||
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
/* ------------ Task template ------------
|
||||
|
||||
class TaskXX : public Task {
|
||||
protected:
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskXX();
|
||||
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
*/
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user