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:
@@ -3833,7 +3833,7 @@ ABlinkGeneric::~ABlinkGeneric()
|
||||
|
||||
// target becomes a parent of card(source)
|
||||
AAConnect::AAConnect(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost) :
|
||||
ActivatedAbility(id, card, _cost, 0)
|
||||
InstantAbility(id, card, target)
|
||||
{
|
||||
target = _target;
|
||||
}
|
||||
@@ -3847,12 +3847,29 @@ int AAConnect::resolve()
|
||||
_target = _target->next;
|
||||
_target->childrenCards.push_back(source);
|
||||
source->parentCards.push_back(_target);
|
||||
if(source->target)
|
||||
source->target = NULL;
|
||||
//clearing the source target allows us to use target= line
|
||||
//without creating side effects on any other abilities a card has
|
||||
//connect has to be the first ability in the cards lines unless you want it to do effects to the targeted card!!!
|
||||
|
||||
//weapon
|
||||
if(source->hasSubtype(Subtypes::TYPE_EQUIPMENT))
|
||||
{
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
for (size_t i = 1; i < g->mLayers->actionLayer()->mObjects.size(); i++)
|
||||
{
|
||||
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
||||
AEquip * eq = dynamic_cast<AEquip*> (a);
|
||||
if (eq && eq->source == source)
|
||||
{
|
||||
((AEquip*)a)->unequip();
|
||||
((AEquip*)a)->equip(_target);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(source->target)
|
||||
source->target = NULL;
|
||||
//clearing the source target allows us to use target= line
|
||||
//without creating side effects on any other abilities a card has
|
||||
//connect has to be the first ability in the cards lines unless you want it to do effects to the targeted card!!!
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user