Hi,
also there is here a small wording confusion, some cards are "harcoded", they are hardcoded with a number that you can call to "attach" the effect to any card. If you create a card with aline "id=1143" it will have the effect of animate dead... if your card has the same effect as animate dead but another id then you need to use the "alias=" line. Since we are now using primitive the "primitive" version of animate dead is using the "alias" line... not sure if I'm clear...
Well anyway, for these specific card you are mentioning you need to look also at the header AllAbilities.h :
http://code.google.com/p/wagic/source/b ... bilities.h
for some other like traumatize the whole code is in the MTGAbility.cpp and is pretty much self speaking if you ask me:
Code: Select all
case 129774: // Traumatize
{
int nbcards;
Player * player = spell->getNextPlayerTarget();
MTGLibrary * library = player->game->library;
nbcards = (library->nb_cards)/2;
for (int i = 0; i < nbcards; i++){
if (library->nb_cards)
player->game->putInZone(library->cards[library->nb_cards-1],library, player->game->graveyard);
}
break;
}
this will result in half of TargetPlayer library being "puInZone"->graveyard.... pretty much straight forward.
Now if you want to now what an alias can or can't do, find the "alias=line" in the primitive, look at the rest of the cards code in the mtg.txt, everything that you cannot find softcoded in the mtg.txt is hardcoded in the alias... But I would say that we still have a lot of cards in these files that could be 100% softcoded (like animate dead, the beacons, etc... etc...), the example you are mentioning are not the best one, because there is a lot of code line for something that could probably be softcoded... I suggest you begin to look at "simple" card "hardcode" like the traumatize....basically all "case" in the MTGAbility.cpp that do not have a line looking like "game->addObserver( NEW A....."
Nervertheless I agree we should do some kind of quick sticky explaining the usage of the aliases... but this is mainly for the development of custom sets... as all cards that could profit from alias should already be included in the SVN (or we might have miss something
).
Grü
Abra