Merge branch 'master' into cmake

This commit is contained in:
fogobogo
2022-01-11 19:19:09 +01:00
955 changed files with 424454 additions and 217753 deletions

View File

@@ -84,8 +84,8 @@ class AIPlayerBaka: public AIPlayer{
//Tries to play an ability recommended by the deck creator
virtual int selectHintAbility();
virtual vector<MTGAbility*> canPayMana(MTGCardInstance * card = NULL, ManaCost * mCost = NULL);
virtual vector<MTGAbility*> canPayMana(MTGCardInstance * card, ManaCost * mCost, map<MTGCardInstance*, bool> &usedCards, bool searchingAgain = false);
virtual vector<MTGAbility*> canPayMana(MTGCardInstance * card, ManaCost * mCost, int anytypeofmana);
virtual vector<MTGAbility*> canPayMana(MTGCardInstance * card, ManaCost * mCost, int anytypeofmana, map<MTGCardInstance*, bool> &usedCards, bool searchingAgain = false);
virtual vector<MTGAbility*> canPaySunBurst(ManaCost * mCost = NULL);
virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0);
@@ -93,6 +93,7 @@ class AIPlayerBaka: public AIPlayer{
virtual AIStats * getStats();
int payAlternative;
MTGCardInstance * nextCardToPlay;
MTGCardInstance * activateCombo();
TargetChooser * GetComboTc(GameObserver * observer, TargetChooser * tc = NULL);
@@ -106,7 +107,7 @@ class AIPlayerBaka: public AIPlayer{
//used by MomirPlayer, hence protected instead of private
virtual int getEfficiency(OrderedAIAction * action);
virtual int getEfficiency(MTGAbility * ability);
virtual bool payTheManaCost(ManaCost * cost, MTGCardInstance * card = NULL,vector<MTGAbility*> gotPayment = vector<MTGAbility*>());
virtual bool payTheManaCost(ManaCost * cost, int anytypeofmana, MTGCardInstance * card = NULL,vector<MTGAbility*> gotPayment = vector<MTGAbility*>());
virtual int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0);
virtual ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
virtual int selectAbility();
@@ -121,6 +122,12 @@ class AIPlayerBaka: public AIPlayer{
INFO_CREATURESATTACKINGPOWER
};
enum {
NONE,
OTHER,
MORPH
}; // Possbile alternative costs to be used for AI.
vector<MTGAbility*>gotPayments;
AIPlayerBaka(GameObserver *observer, string deckFile, string deckfileSmall, string avatarFile, MTGDeck * deck = NULL);
@@ -134,7 +141,7 @@ class AIPlayerBaka: public AIPlayer{
virtual int affectCombatDamages(CombatStep step);
virtual int canHandleCost(MTGAbility * ability);
virtual int chooseTarget(TargetChooser * tc = NULL, Player * forceTarget = NULL,MTGCardInstance * Chosencard = NULL,bool checkonly = false);
virtual vector<MTGAbility*> canPayManaCost(MTGCardInstance * card = NULL, ManaCost * mCost = NULL){ return canPayMana(card, mCost);};
virtual vector<MTGAbility*> canPayManaCost(MTGCardInstance * card = NULL, ManaCost * mCost = NULL, int anytypeofmana = 0){ return canPayMana(card, mCost, anytypeofmana);};
//used by AIHInts, therefore public instead of private :/
virtual int createAbilityTargets(MTGAbility * a, MTGCardInstance * c, RankingContainer& ranking);

View File

@@ -36,7 +36,7 @@ protected:
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
bool payTheManaCost(ManaCost * cost, MTGCardInstance * card = NULL,vector<MTGAbility*> gotPayment = vector<MTGAbility*>());
bool payTheManaCost(ManaCost * cost, int anytypeofmana, MTGCardInstance * card = NULL,vector<MTGAbility*> gotPayment = vector<MTGAbility*>());
int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0);
ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
int selectAbility();

View File

@@ -197,7 +197,10 @@ public:
PUT_IN_GRAVEARD,
PUT_IN_HAND,
PUT_IN_LIBRARY_TOP,
PUT_IN_EXILE
PUT_IN_EXILE,
PUT_IN_LIBRARY_BOTTOM,
PUT_IN_LIBRARY_SECOND,
PUT_IN_EXILE_IMPRINT
} FizzleMode;
protected:
@@ -222,7 +225,7 @@ public:
int getPreviousIndex(Interruptible * next, int type = 0, int state = 0 , int display = -1);
Interruptible * getNext(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
int getNextIndex(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
void Fizzle(Interruptible * action, FizzleMode fizzleMode = PUT_IN_GRAVEARD);
void Fizzle(Interruptible * action, MTGCardInstance* fizzler = NULL, FizzleMode fizzleMode = PUT_IN_GRAVEARD);
Interruptible * getAt(int id);
void cancelInterruptOffer(InterruptDecision cancelMode = DONT_INTERRUPT, bool log = true);
void endOfInterruption(bool log = true);

File diff suppressed because it is too large Load Diff

View File

@@ -30,20 +30,34 @@ class CardDescriptor: public MTGCardInstance
public:
enum Operator{
CD_OR = 1,
CD_AND = 2
CD_AND = 2,
CD_NOR = 3,
CD_NAND = 4
};
Operator mode;
int powerComparisonMode;
int foretoldComparisonMode;
int kickedComparisonMode;
int toughnessComparisonMode;
int manacostComparisonMode;
int counterComparisonMode;
int convertedManacost; // might fit better into MTGCardInstance?
int zposComparisonMode;
int zposition;
int hasKickerCost;
int hasFlashbackCost;
int hasBackSide;
int hasPartner;
int hasXCost;
int anyCounter;
int init();
CardDescriptor();
void unsecureSetKicked(int i);
void unsecureSetHasKickerCost(int i);
void unsecureSetHasFlashbackCost(int i);
void unsecureSetHasBackSide(int i);
void unsecureSetHasPartner(int i);
void unsecureSetTapped(int i);
void unsecuresetfresh(int k);
void unsecuresetrecent(int j);
@@ -69,6 +83,8 @@ class CardDescriptor: public MTGCardInstance
int CDcontrollerDamaged;
int CDdamager;
int CDgeared;
int CDdiscarded;
int CDattached;
int CDblocked;
int CDcanProduceC;
int CDcanProduceG;

View File

@@ -53,6 +53,9 @@ public:
vector<string> formattedText;
string text;
string name;
string nameOrig;
string backSide;
string partner;
int init();
uint8_t colors;

View File

@@ -19,7 +19,7 @@ public:
int init(MTGCardInstance * _target, const char * _name, int _power, int _toughness);
bool sameAs(const char * _name, int _power, int _toughness);
bool cancels(int _power, int _toughness);
int cancelCounter(int power, int toughness);
int cancelCounter(int power, int toughness, MTGCardInstance * _source);
int added();
int removed();
};
@@ -29,14 +29,14 @@ class Counters
{
public:
int mCount;
vector<Counter *>counters;
vector<Counter *>counters;
MTGCardInstance * target;
Counters(MTGCardInstance * _target);
~Counters();
int addCounter(const char * _name, int _power = 0, int _toughness = 0, bool _noevent = false);
int addCounter(const char * _name, int _power = 0, int _toughness = 0, bool _noevent = false, bool duplicated = false, MTGCardInstance * _source = NULL);
int addCounter(int _power, int _toughness);
int addCounter(int _power, int _toughness, bool _noevent);
int removeCounter(const char * _name, int _power = 0, int _toughness = 0);
int removeCounter(const char * _name, int _power = 0, int _toughness = 0, bool _noevent = false, bool duplicated = false, MTGCardInstance * _source = NULL);
int removeCounter(int _power, int _toughness);
Counter * hasCounter(const char * _name, int _power = 0, int _toughness = 0);
Counter * hasCounter(int _power, int _toughness);

View File

@@ -44,6 +44,7 @@ private:
time_t gameLength;
int isDifficultyUnlocked(DeckStats * stats);
int isEvilTwinUnlocked();
int isCommanderUnlocked();
int isRandomDeckUnlocked();
int IsMoreAIDecksUnlocked(DeckStats * stats);
string unlockedTextureName;

View File

@@ -27,6 +27,7 @@ public:
int nonCombatDamage;
int preventable;
int thatmuch;
int exceededDamage;
int lifeLostThisTurn;
int lifeGainedThisTurn;
DamageableType type_as_damageable;

View File

@@ -49,6 +49,7 @@ protected:
bool mShowDetailsScreen;
bool mAlwaysShowDetailsButton;
bool mClosed;
bool isOpponent;
public:
VerticalTextScroller * mScroller;
@@ -67,7 +68,7 @@ public:
JQuadPtr pspIcons[8];
JTexture * pspIconsTexture;
DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "", const int& startIndex = 0, bool alwaysShowDetailsButton = false);
DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "", const int& startIndex = 0, bool alwaysShowDetailsButton = false, bool chooseOpponent = false);
~DeckMenu();
DeckMetaData * getSelectedDeck();

View File

@@ -23,8 +23,9 @@ private:
vector<int> mUnlockRequirements;
int mDeckId;
string mAvatarFilename;
string mColorIndex;
string mColorIndex;
bool mCommanderDeck; //Added to read the command tag in deck's metafile.
// statistical information
int mGamesPlayed, mVictories, mPercentVictories, mDifficulty;
int getAvatarId();
@@ -33,12 +34,12 @@ private:
public:
DeckMetaData(const string& filename, bool isAI = false);
void LoadDeck();
void LoadStats();
// Accessors
bool isCommanderDeck(); //Added to read the command tag in deck's metafile.
string getFilename();
string getDescription();
string getName();

View File

@@ -133,8 +133,10 @@ class GameObserver{
int isInPlay(MTGCardInstance * card);
int isInGrave(MTGCardInstance * card);
int isInExile(MTGCardInstance * card);
int isInCommandZone(MTGCardInstance * card);
int isInHand(MTGCardInstance * card);
int isInLibrary(MTGCardInstance * card);
int isInStack(MTGCardInstance * card);
virtual void Update(float dt);
void Render();
void ButtonPressed(PlayGuiObject*);

View File

@@ -44,8 +44,11 @@ public:
CHEATMODE,
OPTIMIZE_HAND,
CHEATMODEAIDECK,
SHOWBORDER,
BLKBORDER,
SORTINGDECKS,
SHOWTOKENS,
SORTINGSETS,
GDVLARGEIMAGE,
CARDPREFETCHING,
OSD,
@@ -88,6 +91,7 @@ public:
EVILTWIN_MODE_UNLOCKED,
RANDOMDECK_MODE_UNLOCKED,
AWARD_COLLECTOR,
COMMANDER_MODE_UNLOCKED,
LAST_NAMED, //Any option after this does not look up in optionNames.
SET_UNLOCKS = LAST_NAMED + 1, //For sets.
};
@@ -272,6 +276,19 @@ private:
static OptionASkipPhase mDef;
};
class OptionASortingSets : public EnumDefinition
{
public:
static EnumDefinition * getInstance()
{
return &mDef;
}
private:
OptionASortingSets();
static OptionASortingSets mDef;
};
class OptionWhosFirst : public EnumDefinition
{
public:

View File

@@ -73,14 +73,11 @@ public:
// it makes it easier to manipulate the deck information menus.
// generate the Deck Meta Data and build the menu items of the menu given
static vector<DeckMetaData *> fillDeckMenu(SimpleMenu * _menu, const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL);
// generate the Deck Meta Data and build the menu items of the menu given
// Will display up to maxDecks if maxDecks is non 0,all decks in path otherwise
static vector<DeckMetaData *> fillDeckMenu(DeckMenu * _menu, const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL, int maxDecks = 0);
// Will display up to maxDecks if maxDecks is non 0, all decks in path otherwise and it will show or not commander decks according to the current game type or according to "showall" option (e.g. DeckEditorMenu)
static vector<DeckMetaData *> fillDeckMenu(DeckMenu * _menu, const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL, int maxDecks = 0, GameType type = GAME_TYPE_CLASSIC, bool showall = false);
// build a vector of decks with the information passsed in.
static vector<DeckMetaData *> BuildDeckList(const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL, int maxDecks = 0);
static vector<DeckMetaData *> BuildDeckList(const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL, int maxDecks = 0, GameType type = GAME_TYPE_CLASSIC, bool showall = false);
// build menu items based on the vector<DeckMetaData *>
static void renderDeckMenu(SimpleMenu * _menu, const vector<DeckMetaData *>& deckMetaDataList);

View File

@@ -33,7 +33,9 @@ enum
SBMENU_CHOICE = 802,
SBMENU_ADD_NORMAL = 803,
SBMENU_ADD_SB = 804,
SBMENU_ADD_CANCEL = 805
SBMENU_ADD_CMD = 805,
SBMENU_ADD_DNG = 806,
SBMENU_ADD_CANCEL = 807
};
// enums for menu options
@@ -52,6 +54,7 @@ enum DECK_VIEWER_MENU_ITEMS
MENU_ITEM_YES = 20,
MENU_ITEM_NO = 21,
MENU_ITEM_FILTER_BY = 22,
MENU_ITEM_TOGGLE_VIEW = 23,
MENUITEM_MORE_INFO = kInfoMenuID
};
@@ -75,7 +78,7 @@ private:
DeckViewerStages mStage;
JMusic * bgMusic;
InteractiveButton *toggleDeckButton, *sbButton, *sellCardButton, *statsPrevButton, *filterButton, *toggleViewButton, *toggleUpButton, *toggleDownButton, *toggleLeftButton, *toggleRightButton;
InteractiveButton *toggleDeckButton, *sb_cmd_dng_Button, *sellCardButton, *statsPrevButton, *filterButton, *toggleViewButton, *toggleUpButton, *toggleDownButton, *toggleLeftButton, *toggleRightButton;
WGuiFilters * filterMenu;
WSrcDeckViewer * source;
@@ -89,6 +92,8 @@ private:
DeckDataWrapper * myDeck;
DeckDataWrapper * myCollection;
DeckDataWrapper * mySideboard;
DeckDataWrapper * myCommandZone;
DeckDataWrapper * myDungeonZone;
StatsWrapper * mStatsWrapper;
int hudAlpha;
@@ -112,6 +117,8 @@ private:
void setupView(AvailableView view, DeckDataWrapper *deck);
void toggleView();
void insertSideBoard();
void insertCommandZone();
void insertDungeonZone();
public:
GameStateDeckViewer(GameApp* parent);
virtual ~GameStateDeckViewer();
@@ -119,11 +126,13 @@ public:
void updateFilters();
void rebuildFilters();
void toggleCollection();
void toggleSideBoard();
void toggleSB_CMD_DNG();
void Start();
virtual void End();
void addRemove(MTGCard * card);
void SBaddRemove(MTGCard * card);
void CMDaddRemove(MTGCard * card);
void DNGaddRemove(MTGCard * card);
void choiceAddRemove(MTGCard * card);
virtual void Update(float dt);
void renderOnScreenBasicInfo();

View File

@@ -5,6 +5,7 @@
#include "SimpleMenu.h"
#include "SimplePopup.h"
#include "DeckMenu.h"
#include "Tasks.h"
#include "MTGDeck.h"
#include "GameObserver.h"
#ifdef AI_CHANGE_TESTING
@@ -135,7 +136,7 @@ public:
void leaveOutAIvsAIMatches();
void updateScoreforTournament();
int getHardRandomDeck();
int getRandomDeck(bool noEasyDecks);
int getRandomDeck(bool noEasyDecks, GameType type);
int remainingDecksToNextStage();
private:
bool mCompetition;
@@ -186,6 +187,7 @@ private:
DeckMenu * deckmenu;
DeckMenu * opponentMenu;
SimpleMenu * menu;
TaskList * taskList;
SimplePopup * popupScreen; // used for informational screens, modal
static int selectedPlayerDeckId;
static int selectedAIDeckId;
@@ -255,6 +257,7 @@ public:
MENUITEM_RANDOM_AI = kRandomAIPlayerMenuID,
MENUITEM_MAIN_MENU = -13,
MENUITEM_EVIL_TWIN = kEvilTwinMenuID,
MENUITEM_COMMANDER = kCommanderMenuID,
MENUITEM_MULLIGAN = -15,
MENUITEM_UNDO = -16,
#ifdef TESTSUITE
@@ -278,6 +281,10 @@ public:
MENUITEM_FILL_NEXT_STAGE_HARD = -30,
MENUITEM_FILL_NEXT_STAGE = -31,
/////// End Tournament Mod ///////////
MENUITEM_TOGGLEATTACK_ALL_CREATURES = -32,
MENUITEM_TASKBOARD = -33,
MENUITEM_TOGGLE_SELECT_ALL = -34,
MENUITEM_CONFIRM_SELECT_ALL = -35,
MENUITEM_MORE_INFO = kInfoMenuID
};

View File

@@ -8,6 +8,8 @@ class GuiGraveyard;
class GuiLibrary;
class GuiOpponentHand;
class GuiExile;
class GuiCommandZone;
class GuiSideboard;
class GuiAvatars: public GuiLayer
{
protected:
@@ -16,6 +18,8 @@ protected:
GuiLibrary* selfLibrary, *opponentLibrary;
GuiOpponentHand *opponentHand;
GuiExile* selfExile, *opponentExile;
GuiCommandZone* selfCommandZone, *opponentCommandZone;
GuiSideboard* selfSideboard;
GuiAvatar* active;
public:

View File

@@ -98,4 +98,24 @@ public:
virtual ostream& toString(ostream& out) const;
};
class GuiCommandZone: public GuiGameZone
{
public:
Player * player;
GuiCommandZone(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
int receiveEventPlus(WEvent*);
int receiveEventMinus(WEvent*);
virtual ostream& toString(ostream& out) const;
};
class GuiSideboard: public GuiGameZone
{
public:
Player * player;
GuiSideboard(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
int receiveEventPlus(WEvent*);
int receiveEventMinus(WEvent*);
virtual ostream& toString(ostream& out) const;
};
#endif // _GUISTATIC_H_

View File

@@ -176,6 +176,7 @@ public:
virtual ostream& toString(ostream& out) const;
virtual int addToGame();
virtual int removeFromGame();
static vector<void *> deletedpointers;
/*Poor man's casting */
/* Todo replace that crap with dynamic casting */

View File

@@ -62,12 +62,15 @@ public:
int frozen;
int sunburst;
int equipment;
int mutation;
int damageInflictedAsCommander;
int numofcastfromcommandzone;
int auras;
bool wasDealtDamage;
bool combatdamageToOpponent;
bool damageToOpponent;
bool damageToController;
bool damageToCreature;
int wasDealtDamage;
int combatdamageToOpponent;
int damageToOpponent;
int damageToController;
int damageToCreature;
bool isProvoked;
MTGCardInstance * ProvokeTarget;
MTGCardInstance * Provoker;
@@ -93,7 +96,7 @@ public:
bool exerted;
bool turningOver;
bool isMorphed;
bool isFlipped;
int isFlipped;
string MeldedFrom;
bool isPhased;
bool isCascaded;
@@ -101,6 +104,7 @@ public:
bool handEffects;
bool graveEffects;
bool exileEffects;
bool commandZoneEffects;
bool suspended;
bool miracle;
bool hasCopiedToken;
@@ -108,8 +112,14 @@ public:
bool isFacedown;
int chooseacolor;
string chooseasubtype;
string chooseaname;
int coinSide;//1 = tails
int lastFlipResult;
int dieSide;
int lastRollResult;
int dieNumFaces;
int scryedCards;
int stillInUse();
int didattacked;
int didblocked;
@@ -239,9 +249,10 @@ public:
int removeCantBeBlockerOfCard(MTGCardInstance * card, int erase = 0);
int cantBeBlockerOfCard(MTGCardInstance * card);
void copy(MTGCardInstance * card);
void copy(MTGCardInstance * card, bool nolegend = false);
void setUntapping();
void resetUntapping(); // Fix to avoid the untap on frozen card by clicking on them after the untap phase.
int isUntapping();
int isTapped();
void untap();
@@ -286,7 +297,8 @@ public:
ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost, ManaCost * refCost,bool noTrinisphere = false, bool bestow = false);
int countTrini;
bool anymanareplacement;
vector<MTGCardInstance*>imprintedCards;
vector<MTGCardInstance*> imprintedCards;
MTGCardInstance* hauntedCard;
int attackCost;
int attackCostBackup;
int attackPlaneswalkerCost;
@@ -298,6 +310,7 @@ public:
int imprintR;
int imprintB;
int imprintW;
int foretellTurn;
int bushidoPoints;
int modularPoints;
int canproduceMana(int color = -1);

View File

@@ -23,8 +23,10 @@ public:
string id; //Short name: 10E, RAV, etc. Automatic from folder.
string author; //Author of set, for crediting mod makers, etc.
string name; //Long name: Tenth Edition
int block; //For future use by tournament mode, etc.
string orderindex; //Order index for sorting sets: BEG-1.POR
string date; //The full release date of the set.
int year; //The year the set was released.
int block; //For future use by tournament mode, etc.
int total;//total cards
//TODO Way to group cards by name, rather than mtgid.
@@ -32,6 +34,8 @@ public:
int totalCards();
string getName();
string getOrderIndex();
string getDate();
string getBlock();
void processConfLine(string line);
@@ -117,6 +121,7 @@ public:
vector<int> ids;
map<int, MTGCard *> collection;
map<string, CardPrimitive *> primitives;
map<string, bool> limitedCardsMap; //used by parser in case of limited card list
MTGCard * _(int id);
MTGCard * getCardById(int id);
@@ -213,8 +218,11 @@ public:
map<int, int> cards;
string meta_desc;
string meta_name;
bool meta_commander;
vector<string> meta_AIHints;
vector<string> Sideboard;
vector<string> CommandZone;
vector<string> DungeonZone;
string meta_unlockRequirements;
int meta_id;
@@ -232,6 +240,8 @@ public:
int add(MTGCard * card);
int remove(MTGCard * card);
void replaceSB(vector<string> newSB = vector<string>());
void replaceCMD(vector<string> newCMD = vector<string>());
void replaceDNG(vector<string> newDNG = vector<string>());
string getFilename();
int save();
int save(const string& destFileName, bool useExpandedDescriptions, const string& deckTitle, const string& deckDesc);

View File

@@ -15,10 +15,15 @@ typedef enum
GAME_TYPE_MOMIR,
GAME_TYPE_RANDOM1,
GAME_TYPE_RANDOM2,
GAME_TYPE_RANDOM3,
GAME_TYPE_RANDOM5,
GAME_TYPE_HORDE,
GAME_TYPE_SET_LIMITED,
GAME_TYPE_STORY,
GAME_TYPE_DEMO,
GAME_TYPE_STONEHEWER,
GAME_TYPE_HERMIT,
GAME_TYPE_COMMANDER,
#ifdef NETWORK_SUPPORT
GAME_TYPE_SLAVE,
@@ -277,7 +282,63 @@ class Constants
TOTEMARMOR = 155,
DISCARDTOPLAYBYOPPONENT = 156,
MODULAR = 157,
NB_BASIC_ABILITIES = 158,
MUTATE = 158,
ADVENTURE = 159,
MENTOR = 160,
PROWESS = 161,
NOFIZZLEALTERNATIVE = 162,
HASOTHERKICKER = 163,
PARTNER = 164,
CANBECOMMANDER = 165,
ISCOMMANDER = 166,
THREEBLOCKERS = 167,
HANDDEATH = 168,
INPLAYDEATH = 169,
INPLAYTAPDEATH = 170,
GAINEDEXILEDEATH = 171,
GAINEDHANDDEATH = 172,
CYCLING = 173,
FORETELL = 174,
ANYTYPEOFMANAABILITY = 175,
BOAST = 176,
TWOBOAST = 177,
REPLACESCRY = 178,
HASNOKICKER = 179,
UNDAMAGEABLE = 180,
LIFEFAKER = 181,
DOUBLEFACEDEATH = 182,
GAINEDDOUBLEFACEDEATH = 183,
TWODNGTRG = 184,
NODNGOPP = 185,
NODNGPLR = 186,
CANPLAYAURAEQUIPTOPLIBRARY = 187,//aurasequipment
COUNTERDEATH = 188,
DUNGEONCOMPLETED = 189,
PERPETUALLIFELINK = 190,
PERPETUALDEATHTOUCH = 191,
NONCOMBATVIGOR = 192,
NOMOVETRIGGER = 193,
WASCOMMANDER = 194,
SHOWOPPONENTHAND = 195,
SHOWCONTROLLERHAND = 196,
HASREPLICATE = 197,
ISPREY = 198,
HASDISTURB = 199,
DAYBOUND = 200,
NIGHTBOUND = 201,
DECAYED = 202,
HASSTRIVE = 203,
ISCONSPIRACY = 204,
HASAFTERMATH = 205,
NOENTERTRG = 206,
NODIETRG = 207,
TRAINING = 208,
ENERGYSHROUD = 209,
EXPSHROUD = 210,
COUNTERSHROUD = 211,
NONIGHT = 212,
NODAMAGEREMOVED = 213,
NB_BASIC_ABILITIES = 214,
RARITY_S = 'S', //Special Rarity
RARITY_M = 'M', //Mythics
@@ -314,6 +375,10 @@ class Constants
GRADE_UNSUPPORTED = 4,
GRADE_DANGEROUS = 5,
BY_SECTOR=0,
BY_NAME=1,
BY_DATE=2,
ASKIP_NONE=0,
ASKIP_SAFE=1,
ASKIP_FULL=2,

View File

@@ -87,6 +87,22 @@ class MTGGameZone {
SIDEBOARD = 85,
OWNER_SIDEBOARD = 86,
TARGETED_PLAYER_SIDEBOARD = 87,
MY_COMMANDZONE = 88,
OPPONENT_COMMANDZONE = 89,
TARGET_OWNER_COMMANDZONE = 90,
TARGET_CONTROLLER_COMMANDZONE = 91,
COMMANDZONE = 92,
OWNER_COMMANDZONE = 93,
TARGETED_PLAYER_COMMANDZONE = 94,
MY_TEMP = 95,
OPPONENT_TEMP = 96,
TARGET_OWNER_TEMP = 97,
TARGET_CONTROLLER_TEMP = 98,
TEMP = 99,
OWNER_TEMP = 100,
TARGETED_PLAYER_TEMP = 101,
};
Player * owner;
@@ -214,6 +230,7 @@ public:
MTGGameZone * garbageLastTurn;
MTGGameZone * reveal;
MTGGameZone * sideboard;
MTGGameZone * commandzone;
MTGGameZone * temp;
MTGPlayerCards();
@@ -221,7 +238,7 @@ public:
MTGPlayerCards(MTGDeck * deck);
~MTGPlayerCards();
void initGame(int shuffle = 1, int draw = 1);
void OptimizedHand(Player * who,int amount = 7,int lands = 3,int creatures = 0,int othercards = 4);
void OptimizedHand(Player * who,int amount = 7,int lands = 3,int creatures = 0,int othercards = 4);
void setOwner(Player * player);
void discardRandom(MTGGameZone * from,MTGCardInstance * source);
void drawFromLibrary();
@@ -233,6 +250,7 @@ public:
MTGCardInstance * putInExile(MTGCardInstance * card);
MTGCardInstance * putInLibrary(MTGCardInstance * card);
MTGCardInstance * putInHand(MTGCardInstance * card);
MTGCardInstance * putInSideboard(MTGCardInstance * card);
MTGCardInstance * putInZone(MTGCardInstance * card, MTGGameZone * from, MTGGameZone * to, bool asCopy = false);
int isInPlay(MTGCardInstance * card);
int isInGrave(MTGCardInstance * card);

View File

@@ -94,10 +94,13 @@ class MTGKickerRule: public MTGPutInPlayRule
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
string alternativeName;
virtual ostream& toString(ostream& out) const;
MTGKickerRule(GameObserver* observer, int _id);
const string getMenuText()
{
if(alternativeName.size())
return alternativeName.c_str();
return "Pay Kicker";
}
virtual MTGKickerRule * clone() const;
@@ -172,10 +175,13 @@ class MTGRetraceRule: public MTGAlternativeCostRule
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
string alternativeName;
virtual ostream& toString(ostream& out) const;
MTGRetraceRule(GameObserver* observer, int _id);
const string getMenuText()
{
if(alternativeName.size())
return alternativeName.c_str();
return "Retrace";
}
virtual MTGRetraceRule * clone() const;

View File

@@ -137,7 +137,7 @@ public:
int pay (ManaCost * _cost);
//return 1 if _cost can be paid with current data, 0 otherwise
int canAfford(ManaCost * _cost);
int canAfford(ManaCost * _cost, int anytypeofmana);
int isPositive();
ManaCost * Diff(ManaCost * _cost);

View File

@@ -11,6 +11,8 @@
#define GUI_LIBRARY 4
#define GUI_OPPONENTHAND 5
#define GUI_EXILE 6
#define GUI_COMMANDZONE 7
#define GUI_SIDEBOARD 8
#include <JGui.h>
#include "WEvent.h"

View File

@@ -43,11 +43,20 @@ public:
int extraTurn;
int drawCounter;
int energyCount;
int experienceCount;
int yidaroCount;
int dungeonCompleted;
int numOfCommandCast;
int monarch;
int surveilOffset;
int devotionOffset;
int lastShuffleTurn;
int epic;
int forcefield;
int dealsdamagebycombat;
int initLife;
int raidcount;
int cycledCount;
int handmodifier;
int snowManaG;
int snowManaR;
@@ -55,6 +64,7 @@ public:
int snowManaU;
int snowManaW;
int snowManaC;
string lastChosenName;
vector<string> prowledTypes;
vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
@@ -69,9 +79,10 @@ public:
int afterDamage();
int gainLife(int value);
int loseLife(int value);
int gainOrLoseLife(int value);
// Added source of life gain/loss in order to check later a possible exception.
int gainLife(int value, MTGCardInstance* source);
int loseLife(int value, MTGCardInstance* source);
int gainOrLoseLife(int value, MTGCardInstance* source);
bool isPoisoned() {return (poisonCount > 0);}
int poisoned();

View File

@@ -42,6 +42,10 @@ class Rules
protected:
Player * loadPlayerMomir(GameObserver* observer, int isAI);
Player * loadPlayerRandom(GameObserver* observer, int isAI, int mode);
Player * loadPlayerRandomThree(GameObserver* observer, int isAI);
Player * loadPlayerRandomFive(GameObserver* observer, int isAI);
Player * loadPlayerHorde(GameObserver* observer, int isAI);
Player * loadRandomSetLimited(GameObserver* observer, int isAI);
Player * initPlayer(GameObserver *observer, int playerId);
MTGDeck * buildDeck(int playerId);
GameType strToGameMode(string s);

View File

@@ -30,7 +30,10 @@ public:
TYPE_PLANE = 15,
TYPE_SCHEME = 16,
TYPE_VANGUARD = 17,
LAST_TYPE = TYPE_VANGUARD,
TYPE_DUNGEON = 18,
TYPE_EMBLEM = 19,
TYPE_CONSPIRACY = 20,
LAST_TYPE = TYPE_CONSPIRACY,
};
protected:

View File

@@ -44,6 +44,7 @@ public:
MTGCardInstance * targetter; //Optional, usually equals source, used for protection from...
int maxtargets;
bool done;
bool autoChoice; // added to allow choice from game menu.
bool targetMin;
bool validTargetsExist(int maxTarget = 1);
int attemptsToFill;
@@ -153,13 +154,13 @@ class DamageableTargetChooser: public TypeTargetChooser
{
public:
bool withoutProtections;
DamageableTargetChooser(GameObserver *observer, int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false) :
TypeTargetChooser(observer, "creature",_zones, _nbzones, card, _maxtargets, other, targetMin)
DamageableTargetChooser(GameObserver *observer, int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false, string type = "creature") :
TypeTargetChooser(observer, type.c_str(),_zones, _nbzones, card, _maxtargets, other, targetMin)
{
}
;
DamageableTargetChooser(GameObserver *observer, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false) :
TypeTargetChooser(observer, "creature", card, _maxtargets, other, targetMin)
DamageableTargetChooser(GameObserver *observer, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false, string type = "creature") :
TypeTargetChooser(observer, type.c_str(), card, _maxtargets, other, targetMin)
{
}
;
@@ -397,4 +398,24 @@ public:
virtual bool equals(TargetChooser * tc);
~TotemChooser();
};
class EqpChooser: public TypeTargetChooser
{
public:
bool withoutProtections;
EqpChooser(GameObserver *observer, int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false) :
TypeTargetChooser(observer, "*",_zones, _nbzones, card, _maxtargets, other, targetMin)
{
}
;
EqpChooser(GameObserver *observer, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false,bool targetMin = false) :
TypeTargetChooser(observer, "*", card, _maxtargets, other,targetMin)
{
}
;
virtual bool canTarget(Targetable * target, bool withoutProtections = false);
virtual EqpChooser * clone() const;
virtual bool equals(TargetChooser * tc);
~EqpChooser();
};
#endif

View File

@@ -77,6 +77,14 @@ class ThisOpponentlife:public ThisDescriptor{
ThisOpponentlife * clone() const;
};
class ThisMutation:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);
ThisMutation(int mutation);
ThisMutation * clone() const;
};
class ThisEquip:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);

View File

@@ -63,15 +63,17 @@ struct WEventCounters : public WEvent {
int toughness;
bool added;
bool removed;
WEventCounters(Counters *counter,string name,int power, int toughness,bool added = false, bool removed = false);
MTGCardInstance * source;
WEventCounters(Counters *counter,string name,int power, int toughness,bool added = false, bool removed = false, MTGCardInstance * source = NULL);
using WEvent::getTarget;
virtual Targetable * getTarget();
virtual Targetable * getTarget(int target);
};
struct WEventLife : public WEvent {
Player * player;
int amount;
WEventLife(Player * player,int amount);
MTGCardInstance * source;
WEventLife(Player * player, int amount, MTGCardInstance * source);
virtual Targetable * getTarget(int target);
};
@@ -193,6 +195,13 @@ struct WEventCardSacrifice : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//event when card is exploited.
struct WEventCardExploited : public WEventCardUpdate {
MTGCardInstance * cardAfter;
WEventCardExploited(MTGCardInstance * card,MTGCardInstance * afterCard);
virtual Targetable * getTarget(int target);
};
//event when card is discarded.
struct WEventCardDiscard : public WEventCardUpdate {
WEventCardDiscard(MTGCardInstance * card);
@@ -341,15 +350,119 @@ struct WEventCardCopiedACard : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//alterenergy event
struct WEventplayerEnergized : public WEvent {
WEventplayerEnergized(Player * player,int nb_count);
//alterpoison event
struct WEventplayerPoisoned : public WEvent {
WEventplayerPoisoned(Player * player, int nb_count);
Player * player;
int nb_count;
using WEvent::getTarget;
virtual Targetable * getTarget(Player * player);
};
//alterenergy event
struct WEventplayerEnergized : public WEvent {
WEventplayerEnergized(Player * player, int nb_count);
Player * player;
int nb_count;
using WEvent::getTarget;
virtual Targetable * getTarget(Player * player);
};
//alterexperience event
struct WEventplayerExperienced : public WEvent {
WEventplayerExperienced(Player * player, int nb_count);
Player * player;
int nb_count;
using WEvent::getTarget;
virtual Targetable * getTarget(Player * player);
};
//monarch event
struct WEventplayerMonarch : public WEvent {
WEventplayerMonarch(Player * player);
Player * player;
using WEvent::getTarget;
virtual Targetable * getTarget(Player * player);
};
//shuffle event
struct WEventplayerShuffled : public WEvent {
WEventplayerShuffled(Player * player);
Player * player;
using WEvent::getTarget;
virtual Targetable * getTarget(Player * player);
};
//boast event
struct WEventCardBoasted : public WEventCardUpdate {
WEventCardBoasted(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//surveil event
struct WEventCardSurveiled : public WEventCardUpdate {
WEventCardSurveiled(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//foretell event
struct WEventCardForetold : public WEventCardUpdate {
WEventCardForetold(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//training event
struct WEventCardTrained : public WEventCardUpdate {
WEventCardTrained(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//scry event
struct WEventCardScryed : public WEventCardUpdate {
WEventCardScryed(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//explores event
struct WEventCardExplored : public WEventCardUpdate {
WEventCardExplored(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//dungeon completed event
struct WEventCardDungeonCompleted : public WEventCardUpdate {
int totaldng;
string playerName;
WEventCardDungeonCompleted(MTGCardInstance * card, int totaldng, string playerName);
virtual Targetable * getTarget(int target);
};
//roll die event
struct WEventCardRollDie : public WEventCardUpdate {
string playerName;
WEventCardRollDie(MTGCardInstance * card, string playerName);
virtual Targetable * getTarget(int target);
};
//flip coin event
struct WEventCardFlipCoin : public WEventCardUpdate {
string playerName;
WEventCardFlipCoin(MTGCardInstance * card, string playerName);
virtual Targetable * getTarget(int target);
};
//mutation event
struct WEventCardMutated : public WEventCardUpdate {
WEventCardMutated(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//token creation event
struct WEventTokenCreated : public WEventCardUpdate {
WEventTokenCreated(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
std::ostream& operator<<(std::ostream&, const WEvent&);
#endif

View File

@@ -288,6 +288,29 @@ protected:
int color;
};
/**
Matches a card that does not contain a particular color (inclusively).
*/
class WCFilterNotColor: public WCardFilter
{
public:
WCFilterNotColor(int _c)
{
color = _c;
}
;
WCFilterNotColor(string arg);
bool isMatch(MTGCard * c);
string getCode();
float filterFee()
{
return 0.2f;
}
;
protected:
int color;
};
/**
Matches a card that is a particular color (exclusively).
*/

View File

@@ -0,0 +1,36 @@
class WParsedInt
{
private:
void init(string s, Spell * spell, MTGCardInstance * card);
void extendedParse(string type, Spell * spell, MTGCardInstance * card);
public:
int intValue;
int getValue();
string getStringValue();
int computeX(Spell * spell, MTGCardInstance * card);
int countDevotionTo(MTGCardInstance * card, MTGGameZone * zone, int color1, int color2);
int countCardNameinZone(string name, MTGGameZone * zone);
int countCardsInPlaybyColor(int color, GameObserver * observer);
int mostCommonColor(int color, MTGCardInstance * card);
int countCardTypeinZone(string type, MTGGameZone * zone);
int cardHasTypeinZone(const char * type, MTGGameZone * zone);
int countCanTargetby(string type, MTGCardInstance * card, Player * player);
int countManaProducedby(int color, MTGCardInstance * target, Player * player);
WParsedInt(int value = 0);
WParsedInt(string s, Spell * spell, MTGCardInstance * card);
WParsedInt(string s, MTGCardInstance * card);
};
class WParsedPT
{
public:
bool ok;
WParsedInt power, toughness;
WParsedPT(int p, int t);
WParsedPT(string s, Spell * spell, MTGCardInstance * card);
};

View File

@@ -4,6 +4,7 @@ This file was auto-generated by ant build script on Sat, 26-Oct-2013 23::59:07
To make changes please edit the ant build script, otherwise your changes will be lost
Author: Michael Nguyen
Mod by: Vitty85
*/
@@ -12,7 +13,7 @@ Author: Michael Nguyen
/* Wagic versions */
#define WAGIC_VERSION_MAJOR 0
#define WAGIC_VERSION_MEDIUM 20
#define WAGIC_VERSION_MEDIUM 23
#define WAGIC_VERSION_MINOR 1
#define VERSION_DOT(a, b, c) a ##.## b ##.## c
@@ -26,8 +27,8 @@ Author: Michael Nguyen
#define WAGIC_RESOURCE_VERSION VERSION_FILE(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
#define WAGIC_VERSION_STRING VERSION_STRINGIFY(WAGIC_VERSION)
#define WAGIC_CORE_VERSION_STRING "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION)
#define WAGIC_RESOURCE_NAME "Wagic-core.zip"
#define WAGIC_RELEASE_NAME "latest-master"
#define WAGIC_RESOURCE_NAME "Wagic-core-" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION) ".zip"
#define WAGIC_RELEASE_NAME "wagic-v" WAGIC_VERSION_STRING
#define WAGIC_RESOURCE_URL "https://github.com/WagicProject/wagic/releases/download/" WAGIC_RELEASE_NAME "/" WAGIC_RESOURCE_NAME
#endif