No code change. Reformat code
This commit is contained in:
@@ -5222,10 +5222,8 @@ public:
|
||||
|
||||
// utility functions
|
||||
|
||||
void PopulateColorIndexVector( list<int>& colors, const string& colorsString, char delimiter = ',');
|
||||
void PopulateAbilityIndexVector( list<int>& abilities, const string& abilitiesString, char delimiter = ',');
|
||||
void PopulateSubtypesIndexVector( list<int>& subtypes, const string& subtypesString, char delimiter = ' ');
|
||||
|
||||
|
||||
void PopulateColorIndexVector(list<int>& colors, const string& colorsString, char delimiter = ',');
|
||||
void PopulateAbilityIndexVector(list<int>& abilities, const string& abilitiesString, char delimiter = ',');
|
||||
void PopulateSubtypesIndexVector(list<int>& subtypes, const string& subtypesString, char delimiter = ' ');
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
#include "WEvent.h"
|
||||
#include "CardSelector.h"
|
||||
|
||||
class OtherAbilitiesEventReceiver:public MTGAbility{
|
||||
class OtherAbilitiesEventReceiver: public MTGAbility
|
||||
{
|
||||
public:
|
||||
int testDestroy();
|
||||
int receiveEvent(WEvent * event);
|
||||
@@ -17,63 +18,84 @@ public:
|
||||
OtherAbilitiesEventReceiver * clone() const;
|
||||
};
|
||||
|
||||
class MTGPutInPlayRule:public MTGAbility{
|
||||
public:
|
||||
class MTGPutInPlayRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGPutInPlayRule(int _id);
|
||||
const char * getMenuText(){return "Play Card Normally";}
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Play Card Normally";
|
||||
}
|
||||
virtual MTGPutInPlayRule * clone() const;
|
||||
};
|
||||
|
||||
class MTGAlternativeCostRule:public MTGAbility{
|
||||
public:
|
||||
class MTGAlternativeCostRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGAlternativeCostRule(int _id);
|
||||
const char * getMenuText(){return "Pay Alternative Cost";}
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Pay Alternative Cost";
|
||||
}
|
||||
virtual MTGAlternativeCostRule * clone() const;
|
||||
};
|
||||
|
||||
class MTGBuyBackRule:public MTGAbility{
|
||||
public:
|
||||
class MTGBuyBackRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGBuyBackRule(int _id);
|
||||
const char * getMenuText(){return "Cast And Buy Back";}
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Cast And Buy Back";
|
||||
}
|
||||
virtual MTGBuyBackRule * clone() const;
|
||||
};
|
||||
|
||||
class MTGFlashBackRule:public MTGAbility{
|
||||
public:
|
||||
class MTGFlashBackRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGFlashBackRule(int _id);
|
||||
const char * getMenuText(){return "Flash Back";}
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Flash Back";
|
||||
}
|
||||
virtual MTGFlashBackRule * clone() const;
|
||||
};
|
||||
|
||||
class MTGRetraceRule:public MTGAbility{
|
||||
public:
|
||||
class MTGRetraceRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGRetraceRule(int _id);
|
||||
const char * getMenuText(){return "Retrace";}
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Retrace";
|
||||
}
|
||||
virtual MTGRetraceRule * clone() const;
|
||||
};
|
||||
|
||||
class MTGAttackRule:public MTGAbility, public Limitor{
|
||||
public:
|
||||
class MTGAttackRule: public MTGAbility, public Limitor
|
||||
{
|
||||
public:
|
||||
virtual bool select(Target*);
|
||||
virtual bool greyout(Target*);
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
@@ -81,15 +103,18 @@ class MTGAttackRule:public MTGAbility, public Limitor{
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGAttackRule(int _id);
|
||||
const char * getMenuText(){return "Attacker";}
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Attacker";
|
||||
}
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual MTGAttackRule * clone() const;
|
||||
};
|
||||
|
||||
|
||||
/* handles combat trigger send recieve events*/
|
||||
class MTGCombatTriggersRule:public MTGAbility{
|
||||
public:
|
||||
class MTGCombatTriggersRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
MTGCombatTriggersRule(int _id);
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
@@ -97,21 +122,25 @@ class MTGCombatTriggersRule:public MTGAbility{
|
||||
virtual MTGCombatTriggersRule * clone() const;
|
||||
};
|
||||
|
||||
class MTGBlockRule:public MTGAbility{
|
||||
public:
|
||||
class MTGBlockRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGBlockRule(int _id);
|
||||
const char * getMenuText(){return "Blocker";}
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Blocker";
|
||||
}
|
||||
virtual MTGBlockRule * clone() const;
|
||||
};
|
||||
|
||||
|
||||
/* Persist Rule */
|
||||
class MTGPersistRule:public MTGAbility{
|
||||
public:
|
||||
class MTGPersistRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
MTGPersistRule(int _id);
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
@@ -119,8 +148,9 @@ class MTGPersistRule:public MTGAbility{
|
||||
virtual MTGPersistRule * clone() const;
|
||||
};
|
||||
//affinity rules
|
||||
class MTGAffinityRule:public MTGAbility{
|
||||
public:
|
||||
class MTGAffinityRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
MTGAffinityRule(int _id);
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
@@ -128,16 +158,18 @@ class MTGAffinityRule:public MTGAbility{
|
||||
virtual MTGAffinityRule * clone() const;
|
||||
};
|
||||
//unearths destruction if leaves play effect
|
||||
class MTGUnearthRule:public MTGAbility{
|
||||
public:
|
||||
class MTGUnearthRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
MTGUnearthRule(int _id);
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
int testDestroy();
|
||||
virtual MTGUnearthRule * clone() const;
|
||||
};
|
||||
class MTGTokensCleanup:public MTGAbility{
|
||||
public:
|
||||
class MTGTokensCleanup: public MTGAbility
|
||||
{
|
||||
public:
|
||||
vector<MTGCardInstance *> list;
|
||||
MTGTokensCleanup(int _id);
|
||||
int receiveEvent(WEvent * event);
|
||||
@@ -151,8 +183,9 @@ class MTGTokensCleanup:public MTGAbility{
|
||||
* owners' graveyards. This is called the "legend rule." If only one of those permanents is
|
||||
* legendary, this rule doesn't apply.
|
||||
*/
|
||||
class MTGLegendRule:public ListMaintainerAbility{
|
||||
public:
|
||||
class MTGLegendRule: public ListMaintainerAbility
|
||||
{
|
||||
public:
|
||||
MTGLegendRule(int _id);
|
||||
int canBeInList(MTGCardInstance * card);
|
||||
int added(MTGCardInstance * card);
|
||||
@@ -162,8 +195,8 @@ class MTGLegendRule:public ListMaintainerAbility{
|
||||
virtual MTGLegendRule * clone() const;
|
||||
};
|
||||
|
||||
|
||||
class MTGMomirRule:public MTGAbility{
|
||||
class MTGMomirRule: public MTGAbility
|
||||
{
|
||||
private:
|
||||
int genRandomCreatureId(int convertedCost);
|
||||
static vector<int> pool[20];
|
||||
@@ -183,15 +216,18 @@ public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int reactToClick(MTGCardInstance * card, int id);
|
||||
const char * getMenuText(){return "Momir";}
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Momir";
|
||||
}
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual MTGMomirRule * clone() const;
|
||||
};
|
||||
|
||||
|
||||
/* LifeLink */
|
||||
class MTGLifelinkRule:public MTGAbility{
|
||||
public:
|
||||
class MTGLifelinkRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
MTGLifelinkRule(int _id);
|
||||
|
||||
int receiveEvent(WEvent * event);
|
||||
@@ -204,29 +240,40 @@ class MTGLifelinkRule:public MTGAbility{
|
||||
};
|
||||
|
||||
/* Deathtouch */
|
||||
class MTGDeathtouchRule:public MTGAbility{
|
||||
public:
|
||||
class MTGDeathtouchRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
MTGDeathtouchRule(int _id);
|
||||
|
||||
int receiveEvent(WEvent * event);
|
||||
|
||||
int testDestroy();
|
||||
const char * getMenuText(){return "Deathtouch";}
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Deathtouch";
|
||||
}
|
||||
|
||||
virtual MTGDeathtouchRule * clone() const;
|
||||
};
|
||||
|
||||
/* HUD Display */
|
||||
|
||||
class HUDString {
|
||||
class HUDString
|
||||
{
|
||||
public:
|
||||
string value;
|
||||
float timestamp;
|
||||
int quantity;
|
||||
HUDString(string s, float ts):value(s),timestamp(ts){quantity = 1;};
|
||||
HUDString(string s, float ts) :
|
||||
value(s), timestamp(ts)
|
||||
{
|
||||
quantity = 1;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
class HUDDisplay:public MTGAbility{
|
||||
class HUDDisplay: public MTGAbility
|
||||
{
|
||||
private:
|
||||
list<HUDString *> events;
|
||||
float timestamp;
|
||||
@@ -244,6 +291,4 @@ public:
|
||||
virtual HUDDisplay * clone() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -71,7 +71,6 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
virtual int isAI()
|
||||
{
|
||||
return 0;
|
||||
|
||||
+138
-78
@@ -23,20 +23,22 @@ int AIAction::Act()
|
||||
if (ability)
|
||||
{
|
||||
g->mLayers->actionLayer()->reactToClick(ability, click);
|
||||
if (target) g->cardClick(target);
|
||||
if (target)
|
||||
g->cardClick(target);
|
||||
return 1;
|
||||
}
|
||||
else if (click)
|
||||
{ //Shouldn't be used, really...
|
||||
g->cardClick(click, click);
|
||||
if (target) g->cardClick(target);
|
||||
if (target)
|
||||
g->cardClick(target);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
AIPlayer::AIPlayer(MTGDeck * deck, string file, string fileSmall) :
|
||||
Player(deck, file, fileSmall)
|
||||
Player(deck, file, fileSmall)
|
||||
{
|
||||
nextCardToPlay = NULL;
|
||||
stats = NULL;
|
||||
@@ -76,7 +78,8 @@ MTGCardInstance * AIPlayer::chooseCard(TargetChooser * tc, MTGCardInstance * sou
|
||||
int AIPlayer::Act(float dt)
|
||||
{
|
||||
GameObserver * gameObs = GameObserver::GetInstance();
|
||||
if (gameObs->currentPlayer == this) gameObs->userRequestNextGamePhase();
|
||||
if (gameObs->currentPlayer == this)
|
||||
gameObs->userRequestNextGamePhase();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -105,7 +108,8 @@ bool AIPlayer::tapLandsForMana(ManaCost * cost, MTGCardInstance * target)
|
||||
if (amp && canHandleCost(amp))
|
||||
{
|
||||
MTGCardInstance * card = amp->source;
|
||||
if (card == target) used[card] = true; //http://code.google.com/p/wagic/issues/detail?id=76
|
||||
if (card == target)
|
||||
used[card] = true; //http://code.google.com/p/wagic/issues/detail?id=76
|
||||
if (!used[card] && amp->isReactingToClick(card) && amp->output->getConvertedCost() == 1)
|
||||
{
|
||||
used[card] = true;
|
||||
@@ -144,7 +148,8 @@ ManaCost * AIPlayer::getPotentialMana(MTGCardInstance * target)
|
||||
if (amp && canHandleCost(amp))
|
||||
{
|
||||
MTGCardInstance * card = amp->source;
|
||||
if (card == target) used[card] = true; //http://code.google.com/p/wagic/issues/detail?id=76
|
||||
if (card == target)
|
||||
used[card] = true; //http://code.google.com/p/wagic/issues/detail?id=76
|
||||
if (!used[card] && amp->isReactingToClick(card) && amp->output->getConvertedCost() == 1)
|
||||
{
|
||||
result->add(amp->output);
|
||||
@@ -152,7 +157,7 @@ ManaCost * AIPlayer::getPotentialMana(MTGCardInstance * target)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this->getManaPool()->getConvertedCost())
|
||||
if (this->getManaPool()->getConvertedCost())
|
||||
{
|
||||
//adding the current manapool if any, to the potential mana Ai can use.
|
||||
result->add(this->getManaPool());
|
||||
@@ -168,10 +173,12 @@ int AIPlayer::getEfficiency(AIAction * action)
|
||||
//Can't yet handle extraCost objects (ex: sacrifice) if they require a target :(
|
||||
int AIPlayer::CanHandleCost(ManaCost * cost)
|
||||
{
|
||||
if (!cost) return 1;
|
||||
if (!cost)
|
||||
return 1;
|
||||
|
||||
ExtraCosts * ec = cost->extraCosts;
|
||||
if (!ec) return 1;
|
||||
if (!ec)
|
||||
return 1;
|
||||
|
||||
for (size_t i = 0; i < ec->costs.size(); ++i)
|
||||
{
|
||||
@@ -193,12 +200,15 @@ int AIPlayer::canHandleCost(MTGAbility * ability)
|
||||
int AIAction::getEfficiency()
|
||||
{
|
||||
//TODO add multiplier according to what the player wants
|
||||
if (efficiency != -1) return efficiency;
|
||||
if (!ability) return 0;
|
||||
if (efficiency != -1)
|
||||
return efficiency;
|
||||
if (!ability)
|
||||
return 0;
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
ActionStack * s = g->mLayers->stackLayer();
|
||||
Player * p = g->currentlyActing();
|
||||
if (s->has(ability)) return 0;
|
||||
if (s->has(ability))
|
||||
return 0;
|
||||
|
||||
MTGAbility * a = AbilityFactory::getCoreAbility(ability);
|
||||
|
||||
@@ -208,7 +218,8 @@ int AIAction::getEfficiency()
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!((AIPlayer *) p)->canHandleCost(ability)) return 0;
|
||||
if (!((AIPlayer *) p)->canHandleCost(ability))
|
||||
return 0;
|
||||
switch (a->aType)
|
||||
{
|
||||
case MTGAbility::DAMAGER:
|
||||
@@ -245,10 +256,12 @@ int AIAction::getEfficiency()
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||
efficiency = 0;
|
||||
if (!_target) break;
|
||||
if (!_target)
|
||||
break;
|
||||
|
||||
if (!_target->regenerateTokens && g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBLOCKERS && (_target->defenser
|
||||
|| _target->blockers.size()))
|
||||
if (!_target->regenerateTokens && g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBLOCKERS
|
||||
&& (_target->defenser || _target->blockers.size())
|
||||
)
|
||||
{
|
||||
efficiency = 95;
|
||||
}
|
||||
@@ -259,20 +272,22 @@ int AIAction::getEfficiency()
|
||||
case MTGAbility::STANDARD_PREVENT:
|
||||
{
|
||||
efficiency = 0;//starts out low to avoid spamming it when its not needed.
|
||||
if (!target) break;
|
||||
if (!target)
|
||||
break;
|
||||
|
||||
bool NeedPreventing;
|
||||
NeedPreventing = false;
|
||||
if (g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBLOCKERS)
|
||||
{
|
||||
if ((target->defenser || target->blockers.size()) && target->preventable < target->getNextOpponent()->power) NeedPreventing
|
||||
= true;
|
||||
if ((target->defenser || target->blockers.size()) && target->preventable < target->getNextOpponent()->power)
|
||||
NeedPreventing = true;
|
||||
}
|
||||
if (p == target->controller() && NeedPreventing == true && !(target->getNextOpponent()->has(Constants::DEATHTOUCH)
|
||||
|| target->getNextOpponent()->has(Constants::WITHER)))
|
||||
{
|
||||
efficiency = 20 * (target->DangerRanking());//increase this chance to be used in combat if the creature blocking/blocked could kill the creature this chance is taking into consideration how good the creature is, best creature will always be the first "saved"..
|
||||
if (target->toughness == 1 && target->getNextOpponent()->power == 1) efficiency += 15;
|
||||
if (target->toughness == 1 && target->getNextOpponent()->power == 1)
|
||||
efficiency += 15;
|
||||
//small bonus added for the poor 1/1s, if we can save them, we will unless something else took precidence.
|
||||
}
|
||||
//note is the target is being blocked or blocking a creature with wither or deathtouch, it is not even considered for preventing as it is a waste.
|
||||
@@ -284,7 +299,8 @@ int AIAction::getEfficiency()
|
||||
{
|
||||
|
||||
efficiency = 0;
|
||||
if (!target) break;
|
||||
if (!target)
|
||||
break;
|
||||
|
||||
int equips = p->game->battlefield->countByType("Equipment");
|
||||
int myArmy = p->game->battlefield->countByType("Creature");
|
||||
@@ -293,8 +309,10 @@ int AIAction::getEfficiency()
|
||||
if (p == target->controller() && target->equipment <= 1 && !a->source->target)
|
||||
{
|
||||
efficiency = 20 * (target->DangerRanking());
|
||||
if (target->hasColor(5)) efficiency += 20;//this is to encourage Ai to equip white creatures in a weenie deck. ultimately it will depend on what had the higher dangerranking.
|
||||
if (target->power == 1 && target->toughness == 1 && target->isToken == 0) efficiency += 10; //small bonus to encourage equipping nontoken 1/1 creatures.
|
||||
if (target->hasColor(5))
|
||||
efficiency += 20;//this is to encourage Ai to equip white creatures in a weenie deck. ultimately it will depend on what had the higher dangerranking.
|
||||
if (target->power == 1 && target->toughness == 1 && target->isToken == 0)
|
||||
efficiency += 10; //small bonus to encourage equipping nontoken 1/1 creatures.
|
||||
}
|
||||
|
||||
if (p == target->controller() && !a->source->target && target->equipment < equilized)
|
||||
@@ -344,7 +362,8 @@ int AIAction::getEfficiency()
|
||||
case MTGAbility::STANDARD_PUMP:
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||
if (!target) break;
|
||||
if (!target)
|
||||
break;
|
||||
//i do not set a starting eff. on this ability, this allows Ai to sometimes randomly do it as it normally does.
|
||||
if (g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBLOCKERS)
|
||||
{
|
||||
@@ -405,7 +424,8 @@ int AIAction::getEfficiency()
|
||||
}
|
||||
}
|
||||
|
||||
if (p->game->hand->hasX()) efficiency = 100;
|
||||
if (p->game->hand->hasX())
|
||||
efficiency = 100;
|
||||
|
||||
}
|
||||
else
|
||||
@@ -434,7 +454,8 @@ int AIAction::getEfficiency()
|
||||
{
|
||||
efficiency = 0;
|
||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||
if (!target) break;
|
||||
if (!target)
|
||||
break;
|
||||
//ensuring that Ai grants abilities to creatures during first main, so it can actually use them in combat.
|
||||
//quick note: the eff is multiplied by creatures ranking then divided by the number of cards in hand.
|
||||
//the reason i do this is to encourage more casting and less waste of mana on abilities.
|
||||
@@ -451,7 +472,9 @@ int AIAction::getEfficiency()
|
||||
efficiency += efficiencyModifier;
|
||||
}
|
||||
|
||||
if (!target->has(a->abilitygranted) && g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBEGIN && p == target->controller() && p->isAI())
|
||||
if (!target->has(a->abilitygranted) && g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBEGIN
|
||||
&& p == target->controller() && p->isAI()
|
||||
)
|
||||
{
|
||||
efficiency += efficiencyModifier;
|
||||
}
|
||||
@@ -462,8 +485,9 @@ int AIAction::getEfficiency()
|
||||
efficiency = 0;
|
||||
}
|
||||
|
||||
if ((suggestion == BAKA_EFFECT_BAD && p == target->controller()) || (suggestion == BAKA_EFFECT_GOOD && p
|
||||
!= target->controller()))
|
||||
if ((suggestion == BAKA_EFFECT_BAD && p == target->controller())
|
||||
|| (suggestion == BAKA_EFFECT_GOOD && p != target->controller())
|
||||
)
|
||||
{
|
||||
efficiency = 0;
|
||||
//stop giving trample to the players creatures.
|
||||
@@ -475,7 +499,8 @@ int AIAction::getEfficiency()
|
||||
//untap things that Ai owns and are tapped.
|
||||
{
|
||||
efficiency = 0;
|
||||
if (!target) break;
|
||||
if (!target)
|
||||
break;
|
||||
|
||||
if (target->isTapped() && target->controller()->isAI())
|
||||
{
|
||||
@@ -487,11 +512,14 @@ int AIAction::getEfficiency()
|
||||
case MTGAbility::TAPPER:
|
||||
//tap things the player owns and that are untapped.
|
||||
{
|
||||
if (!target) break;
|
||||
if (!target)
|
||||
break;
|
||||
|
||||
if (!target->controller()->isAI()) efficiency = (20 * target->DangerRanking());
|
||||
if (!target->controller()->isAI())
|
||||
efficiency = (20 * target->DangerRanking());
|
||||
|
||||
if (target->isTapped()) efficiency = 0;
|
||||
if (target->isTapped())
|
||||
efficiency = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -521,11 +549,11 @@ int AIAction::getEfficiency()
|
||||
//eff of drawing ability is calculated by base 20 + the amount of cards in library minus the amount of cards in hand times 7.
|
||||
//drawing is never going to return a hundred eff because later eff is multiplied by 1.3 if no cards in hand.
|
||||
efficiency = int(20 + p->game->library->nb_cards) - int(p->game->hand->nb_cards * 7);
|
||||
if(p->game->hand->nb_cards > 8)//reduce by 50 if cards in hand are over 8, high chance ai cant play them.
|
||||
if (p->game->hand->nb_cards > 8)//reduce by 50 if cards in hand are over 8, high chance ai cant play them.
|
||||
{
|
||||
efficiency -= 70;
|
||||
}
|
||||
if((a->nbcardAmount >= p->game->library->nb_cards && p->isAI()) || (p->game->hand->nb_cards > 10 && p->isAI()))
|
||||
if ((a->nbcardAmount >= p->game->library->nb_cards && p->isAI()) || (p->game->hand->nb_cards > 10 && p->isAI()))
|
||||
{
|
||||
//if the amount im drawing will mill me to death or i have more then 10 cards in hand, eff is 0;
|
||||
efficiency = 0;
|
||||
@@ -550,8 +578,8 @@ int AIAction::getEfficiency()
|
||||
{
|
||||
AbilityFactory af;
|
||||
int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY);
|
||||
if ((suggestion == BAKA_EFFECT_BAD && p == target->controller()) || (suggestion == BAKA_EFFECT_GOOD && p
|
||||
!= target->controller()))
|
||||
if ((suggestion == BAKA_EFFECT_BAD && p == target->controller())
|
||||
|| (suggestion == BAKA_EFFECT_GOOD && p != target->controller()))
|
||||
{
|
||||
efficiency = 0;
|
||||
}
|
||||
@@ -567,11 +595,13 @@ int AIAction::getEfficiency()
|
||||
break;
|
||||
}
|
||||
|
||||
if (p->game->hand->nb_cards == 0) efficiency = (int) ((float) efficiency * 1.3); //increase chance of using ability if hand is empty
|
||||
if (p->game->hand->nb_cards == 0)
|
||||
efficiency = (int) ((float) efficiency * 1.3); //increase chance of using ability if hand is empty
|
||||
if (ability->cost)
|
||||
{
|
||||
ExtraCosts * ec = ability->cost->extraCosts;
|
||||
if (ec) efficiency = efficiency / 3; //Decrease chance of using ability if there is an extra cost to use the ability
|
||||
if (ec)
|
||||
efficiency = efficiency / 3; //Decrease chance of using ability if there is an extra cost to use the ability
|
||||
}
|
||||
return efficiency;
|
||||
}
|
||||
@@ -630,7 +660,8 @@ int AIPlayer::selectAbility()
|
||||
{ //0 is not a mtgability...hackish
|
||||
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
||||
//Skip mana abilities for performance
|
||||
if (dynamic_cast<AManaProducer*> (a)) continue;
|
||||
if (dynamic_cast<AManaProducer*> (a))
|
||||
continue;
|
||||
//Make sure we can use the ability
|
||||
for (int j = 0; j < game->inPlay->nb_cards; j++)
|
||||
{
|
||||
@@ -650,7 +681,8 @@ int AIPlayer::selectAbility()
|
||||
{
|
||||
AIAction action = ranking.begin()->first;
|
||||
int chance = 1;
|
||||
if (!forceBestAbilityUse) chance = 1 + WRand() % 100;
|
||||
if (!forceBestAbilityUse)
|
||||
chance = 1 + WRand() % 100;
|
||||
if (action.getEfficiency() >= chance)
|
||||
{
|
||||
if (!clickstream.size())
|
||||
@@ -685,7 +717,8 @@ int AIPlayer::effectBadOrGood(MTGCardInstance * card, int mode, TargetChooser *
|
||||
int id = card->getMTGId();
|
||||
AbilityFactory af;
|
||||
int autoGuess = af.magicText(id, NULL, card, mode, tc);
|
||||
if (autoGuess) return autoGuess;
|
||||
if (autoGuess)
|
||||
return autoGuess;
|
||||
return BAKA_EFFECT_DONTKNOW;
|
||||
}
|
||||
|
||||
@@ -704,9 +737,11 @@ int AIPlayer::chooseTarget(TargetChooser * _tc, Player * forceTarget)
|
||||
{
|
||||
tc = gameObs->getCurrentTargetChooser();
|
||||
}
|
||||
if (!tc) return 0;
|
||||
if (!tc)
|
||||
return 0;
|
||||
tc->initTargets(); //cleanup the targetchooser just in case.
|
||||
if (!(gameObs->currentlyActing() == this)) return 0;
|
||||
if (!(gameObs->currentlyActing() == this))
|
||||
return 0;
|
||||
Player * target = forceTarget;
|
||||
|
||||
if (!target)
|
||||
@@ -726,7 +761,8 @@ int AIPlayer::chooseTarget(TargetChooser * _tc, Player * forceTarget)
|
||||
potentialTargets.push_back(target);
|
||||
nbtargets++;
|
||||
}
|
||||
if (checkOnly) return 1;
|
||||
if (checkOnly)
|
||||
return 1;
|
||||
}
|
||||
MTGPlayerCards * playerZones = target->game;
|
||||
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard };
|
||||
@@ -738,7 +774,8 @@ int AIPlayer::chooseTarget(TargetChooser * _tc, Player * forceTarget)
|
||||
MTGCardInstance * card = zone->cards[k];
|
||||
if (!tc->alreadyHasTarget(card) && tc->canTarget(card) && nbtargets < 50)
|
||||
{
|
||||
if (checkOnly) return 1;
|
||||
if (checkOnly)
|
||||
return 1;
|
||||
int multiplier = 1;
|
||||
if (getStats() && getStats()->isInTop(card, 10))
|
||||
{
|
||||
@@ -785,9 +822,11 @@ int AIPlayer::chooseTarget(TargetChooser * _tc, Player * forceTarget)
|
||||
//Couldn't find any valid target,
|
||||
//usually that's because we played a card that has bad side effects (ex: when X comes into play, return target land you own to your hand)
|
||||
//so we try again to choose a target in the other player's field...
|
||||
if (checkOnly) return 0;
|
||||
if (checkOnly)
|
||||
return 0;
|
||||
int cancel = gameObs->cancelCurrentAction();
|
||||
if (!cancel && !forceTarget) return chooseTarget(_tc, target->opponent());
|
||||
if (!cancel && !forceTarget)
|
||||
return chooseTarget(_tc, target->opponent());
|
||||
|
||||
//ERROR!!!
|
||||
DebugTrace("AIPLAYER: ERROR! AI needs to choose a target but can't decide!!!");
|
||||
@@ -832,8 +871,8 @@ int AIPlayer::chooseAttackers()
|
||||
{
|
||||
opponentCreatures = getCreaturesInfo(opponent(), INFO_NBCREATURES, -1);
|
||||
opponentForce = getCreaturesInfo(opponent(), INFO_CREATURESPOWER, -1);
|
||||
attack = (myCreatures >= opponentCreatures && myForce > opponentForce) || (myForce > opponentForce) || (myForce
|
||||
> opponent()->life);
|
||||
attack = (myCreatures >= opponentCreatures && myForce > opponentForce)
|
||||
|| (myForce > opponentForce) || (myForce > opponent()->life);
|
||||
}
|
||||
printf("Choose attackers : %i %i %i %i -> %i\n", opponentForce, opponentCreatures, myForce, myCreatures, attack);
|
||||
if (attack)
|
||||
@@ -855,10 +894,14 @@ int AIPlayer::chooseAttackers()
|
||||
/* Can I first strike my oponent and get away with murder ? */
|
||||
int AIPlayer::canFirstStrikeKill(MTGCardInstance * card, MTGCardInstance *ennemy)
|
||||
{
|
||||
if (ennemy->has(Constants::FIRSTSTRIKE) || ennemy->has(Constants::DOUBLESTRIKE)) return 0;
|
||||
if (!(card->has(Constants::FIRSTSTRIKE) || card->has(Constants::DOUBLESTRIKE))) return 0;
|
||||
if (!(card->power >= ennemy->toughness)) return 0;
|
||||
if (!(card->power >= ennemy->toughness + 1) && ennemy->has(Constants::FLANKING)) return 0;
|
||||
if (ennemy->has(Constants::FIRSTSTRIKE) || ennemy->has(Constants::DOUBLESTRIKE))
|
||||
return 0;
|
||||
if (!(card->has(Constants::FIRSTSTRIKE) || card->has(Constants::DOUBLESTRIKE)))
|
||||
return 0;
|
||||
if (!(card->power >= ennemy->toughness))
|
||||
return 0;
|
||||
if (!(card->power >= ennemy->toughness + 1) && ennemy->has(Constants::FLANKING))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -866,9 +909,6 @@ int AIPlayer::chooseBlockers()
|
||||
{
|
||||
map<MTGCardInstance *, int> opponentsToughness;
|
||||
int opponentForce = getCreaturesInfo(opponent(), INFO_CREATURESPOWER);
|
||||
//int opponentCreatures = getCreaturesInfo(opponent(), INFO_NBCREATURES, -1);
|
||||
//int myForce = getCreaturesInfo(this,INFO_CREATURESPOWER);
|
||||
//int myCreatures = getCreaturesInfo(this, INFO_NBCREATURES, -1);
|
||||
CardDescriptor cd;
|
||||
cd.init();
|
||||
cd.setType("Creature");
|
||||
@@ -936,7 +976,8 @@ int AIPlayer::chooseBlockers()
|
||||
{
|
||||
MTGCardInstance * attacker = card->defenser;
|
||||
if (opponentsToughness[attacker] <= 0 || (card->toughness <= attacker->power && opponentForce * 2 < life
|
||||
&& !canFirstStrikeKill(card, attacker)) || attacker->nbOpponents() > 1 || attacker->controller()->isAI())
|
||||
&& !canFirstStrikeKill(card, attacker)) || attacker->nbOpponents() > 1
|
||||
|| attacker->controller()->isAI())
|
||||
{
|
||||
g->mLayers->actionLayer()->reactToClick(a, card);
|
||||
}
|
||||
@@ -981,9 +1022,11 @@ int AIPlayer::combatDamages()
|
||||
GameObserver * gameObs = GameObserver::GetInstance();
|
||||
int currentGamePhase = gameObs->getCurrentGamePhase();
|
||||
|
||||
if (currentGamePhase == Constants::MTG_PHASE_COMBATBLOCKERS) return orderBlockers();
|
||||
if (currentGamePhase == Constants::MTG_PHASE_COMBATBLOCKERS)
|
||||
return orderBlockers();
|
||||
|
||||
if (currentGamePhase != Constants::MTG_PHASE_COMBATDAMAGE) return 0;
|
||||
if (currentGamePhase != Constants::MTG_PHASE_COMBATDAMAGE)
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1033,7 +1076,8 @@ AIPlayer * AIPlayerFactory::createAIPlayer(MTGAllCards * collection, Player * op
|
||||
nbdecks++;
|
||||
}
|
||||
}
|
||||
if (!nbdecks) return NULL;
|
||||
if (!nbdecks)
|
||||
return NULL;
|
||||
deckid = 1 + WRand() % (nbdecks);
|
||||
}
|
||||
sprintf(deckFile, JGE_GET_RES("ai/baka/deck%i.txt").c_str(), deckid);
|
||||
@@ -1061,14 +1105,22 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty
|
||||
card = NULL;
|
||||
while ((card = cd.nextmatch(game->hand, card)))
|
||||
{
|
||||
if (!CanHandleCost(card->getManaCost())) continue;
|
||||
if (card->hasType(Subtypes::TYPE_CREATURE) && this->castrestrictedcreature == true && this->castrestrictedspell == true) continue;
|
||||
if (card->hasType(Subtypes::TYPE_ENCHANTMENT) && this->castrestrictedspell == true) continue;
|
||||
if (card->hasType(Subtypes::TYPE_ARTIFACT) && this->castrestrictedspell == true) continue;
|
||||
if (card->hasType(Subtypes::TYPE_SORCERY) && this->castrestrictedspell == true) continue;
|
||||
if (card->hasType(Subtypes::TYPE_INSTANT) && this->castrestrictedspell == true) continue;
|
||||
if (card->hasType(Subtypes::TYPE_LAND) && !this->canPutLandsIntoPlay) continue;
|
||||
if (card->hasType(Subtypes::TYPE_LEGENDARY) && game->inPlay->findByName(card->name)) continue;
|
||||
if (!CanHandleCost(card->getManaCost()))
|
||||
continue;
|
||||
if (card->hasType(Subtypes::TYPE_CREATURE) && this->castrestrictedcreature == true && this->castrestrictedspell == true)
|
||||
continue;
|
||||
if (card->hasType(Subtypes::TYPE_ENCHANTMENT) && this->castrestrictedspell == true)
|
||||
continue;
|
||||
if (card->hasType(Subtypes::TYPE_ARTIFACT) && this->castrestrictedspell == true)
|
||||
continue;
|
||||
if (card->hasType(Subtypes::TYPE_SORCERY) && this->castrestrictedspell == true)
|
||||
continue;
|
||||
if (card->hasType(Subtypes::TYPE_INSTANT) && this->castrestrictedspell == true)
|
||||
continue;
|
||||
if (card->hasType(Subtypes::TYPE_LAND) && !this->canPutLandsIntoPlay)
|
||||
continue;
|
||||
if (card->hasType(Subtypes::TYPE_LEGENDARY) && game->inPlay->findByName(card->name))
|
||||
continue;
|
||||
int currentCost = card->getManaCost()->getConvertedCost();
|
||||
int hasX = card->getManaCost()->hasX();
|
||||
if ((currentCost > maxCost || hasX) && pMana->canAfford(card->getManaCost()))
|
||||
@@ -1080,7 +1132,8 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty
|
||||
{
|
||||
int hasTarget = (chooseTarget(tc));
|
||||
delete tc;
|
||||
if (!hasTarget) continue;
|
||||
if (!hasTarget)
|
||||
continue;
|
||||
shouldPlayPercentage = 90;
|
||||
}
|
||||
else
|
||||
@@ -1099,21 +1152,24 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty
|
||||
if (hasX)
|
||||
{
|
||||
int xDiff = pMana->getConvertedCost() - currentCost;
|
||||
if (xDiff < 0) xDiff = 0;
|
||||
if (xDiff < 0)
|
||||
xDiff = 0;
|
||||
shouldPlayPercentage = shouldPlayPercentage - static_cast<int> ((shouldPlayPercentage * 1.9f) / (1 + xDiff));
|
||||
}
|
||||
|
||||
if (WRand() % 100 > shouldPlayPercentage) continue;
|
||||
if (WRand() % 100 > shouldPlayPercentage)
|
||||
continue;
|
||||
nextCardToPlay = card;
|
||||
maxCost = currentCost;
|
||||
if (hasX) maxCost = pMana->getConvertedCost();
|
||||
if (hasX)
|
||||
maxCost = pMana->getConvertedCost();
|
||||
}
|
||||
}
|
||||
return nextCardToPlay;
|
||||
}
|
||||
|
||||
AIPlayerBaka::AIPlayerBaka(MTGDeck * deck, string file, string fileSmall, string avatarFile) :
|
||||
AIPlayer(deck, file, fileSmall)
|
||||
AIPlayer(deck, file, fileSmall)
|
||||
{
|
||||
mAvatarTex = WResourceManager::Instance()->RetrieveTexture(avatarFile, RETRIEVE_LOCK, TEXTURE_SUB_AVATAR);
|
||||
|
||||
@@ -1141,13 +1197,15 @@ int AIPlayerBaka::computeActions()
|
||||
{
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
Player * p = g->currentPlayer;
|
||||
if (!(g->currentlyActing() == this)) return 0;
|
||||
if (!(g->currentlyActing() == this))
|
||||
return 0;
|
||||
if (g->mLayers->actionLayer()->menuObject)
|
||||
{
|
||||
g->mLayers->actionLayer()->doReactTo(0);
|
||||
return 1;
|
||||
}
|
||||
if (chooseTarget()) return 1;
|
||||
if (chooseTarget())
|
||||
return 1;
|
||||
int currentGamePhase = g->getCurrentGamePhase();
|
||||
if (g->isInterrupting == this)
|
||||
{ // interrupting
|
||||
@@ -1294,7 +1352,8 @@ int AIPlayerBaka::computeActions()
|
||||
|
||||
int AIPlayer::receiveEvent(WEvent * event)
|
||||
{
|
||||
if (getStats()) return getStats()->receiveEvent(event);
|
||||
if (getStats())
|
||||
return getStats()->receiveEvent(event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1334,7 +1393,8 @@ int AIPlayerBaka::Act(float dt)
|
||||
DebugTrace("Cannot interrupt");
|
||||
return 0;
|
||||
}
|
||||
if (clickstream.empty()) computeActions();
|
||||
if (clickstream.empty())
|
||||
computeActions();
|
||||
if (clickstream.empty())
|
||||
{
|
||||
if (g->isInterrupting == this)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "AllAbilities.h"
|
||||
|
||||
|
||||
//Activated Abilities
|
||||
|
||||
//Generic Activated Abilities
|
||||
@@ -21,19 +20,22 @@ int GenericActivatedAbility::resolve()
|
||||
SAFE_DELETE(diff);
|
||||
//SAFE_DELETE(abilityCost); this line has been reported as a bug. removing it doesn't seem to break anything, although I didn't get any error in the test suite by leaving it either, so... leaving it for now as a comment, in case.
|
||||
ability->target = target; //may have been updated...
|
||||
if (ability) return ability->resolve();
|
||||
if (ability)
|
||||
return ability->resolve();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * GenericActivatedAbility::getMenuText()
|
||||
{
|
||||
if (ability) return ability->getMenuText();
|
||||
if (ability)
|
||||
return ability->getMenuText();
|
||||
return "Error";
|
||||
}
|
||||
|
||||
int GenericActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
{
|
||||
if (limitPerTurn && counters >= limitPerTurn) return 0;
|
||||
if (limitPerTurn && counters >= limitPerTurn)
|
||||
return 0;
|
||||
return ActivatedAbility::isReactingToClick(card, mana);
|
||||
}
|
||||
|
||||
@@ -48,8 +50,10 @@ void GenericActivatedAbility::Update(float dt)
|
||||
|
||||
int GenericActivatedAbility::testDestroy()
|
||||
{
|
||||
if (!activeZone) return ActivatedAbility::testDestroy();
|
||||
if (activeZone->hasCard(source)) return 0;
|
||||
if (!activeZone)
|
||||
return ActivatedAbility::testDestroy();
|
||||
if (activeZone->hasCard(source))
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
}
|
||||
@@ -195,7 +199,8 @@ int AADepleter::resolve()
|
||||
MTGLibrary * library = player->game->library;
|
||||
for (int i = 0; i < nbcards; i++)
|
||||
{
|
||||
if (library->nb_cards) player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->graveyard);
|
||||
if (library->nb_cards)
|
||||
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->graveyard);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
@@ -249,7 +254,8 @@ AACounter::AACounter(int id, MTGCardInstance * source, MTGCardInstance * target,
|
||||
ActivatedAbility(id, source, cost, 0, doTap), nb(nb), power(power), toughness(toughness), name(_name)
|
||||
{
|
||||
this->target = target;
|
||||
if (name.find("Level")) aType = MTGAbility::STANDARD_LEVELUP;
|
||||
if (name.find("Level"))
|
||||
aType = MTGAbility::STANDARD_LEVELUP;
|
||||
menu = "";
|
||||
}
|
||||
|
||||
@@ -283,34 +289,34 @@ int AACounter::resolve()
|
||||
|
||||
const char* AACounter::getMenuText()
|
||||
{
|
||||
if(menu.size())
|
||||
if (menu.size())
|
||||
{
|
||||
return menu.c_str();
|
||||
}
|
||||
char buffer[128];
|
||||
|
||||
if(name.size())
|
||||
if (name.size())
|
||||
{
|
||||
string s = name;
|
||||
menu.append(s.c_str());
|
||||
}
|
||||
|
||||
if(power != 0 || toughness != 0)
|
||||
if (power != 0 || toughness != 0)
|
||||
{
|
||||
sprintf(buffer, " %i/%i", power,toughness);
|
||||
sprintf(buffer, " %i/%i", power, toughness);
|
||||
menu.append(buffer);
|
||||
}
|
||||
|
||||
menu.append(" Counter");
|
||||
if(nb != 1)
|
||||
if (nb != 1)
|
||||
{
|
||||
sprintf(buffer, ": %i", nb);
|
||||
menu.append(buffer);
|
||||
}
|
||||
|
||||
sprintf(menuText, "%s",menu.c_str());
|
||||
sprintf(menuText, "%s", menu.c_str());
|
||||
return menuText;
|
||||
}
|
||||
}
|
||||
|
||||
AACounter * AACounter::clone() const
|
||||
{
|
||||
@@ -329,7 +335,8 @@ AAFizzler::AAFizzler(int _id, MTGCardInstance * card, Spell * _target, ManaCost
|
||||
int AAFizzler::resolve()
|
||||
{
|
||||
Spell * _target = (Spell *) target;
|
||||
if (target && _target->source->has(Constants::NOFIZZLE)) return 0;
|
||||
if (target && _target->source->has(Constants::NOFIZZLE))
|
||||
return 0;
|
||||
game->mLayers->stackLayer()->Fizzle(_target);
|
||||
return 1;
|
||||
}
|
||||
@@ -350,7 +357,8 @@ AAFizzler* AAFizzler::clone() const
|
||||
AABanishCard::AABanishCard(int _id, MTGCardInstance * _source, MTGCardInstance * _target, int _banishmentType) :
|
||||
ActivatedAbility(_id, _source, NULL), banishmentType(_banishmentType)
|
||||
{
|
||||
if (_target) target = _target;
|
||||
if (_target)
|
||||
target = _target;
|
||||
}
|
||||
|
||||
const char * AABanishCard::getMenuText()
|
||||
@@ -660,7 +668,7 @@ AACloner::AACloner(int _id, MTGCardInstance * _source, MTGCardInstance * _target
|
||||
aType = MTGAbility::CLONING;
|
||||
target = _target;
|
||||
source = _source;
|
||||
if ( abilitiesStringList.size() > 0 )
|
||||
if (abilitiesStringList.size() > 0)
|
||||
{
|
||||
PopulateAbilityIndexVector(awith, abilitiesStringList);
|
||||
PopulateColorIndexVector(colors, abilitiesStringList);
|
||||
@@ -676,8 +684,10 @@ int AACloner::resolve()
|
||||
MTGCardInstance * myClone = NULL;
|
||||
MTGCard* clone = (_target->isToken ? _target : GameApp::collection->getCardById(_target->getId()));
|
||||
|
||||
if (who != 1) myClone = NEW MTGCardInstance(clone, source->controller()->game);
|
||||
if (who == 1) myClone = NEW MTGCardInstance(clone, source->controller()->opponent()->game);
|
||||
if (who != 1)
|
||||
myClone = NEW MTGCardInstance(clone, source->controller()->game);
|
||||
if (who == 1)
|
||||
myClone = NEW MTGCardInstance(clone, source->controller()->opponent()->game);
|
||||
if (who != 1)
|
||||
source->controller()->game->temp->addCard(myClone);
|
||||
else
|
||||
@@ -703,7 +713,8 @@ int AACloner::resolve()
|
||||
|
||||
const char * AACloner::getMenuText()
|
||||
{
|
||||
if (who == 1) return "Clone For Opponent";
|
||||
if (who == 1)
|
||||
return "Clone For Opponent";
|
||||
return "Clone";
|
||||
}
|
||||
|
||||
@@ -772,7 +783,8 @@ AAMoreLandPlz::~AAMoreLandPlz()
|
||||
AAMover::AAMover(int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest, ManaCost * _cost, int doTap) :
|
||||
ActivatedAbility(_id, _source, _cost, 0, doTap), destination(dest)
|
||||
{
|
||||
if (_target) target = _target;
|
||||
if (_target)
|
||||
target = _target;
|
||||
}
|
||||
|
||||
MTGGameZone * AAMover::destinationZone()
|
||||
@@ -1156,7 +1168,6 @@ AAWinGame * AAWinGame::clone() const
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
//Generic Abilities
|
||||
|
||||
//May Abilities
|
||||
@@ -1175,7 +1186,8 @@ void MayAbility::Update(float dt)
|
||||
triggered = 1;
|
||||
if (TargetAbility * ta = dynamic_cast<TargetAbility *>(ability))
|
||||
{
|
||||
if (!ta->tc->validTargetsExist()) return;
|
||||
if (!ta->tc->validTargetsExist())
|
||||
return;
|
||||
}
|
||||
game->mLayers->actionLayer()->setMenuObject(source, must);
|
||||
game->mLayers->stackLayer()->setIsInterrupting(source->controller());
|
||||
@@ -1189,15 +1201,19 @@ const char * MayAbility::getMenuText()
|
||||
|
||||
int MayAbility::testDestroy()
|
||||
{
|
||||
if (!triggered) return 0;
|
||||
if (game->mLayers->actionLayer()->menuObject) return 0;
|
||||
if (game->mLayers->actionLayer()->getIndexOf(mClone) != -1) return 0;
|
||||
if (!triggered)
|
||||
return 0;
|
||||
if (game->mLayers->actionLayer()->menuObject)
|
||||
return 0;
|
||||
if (game->mLayers->actionLayer()->getIndexOf(mClone) != -1)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int MayAbility::isReactingToTargetClick(Targetable * card)
|
||||
{
|
||||
if (card == source) return 1;
|
||||
if (card == source)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1226,7 +1242,8 @@ MayAbility::~MayAbility()
|
||||
MultiAbility::MultiAbility(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, int _tap) :
|
||||
ActivatedAbility(_id, card, _cost, 0, _tap)
|
||||
{
|
||||
if (_target) target = _target;
|
||||
if (_target)
|
||||
target = _target;
|
||||
}
|
||||
|
||||
int MultiAbility::Add(MTGAbility * ability)
|
||||
@@ -1240,9 +1257,11 @@ int MultiAbility::resolve()
|
||||
vector<int>::size_type sz = abilities.size();
|
||||
for (unsigned int i = 0; i < sz; i++)
|
||||
{
|
||||
if (abilities[i] == NULL) continue;
|
||||
if (abilities[i] == NULL)
|
||||
continue;
|
||||
Targetable * backup = abilities[i]->target;
|
||||
if (target && target != source && abilities[i]->target == abilities[i]->source) abilities[i]->target = target;
|
||||
if (target && target != source && abilities[i]->target == abilities[i]->source)
|
||||
abilities[i]->target = target;
|
||||
abilities[i]->resolve();
|
||||
abilities[i]->target = backup;
|
||||
}
|
||||
@@ -1251,7 +1270,8 @@ int MultiAbility::resolve()
|
||||
|
||||
const char * MultiAbility::getMenuText()
|
||||
{
|
||||
if (abilities.size()) return abilities[0]->getMenuText();
|
||||
if (abilities.size())
|
||||
return abilities[0]->getMenuText();
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -1275,7 +1295,6 @@ MultiAbility::~MultiAbility()
|
||||
abilities.clear();
|
||||
}
|
||||
|
||||
|
||||
//Generic Target Ability
|
||||
GenericTargetAbility::GenericTargetAbility(int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a,
|
||||
ManaCost * _cost, int _tap, int limit, int restrictions, MTGGameZone * dest) :
|
||||
@@ -1283,13 +1302,15 @@ GenericTargetAbility::GenericTargetAbility(int _id, MTGCardInstance * _source, T
|
||||
{
|
||||
ability = a;
|
||||
MTGAbility * core = AbilityFactory::getCoreAbility(a);
|
||||
if (dynamic_cast<AACopier *> (core)) tc->other = true; //http://code.google.com/p/wagic/issues/detail?id=209 (avoid inifinite loop)
|
||||
if (dynamic_cast<AACopier *> (core))
|
||||
tc->other = true; //http://code.google.com/p/wagic/issues/detail?id=209 (avoid inifinite loop)
|
||||
counters = 0;
|
||||
}
|
||||
|
||||
const char * GenericTargetAbility::getMenuText()
|
||||
{
|
||||
if (!ability) return "Error";
|
||||
if (!ability)
|
||||
return "Error";
|
||||
|
||||
MTGAbility * core = AbilityFactory::getCoreAbility(ability);
|
||||
if (AAMover * move = dynamic_cast<AAMover *>(core))
|
||||
@@ -1318,7 +1339,9 @@ const char * GenericTargetAbility::getMenuText()
|
||||
{
|
||||
return "Reanimate";
|
||||
}
|
||||
else if ((tc->targetsZone(g->players[i]->game->inPlay) && dest == g->players[i]->game->library) || dest == g->players[i]->game->library )
|
||||
else if ((tc->targetsZone(g->players[i]->game->inPlay)
|
||||
&& dest == g->players[i]->game->library)
|
||||
|| dest == g->players[i]->game->library)
|
||||
{
|
||||
return "Put in Library";
|
||||
}
|
||||
@@ -1361,7 +1384,8 @@ int GenericTargetAbility::resolve()
|
||||
|
||||
int GenericTargetAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
{
|
||||
if (limitPerTurn && counters >= limitPerTurn) return 0;
|
||||
if (limitPerTurn && counters >= limitPerTurn)
|
||||
return 0;
|
||||
return TargetAbility::isReactingToClick(card, mana);
|
||||
}
|
||||
|
||||
@@ -1376,8 +1400,10 @@ void GenericTargetAbility::Update(float dt)
|
||||
|
||||
int GenericTargetAbility::testDestroy()
|
||||
{
|
||||
if (!activeZone) return TargetAbility::testDestroy();
|
||||
if (activeZone->hasCard(source)) return 0;
|
||||
if (!activeZone)
|
||||
return TargetAbility::testDestroy();
|
||||
if (activeZone->hasCard(source))
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
}
|
||||
@@ -1388,7 +1414,8 @@ GenericTargetAbility * GenericTargetAbility::clone() const
|
||||
a->ability = ability->clone();
|
||||
a->cost = NEW ManaCost();
|
||||
a->cost->copy(cost);
|
||||
if (tc) a->tc = tc->clone();
|
||||
if (tc)
|
||||
a->tc = tc->clone();
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -1461,19 +1488,23 @@ ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * t
|
||||
PopulateColorIndexVector(colors, sabilities);
|
||||
|
||||
remove = false;
|
||||
if (stypes == "removesubtypes") remove = true;
|
||||
if (stypes == "removesubtypes")
|
||||
remove = true;
|
||||
if (stypes == "allsubtypes" || stypes == "removesubtypes")
|
||||
{
|
||||
for (int i = Subtypes::LAST_TYPE + 1;; i++)
|
||||
{
|
||||
string s = Subtypes::subtypesList->find(i);
|
||||
{
|
||||
if (s == "") break;
|
||||
if (s.find(" ") != string::npos) continue;
|
||||
if (s == "Nothing" || s == "Swamp" || s == "Plains" || s == "Mountain" || s == "Forest" || s == "Island" || s
|
||||
== "Shrine" || s == "Basic" || s == "Colony" || s == "Desert" || s == "Dismiss" || s == "Equipment" || s
|
||||
== "Everglades" || s == "Grasslands" || s == "Lair" || s == "Level" || s == "Levelup" || s == "Mine" || s
|
||||
== "Oasis" || s == "World" || s == "Aura")
|
||||
if (s == "")
|
||||
break;
|
||||
if (s.find(" ") != string::npos)
|
||||
continue;
|
||||
if (s == "Nothing" || s == "Swamp" || s == "Plains" || s == "Mountain" || s == "Forest"
|
||||
|| s == "Island" || s == "Shrine" || s == "Basic" || s == "Colony" || s == "Desert"
|
||||
|| s == "Dismiss" || s == "Equipment" || s == "Everglades" || s == "Grasslands" || s == "Lair"
|
||||
|| s == "Level" || s == "Levelup" || s == "Mine" || s == "Oasis" || s == "World" || s == "Aura"
|
||||
)
|
||||
{//dont add "nothing" or land type to this card.
|
||||
}
|
||||
else
|
||||
@@ -1500,13 +1531,16 @@ int ATransformer::addToGame()
|
||||
_target = _target->next;
|
||||
for (int j = 0; j < Constants::MTG_NB_COLORS; j++)
|
||||
{
|
||||
if (_target->hasColor(j)) oldcolors.push_back(j);
|
||||
if (_target->hasColor(j))
|
||||
oldcolors.push_back(j);
|
||||
}
|
||||
for (int j = Subtypes::LAST_TYPE + 1;; j++)
|
||||
{
|
||||
string otypes = Subtypes::subtypesList->find(j);
|
||||
if (otypes == "") break;
|
||||
if (otypes.find(" ") != string::npos) continue;
|
||||
if (otypes == "")
|
||||
break;
|
||||
if (otypes.find(" ") != string::npos)
|
||||
continue;
|
||||
if (_target->hasSubtype(j))
|
||||
{
|
||||
oldtypes.push_back(j);
|
||||
@@ -1554,7 +1588,8 @@ int ATransformer::destroy()
|
||||
list<int>::iterator it;
|
||||
for (it = types.begin(); it != types.end(); it++)
|
||||
{
|
||||
if (remove == false) _target->removeType(*it);
|
||||
if (remove == false)
|
||||
_target->removeType(*it);
|
||||
}
|
||||
for (it = colors.begin(); it != colors.end(); it++)
|
||||
{
|
||||
@@ -1572,7 +1607,8 @@ int ATransformer::destroy()
|
||||
{
|
||||
for (it = oldtypes.begin(); it != oldtypes.end(); it++)
|
||||
{
|
||||
if (!_target->hasSubtype(*it)) _target->addType(*it);
|
||||
if (!_target->hasSubtype(*it))
|
||||
_target->addType(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1824,7 +1860,8 @@ const char * ABecomes::getMenuText()
|
||||
ABecomes * ABecomes::clone() const
|
||||
{
|
||||
ABecomes * a = NEW ABecomes(*this);
|
||||
if (a->wppt) a->wppt = NEW WParsedPT(*(a->wppt));
|
||||
if (a->wppt)
|
||||
a->wppt = NEW WParsedPT(*(a->wppt));
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -1887,9 +1924,11 @@ int APreventDamageTypes::addToGame()
|
||||
}
|
||||
TargetChooserFactory tcf;
|
||||
TargetChooser *toTc = tcf.createTargetChooser(to, source, this);
|
||||
if (toTc) toTc->targetter = NULL;
|
||||
if (toTc)
|
||||
toTc->targetter = NULL;
|
||||
TargetChooser *fromTc = tcf.createTargetChooser(from, source, this);
|
||||
if (fromTc) fromTc->targetter = NULL;
|
||||
if (fromTc)
|
||||
fromTc->targetter = NULL;
|
||||
if (type != 1 && type != 2)
|
||||
{//not adding this creates a memory leak.
|
||||
re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, DAMAGE_COMBAT);
|
||||
@@ -1990,14 +2029,16 @@ void AUpkeep::Update(float dt)
|
||||
{
|
||||
ability->resolve();
|
||||
}
|
||||
if (newPhase == phase + 1 && once) once = 2;
|
||||
if (newPhase == phase + 1 && once)
|
||||
once = 2;
|
||||
}
|
||||
ActivatedAbility::Update(dt);
|
||||
}
|
||||
|
||||
int AUpkeep::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
{
|
||||
if (currentPhase != phase || paidThisTurn || once >= 2) return 0;
|
||||
if (currentPhase != phase || paidThisTurn || once >= 2)
|
||||
return 0;
|
||||
return ActivatedAbility::isReactingToClick(card, mana);
|
||||
}
|
||||
|
||||
@@ -2031,45 +2072,44 @@ AUpkeep::~AUpkeep()
|
||||
SAFE_DELETE(ability);
|
||||
}
|
||||
|
||||
|
||||
// utility functions
|
||||
|
||||
// Given a delimited string of abilities, add the ones to the list that are "Basic" MTG abilities
|
||||
void PopulateAbilityIndexVector( list<int>& abilities, const string& abilityStringList, char delimiter )
|
||||
void PopulateAbilityIndexVector(list<int>& abilities, const string& abilityStringList, char delimiter)
|
||||
{
|
||||
vector<string> abilitiesList = split( abilityStringList, delimiter);
|
||||
for ( vector<string>::iterator iter = abilitiesList.begin(); iter != abilitiesList.end(); ++iter)
|
||||
vector<string> abilitiesList = split(abilityStringList, delimiter);
|
||||
for (vector<string>::iterator iter = abilitiesList.begin(); iter != abilitiesList.end(); ++iter)
|
||||
{
|
||||
int abilityIndex = Constants::GetBasicAbilityIndex( *iter );
|
||||
int abilityIndex = Constants::GetBasicAbilityIndex(*iter);
|
||||
|
||||
if (abilityIndex != -1)
|
||||
abilities.push_back( abilityIndex );
|
||||
abilities.push_back(abilityIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PopulateColorIndexVector( list<int>& colors, const string& colorStringList, char delimiter )
|
||||
void PopulateColorIndexVector(list<int>& colors, const string& colorStringList, char delimiter)
|
||||
{
|
||||
vector<string> abilitiesList = split( colorStringList, delimiter);
|
||||
for ( vector<string>::iterator iter = abilitiesList.begin(); iter != abilitiesList.end(); ++iter)
|
||||
vector<string> abilitiesList = split(colorStringList, delimiter);
|
||||
for (vector<string>::iterator iter = abilitiesList.begin(); iter != abilitiesList.end(); ++iter)
|
||||
{
|
||||
for (int colorIndex = Constants::MTG_COLOR_ARTIFACT; colorIndex < Constants::MTG_NB_COLORS; ++colorIndex)
|
||||
{
|
||||
// if the text is not a basic ability but contains a valid color add it to the color vector
|
||||
if ( (Constants::GetBasicAbilityIndex( *iter ) != -1) && ((*iter).find( Constants::MTGColorStrings[ colorIndex ] ) != string::npos) )
|
||||
if ((Constants::GetBasicAbilityIndex(*iter) != -1)
|
||||
&& ((*iter).find(Constants::MTGColorStrings[colorIndex]) != string::npos))
|
||||
colors.push_back(colorIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PopulateSubtypesIndexVector( list<int>& types, const string& subTypesStringList, char delimiter)
|
||||
void PopulateSubtypesIndexVector(list<int>& types, const string& subTypesStringList, char delimiter)
|
||||
{
|
||||
vector<string> subTypesList = split( subTypesStringList, delimiter);
|
||||
vector<string> subTypesList = split(subTypesStringList, delimiter);
|
||||
for (vector<string>::iterator it = subTypesList.begin(); it != subTypesList.end(); ++it)
|
||||
{
|
||||
string subtype = *it;
|
||||
size_t id = Subtypes::subtypesList->find( subtype );
|
||||
if ( id != string::npos )
|
||||
size_t id = Subtypes::subtypesList->find(subtype);
|
||||
if (id != string::npos)
|
||||
types.push_back(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ void GameObserver::nextGamePhase()
|
||||
{
|
||||
Phase * cPhaseOld = phaseRing->getCurrentPhase();
|
||||
if (cPhaseOld->id == Constants::MTG_PHASE_COMBATDAMAGE)
|
||||
if (FIRST_STRIKE == combatStep || END_FIRST_STRIKE == combatStep || DAMAGE == combatStep)
|
||||
if ((FIRST_STRIKE == combatStep) || (END_FIRST_STRIKE == combatStep) || (DAMAGE == combatStep))
|
||||
{
|
||||
nextCombatStep();
|
||||
return;
|
||||
@@ -213,10 +213,12 @@ void GameObserver::userRequestNextGamePhase()
|
||||
bool executeNextPhaseImmediately = true;
|
||||
|
||||
Phase * cPhaseOld = phaseRing->getCurrentPhase();
|
||||
if ((cPhaseOld->id == Constants::MTG_PHASE_COMBATBLOCKERS && combatStep == ORDER) || (cPhaseOld->id
|
||||
== Constants::MTG_PHASE_COMBATBLOCKERS && combatStep == TRIGGERS) || cPhaseOld->id
|
||||
== Constants::MTG_PHASE_COMBATDAMAGE || opponent()->isAI()
|
||||
|| options[Options::optionInterrupt(currentGamePhase)].number)
|
||||
if ((cPhaseOld->id == Constants::MTG_PHASE_COMBATBLOCKERS && combatStep == ORDER)
|
||||
|| (cPhaseOld->id == Constants::MTG_PHASE_COMBATBLOCKERS && combatStep == TRIGGERS)
|
||||
|| (cPhaseOld->id == Constants::MTG_PHASE_COMBATDAMAGE)
|
||||
|| opponent()->isAI()
|
||||
|| options[Options::optionInterrupt(currentGamePhase)].number
|
||||
)
|
||||
{
|
||||
executeNextPhaseImmediately = false;
|
||||
}
|
||||
@@ -372,7 +374,7 @@ void GameObserver::gameStateBasedEffects()
|
||||
//effects or menus actions
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
if(players[i]->landsPlayerCanStillPlay <= 0)
|
||||
if (players[i]->landsPlayerCanStillPlay <= 0)
|
||||
{
|
||||
players[i]->canPutLandsIntoPlay = false;
|
||||
}
|
||||
@@ -525,28 +527,28 @@ void GameObserver::gameStateBasedEffects()
|
||||
p->onlyoneboth = false;
|
||||
}
|
||||
//------------------------------------
|
||||
if(players[0]->bothrestrictedcreature)
|
||||
if (players[0]->bothrestrictedcreature)
|
||||
players[1]->castrestrictedcreature = true;
|
||||
//------------------------------------
|
||||
if(players[0]->bothrestrictedspell)
|
||||
if (players[0]->bothrestrictedspell)
|
||||
players[1]->castrestrictedspell = true;
|
||||
//------------------------------------
|
||||
if(players[0]->onlyoneboth)
|
||||
if (players[0]->onlyoneboth)
|
||||
players[1]->onlyoneboth = true;
|
||||
//------------------------------------
|
||||
if(players[1]->bothrestrictedcreature)
|
||||
if (players[1]->bothrestrictedcreature)
|
||||
players[0]->castrestrictedcreature = true;
|
||||
//------------------------------------
|
||||
if(players[1]->bothrestrictedspell)
|
||||
if (players[1]->bothrestrictedspell)
|
||||
players[0]->castrestrictedspell = true;
|
||||
//------------------------------------
|
||||
if(players[1]->onlyoneboth)
|
||||
if (players[1]->onlyoneboth)
|
||||
players[0]->onlyoneboth = true;
|
||||
//------------------------------------
|
||||
/////////////////////////////////////////////////
|
||||
//handle end of turn effects while we're at it.//
|
||||
/////////////////////////////////////////////////
|
||||
if( currentGamePhase == Constants::MTG_PHASE_ENDOFTURN)
|
||||
if (currentGamePhase == Constants::MTG_PHASE_ENDOFTURN)
|
||||
{
|
||||
for (int j = 0; j < nbcards; ++j)
|
||||
{
|
||||
@@ -564,10 +566,8 @@ void GameObserver::gameStateBasedEffects()
|
||||
game->receiveEvent(e);
|
||||
p->game->putInGraveyard(c);
|
||||
}
|
||||
if (c->has(Constants::UNEARTH))
|
||||
p->game->putInExile(c);
|
||||
if (c->fresh)
|
||||
c->fresh = 0;
|
||||
if (c->has(Constants::UNEARTH)) p->game->putInExile(c);
|
||||
if (c->fresh) c->fresh = 0;
|
||||
if (c->has(Constants::ONLYONEBOTH))
|
||||
{
|
||||
c->controller()->castcount = 0;
|
||||
@@ -582,12 +582,12 @@ void GameObserver::gameStateBasedEffects()
|
||||
card->fresh = 0;
|
||||
}
|
||||
}
|
||||
if(z->nb_cards == 0)
|
||||
if (z->nb_cards == 0)
|
||||
{
|
||||
p->nomaxhandsize = false;
|
||||
if(!p->bothrestrictedcreature && !p->opponent()->bothrestrictedcreature)
|
||||
if (!p->bothrestrictedcreature && !p->opponent()->bothrestrictedcreature)
|
||||
p->castrestrictedcreature = false;
|
||||
if(!p->bothrestrictedspell && !p->opponent()->bothrestrictedspell)
|
||||
if (!p->bothrestrictedspell && !p->opponent()->bothrestrictedspell)
|
||||
p->castrestrictedspell = false;
|
||||
p->onlyonecast = false;
|
||||
}
|
||||
@@ -597,28 +597,30 @@ void GameObserver::gameStateBasedEffects()
|
||||
///////////////////////////////////
|
||||
if (combatStep == TRIGGERS)
|
||||
{
|
||||
if (!mLayers->stackLayer()->getNext(NULL, 0, NOT_RESOLVED) && !targetChooser && !mLayers->actionLayer()->isWaitingForAnswer())
|
||||
if (!mLayers->stackLayer()->getNext(NULL, 0, NOT_RESOLVED) && !targetChooser
|
||||
&& !mLayers->actionLayer()->isWaitingForAnswer())
|
||||
mLayers->stackLayer()->AddNextCombatStep();
|
||||
}
|
||||
|
||||
//Auto skip Phases
|
||||
GameObserver * game = game->GetInstance();
|
||||
int skipLevel = (game->currentPlayer->playMode == Player::MODE_TEST_SUITE) ? Constants::ASKIP_NONE : options[Options::ASPHASES].number;
|
||||
int skipLevel = (game->currentPlayer->playMode == Player::MODE_TEST_SUITE) ? Constants::ASKIP_NONE
|
||||
: options[Options::ASPHASES].number;
|
||||
int nrCreatures = currentPlayer->game->inPlay->countByType("Creature");
|
||||
|
||||
if (skipLevel == Constants::ASKIP_SAFE || skipLevel == Constants::ASKIP_FULL)
|
||||
{
|
||||
if ((opponent()->isAI() && !(isInterrupting)) && (currentGamePhase == Constants::MTG_PHASE_UNTAP || currentGamePhase
|
||||
== Constants::MTG_PHASE_DRAW || currentGamePhase == Constants::MTG_PHASE_COMBATBEGIN || ((currentGamePhase
|
||||
== Constants::MTG_PHASE_COMBATATTACKERS) && (nrCreatures == 0)) || currentGamePhase
|
||||
== Constants::MTG_PHASE_COMBATEND || currentGamePhase == Constants::MTG_PHASE_ENDOFTURN
|
||||
if ((opponent()->isAI() && !(isInterrupting)) && ((currentGamePhase == Constants::MTG_PHASE_UNTAP)
|
||||
|| (currentGamePhase == Constants::MTG_PHASE_DRAW) || (currentGamePhase == Constants::MTG_PHASE_COMBATBEGIN)
|
||||
|| ((currentGamePhase == Constants::MTG_PHASE_COMBATATTACKERS) && (nrCreatures == 0))
|
||||
|| currentGamePhase == Constants::MTG_PHASE_COMBATEND || currentGamePhase == Constants::MTG_PHASE_ENDOFTURN
|
||||
|| ((currentGamePhase == Constants::MTG_PHASE_CLEANUP) && (currentPlayer->game->hand->nb_cards < 8))))
|
||||
userRequestNextGamePhase();
|
||||
}
|
||||
if (skipLevel == Constants::ASKIP_FULL)
|
||||
{
|
||||
if ((opponent()->isAI() && !(isInterrupting)) && (currentGamePhase == Constants::MTG_PHASE_UPKEEP || currentGamePhase
|
||||
== Constants::MTG_PHASE_COMBATDAMAGE))
|
||||
if ((opponent()->isAI() && !(isInterrupting)) && (currentGamePhase == Constants::MTG_PHASE_UPKEEP
|
||||
|| currentGamePhase == Constants::MTG_PHASE_COMBATDAMAGE))
|
||||
userRequestNextGamePhase();
|
||||
}
|
||||
}
|
||||
@@ -630,6 +632,7 @@ void GameObserver::Render()
|
||||
JRenderer::GetInstance()->DrawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(255,255,0,0));
|
||||
if (mExtraPayment)
|
||||
mExtraPayment->Render();
|
||||
|
||||
for (int i = 0; i < nbPlayers; ++i)
|
||||
{
|
||||
players[i]->Render();
|
||||
|
||||
+111
-66
@@ -19,9 +19,11 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
Player * currentPlayer = game->currentPlayer;
|
||||
if (!player->game->hand->hasCard(card))
|
||||
return 0;
|
||||
if ((game->turn < 1) && (cardsinhand != 0) && (card->basicAbilities[Constants::LEYLINE]) && game->currentGamePhase
|
||||
== Constants::MTG_PHASE_FIRSTMAIN && game->players[0]->game->graveyard->nb_cards == 0
|
||||
&& game->players[0]->game->exile->nb_cards == 0)
|
||||
if ((game->turn < 1) && (cardsinhand != 0) && (card->basicAbilities[Constants::LEYLINE])
|
||||
&& game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN
|
||||
&& game->players[0]->game->graveyard->nb_cards == 0
|
||||
&& game->players[0]->game->exile->nb_cards == 0
|
||||
)
|
||||
{
|
||||
Player * p = game->currentPlayer;
|
||||
if (card->basicAbilities[Constants::LEYLINE])
|
||||
@@ -35,15 +37,18 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
}
|
||||
if (card->hasType("land"))
|
||||
{
|
||||
if (player == currentPlayer && currentPlayer->canPutLandsIntoPlay && (game->currentGamePhase
|
||||
== Constants::MTG_PHASE_FIRSTMAIN || game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN))
|
||||
if (player == currentPlayer && currentPlayer->canPutLandsIntoPlay
|
||||
&& (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN || game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN)
|
||||
)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if ((card->hasType("instant")) || card->has(Constants::FLASH) || (player == currentPlayer && !game->isInterrupting
|
||||
&& (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN || game->currentGamePhase
|
||||
== Constants::MTG_PHASE_SECONDMAIN)))
|
||||
else if ((card->hasType("instant")) || card->has(Constants::FLASH)
|
||||
|| (player == currentPlayer && !game->isInterrupting
|
||||
&& (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN
|
||||
|| game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN))
|
||||
)
|
||||
{
|
||||
ManaCost * playerMana = player->getManaPool();
|
||||
ManaCost * cost = card->getManaCost();
|
||||
@@ -241,15 +246,17 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
|
||||
return 0;
|
||||
if (card->hasType("land"))
|
||||
{
|
||||
if (player == currentPlayer && currentPlayer->canPutLandsIntoPlay && (game->currentGamePhase
|
||||
== Constants::MTG_PHASE_FIRSTMAIN || game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN))
|
||||
{
|
||||
if (player == currentPlayer && currentPlayer->canPutLandsIntoPlay
|
||||
&& (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN
|
||||
|| game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN)
|
||||
)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if ((card->hasType("instant")) || card->has(Constants::FLASH) || (player == currentPlayer && !game->isInterrupting
|
||||
&& (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN || game->currentGamePhase
|
||||
== Constants::MTG_PHASE_SECONDMAIN)))
|
||||
else if ((card->hasType("instant")) || card->has(Constants::FLASH) || (player == currentPlayer
|
||||
&& !game->isInterrupting
|
||||
&& (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN
|
||||
|| game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN))
|
||||
)
|
||||
{
|
||||
ManaCost * playerMana = player->getManaPool();
|
||||
ManaCost * cost = card->getManaCost();
|
||||
@@ -455,11 +462,11 @@ int MTGBuyBackRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (player->nospellinstant == true )
|
||||
if (player->nospellinstant == true)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (player->onlyoneinstant == true )
|
||||
if (player->onlyoneinstant == true)
|
||||
{
|
||||
if (player->castcount >= 1)
|
||||
{
|
||||
@@ -621,9 +628,11 @@ int MTGFlashBackRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
return 0;
|
||||
if (!card->getManaCost()->FlashBack)
|
||||
return 0;
|
||||
if ((card->hasType("instant")) || card->has(Constants::FLASH) || (player == currentPlayer && !game->isInterrupting
|
||||
&& (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN || game->currentGamePhase
|
||||
== Constants::MTG_PHASE_SECONDMAIN)))
|
||||
if ((card->hasType("instant")) || card->has(Constants::FLASH)
|
||||
|| (player == currentPlayer && !game->isInterrupting
|
||||
&& (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN
|
||||
|| game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN))
|
||||
)
|
||||
{
|
||||
ManaCost * playerMana = player->getManaPool();
|
||||
ManaCost * cost = card->getManaCost();
|
||||
@@ -640,11 +649,11 @@ int MTGFlashBackRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (player->nospellinstant == true )
|
||||
if (player->nospellinstant == true)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (player->onlyoneinstant == true )
|
||||
if (player->onlyoneinstant == true)
|
||||
{
|
||||
if (player->castcount >= 1)
|
||||
{
|
||||
@@ -732,7 +741,7 @@ int MTGFlashBackRule::reactToClick(MTGCardInstance * card)
|
||||
game->targetChooser = NULL;
|
||||
player->castedspellsthisturn += 1;
|
||||
player->opponent()->castedspellsthisturn += 1;
|
||||
if (player->onlyonecast == true || player->onlyoneinstant == true )
|
||||
if (player->onlyonecast == true || player->onlyoneinstant == true)
|
||||
{
|
||||
player->castcount += 1;
|
||||
}
|
||||
@@ -805,9 +814,11 @@ int MTGRetraceRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
return 0;
|
||||
if (!card->getManaCost()->Retrace)
|
||||
return 0;
|
||||
if ((card->hasType("instant")) || card->has(Constants::FLASH) || (player == currentPlayer && !game->isInterrupting
|
||||
&& (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN || game->currentGamePhase
|
||||
== Constants::MTG_PHASE_SECONDMAIN)))
|
||||
if ((card->hasType("instant")) || card->has(Constants::FLASH)
|
||||
|| (player == currentPlayer && !game->isInterrupting
|
||||
&& (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN
|
||||
|| game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN))
|
||||
)
|
||||
{
|
||||
ManaCost * playerMana = player->getManaPool();
|
||||
ManaCost * cost = card->getManaCost();
|
||||
@@ -824,11 +835,11 @@ int MTGRetraceRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (player->nospellinstant == true )
|
||||
if (player->nospellinstant == true)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (player->onlyoneinstant == true )
|
||||
if (player->onlyoneinstant == true)
|
||||
{
|
||||
if (player->castcount >= 1)
|
||||
{
|
||||
@@ -874,7 +885,8 @@ int MTGRetraceRule::reactToClick(MTGCardInstance * card)
|
||||
{
|
||||
cost->Retrace->setExtraCostsAction(this, card);
|
||||
game->mExtraPayment = cost->Retrace->extraCosts;
|
||||
card->paymenttype = MTGAbility::RETRACE_COST;;
|
||||
card->paymenttype = MTGAbility::RETRACE_COST;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -912,7 +924,7 @@ int MTGRetraceRule::reactToClick(MTGCardInstance * card)
|
||||
game->targetChooser = NULL;
|
||||
player->castedspellsthisturn += 1;
|
||||
player->opponent()->castedspellsthisturn += 1;
|
||||
if (player->onlyonecast == true || player->onlyoneinstant == true )
|
||||
if (player->onlyonecast == true || player->onlyoneinstant == true)
|
||||
{
|
||||
player->castcount += 1;
|
||||
}
|
||||
@@ -1013,8 +1025,10 @@ int MTGAttackRule::receiveEvent(WEvent *e)
|
||||
for (int i = 0; i < z->nb_cards; i++)
|
||||
{
|
||||
MTGCardInstance * card = z->cards[i];
|
||||
if (!card->isAttacker() && card->has(Constants::MUSTATTACK)) reactToClick(card);
|
||||
if (!card->isAttacker() && card->has(Constants::TREASON) && p->isAI()) reactToClick(card);
|
||||
if (!card->isAttacker() && card->has(Constants::MUSTATTACK))
|
||||
reactToClick(card);
|
||||
if (!card->isAttacker() && card->has(Constants::TREASON) && p->isAI())
|
||||
reactToClick(card);
|
||||
if (card->isAttacker() && card->isTapped())
|
||||
card->setAttacker(0);
|
||||
if (card->isAttacker() && !card->has(Constants::VIGILANCE))
|
||||
@@ -1223,8 +1237,9 @@ MTGBlockRule::MTGBlockRule(int _id) :
|
||||
|
||||
int MTGBlockRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
{
|
||||
if (currentPhase == Constants::MTG_PHASE_COMBATBLOCKERS && !game->isInterrupting && card->controller()
|
||||
== game->currentlyActing())
|
||||
if (currentPhase == Constants::MTG_PHASE_COMBATBLOCKERS && !game->isInterrupting
|
||||
&& card->controller() == game->currentlyActing()
|
||||
)
|
||||
{
|
||||
if (card->canBlock())
|
||||
return 1;
|
||||
@@ -1315,8 +1330,10 @@ int MTGMomirRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
Player * currentPlayer = game->currentPlayer;
|
||||
if (!player->game->hand->hasCard(card))
|
||||
return 0;
|
||||
if (player == currentPlayer && !game->isInterrupting && (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN
|
||||
|| game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN))
|
||||
if (player == currentPlayer && !game->isInterrupting
|
||||
&& (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN
|
||||
|| game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN)
|
||||
)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -1414,8 +1431,9 @@ void MTGMomirRule::Render()
|
||||
|
||||
ostream& MTGMomirRule::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGMomirRule ::: pool : " << pool << " ; initialized : " << initialized << " ; textAlpha : " << textAlpha << " ; text "
|
||||
<< text << " ; alreadyplayed : " << alreadyplayed << " ; collection : " << collection << "(";
|
||||
out << "MTGMomirRule ::: pool : " << pool << " ; initialized : " << initialized << " ; textAlpha : " << textAlpha
|
||||
<< " ; text " << text << " ; alreadyplayed : " << alreadyplayed
|
||||
<< " ; collection : " << collection << "(";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
|
||||
@@ -1696,10 +1714,19 @@ int MTGAffinityRule::receiveEvent(WEvent * event)
|
||||
//when cards with affinity enter you hand from anywhere a redux is applied to them for the artifacts in play.
|
||||
if (ok == 1)
|
||||
{//enters play from anywhere
|
||||
if (e->from == p->game->graveyard || e->from == p->game->hand || e->from == p->game->library || e->from
|
||||
== p->game->exile || e->from == p->game->stack || e->from == p->opponent()->game->battlefield
|
||||
|| e->from == p->game->temp || e->from == p->game->battlefield)
|
||||
if (e->from == p->game->graveyard
|
||||
|| e->from == p->game->hand
|
||||
|| e->from == p->game->library
|
||||
|| e->from == p->game->exile
|
||||
|| e->from == p->game->stack
|
||||
|| e->from == p->opponent()->game->battlefield
|
||||
|| e->from == p->game->temp
|
||||
|| e->from == p->game->battlefield
|
||||
)
|
||||
{
|
||||
// TODO:
|
||||
// what happens if there are any cards with two or more affinity abilities? If no such card exist
|
||||
// then could this block be changed to use else if? That will save on the number of operations.
|
||||
MTGCardInstance * card = e->card->previous;
|
||||
if (card && card->has(Constants::AFFINITYARTIFACTS))
|
||||
{
|
||||
@@ -1743,13 +1770,14 @@ int MTGAffinityRule::receiveEvent(WEvent * event)
|
||||
{
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
int check = e->card->getManaCost()->getConvertedCost();
|
||||
if ((e->card->has(Constants::AFFINITYARTIFACTS) && c->hasSubtype("artifact")) || (e->card->has(
|
||||
Constants::AFFINITYSWAMP) && c->hasSubtype("swamp")) || (e->card->has(
|
||||
Constants::AFFINITYMOUNTAIN) && c->hasSubtype("moutain")) || (e->card->has(
|
||||
Constants::AFFINITYPLAINS) && c->hasSubtype("plains")) || (e->card->has(
|
||||
Constants::AFFINITYISLAND) && c->hasSubtype("island")) || (e->card->has(
|
||||
Constants::AFFINITYFOREST) && c->hasSubtype("forest")) || (e->card->has(
|
||||
Constants::AFFINITYGREENCREATURES) && c->hasColor(1) && c->isCreature()))
|
||||
if ((e->card->has(Constants::AFFINITYARTIFACTS) && c->hasSubtype("artifact"))
|
||||
|| (e->card->has(Constants::AFFINITYSWAMP) && c->hasSubtype("swamp"))
|
||||
|| (e->card->has(Constants::AFFINITYMOUNTAIN) && c->hasSubtype("moutain"))
|
||||
|| (e->card->has(Constants::AFFINITYPLAINS) && c->hasSubtype("plains"))
|
||||
|| (e->card->has(Constants::AFFINITYISLAND) && c->hasSubtype("island"))
|
||||
|| (e->card->has(Constants::AFFINITYFOREST) && c->hasSubtype("forest"))
|
||||
|| (e->card->has(Constants::AFFINITYGREENCREATURES) && c->hasColor(1) && c->isCreature())
|
||||
)
|
||||
{
|
||||
if (check > 0)
|
||||
{
|
||||
@@ -1776,8 +1804,13 @@ int MTGAffinityRule::receiveEvent(WEvent * event)
|
||||
ok = 2;//card enters play
|
||||
if (ok == 2)
|
||||
{//enters play from anywhere
|
||||
if (e->from == p->game->graveyard || e->from == p->game->hand || e->from == p->game->library || e->from
|
||||
== p->game->exile || e->from == p->game->stack || e->from == p->game->temp)
|
||||
if (e->from == p->game->graveyard
|
||||
|| e->from == p->game->hand
|
||||
|| e->from == p->game->library
|
||||
|| e->from == p->game->exile
|
||||
|| e->from == p->game->stack
|
||||
|| e->from == p->game->temp
|
||||
)
|
||||
{
|
||||
//--redux effect
|
||||
MTGGameZone * z = card->controller()->game->hand;
|
||||
@@ -1817,13 +1850,14 @@ int MTGAffinityRule::receiveEvent(WEvent * event)
|
||||
for (int j = 0; j < nbcards; ++j)
|
||||
{
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if ((c->has(Constants::AFFINITYARTIFACTS) && etype.find("art") != string::npos) || (c->has(
|
||||
Constants::AFFINITYSWAMP) && etype.find("swa") != string::npos) || (c->has(
|
||||
Constants::AFFINITYMOUNTAIN) && etype.find("mou") != string::npos) || (c->has(
|
||||
Constants::AFFINITYPLAINS) && etype.find("pla") != string::npos) || (c->has(
|
||||
Constants::AFFINITYISLAND) && etype.find("isl") != string::npos) || (c->has(
|
||||
Constants::AFFINITYFOREST) && etype.find("for") != string::npos) || (c->has(
|
||||
Constants::AFFINITYGREENCREATURES) && etype.find("cre") != string::npos))
|
||||
if ((c->has(Constants::AFFINITYARTIFACTS) && etype.find("art") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYSWAMP) && etype.find("swa") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYMOUNTAIN) && etype.find("mou") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYPLAINS) && etype.find("pla") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYISLAND) && etype.find("isl") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYFOREST) && etype.find("for") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYGREENCREATURES) && etype.find("cre") != string::npos)
|
||||
)
|
||||
{
|
||||
if (c->getManaCost()->getConvertedCost() > 0)
|
||||
{
|
||||
@@ -1839,9 +1873,15 @@ int MTGAffinityRule::receiveEvent(WEvent * event)
|
||||
}//--end of redux bracket ok == 2
|
||||
//---------
|
||||
ok = 0;
|
||||
if (e->to == p->game->graveyard || e->to == p->game->hand || e->to == p->game->library || e->to == p->game->exile
|
||||
|| e->to == p->game->stack || e->to == p->opponent()->game->battlefield)
|
||||
if (e->to == p->game->graveyard
|
||||
|| e->to == p->game->hand
|
||||
|| e->to == p->game->library
|
||||
|| e->to == p->game->exile
|
||||
|| e->to == p->game->stack
|
||||
|| e->to == p->opponent()->game->battlefield
|
||||
)
|
||||
ok = 3;//card leaves play
|
||||
|
||||
if (ok == 3)
|
||||
{//leave play from your battlefield
|
||||
if (e->from == p->game->battlefield)
|
||||
@@ -1883,13 +1923,14 @@ int MTGAffinityRule::receiveEvent(WEvent * event)
|
||||
for (int j = 0; j < nbcards; ++j)
|
||||
{
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c && ((c->has(Constants::AFFINITYARTIFACTS) && etype.find("art") != string::npos) || (c->has(
|
||||
Constants::AFFINITYSWAMP) && etype.find("swa") != string::npos) || (c->has(
|
||||
Constants::AFFINITYMOUNTAIN) && etype.find("mou") != string::npos) || (c->has(
|
||||
Constants::AFFINITYPLAINS) && etype.find("pla") != string::npos) || (c->has(
|
||||
Constants::AFFINITYISLAND) && etype.find("isl") != string::npos) || (c->has(
|
||||
Constants::AFFINITYFOREST) && etype.find("for") != string::npos) || (c->has(
|
||||
Constants::AFFINITYGREENCREATURES) && etype.find("cre") != string::npos)))
|
||||
if (c && ((c->has(Constants::AFFINITYARTIFACTS) && etype.find("art") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYSWAMP) && etype.find("swa") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYMOUNTAIN) && etype.find("mou") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYPLAINS) && etype.find("pla") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYISLAND) && etype.find("isl") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYFOREST) && etype.find("for") != string::npos)
|
||||
|| (c->has(Constants::AFFINITYGREENCREATURES) && etype.find("cre") != string::npos))
|
||||
)
|
||||
{
|
||||
if (c->reduxamount > 0)
|
||||
{
|
||||
@@ -1911,21 +1952,25 @@ int MTGAffinityRule::receiveEvent(WEvent * event)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ostream& MTGAffinityRule::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGAffinityRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
|
||||
int MTGAffinityRule::testDestroy()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
MTGAffinityRule * MTGAffinityRule::clone() const
|
||||
{
|
||||
MTGAffinityRule * a = NEW MTGAffinityRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
MTGTokensCleanup::MTGTokensCleanup(int _id) :
|
||||
|
||||
Reference in New Issue
Block a user