Fix Cloner and Copier abilities
This commit is contained in:
@@ -2068,6 +2068,7 @@ public:
|
|||||||
|
|
||||||
assert(value < 2);
|
assert(value < 2);
|
||||||
_target->basicAbilities.set(ability, value > 0);
|
_target->basicAbilities.set(ability, value > 0);
|
||||||
|
_target->modifiedbAbi += 1;
|
||||||
return InstantAbility::addToGame();
|
return InstantAbility::addToGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2080,7 +2081,10 @@ public:
|
|||||||
{
|
{
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
if (_target)
|
if (_target)
|
||||||
|
{
|
||||||
_target->basicAbilities.set(ability, stateBeforeActivation);
|
_target->basicAbilities.set(ability, stateBeforeActivation);
|
||||||
|
_target->modifiedbAbi -= 1;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public:
|
|||||||
uint8_t colors;
|
uint8_t colors;
|
||||||
typedef std::bitset<Constants::NB_BASIC_ABILITIES> BasicAbilitiesSet;
|
typedef std::bitset<Constants::NB_BASIC_ABILITIES> BasicAbilitiesSet;
|
||||||
BasicAbilitiesSet basicAbilities;
|
BasicAbilitiesSet basicAbilities;
|
||||||
|
BasicAbilitiesSet origbasicAbilities;
|
||||||
|
|
||||||
map<string,string> magicTexts;
|
map<string,string> magicTexts;
|
||||||
string magicText;
|
string magicText;
|
||||||
|
|||||||
@@ -242,6 +242,8 @@ public:
|
|||||||
bool isACopier;
|
bool isACopier;
|
||||||
bool bypassTC;
|
bool bypassTC;
|
||||||
bool discarded;
|
bool discarded;
|
||||||
|
int copiedID;
|
||||||
|
int modifiedbAbi;
|
||||||
|
|
||||||
void eventattacked();
|
void eventattacked();
|
||||||
void eventattackedAlone();
|
void eventattackedAlone();
|
||||||
|
|||||||
@@ -389,9 +389,21 @@ int AACopier::resolve()
|
|||||||
{
|
{
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
if (_target)
|
if (_target)
|
||||||
|
{
|
||||||
|
if(_target->isACopier)
|
||||||
|
{
|
||||||
|
MTGCard* clone = MTGCollection()->getCardById(_target->copiedID);
|
||||||
|
MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game);
|
||||||
|
source->copy(myClone);
|
||||||
|
source->isACopier = true;
|
||||||
|
source->copiedID = _target->copiedID;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
source->copy(_target);
|
source->copy(_target);
|
||||||
source->isACopier = true;
|
source->isACopier = true;
|
||||||
|
source->copiedID = _target->getId();
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2520,6 +2532,10 @@ int AACloner::resolve()
|
|||||||
// Use id of the card to have the same image as the original
|
// Use id of the card to have the same image as the original
|
||||||
MTGCard* clone = (_target->isToken ? _target: MTGCollection()->getCardById(_target->getId()));
|
MTGCard* clone = (_target->isToken ? _target: MTGCollection()->getCardById(_target->getId()));
|
||||||
|
|
||||||
|
// If its a copier then copy what it is
|
||||||
|
if(_target->isACopier)
|
||||||
|
clone = _target;
|
||||||
|
|
||||||
Player * targetPlayer = who == 1 ? source->controller()->opponent() : source->controller();
|
Player * targetPlayer = who == 1 ? source->controller()->opponent() : source->controller();
|
||||||
|
|
||||||
int tokenize = 1;//tokenizer support for cloning
|
int tokenize = 1;//tokenizer support for cloning
|
||||||
@@ -2575,6 +2591,8 @@ int AACloner::resolve()
|
|||||||
{
|
{
|
||||||
spell->source->addType(*it);
|
spell->source->addType(*it);
|
||||||
}
|
}
|
||||||
|
spell->source->modifiedbAbi = _target->modifiedbAbi;
|
||||||
|
spell->source->origbasicAbilities = _target->origbasicAbilities;
|
||||||
delete spell;
|
delete spell;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@@ -4157,6 +4175,7 @@ for (it = types.begin(); it != types.end(); it++)
|
|||||||
for (it = abilities.begin(); it != abilities.end(); it++)
|
for (it = abilities.begin(); it != abilities.end(); it++)
|
||||||
{
|
{
|
||||||
_target->basicAbilities.set(*it);
|
_target->basicAbilities.set(*it);
|
||||||
|
_target->modifiedbAbi += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newAbilityFound)
|
if(newAbilityFound)
|
||||||
@@ -4305,6 +4324,7 @@ int ATransformer::destroy()
|
|||||||
for (it = abilities.begin(); it != abilities.end(); it++)
|
for (it = abilities.begin(); it != abilities.end(); it++)
|
||||||
{
|
{
|
||||||
_target->basicAbilities.reset(*it);
|
_target->basicAbilities.reset(*it);
|
||||||
|
_target->modifiedbAbi -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (it = oldcolors.begin(); it != oldcolors.end(); it++)
|
for (it = oldcolors.begin(); it != oldcolors.end(); it++)
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
|
|||||||
if(!source)
|
if(!source)
|
||||||
return;
|
return;
|
||||||
basicAbilities = source->basicAbilities;
|
basicAbilities = source->basicAbilities;
|
||||||
|
origbasicAbilities = source->basicAbilities;
|
||||||
|
|
||||||
for (size_t i = 0; i < source->types.size(); ++i)
|
for (size_t i = 0; i < source->types.size(); ++i)
|
||||||
types.push_back(source->types[i]);
|
types.push_back(source->types[i]);
|
||||||
@@ -76,6 +77,7 @@ CardPrimitive::~CardPrimitive()
|
|||||||
int CardPrimitive::init()
|
int CardPrimitive::init()
|
||||||
{
|
{
|
||||||
basicAbilities.reset();
|
basicAbilities.reset();
|
||||||
|
origbasicAbilities.reset();
|
||||||
|
|
||||||
types.clear();
|
types.clear();
|
||||||
|
|
||||||
|
|||||||
@@ -804,6 +804,11 @@ void GameObserver::gameStateBasedEffects()
|
|||||||
c->damageToOpponent = false;
|
c->damageToOpponent = false;
|
||||||
c->damageToCreature = false;
|
c->damageToCreature = false;
|
||||||
c->isAttacking = NULL;
|
c->isAttacking = NULL;
|
||||||
|
if(c->modifiedbAbi > 0)
|
||||||
|
{
|
||||||
|
c->modifiedbAbi = 0;
|
||||||
|
c->basicAbilities = c->origbasicAbilities;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (int t = 0; t < nbcards; t++)
|
for (int t = 0; t < nbcards; t++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
|
|||||||
isACopier = false;
|
isACopier = false;
|
||||||
bypassTC = false;
|
bypassTC = false;
|
||||||
discarded = false;
|
discarded = false;
|
||||||
|
copiedID = getId();
|
||||||
|
modifiedbAbi = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MTGCardInstance * MTGCardInstance::createSnapShot()
|
MTGCardInstance * MTGCardInstance::createSnapShot()
|
||||||
@@ -76,6 +78,8 @@ void MTGCardInstance::copy(MTGCardInstance * card)
|
|||||||
CardPrimitive * data = source->data;
|
CardPrimitive * data = source->data;
|
||||||
|
|
||||||
basicAbilities = card->basicAbilities;
|
basicAbilities = card->basicAbilities;
|
||||||
|
origbasicAbilities = card->origbasicAbilities;
|
||||||
|
modifiedbAbi = card->modifiedbAbi;
|
||||||
for (size_t i = 0; i < data->types.size(); i++)
|
for (size_t i = 0; i < data->types.size(); i++)
|
||||||
{
|
{
|
||||||
types.push_back(data->types[i]);
|
types.push_back(data->types[i]);
|
||||||
|
|||||||
Reference in New Issue
Block a user