Card *Card::attach(Card *other, Race *owner) { if (other == NULL) { Log::message("Card","(%s) Can't attach NULL child card",filename.c_str(), Log::WARN); return NULL; } Card *toAttach = (other->isTemplate() ? new Card(other) : other); if (owner != NULL) { toAttach->setOwner(owner); } attached.push_back(toAttach); toAttach->parent = this; // Execute onPlay script if we've just created this card if (other->isTemplate()) { toAttach->executeScript("onPlay"); } // Execute onAttach script this->executeScript("onAttach"); return toAttach; }