added weapon handling for connect, please be sure to code these weapons as follows
target=*|mybattlefield
auto={0}:equip
auto=connect
notice i declare the equip before the connect, this is becuase connect will use the equip ability of the card to handle it.
target= can be used for connecting them now as the first time equip. please remember to use teach( or autoskill= to avoid giving abilities forever to a target...this makes equipments hybrid auras.
also, moved parentchildrule init from original init to rules.txt...
in yourrules.txt
should look like this:
include mtg.txt
name=Classic
[INIT]
mode=mtg
auto=connectrule
[PLAYERS]
auto=shuffle
auto=draw:7
i did this becuase i want to reuse the parentchild associations for mtgabilities...and if parents will always kill thier children, i won't be able to use it :P
changed connect into an instant ability, i don't want this ability to be done by menu choice.
This commit is contained in:
@@ -2330,6 +2330,15 @@ public:
|
||||
};
|
||||
//
|
||||
|
||||
/* create a parent child association between cards */
|
||||
class AAConnect: public InstantAbility
|
||||
{
|
||||
public:
|
||||
AAConnect(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
AAConnect * clone() const;
|
||||
};
|
||||
|
||||
//equipment
|
||||
class AEquip: public TargetAbility
|
||||
{
|
||||
@@ -2347,12 +2356,19 @@ public:
|
||||
if (source->target)
|
||||
{
|
||||
source->target->equipment -= 1;
|
||||
source->parentCards.clear();
|
||||
for(unsigned int w = 0;w < source->target->childrenCards.size();w++)
|
||||
{
|
||||
MTGCardInstance * child = source->target->childrenCards[w];
|
||||
if(child == source)
|
||||
source->target->childrenCards.erase(source->target->childrenCards.begin() + w);
|
||||
}
|
||||
}
|
||||
source->target = NULL;
|
||||
for (size_t i = 0; i < currentAbilities.size(); ++i)
|
||||
{
|
||||
MTGAbility * a = currentAbilities[i];
|
||||
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot))
|
||||
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || dynamic_cast<AAConnect *> (a) || (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot))
|
||||
{
|
||||
SAFE_DELETE(a);
|
||||
continue;
|
||||
@@ -2367,6 +2383,8 @@ public:
|
||||
{
|
||||
source->target = equipped;
|
||||
source->target->equipment += 1;
|
||||
source->parentCards.push_back((MTGCardInstance*)target);
|
||||
source->target->childrenCards.push_back((MTGCardInstance*)source);
|
||||
AbilityFactory af;
|
||||
af.getAbilities(¤tAbilities, NULL, source);
|
||||
for (size_t i = 0; i < currentAbilities.size(); ++i)
|
||||
@@ -2374,6 +2392,7 @@ public:
|
||||
MTGAbility * a = currentAbilities[i];
|
||||
if (dynamic_cast<AEquip *> (a)) continue;
|
||||
if (dynamic_cast<ATeach *> (a)) continue;
|
||||
if (dynamic_cast<AAConnect *> (a)) continue;
|
||||
if (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)
|
||||
{
|
||||
a->forceDestroy = 1;
|
||||
@@ -3214,15 +3233,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/* create a parent child association between cards */
|
||||
class AAConnect: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
AAConnect(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
AAConnect * clone() const;
|
||||
};
|
||||
|
||||
// Add life of gives damage if a given zone has more or less than [condition] cards at the beginning of [phase]
|
||||
//Ex : the rack, ivory tower...
|
||||
class ALifeZoneLink: public MTGAbility
|
||||
|
||||
Reference in New Issue
Block a user