- Added Momir Basic mode :)
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-04-04 12:52:36 +00:00
parent 82f418d0f3
commit 6582a1972a
24 changed files with 479 additions and 131 deletions

View File

@@ -0,0 +1,17 @@
#ifndef _AIMOMIRPLAYER_H_
#define _AIMOMIRPLAYER_H_
#include "AIPlayer.h"
class AIMomirPlayer:public AIPlayerBaka{
public:
AIMomirPlayer(MTGPlayerCards * _deck, char * file, char * avatarFile);
int getEfficiency(AIAction * action);
int momir();
int computeActions();
static MTGAbility * momirAbility;
static MTGAbility * getMomirAbility();
};
#endif

View File

@@ -71,6 +71,7 @@ class AIPlayer: public Player{
int selectAbility();
int createAbilityTargets(MTGAbility * a, MTGCardInstance * c, map<AIAction *, int,CmpAbilities> * ranking);
int useAbility();
virtual int getEfficiency(AIAction * action);
};
@@ -84,7 +85,7 @@ class AIPlayerBaka: public AIPlayer{
AIPlayerBaka(MTGPlayerCards * _deck, char * deckFile, char * avatarFile);
virtual int Act(float dt);
void initTimer();
int computeActions();
virtual int computeActions();
};
class AIPlayerFactory{

View File

@@ -10,6 +10,7 @@
#include "GuiLayers.h"
#include "ActionElement.h"
#include "SimpleMenu.h"
#include "MTGAbility.h"
class GuiLayer;
class Targetable;
@@ -36,6 +37,7 @@ class ActionLayer: public GuiLayer, public JGuiListener{
void ButtonPressed(int controllerid, int controlid);
void doReactTo(int menuIndex);
TargetChooser * getCurrentTargetChooser();
MTGAbility * getAbility(int type);
};

View File

@@ -41,6 +41,9 @@
#define PLAYER_TYPE_TESTSUITE 2
#define GAME_TYPE_CLASSIC 0
#define GAME_TYPE_MOMIR 1
class MTGAllCards;
class TexturesCache;
@@ -63,6 +66,7 @@ class GameApp: public JApp
public:
int players[2];
MTGAllCards * collection;
int gameType;
TexturesCache * cache;
GameApp();

View File

@@ -9,6 +9,7 @@ using std::string;
#define OPTIONS_MUSICVOLUME "musicVolume"
#define OPTIONS_SFXVOLUME "sfxVolume"
#define OPTIONS_DIFFICULTY_MODE_UNLOCKED "prx_handler" //huhu
#define OPTIONS_MOMIR_MODE_UNLOCKED "prx_rimom" //haha
#define OPTIONS_DIFFICULTY "difficulty"
// WALDORF - added

View File

@@ -33,7 +33,9 @@ class GameStateDuel: public GameState, public JGuiListener
JQuad * unlockedQuad;
JTexture * unlockedTex;
int isDifficultyUnlocked();
int isMomirUnlocked();
void loadPlayer(int playerId, int decknb = 0, int isAI = 0);
void loadPlayerMomir(int playerId, int isAI);
public:
GameStateDuel(GameApp* parent);
virtual ~GameStateDuel();

View File

@@ -11,6 +11,8 @@ class GameStateMenu: public GameState, public JGuiListener
private:
JGuiController* mGuiController;
SimpleMenu* subMenuController;
SimpleMenu* gameTypeMenu;
int hasChosenGameType;
JQuad * mIcons[10];
JTexture * mIconsTexture;
JTexture * bgTexture;

View File

@@ -60,12 +60,16 @@ class MTGAbility: public ActionElement{
virtual int resolve(){return 0;};
/*Poor man's casting */
/* Todo replace that crap with dynamic casting */
enum {
UNKNOWN = 0,
MANA_PRODUCER = 1,
MTG_ATTACK_RULE = 2,
DAMAGER = 3,
STANDARD_REGENERATE = 4,
PUT_INTO_PLAY = 5,
MOMIR = 6,
MTG_BLOCK_RULE = 7,
};
};

View File

@@ -85,6 +85,7 @@ class MTGPlayerCards {
MTGInPlay * inPlay;
MTGStack * stack;
MTGRemovedFromGame * removedFromGame;
MTGGameZone * garbage;
MTGAllCards * collection;

View File

@@ -81,62 +81,6 @@ OutputDebugString("Receive5\n");
};
/*
class MTGPersistRule:public ListMaintainerAbility{
public:
MTGPersistRule(int _id):ListMaintainerAbility(_id){};
virtual void Update(float dt){
map<MTGCardInstance *,bool>::iterator it;
for ( it=cards.begin() ; it != cards.end(); it++ ){
MTGCardInstance * card = ((*it).first);
Player * p = card->controller();
if (p->game->graveyard->hasCard(card)){
p->game->putInZone(card, p->game->graveyard, p->game->hand);
Spell * spell = NEW Spell(card);
p->game->putInZone(card, p->game->hand, p->game->stack);
spell->resolve();
delete spell;
card->counters->addCounter(-1,-1);
}
}
// Dirtiest Code Ever, we remove the counters here
for (int i = 0; i < 2; i++){
Player * p = game->players[i];
MTGGameZone * zones[] = {p->game->graveyard, p->game->hand, p->game->library, p->game->removedFromGame};
for (int j = 0; j < 5; j++){
MTGGameZone * zone = zones[j];
for (int k=0; k < zone->nb_cards; k++){
zone->cards[k]->counters->init();
}
}
}
ListMaintainerAbility::Update(dt);
}
int canBeInList(MTGCardInstance * card){
if (card->basicAbilities[Constants::PERSIST] && !card->counters->hasCounter(-1,-1) ){
#if defined (WIN32) || defined (LINUX)
OutputDebugString("yay, persist !\n");
#endif
return 1;
}
return 0;
}
int added(MTGCardInstance * card){return 1;}
int removed(MTGCardInstance * card){return 0;}
int testDestroy(){return 0;}
};
*/
/*
* Rule 420.5e (Legend Rule)
@@ -176,4 +120,18 @@ class MTGLegendRule:public ListMaintainerAbility{
int testDestroy(){return 0;}
};
class MTGMomirRule:public MTGAbility{
public:
int alreadyplayed;
MTGAllCards * collection;
MTGCardInstance * genRandomCreature(int convertedCost);
int testDestroy();
void Update(float dt);
MTGMomirRule(int _id, MTGAllCards * _collection);
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
const char * getMenuText(){return "Momir";}
};
#endif

View File

@@ -22,7 +22,7 @@ class ManaCost{
static ManaCost * parseManaCost(string value, ManaCost * _manacost = NULL);
void init();
void x();
ManaCost(int _cost[], int nb_elems);
ManaCost(int _cost[], int nb_elems = 1);
ManaCost();
~ManaCost();
ManaCost(ManaCost * _manaCost);