Merge branch 'master' into iOS-Build

This commit is contained in:
xawotihs
2015-09-13 18:42:31 +02:00
25 changed files with 2390 additions and 201 deletions

View File

@@ -599,6 +599,10 @@ private:
{
intValue = target->controller()->opponent()->drawCounter;
}
else if (s == "epicactivated")
{
intValue = target->controller()->epic;
}
else if (s == "p" || s == "power")
{
intValue = target->getPower();
@@ -635,6 +639,21 @@ private:
{
intValue = target->controller()->opponent()->game->hand->nb_cards;
}
else if (s == "morethanfourcards")
{
if(card->playerTarget)
{//blackvise
intValue = 0;
if ((card->playerTarget->game->hand->nb_cards - 4)>0)
intValue = (card->playerTarget->game->hand->nb_cards - 4);
}
else
{//viseling
intValue = 0;
if ((card->controller()->opponent()->game->hand->nb_cards - 4)>0)
intValue = (card->controller()->opponent()->game->hand->nb_cards - 4);
}
}
else if (s == "powertotalinplay")//Count Total Power of Creatures you control... Formidable
{
intValue = 0;
@@ -1335,6 +1354,16 @@ public:
AAFakeAbility * clone() const;
};
class AAEPIC: public ActivatedAbility
{
public:
string named;
AAEPIC(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL);
int resolve();
const string getMenuText();
AAEPIC * clone() const;
};
class AAFizzler: public ActivatedAbility
{
public:
@@ -2231,16 +2260,18 @@ public:
{
if(!nonstatic)
return;
((MTGCardInstance *) target)->power -= wppt->power.getValue();
((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue());
((MTGCardInstance *) target)->pbonus -= wppt->power.getValue();
((MTGCardInstance *) target)->tbonus -= wppt->toughness.getValue();
((MTGCardInstance *) target)->applyPTL();
if(PT.size())
{
SAFE_DELETE(wppt);
wppt = NEW WParsedPT(PT,NULL,(MTGCardInstance *) source);
}
MTGCardInstance * _target = (MTGCardInstance *) target;
_target->power += wppt->power.getValue();
_target->addToToughness(wppt->toughness.getValue());
_target->pbonus += wppt->power.getValue();
_target->tbonus += wppt->toughness.getValue();
_target->applyPTL();
}
int addToGame()
@@ -2251,8 +2282,9 @@ public:
SAFE_DELETE(wppt);
wppt = NEW WParsedPT(PT,NULL,(MTGCardInstance *) source);
}
_target->power += wppt->power.getValue();
_target->addToToughness(wppt->toughness.getValue());
_target->pbonus += wppt->power.getValue();
_target->tbonus += wppt->toughness.getValue();
_target->applyPTL();
if(_target->has(Constants::INDESTRUCTIBLE) && wppt->toughness.getValue() < 0 && _target->toughness <= 0)
{
_target->controller()->game->putInGraveyard(_target);
@@ -2262,8 +2294,9 @@ public:
int destroy()
{
((MTGCardInstance *) target)->power -= wppt->power.getValue();
((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue());
((MTGCardInstance *) target)->pbonus -= wppt->power.getValue();
((MTGCardInstance *) target)->tbonus -= wppt->toughness.getValue();
((MTGCardInstance *) target)->applyPTL();
return 1;
}
const string getMenuText()
@@ -3998,8 +4031,6 @@ string menu;
class ASwapPT: public InstantAbility
{
public:
int oldpower;
int oldtoughness;
ASwapPT(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target) :
InstantAbility(observer, _id, _source, _target)
{
@@ -4013,13 +4044,13 @@ public:
{
while (_target->next)
_target = _target->next; //This is for cards such as rampant growth
oldpower = _target->power;
oldtoughness = _target->toughness;
_target->addToToughness(oldpower);
_target->addToToughness(-oldtoughness);
_target->power = oldtoughness;
if(_target->isPTswitch)
_target->isPTswitch = false;
else
_target->isPTswitch = true;
_target->applyPTL();
}
return 1;
}
@@ -4031,12 +4062,10 @@ public:
{
while (_target->next)
_target = _target->next; //This is for cards such as rampant growth
oldpower = _target->power;
oldtoughness = _target->toughness;
_target->isPTswitch = false;
_target->addToToughness(oldpower);
_target->addToToughness(-oldtoughness);
_target->power = oldtoughness;
_target->applyPTL();
}
return 1;
@@ -4278,10 +4307,9 @@ public:
string newpower;
bool newpowerfound;
int oldpower;
string newtoughness;
bool newtoughnessfound;
int oldtoughness;
map<Damageable *, vector<MTGAbility *> > newAbilities;
vector<string> newAbilitiesList;
bool newAbilityFound;
@@ -5619,15 +5647,17 @@ public:
{
nbOpponents = source->blockers.size();
if (nbOpponents <= MaxOpponent) return 0;
source->power += PowerModifier * (nbOpponents - MaxOpponent);
source->addToToughness(ToughnessModifier * (nbOpponents - MaxOpponent));
source->pbonus += PowerModifier * (nbOpponents - MaxOpponent);
source->tbonus += ToughnessModifier * (nbOpponents - MaxOpponent);
source->applyPTL();
}
else if (WEventPhaseChange* pe = dynamic_cast<WEventPhaseChange*>(event))
{
if (MTG_PHASE_AFTER_EOT == pe->to->id && nbOpponents > MaxOpponent)
{
source->power -= PowerModifier * (nbOpponents - MaxOpponent);
source->addToToughness(-ToughnessModifier * (nbOpponents - MaxOpponent));
source->pbonus -= PowerModifier * (nbOpponents - MaxOpponent);
source->tbonus -= ToughnessModifier * (nbOpponents - MaxOpponent);
source->applyPTL();
nbOpponents = 0;
}
}

View File

@@ -33,8 +33,9 @@ public:
MTGCardInstance * target;
Counters(MTGCardInstance * _target);
~Counters();
int addCounter(const char * _name, int _power = 0, int _toughness = 0);
int addCounter(const char * _name, int _power = 0, int _toughness = 0, bool _noevent = false);
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(int _power, int _toughness);
Counter * hasCounter(const char * _name, int _power = 0, int _toughness = 0);

View File

@@ -254,6 +254,17 @@ public:
virtual Ninja * clone() const;
};
//offering cost
class Offering : public ExtraCost
{
public:
Offering(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int isPaymentSet();
virtual int doPay();
virtual Offering * clone() const;
};
class CounterCost : public ExtraCost
{
public:

View File

@@ -72,7 +72,11 @@ public:
int regenerateTokens;
int isToken;
int origpower;
int basepower;//to keep origpower intact
int pbonus;
int origtoughness;
int basetoughness;//to keep origtoughness intact
int tbonus;
int isMultiColored;
int isLeveler;
bool enchanted;
@@ -182,6 +186,11 @@ public:
int addToToughness(int value);
int setToughness(int value);
bool isSettingBase;
bool isPTswitch;
int oldP;
int oldT;
void applyPTL();
vector<TargetChooser *>protections;
int addProtection(TargetChooser * tc);

View File

@@ -220,7 +220,12 @@ class Constants
NOLEGEND = 102,
CANPLAYFROMGRAVEYARD = 103,
TOKENIZER = 104,
NB_BASIC_ABILITIES = 105,
MYGRAVEEXILER = 105,
OPPGRAVEEXILER = 106,
LIBRARYDEATH = 107,
SHUFFLELIBRARYDEATH = 108,
OFFERING = 109,
NB_BASIC_ABILITIES = 110,
RARITY_S = 'S', //Special Rarity

View File

@@ -42,6 +42,7 @@ public:
int skippingTurn;
int extraTurn;
int drawCounter;
int epic;
vector<string> prowledTypes;
vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);