Merge branch 'master' of https://github.com/WagicProject/wagic into cmake

This commit is contained in:
xawotihs
2017-09-02 21:15:47 +02:00
541 changed files with 95355 additions and 35840 deletions

View File

@@ -45,6 +45,8 @@ public:
// Functions depending on the type of Ability
int getEfficiency(AADamager * aad);
int getRevealedEfficiency(MTGAbility * ability);
};
// compares Abilities efficiency
@@ -108,6 +110,7 @@ class AIPlayerBaka: public AIPlayer{
virtual int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0);
virtual ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
virtual int selectAbility();
virtual int doAbility(MTGAbility * Specific = NULL, MTGCardInstance * withCard = NULL);
public:
enum {

View File

@@ -77,7 +77,7 @@ public:
}
virtual const string getDisplayName() const;
void Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad = false);
void Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad = false, int aType = 0, vector<JQuadPtr> targetIcons = vector<JQuadPtr>());
virtual int receiveEvent(WEvent *)
{
@@ -230,7 +230,7 @@ public:
Player * askIfWishesToInterrupt;
int garbageCollect();
int addAction(Interruptible * interruptible);
Spell * addSpell(MTGCardInstance* card, TargetChooser * tc, ManaCost * mana, int payResult, int storm);
Spell * addSpell(MTGCardInstance* card, TargetChooser * tc, ManaCost * mana, int payResult, int storm, bool forcedinterrupt = false);
int AddNextGamePhase();
int AddNextCombatStep();
int addPutInGraveyard(MTGCardInstance * card);

File diff suppressed because it is too large Load Diff

View File

@@ -39,11 +39,14 @@ class CardDescriptor: public MTGCardInstance
int manacostComparisonMode;
int counterComparisonMode;
int convertedManacost; // might fit better into MTGCardInstance?
int zposComparisonMode;
int zposition;
int anyCounter;
int init();
CardDescriptor();
void unsecureSetTapped(int i);
void unsecuresetfresh(int k);
void unsecuresetrecent(int j);
void setisMultiColored(int w);
void setNegativeSubtype( string value);
int counterPower;
@@ -65,6 +68,15 @@ class CardDescriptor: public MTGCardInstance
int CDopponentDamaged;
int CDcontrollerDamaged;
int CDdamager;
int CDgeared;
int CDblocked;
int CDcanProduceC;
int CDcanProduceG;
int CDcanProduceU;
int CDcanProduceR;
int CDcanProduceB;
int CDcanProduceW;
int CDnocolor;
};
#endif

View File

@@ -23,7 +23,7 @@ public:
void rotateRight();
bool CheckUserInput(JButton key);
virtual void Update(float dt);
void Render();
void Render(bool norect = false);
void init(MTGGameZone * zone);
virtual ostream& toString(ostream& out) const;
};

View File

@@ -33,7 +33,7 @@ protected:
/*
** Tries to render the Big version of a card picture, backups to text version in case of failure
*/
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false);
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false, bool gdv = false);
static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal);
static void AlternateRender(MTGCard * card, const Pos& pos);
@@ -55,8 +55,8 @@ public:
virtual void Render();
virtual void Update(float dt);
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false);
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false);
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool gdv = false);
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool gdv = false);
static JQuadPtr AlternateThumbQuad(MTGCard * card);
virtual ostream& toString(ostream&) const;

View File

@@ -58,7 +58,6 @@ public:
uint8_t colors;
typedef std::bitset<Constants::NB_BASIC_ABILITIES> BasicAbilitiesSet;
BasicAbilitiesSet basicAbilities;
BasicAbilitiesSet origbasicAbilities;
BasicAbilitiesSet LKIbasicAbilities;
map<string,string> magicTexts;
@@ -69,6 +68,21 @@ public:
int toughness;
int suspendedTime;
int dredgeAmount;
string doubleFaced;
void setdoubleFaced(const string& value);
const string& getdoubleFaced() const;
string AICustomCode;
void setAICustomCode(const string& value);
const string& getAICustomCode() const;
string CrewAbility;
void setCrewAbility(const string& value);
const string& getCrewAbility() const;
string PhasedOutAbility;
void setPhasedOutAbility(const string& value);
const string& getPhasedOutAbility() const;
string ModularValue;
void setModularValue(const string& value);
const string& getModularValue() const;
vector<int>types;
CardPrimitive();
@@ -87,7 +101,7 @@ public:
int has(int ability);
void setText(const string& value);
const vector<string>& getFormattedText();
const vector<string>& getFormattedText(bool noremove = false);
void addMagicText(string value);
void addMagicText(string value, string zone);
@@ -112,6 +126,8 @@ public:
bool isCreature();
bool isLand();
bool isSpell();
bool isPermanent();
bool isSorceryorInstant();
int dredge();
void setPower(int _power);
int getPower();

View File

@@ -24,14 +24,16 @@ public:
int handsize;
int poisonCount;
int damageCount;
int nonCombatDamage;
int preventable;
int thatmuch;
int lifeLostThisTurn;
int lifeGainedThisTurn;
DamageableType type_as_damageable;
Damageable(GameObserver* observer, int _life)
: Targetable(observer), life(_life), handsize(0),
poisonCount(0), damageCount(0), preventable(0), thatmuch(0),
lifeLostThisTurn(0), type_as_damageable(DAMAGEABLE_MTGCARDINSTANCE)
lifeLostThisTurn(0), lifeGainedThisTurn(0), type_as_damageable(DAMAGEABLE_MTGCARDINSTANCE)
{}
int getLife(){return life;}
virtual int dealDamage(int damage){life-=damage;return life;}

View File

@@ -207,7 +207,7 @@ protected:
*
* \see mCards
*/
void renderCard(int index, int alpha, bool asThumbnail = false);
void renderCard(int index, int alpha, bool asThumbnail = false, bool griddeckview = false);
/*! \brief Returns the index in mCards of the card that is nearest to the given point
*

View File

@@ -183,6 +183,15 @@ public:
virtual int doPay();
};
//Sacrifice all Lands cost
class SacLandsCost : public ExtraCost
{
public:
SacLandsCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual SacLandsCost * clone() const;
};
//unattach cost
class UnattachCost : public ExtraCost
{
@@ -216,6 +225,19 @@ public:
virtual SnowCost * clone() const;
};
//Energy cost
class EnergyCost : public ExtraCost
{
private:
int enc;
public:
EnergyCost(int enc = 0);
virtual int canPay();
virtual int doPay();
virtual EnergyCost * clone() const;
};
//untap cost
class UnTapCost : public ExtraCost
{
@@ -231,7 +253,8 @@ public:
class TapTargetCost : public ExtraCost
{
public:
TapTargetCost(TargetChooser *_tc = NULL);
bool crew;
TapTargetCost(TargetChooser *_tc = NULL, bool crew = false);
virtual int isPaymentSet();
virtual int doPay();
virtual TapTargetCost * clone() const;
@@ -274,12 +297,43 @@ public:
virtual int doPay();
virtual Ninja * clone() const;
};
//Convoke
class Convoke : public ExtraCost
{
public:
ManaCost * getReduction();
Convoke(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int isPaymentSet();
virtual int doPay();
virtual Convoke * clone() const;
};
//delve
class Delve : public ExtraCost
{
public:
Delve(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int isPaymentSet();
virtual int doPay();
virtual Delve * clone() const;
};
//improvise
class Improvise : public ExtraCost
{
public:
Improvise(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int isPaymentSet();
virtual int doPay();
virtual Improvise * clone() const;
};
//offering cost
class Offering : public ExtraCost
{
public:
Offering(TargetChooser *_tc = NULL);
bool emerge;
Offering(TargetChooser *_tc = NULL, bool emerge = false);
virtual int canPay();
virtual int isPaymentSet();
virtual int doPay();

View File

@@ -74,6 +74,7 @@ public:
static bool HasMusic;
static string systemError;
static char mynbcardsStr[512];
static int mycredits;
static JMusic* music;
static string currentMusicFile;
static void playMusic(string filename = "", bool loop = true);

View File

@@ -81,6 +81,7 @@ class GameObserver{
int oldGamePhase;
TargetChooser * targetChooser;
CardDisplay * OpenedDisplay;
GuiGameZone * guiOpenDisplay;
DuelLayers * mLayers;
ReplacementEffects *replacementEffects;
vector<Player *> players; //created outside
@@ -123,6 +124,7 @@ class GameObserver{
void gameStateBasedEffects();
void enchantmentStatus();
void Affinity();
bool AffinityNeedsUpdate;
void addObserver(MTGAbility * observer);
bool removeObserver(ActionElement * observer);
void startGame(GameType, Rules * rules);
@@ -131,6 +133,8 @@ class GameObserver{
int isInPlay(MTGCardInstance * card);
int isInGrave(MTGCardInstance * card);
int isInExile(MTGCardInstance * card);
int isInHand(MTGCardInstance * card);
int isInLibrary(MTGCardInstance * card);
virtual void Update(float dt);
void Render();
void ButtonPressed(PlayGuiObject*);
@@ -138,6 +142,7 @@ class GameObserver{
int receiveEvent(WEvent * event);
bool connectRule;
bool LPWeffect;
void logAction(Player* player, const string& s="");
void logAction(int playerId, const string& s="") {

View File

@@ -44,6 +44,10 @@ public:
CHEATMODE,
OPTIMIZE_HAND,
CHEATMODEAIDECK,
BLKBORDER,
SHOWTOKENS,
GDVLARGEIMAGE,
CARDPREFETCHING,
OSD,
CLOSEDHAND,
HANDDIRECTION,

View File

@@ -29,7 +29,11 @@ enum
MENU_DECK_SELECTION = 10,
MENU_DECK_BUILDER = 11,
MENU_FIRST_DUEL_SUBMENU = 102,
MENU_LANGUAGE_SELECTION = 103
MENU_LANGUAGE_SELECTION = 103,
SBMENU_CHOICE = 802,
SBMENU_ADD_NORMAL = 803,
SBMENU_ADD_SB = 804,
SBMENU_ADD_CANCEL = 805
};
// enums for menu options
@@ -71,18 +75,20 @@ private:
DeckViewerStages mStage;
JMusic * bgMusic;
InteractiveButton *toggleDeckButton, *sellCardButton, *statsPrevButton, *filterButton, *toggleViewButton;
InteractiveButton *toggleDeckButton, *sbButton, *sellCardButton, *statsPrevButton, *filterButton, *toggleViewButton, *toggleUpButton, *toggleDownButton, *toggleLeftButton, *toggleRightButton;
WGuiFilters * filterMenu;
WSrcDeckViewer * source;
DeckEditorMenu * welcome_menu;
SimpleMenu * subMenu;
SimpleMenu * sbMenu;
DeckEditorMenu * deckMenu;
PriceList* pricelist;
PlayerData * playerdata;
DeckDataWrapper * myDeck;
DeckDataWrapper * myCollection;
DeckDataWrapper * mySideboard;
StatsWrapper * mStatsWrapper;
int hudAlpha;
@@ -105,6 +111,7 @@ private:
void RenderButtons();
void setupView(AvailableView view, DeckDataWrapper *deck);
void toggleView();
void insertSideBoard();
public:
GameStateDeckViewer(GameApp* parent);
virtual ~GameStateDeckViewer();
@@ -112,9 +119,12 @@ public:
void updateFilters();
void rebuildFilters();
void toggleCollection();
void toggleSideBoard();
void Start();
virtual void End();
void addRemove(MTGCard * card);
void SBaddRemove(MTGCard * card);
void choiceAddRemove(MTGCard * card);
virtual void Update(float dt);
void renderOnScreenBasicInfo();
void renderSlideBar();

View File

@@ -80,6 +80,7 @@ protected:
vector<CardView*> cards;
public:
int wave;
GuiPlay(DuelLayers*);
~GuiPlay();
virtual void Render();

View File

@@ -22,13 +22,18 @@ using std::string;
const int kDismissButtonId = 10000;
const int kToggleDeckActionId = 10001;
const int kSellCardActionId = 10002;
const int kMenuButtonId = 10003;
const int kFilterButtonId = 10004;
const int kNextStatsButtonId = 10005;
const int kPrevStatsButtonId = 10006;
const int kCycleCardsButtonId = 10007;
const int kShowCardListButtonId = 10008;
const int kSwitchViewButton = 10009;
const int kSBActionId = 10003;
const int kMenuButtonId = 10004;
const int kFilterButtonId = 10005;
const int kNextStatsButtonId = 10006;
const int kPrevStatsButtonId = 10007;
const int kCycleCardsButtonId = 10008;
const int kShowCardListButtonId = 10009;
const int kSwitchViewButton = 10010;
const int kToggleUpButton = 10011;
const int kToggleDownButton = 10012;
const int kToggleLeftButton = 10013;
const int kToggleRightButton = 10014;
class InteractiveButton: public SimpleButton
{

View File

@@ -121,7 +121,7 @@ public:
ManaCost* BuyBack;
ManaCost* FlashBack;
ManaCost* Retrace;
ManaCost* Bestow;
ManaCost* Bestow;
ManaCost* morph;
ManaCost* suspend;
@@ -219,6 +219,9 @@ public:
BESTOW_COST = 35,
ATTACK_COST = 36,
BLOCK_COST = 37,
GRANTEDFLASHBACK_COST = 38,
FORCED_TOKEN_CREATOR = 39,
HIDDENVIEW = 40,
};
};
@@ -424,6 +427,19 @@ public:
};
class TriggerRebound : public TriggerAtPhase
{
public:
int destroyActivated;
bool sourceUntapped;
bool sourceTap;
bool once,activeTrigger;
TriggerRebound(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,int _phaseId, int who = 0,bool sourceUntapped = false,bool sourceTap = false,bool once = false);
virtual TriggerRebound* clone() const;
virtual int testDestroy();
};
class GenericTriggeredAbility : public TriggeredAbility, public NestedAbility
{
@@ -522,6 +538,7 @@ protected:
Player * controller;
public:
MTGAbility * andAbility;
string menutext;
ManaCost * output;
int tap;

View File

@@ -55,6 +55,7 @@ public:
Pos* view;
int X;
int castX;
int setX;
int alternateCostPaid[ManaCost::MANA_PAID_WITH_BESTOW + 1];
int paymenttype;
int castMethod; /* Tells if the card reached its current zone by being cast or not (brought into the zone by an effect). non 0 == cast, 0 == not cast */
@@ -63,9 +64,13 @@ public:
int equipment;
int auras;
bool wasDealtDamage;
bool combatdamageToOpponent;
bool damageToOpponent;
bool damageToController;
bool damageToCreature;
bool isProvoked;
MTGCardInstance * ProvokeTarget;
MTGCardInstance * Provoker;
bool mPropertiesChangedSinceLastUpdate;
int reduxamount;
int flanked;
@@ -85,17 +90,22 @@ public:
bool blinked;
bool isExtraCostTarget;
bool morphed;
bool exerted;
bool turningOver;
bool isMorphed;
bool isFlipped;
string MeldedFrom;
bool isPhased;
bool isCascaded;
int phasedTurn;
bool handEffects;
bool graveEffects;
bool exileEffects;
bool suspended;
bool miracle;
bool isBestowed;
bool hasCopiedToken;
bool isBestowed;
bool isFacedown;
int chooseacolor;
string chooseasubtype;
int coinSide;//1 = tails
@@ -106,16 +116,24 @@ public:
int notblocked;
int fresh;
int MaxLevelUp;
int CountedObjects;
int CountedObjects;
int CountedObjectsB;
int kicked;
int dredge;
int zpos;
bool isDualWielding;
bool stillNeeded;
Player * discarderOwner;
Player * lastController;
Player * previousController;
MTGGameZone * getCurrentZone();
MTGGameZone * previousZone;
MTGCardInstance * tokCard;
MTGCardInstance * previous;
MTGCardInstance * next;
MTGCardInstance * auraParent;
MTGAbility * TokenAndAbility;
MTGAbility * GrantedAndAbility;
int doDamageTest;
bool skipDamageTestOnce;
int summoningSickness;
@@ -124,6 +142,7 @@ public:
ManaCost * getReducedManaCost();
ManaCost * getIncreasedManaCost();
bool matchesCastFilter(int castMethod);
bool hasTotemArmor();
// The recommended method to test for summoning Sickness !
int hasSummoningSickness();
@@ -151,22 +170,26 @@ public:
MTGCardInstance * defenser;
list<MTGCardInstance *>blockers;
int attacker;
int willattackplayer;
int willattackpw;
int toggleDefenser(MTGCardInstance * opponent);
int raiseBlockerRankOrder(MTGCardInstance * blocker);
//Returns rank of the card in blockers if it is a blocker of this (starting at 1), 0 otherwise
int getDefenserRank(MTGCardInstance * blocker);
int toggleAttacker();
int toggleAttacker(bool pw = false);
MTGCardInstance * banding; // If belongs to a band when attacking
int canBlock();
int canBlock(MTGCardInstance * opponent);
int canAttack();
int canAttack( bool pwcheck = false );
int isAttacker();
Targetable * isAttacking;
MTGCardInstance * storedCard;
MTGCardInstance * myPair;
MTGCardInstance * createSnapShot();
MTGCardInstance * storedSourceCard;
MTGCardInstance * shackled;
MTGCardInstance * seized;
MTGCardInstance * isDefenser();
int initAttackersDefensers();
MTGCardInstance * getNextOpponent(MTGCardInstance * previous=NULL);
@@ -184,8 +207,10 @@ public:
Player * controller();
virtual ~MTGCardInstance();
int bury();
int totem( bool noregen = false );
int toGrave( bool forced = false );
int destroy();
int destroyNoRegen();
int addToToughness(int value);
int setToughness(int value);
@@ -220,7 +245,7 @@ public:
int isUntapping();
int isTapped();
void untap();
void tap();
void tap(bool sendNoEvent = false);
void attemptUntap();
//cda and other func
@@ -240,6 +265,8 @@ public:
int getCurrentToughness();
int LKIpower;
int LKItoughness;
int countDuplicateCardNames();
int countDuplicateCardTypes();
void cdaPT(int p = 0, int t = 0);
bool isCDA;
void switchPT(bool apply = false);
@@ -250,15 +277,15 @@ public:
bool bypassTC;
bool discarded;
int copiedID;
int modifiedbAbi;
int copiedSetID;
bool canPlayFromLibrary();
bool StackIsEmptyandSorcerySpeed();
bool isTargetted();
int cardistargetted;
bool isTargetter();
int cardistargetter;
int forcedBorderA;
int forcedBorderB;
int myconvertedcost;
ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost, ManaCost * refCost,bool noTrinisphere = false);
ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost, ManaCost * refCost,bool noTrinisphere = false, bool bestow = false);
int countTrini;
bool anymanareplacement;
vector<MTGCardInstance*>imprintedCards;
int attackCost;
int attackCostBackup;
@@ -271,11 +298,15 @@ public:
int imprintR;
int imprintB;
int imprintW;
int bushidoPoints;
int modularPoints;
int canproduceMana(int color = -1);
int entersBattlefield;
string currentimprintName;
vector<string>imprintedNames;
MTGCardInstance * revealedLast;//last card revealed by a ability this card owns.
bool MadnessPlay;
MTGCardInstance * revealedLast;//last card revealed by a ability this card owns.
bool MadnessPlay;
void eventattacked();
void eventattackedAlone();
void eventattackednotblocked();

View File

@@ -214,6 +214,7 @@ public:
string meta_desc;
string meta_name;
vector<string> meta_AIHints;
vector<string> Sideboard;
string meta_unlockRequirements;
int meta_id;
@@ -230,6 +231,7 @@ public:
int removeAll();
int add(MTGCard * card);
int remove(MTGCard * card);
void replaceSB(vector<string> newSB = vector<string>());
string getFilename();
int save();
int save(const string& destFileName, bool useExpandedDescriptions, const string& deckTitle, const string& deckDesc);

View File

@@ -98,7 +98,7 @@ class Constants
MTG_COLOR_WHITE = 5,
MTG_COLOR_WASTE = 6,
MTG_COLOR_LAND = 7,
MTG_NB_COLORS = 8,
@@ -248,10 +248,36 @@ class Constants
CANTPAYLIFE = 126,
CANTBESACRIFIED = 127,
SKULK = 128,
MENACE = 129,
NOSOLO = 130,//cant attack alone
MUSTBLOCK = 131,//blocks each turn
NB_BASIC_ABILITIES = 132,
MENACE = 129,
NOSOLO = 130,//cant attack alone
MUSTBLOCK = 131,//blocks each turn
DETHRONE = 132,
OVERLOAD = 133,
SHACKLER = 134,
FLYERSONLY = 135,//can attack only if it has flying
TEMPFLASHBACK = 136,
NOLEGENDRULE =137,
CANTTRANSFORM =138,
ASFLASH =139,
CONDUITED = 140,
CANBLOCKTAPPED = 141,
OPPNOMAXHAND = 142,
CANTCREW = 143,
HIDDENFACE = 144,
ANYTYPEOFMANA = 145,
NECROED = 146,
CANTPWATTACK = 147,
CANPLAYFROMLIBRARYTOP = 148,//all
CANPLAYLANDTOPLIBRARY = 149,//land
CANPLAYCREATURETOPLIBRARY = 150,//creature
CANPLAYARTIFACTTOPLIBRARY = 151,//artifact
CANPLAYINSTANTSORCERYTOPLIBRARY = 152,//instantorsorcery
SHOWFROMTOPLIBRARY = 153,
SHOWOPPONENTTOPLIBRARY = 154,
TOTEMARMOR = 155,
DISCARDTOPLAYBYOPPONENT = 156,
MODULAR = 157,
NB_BASIC_ABILITIES = 158,
RARITY_S = 'S', //Special Rarity
RARITY_M = 'M', //Mythics
@@ -312,7 +338,7 @@ class Constants
CAST_WITH_RETRACE = 6,
CAST_WITH_MORPH = 7,
CAST_WITH_SUSPEND = 8,
CAST_WITH_BESTOW = 9,
CAST_WITH_BESTOW = 9,
CAST_ALTERNATE = -1, //matches all alternate costs, including itself
CAST_ALL = -2, // matches everything except NOT_CAST

View File

@@ -72,14 +72,21 @@ class MTGGameZone {
OWNER_STACK = 66,
TARGETED_PLAYER_STACK = 67,
MY_REVEAL = 71,
OPPONENT_REVEAL = 72,
TARGET_OWNER_REVEAL = 73,
TARGET_CONTROLLER_REVEAL = 74,
REVEAL = 75,
OWNER_REVEAL = 76,
TARGETED_PLAYER_REVEAL = 77,
MY_REVEAL = 71,
OPPONENT_REVEAL = 72,
TARGET_OWNER_REVEAL = 73,
TARGET_CONTROLLER_REVEAL = 74,
REVEAL = 75,
OWNER_REVEAL = 76,
TARGETED_PLAYER_REVEAL = 77,
MY_SIDEBOARD = 81,
OPPONENT_SIDEBOARD = 82,
TARGET_OWNER_SIDEBOARD = 83,
TARGET_CONTROLLER_SIDEBOARD = 84,
SIDEBOARD = 85,
OWNER_SIDEBOARD = 86,
TARGETED_PLAYER_SIDEBOARD = 87,
};
Player * owner;
@@ -102,7 +109,8 @@ class MTGGameZone {
size_t getIndex(MTGCardInstance * card);
void cleanupPhase();
void beforeBeginPhase();
unsigned int countByAlias(int number = 0);
unsigned int countByType(const string &value);
unsigned int countByCanTarget(TargetChooser * tc);
unsigned int countTotalManaSymbols(TargetChooser * tc, int color);
@@ -178,7 +186,9 @@ public:
void untapAll();
MTGCardInstance * getNextAttacker(MTGCardInstance * previous);
MTGCardInstance * getNextLurer(MTGCardInstance * previous);
MTGCardInstance * getNextProvoker(MTGCardInstance * previous, MTGCardInstance * source);
MTGCardInstance * findALurer();
MTGCardInstance * findAProvoker(MTGCardInstance * source);
virtual ostream& toString(ostream&) const;
const char * getName(){return "battlefield";}
};
@@ -202,7 +212,8 @@ public:
MTGRemovedFromGame * exile; //alias to removedFromZone
MTGGameZone * garbage;
MTGGameZone * garbageLastTurn;
MTGGameZone * reveal;
MTGGameZone * reveal;
MTGGameZone * sideboard;
MTGGameZone * temp;
MTGPlayerCards();

View File

@@ -58,6 +58,10 @@ public:
int Angel[2];
bool dragonbonusgranted[2];
int dragon[2];
bool eldrazibonusgranted[2];
int eldrazi[2];
bool werewolfbonusgranted[2];
int werewolf[2];
int receiveEvent(WEvent * event);
void grantAward(string awardName,int amount);
@@ -69,6 +73,8 @@ public:
class MTGPutInPlayRule: public PermanentAbility
{
protected:
string defaultPlayName;
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
@@ -76,8 +82,8 @@ public:
MTGPutInPlayRule(GameObserver* observer, int _id);
const string getMenuText()
{
if(game && game->gameType() == GAME_TYPE_MOMIR)
return "Play Land";
if(defaultPlayName.size())
return defaultPlayName.c_str();
return "Cast Card Normally";
}
virtual MTGPutInPlayRule * clone() const;
@@ -146,6 +152,21 @@ public:
virtual MTGFlashBackRule * clone() const;
};
class MTGTempFlashBackRule: public MTGAlternativeCostRule
{
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGTempFlashBackRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "Flashback Manacost";
}
virtual MTGTempFlashBackRule * clone() const;
};
class MTGRetraceRule: public MTGAlternativeCostRule
{
public:
@@ -209,15 +230,15 @@ public:
class MTGBestowRule : public MTGAlternativeCostRule
{
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGBestowRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "Bestow";
}
virtual MTGBestowRule * clone() const;
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGBestowRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "Bestow";
}
virtual MTGBestowRule * clone() const;
};
@@ -249,17 +270,14 @@ public:
class MTGAttackRule: public PermanentAbility, public Limitor
{
public:
string attackmenu;
virtual bool select(Target*);
virtual bool greyout(Target*);
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGAttackRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "Attacker";
}
const string getMenuText();
int receiveEvent(WEvent * event);
virtual MTGAttackRule * clone() const;
};
@@ -268,16 +286,13 @@ public:
class MTGPlaneswalkerAttackRule: public PermanentAbility, public Limitor
{
public:
string attackpwmenu;
virtual bool select(Target*);
virtual bool greyout(Target*);
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
MTGPlaneswalkerAttackRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "Attack Planeswalker";
}
const string getMenuText();
virtual MTGPlaneswalkerAttackRule * clone() const;
};
class AAPlaneswalkerAttacked: public InstantAbility
@@ -400,12 +415,40 @@ public:
int receiveEvent(WEvent * event);
virtual MTGTokensCleanup * clone() const;
};
//New Legend Rule
class MTGNewLegend: public PermanentAbility
{
public:
TargetChooser * tcL;
MTGAbility * Legendrule;
MTGAbility * LegendruleAbility;
MTGAbility * LegendruleGeneric;
//vector<MTGCardInstance *> list;
MTGNewLegend(GameObserver* observer, int _id);
int CheckLegend(MTGCardInstance * card);
void MoveLegend(MTGCardInstance * card);
int receiveEvent(WEvent * event);
virtual MTGNewLegend * clone() const;
};
//New Planeswalker Rule
class MTGNewPlaneswalker: public PermanentAbility
{
public:
TargetChooser * tcP;
MTGAbility * PWrule;
MTGAbility * PWruleAbility;
MTGAbility * PWruleGeneric;
//vector<MTGCardInstance *> list;
MTGNewPlaneswalker(GameObserver* observer, int _id);
int CheckPW(MTGCardInstance * card);
void MovePW(MTGCardInstance * card);
int receiveEvent(WEvent * event);
virtual MTGNewPlaneswalker * clone() const;
};
/*
* Rule 420.5e (Legend Rule)
* If two or more legendary permanents with the same name are in play, all are put into their
* owners' graveyards. This is called the "legend rule." If only one of those permanents is
* legendary, this rule doesn't apply.
* 704.5k If a player controls two or more legendary permanents with the same name,
* that player chooses one of them, and the rest are put into their owners graveyards.
* This is called the legend rule.
*/
class MTGLegendRule: public ListMaintainerAbility
{
@@ -452,7 +495,8 @@ public:
int alreadyplayed;
MTGAllCards * collection;
MTGCardInstance * genCreature(int id);
MTGAbility * tokCreate;
MTGCardInstance * genCreature(int id, Player * p);
void Update(float dt);
void Render();
MTGMomirRule(GameObserver* observer, int _id, MTGAllCards * _collection);

View File

@@ -31,7 +31,7 @@ protected:
ManaCost * manaUsedToCast;
ManaCost * morph;
ManaCost * Retrace;
ManaCost * Bestow;
ManaCost * Bestow;
ManaCost * FlashBack;
ManaCost * BuyBack;
ManaCost * kicker;
@@ -76,8 +76,8 @@ public:
ManaCost * getSuspend(){ return suspend; };
void setSuspend(ManaCost * aMana){ SAFE_DELETE(suspend); suspend = aMana;};
ManaCost * getBestow() { return Bestow; };
void setBestow(ManaCost * aMana) { SAFE_DELETE(Bestow); Bestow = aMana; };
ManaCost * getBestow() { return Bestow; };
void setBestow(ManaCost * aMana) { SAFE_DELETE(Bestow); Bestow = aMana; };
ManaCost * getManaUsedToCast(){ return manaUsedToCast; };
void setManaUsedToCast(ManaCost * aMana){ SAFE_DELETE(manaUsedToCast); manaUsedToCast = aMana;};
@@ -101,6 +101,7 @@ public:
ManaCost(const ManaCost& manaCost);
ManaCost& operator= (const ManaCost& manaCost);
void copy(ManaCost * _manaCost);
void changeCostTo(ManaCost * _manaCost);
int isNull();
int getConvertedCost();
string toString();
@@ -108,6 +109,7 @@ public:
int getManaSymbols(int color);
int getManaSymbolsHybridMerged(int color);
int countHybridsNoPhyrexian();
void removeHybrid(ManaCost * _cost);
//Returns NULL if i is greater than nbhybrids
ManaCostHybrid * getHybridCost(unsigned int i);

View File

@@ -20,6 +20,7 @@ public:
int getConvertedCost();
int getManaSymbols(int color);
int getManaSymbolsHybridMerged(int color);
void reduceValue(int color, int value);
friend std::ostream& operator<<(std::ostream& out, ManaCostHybrid& m);
friend std::ostream& operator<<(std::ostream& out, ManaCostHybrid* m);

View File

@@ -42,8 +42,10 @@ public:
int skippingTurn;
int extraTurn;
int drawCounter;
int energyCount;
int epic;
int forcefield;
int dealsdamagebycombat;
int initLife;
int raidcount;
int handmodifier;
@@ -85,6 +87,8 @@ public:
bool DeadLifeState(bool check = false);
ManaCost * doesntEmpty;
ManaCost * poolDoesntEmpty;
ManaCost * AuraIncreased;
ManaCost * AuraReduced;
void cleanupPhase();
virtual int Act(float)
{

View File

@@ -25,7 +25,7 @@ class TargetChooser: public TargetsList
protected:
int forceTargetListReady;
public:
int forceTargetListReadyByPlayer;
int forceTargetListReadyByPlayer;
const static int UNLITMITED_TARGETS = 1000;
enum
{
@@ -357,4 +357,44 @@ public:
virtual bool equals(TargetChooser * tc);
~ParentChildChooser();
};
class ChildrenChooser: public TypeTargetChooser
{
public:
bool withoutProtections;
ChildrenChooser(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)
{
}
;
ChildrenChooser(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 ChildrenChooser * clone() const;
virtual bool equals(TargetChooser * tc);
~ChildrenChooser();
};
class TotemChooser: public TypeTargetChooser
{
public:
bool withoutProtections;
TotemChooser(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)
{
}
;
TotemChooser(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 TotemChooser * clone() const;
virtual bool equals(TargetChooser * tc);
~TotemChooser();
};
#endif

View File

@@ -61,6 +61,14 @@ class ThisControllerlife:public ThisDescriptor{
ThisControllerlife * clone() const;
};
class ThisCreatureSpells:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);
ThisCreatureSpells(int count);
ThisCreatureSpells * clone() const;
};
class ThisOpponentlife:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);

View File

@@ -79,6 +79,11 @@ struct WEventDamageStackResolved : public WEvent {
WEventDamageStackResolved();
};
struct WEventGameStateBasedChecked : public WEvent {
WEventGameStateBasedChecked();
};
struct WEventPhasePreChange : public WEvent {
Phase * from;
Phase * to;
@@ -127,6 +132,7 @@ struct WEventCardChangeType : public WEventCardUpdate {
struct WEventCardTap : public WEventCardUpdate {
bool before;
bool after;
bool noTrigger;
WEventCardTap(MTGCardInstance * card, bool before, bool after);
virtual Targetable * getTarget(int target);
};
@@ -199,6 +205,12 @@ struct WEventCardCycle : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//event when card is exerted.
struct WEventCardExerted : public WEventCardUpdate {
WEventCardExerted(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//Event when a card's "defenser" status changes
//before : attacker that card was blocking previously
//after: attacker that card is blocking now
@@ -299,6 +311,45 @@ struct WEventCardControllerChange : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//event when card phases out
struct WEventCardPhasesOut : public WEventCardUpdate {
WEventCardPhasesOut(MTGCardInstance * card, int turn);
virtual Targetable * getTarget(int target);
};
//event when card phases in
struct WEventCardPhasesIn : public WEventCardUpdate {
WEventCardPhasesIn(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//event when card with morph faces up
struct WEventCardFaceUp : public WEventCardUpdate {
WEventCardFaceUp(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//event when card transforms
struct WEventCardTransforms : public WEventCardUpdate {
WEventCardTransforms(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//event when card copies a card
struct WEventCardCopiedACard : public WEventCardUpdate {
WEventCardCopiedACard(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//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);
};
std::ostream& operator<<(std::ostream&, const WEvent&);
#endif

View File

@@ -233,8 +233,8 @@ public:
;
WCFilterSet(string arg);
bool isMatch(MTGCard *c)
{
return (setid == MTGSets::ALL_SETS || c->setId == setid) && (c->getRarity() != Constants::RARITY_T); //removes viewing of card tokens. tokens will not display on spoiler and should not affect gameplay :)
{//exclude negative id's and tokens
return (setid == MTGSets::ALL_SETS || c->setId == setid) && ((c->getId() > 0) && (c->getRarity() != Constants::RARITY_T));
}
;
string getCode();

View File

@@ -52,7 +52,7 @@ public:
// Set Base for the character set to use.
virtual void SetBase(int base) = 0;
// Format text.
virtual void FormatText(string &s, vector<string>& output) = 0;
virtual void FormatText(string &s, vector<string>& output, int customLen = 0) = 0;
WFont(int inID) : mFontID(inID) {};
virtual ~WFont() {};
};
@@ -117,7 +117,7 @@ public:
it->SetBase(base);
}
;
void FormatText(string &s, vector<string>& output);
void FormatText(string &s, vector<string>& output, int customLen = 0);
private:
JLBFont * it;
@@ -143,7 +143,7 @@ public:
virtual float GetStringWidth(const char *s) const;
void SetTracking(float) {};
void SetBase(int) {};
void FormatText(string &, vector<string>&) {};
void FormatText(string &, vector<string>&, int customLen = 0) {};
virtual void DrawString(const char *s, float x, float y, int align = JGETEXT_LEFT, float leftOffset = 0, float width = 0);
virtual int GetCode(const u8 *ch, int *charLength) const = 0;
@@ -187,7 +187,7 @@ public:
void DrawString(const char *s, float x, float y, int align = JGETEXT_LEFT, float leftOffset = 0, float width = 0);
int GetCode(const u8 *ch, int *charLength) const;
int GetMana(const u8 *ch) const;
void FormatText(string &s, vector<string>& output);
void FormatText(string &s, vector<string>& output, int customLen = 0);
};
class WUFont: public WFBFont
@@ -198,7 +198,7 @@ public:
int GetCode(const u8 *ch, int *charLength) const;
int GetMana(const u8 *ch) const;
void FormatText(string &s, vector<string>& output);
void FormatText(string &s, vector<string>& output, int customLen = 0);
};
#if defined (PSP)

View File

@@ -626,7 +626,7 @@ protected:
class WGuiSplit: public WGuiItem
{
public:
WGuiSplit(WGuiBase* _left, WGuiBase* _right);
WGuiSplit(WGuiBase* _left, WGuiBase* _right, bool custom = false);
virtual ~WGuiSplit();
virtual bool yieldFocus();
@@ -998,6 +998,8 @@ protected:
set<LocalKeySym> confirmedKeys;
set<JButton> confirmedButtons;
string confirmationString;
private:
void populateKeyBindingList();
};
/**@} This comment used by Doxyyen. */

View File

@@ -80,6 +80,7 @@ public:
}
};
virtual JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL) = 0;
virtual JQuadPtr RetrieveCardToken(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL, int tId = 0) = 0;
virtual JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
virtual JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
virtual JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL, int id = 0) = 0;

View File

@@ -10,7 +10,11 @@
#include "JLogger.h"
#include <sstream>
#define HUGE_CACHE_LIMIT 20000000 // Size of the cache for Windows and Linux (in bytes)
#if defined (PSP)
#define HUGE_CACHE_LIMIT 25000000 // Size of the cache for PSP (in bytes) - old value is 20mb - reverted
#else
#define HUGE_CACHE_LIMIT 60000000 // Size of the cache for Windows and Linux (in bytes) - old value is 20mb increased to 60mb
#endif
#define SAMPLES_CACHE_SIZE 1500000 // Size in bytes of the cached samples
#define PSI_CACHE_SIZE 500000 // Size in bytes of the cached particles
#define TEXTURES_CACHE_MINSIZE 2000000 // Minimum size of the cache on the PSP. The program should complain if the cache ever gets smaller than this
@@ -137,6 +141,7 @@ public:
bool IsThreaded();
JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL);
JQuadPtr RetrieveCardToken(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL, int tId = 0);
JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0);

View File

@@ -12,8 +12,8 @@ Author: Michael Nguyen
/* Wagic versions */
#define WAGIC_VERSION_MAJOR 0
#define WAGIC_VERSION_MEDIUM 19
#define WAGIC_VERSION_MINOR 2
#define WAGIC_VERSION_MEDIUM 20
#define WAGIC_VERSION_MINOR 1
#define VERSION_DOT(a, b, c) a ##.## b ##.## c
#define VERSION_WITHOUT_DOT(a, b, c) a ## b ## c

View File

@@ -77,7 +77,7 @@ public:
RandomGenerator(unsigned int seed = -1, bool doLog = false) : log(doLog) { if(seed != (unsigned int)-1) srand(seed);};
void loadRandValues(string s);
ostream& saveUsedRandValues(ostream& out) const;
ostream& saveLoadedRandValues(ostream& out);
ostream& saveLoadedRandValues(ostream& out) const;
int random();
void setSeed(unsigned int seed) { srand(seed); };
template<typename Iter> void random_shuffle(Iter first, Iter last)