Merge pull request #929 from kevlahnota/master

Some Bug Fixes
This commit is contained in:
Anthony Calosa
2017-02-06 22:25:59 +08:00
committed by GitHub
7 changed files with 49 additions and 25 deletions

View File

@@ -48,7 +48,6 @@ public:
vector<MTGCardInstance*>parentCards;
vector<MTGCardInstance*>childrenCards;
vector<MTGAbility *>cardsAbilities;
//vector<MTGAbility *>cardsAbilitiesFilter;
int setAttacker(int value);
int setDefenser(MTGCardInstance * c);
@@ -263,6 +262,7 @@ public:
bool bypassTC;
bool discarded;
int copiedID;
int copiedSetID;
bool StackIsEmptyandSorcerySpeed();
bool isTargetted();
int cardistargetted;

View File

@@ -593,7 +593,12 @@ int ActionStack::addAbility(MTGAbility * ability)
int result = addAction(stackAbility);
if (!observer->players[0]->isAI() && ability->source->controller() == observer->players[0] && 0
== options[Options::INTERRUPTMYABILITIES].number)
interruptDecision[0] = DONT_INTERRUPT;
{
if(observer->gameType() == GAME_TYPE_MOMIR && ability->aType == MTGAbility::FORCED_TOKEN_CREATOR)
interruptDecision[0] = NOT_DECIDED;
else
interruptDecision[0] = DONT_INTERRUPT;
}
if (observer->OpenedDisplay && observer->players[0]->game->reveal->cards.size())
{
interruptDecision[0] = DONT_INTERRUPT;

View File

@@ -1799,6 +1799,18 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
while (_target->next)
_target = _target->next;
if(_target->getCurrentZone() != _target->controller()->game->battlefield ||
_target->getCurrentZone() != _target->controller()->opponent()->game->battlefield)
{
if(power||toughness)
{
if(_target->previousZone == _target->controller()->game->battlefield ||
_target->previousZone == _target->controller()->opponent()->game->battlefield)
return 0;
}
}
Counter * targetCounter = NULL;
int currentAmount = 0;
if (_target->counters && _target->counters->hasCounter(name.c_str(), power, toughness))

View File

@@ -3638,7 +3638,18 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
a->oneShot = 1;
a->canBeInterrupted = false;
a->named = newName;
if(card->getAICustomCode().size() && card->controller()->isAI())
/***********do nothing***********/
if((card->controller()->isAI() &&
card->controller()->opponent()->isAI())||
!card->getAICustomCode().size())
{
MTGAbility * a2 = parseMagicLine("activate donothing", id, spell, card);
a2->oneShot = 1;
a2->canBeInterrupted = false;
return a2;
}
/*******************************/
else if(card->getAICustomCode().size() && card->controller()->isAI())
{
MTGAbility * a3 = parseMagicLine(card->getAICustomCode(), id, spell, card);
a3->oneShot = 1;

View File

@@ -64,6 +64,7 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
bypassTC = false;
discarded = false;
copiedID = getId();
copiedSetID = 0;
LKIpower = power;
LKItoughness = toughness;
cardistargetted = 0;
@@ -143,6 +144,7 @@ void MTGCardInstance::copy(MTGCardInstance * card)
spellTargetType = data->spellTargetType;
alias = data->alias;
copiedID = card->copiedID;
copiedSetID = card->setId;
doubleFaced = data->doubleFaced;
AICustomCode = data->AICustomCode;
CrewAbility = data->CrewAbility;
@@ -156,25 +158,9 @@ void MTGCardInstance::copy(MTGCardInstance * card)
int castMethodBackUP = this->castMethod;
mtgid = source->getId();
MTGCardInstance * oldStored = this->storedSourceCard;
//test copy filtered
/*cardsAbilitiesFilter.clear();
for(unsigned int i = 0;i < card->cardsAbilities.size();i++)
{
MTGAbility * a = dynamic_cast<MTGAbility *>(card->cardsAbilities[i]);
if(a && a->source == card)
{
cardsAbilitiesFilter.push_back(a);
}
}*/
if(observer->players[1]->playMode == Player::MODE_TEST_SUITE)
mtgid = backupid; // there must be a way to get the token id...
else
{
mtgid = card->getMTGId(); ///////////////////////////////////////////////////
setId = card->setId; // Copier/Cloner cards produces the same token...//
rarity = card->getRarity(); ///////////////////////////////////////////////////
}
mtgid = backupid; // found a way :)
castMethod = castMethodBackUP;
backupTargets = this->backupTargets;
storedCard = oldStored;

View File

@@ -3262,7 +3262,8 @@ int MTGLegendRule::added(MTGCardInstance * card)
{
MTGCardInstance * comparison = (*it).first;
if (comparison != card && comparison->controller() == card->controller() && !(comparison->getName().compare(card->getName())))
destroy = 1;
if (!(game->getCurrentTargetChooser() || game->mLayers->actionLayer()->isWaitingForAnswer()))
destroy = 1;
}
if(destroy)
{
@@ -3340,7 +3341,8 @@ int MTGPlaneWalkerRule::added(MTGCardInstance * card)
{
MTGCardInstance * comparison = (*it).first;
if (comparison != card && comparison->types == card->types && comparison->controller() == card->controller())
destroy = 1;
if (!(game->getCurrentTargetChooser() || game->mLayers->actionLayer()->isWaitingForAnswer()))
destroy = 1;
}
if (destroy)
{

View File

@@ -18,8 +18,16 @@ Token::Token(string _name, MTGCardInstance * source, int _power, int _toughness)
rarity = Constants::RARITY_T;
name = _name;
if (name.size() && name[0] >= 97 && name[0] <= 122) name[0] -= 32; //Poor man's camelcase. We assume strings we get are either Camelcased or lowercase
setMTGId(-source->getMTGId());
setId = source->setId;
if(source->isACopier && source->copiedSetID)
{
setMTGId(-source->copiedID);
setId = source->copiedSetID;
}
else
{
setMTGId(-source->getMTGId());
setId = source->setId;
}
model = this;
data = this;
owner = source->owner;