- fixed the "may" ability a little bit (needs testing: can it be called only once ???)
- Added "Clone", yay :)
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-04-01 12:59:53 +00:00
parent 60b35f7f7f
commit bdf989ffac
12 changed files with 201 additions and 25 deletions

View File

@@ -295,6 +295,19 @@ subtype=Spider
toughness=3
[/card]
[card]
text=As Clone comes into play, you may choose a creature in play. If you do, Clone comes into play as a copy of that creature.
auto=may copy target(creature)
id=129501
name=Clone
rarity=R
color=Blue
type=Creature
mana={3}{U}
power=0
subtype=Shapeshifter
toughness=0
[/card]
[card]
text=Flying (This creature can't be blocked except by creatures with flying or reach.) Cloud Elemental can block only creatures with flying.
abilities=cloud,flying
id=129804

View File

@@ -283,18 +283,7 @@ power=2
subtype=Elf Warrior Druid
toughness=2
[/card]
[card]
text=As Clone comes into play, you may choose a creature in play. If you do, Clone comes into play as a copy of that creature.
id=129501
name=Clone
rarity=R
color=Blue
type=Creature
mana={3}{U}
power=0
subtype=Shapeshifter
toughness=0
[/card]
[card]
text=Each creature gets +1/+1 for each other creature in play that shares a creature type with it. (For example, if a Goblin Warrior, a Goblin Scout, and a Zombie Goblin are in play, each gets +2/+2.)
id=129502

View File

@@ -357,6 +357,19 @@ power=0
toughness=4
[/card]
[card]
text=As Clone comes into play, you may choose a creature in play. If you do, Clone comes into play as a copy of that creature.
auto=may copy target(creature)
id=1193
name=Clone
rarity=U
color=Blue
type=Creature
mana={3}{U}
power=0
subtype=Shapeshifter
toughness=0
[/card]
[card]
text=Flying Whenever Cockatrice blocks or becomes blocked by a non-Wall creature, destroy that creature at end of combat.
abilities=Flying
id=1238

View File

@@ -17,18 +17,6 @@ type=Artifact
mana={4}
[/card]
[card]
text=As Clone comes into play, you may choose a creature in play. If you do, Clone comes into play as a copy of that creature.
id=1193
name=Clone
rarity=U
color=Blue
type=Creature
mana={3}{U}
power=0
subtype=Shapeshifter
toughness=0
[/card]
[card]
text=Remove Contract from Below from your deck before playing if you're not playing for ante. Discard your hand, add the top card of your library to the ante, then draw seven cards.
id=1147
name=Contract from Below

View File

@@ -31,6 +31,8 @@ brass_man.txt
castle.txt
celestial_purge.txt
circle_of_protection.txt
clone.txt
clone2.txt
composite_golem.txt
control_magic.txt
control_magic2.txt

View File

@@ -0,0 +1,41 @@
# As Clone comes into play, you may choose a creature in play. If you do, Clone comes into play as a copy of that creature.
[INIT]
FIRSTMAIN
[PLAYER1]
hand:129501
manapool:{3}{U}
inplay:135185
[PLAYER2]
[DO]
129501
choice 0
135185
eot
eot
#untap
next
#upkeep
next
#draw
next
#main1
next
#combat begin
next
#attackers
129501
135185
next
#blockers
next
#damage
next
#combat end
[ASSERT]
COMBATEND
[PLAYER1]
inplay:129501,135185
manapool:{0}
[PLAYER2]
life:18
[END]

View File

@@ -0,0 +1,42 @@
# As Clone comes into play, you may choose a creature in play. If you do, Clone comes into play as a copy of that creature.
[INIT]
FIRSTMAIN
[PLAYER1]
hand:129501
manapool:{3}{U}
[PLAYER2]
inplay:1221
[DO]
129501
choice 0
1221
eot
eot
#untap
next
#upkeep
next
#draw
next
#main1
next
#combat begin
next
#attackers
129501
next
#blockers
next
#damage
next
#combat end
[ASSERT]
COMBATEND
[PLAYER1]
inplay:129501
manapool:{0}
life:19
[PLAYER2]
inplay:1221
life:16
[END]

View File

@@ -31,6 +31,7 @@ public:
int deleteAbility;
MayAbility(int _id, MTGAbility * _ability, MTGCardInstance * _source):MTGAbility(_id,_source),ability(_ability){
triggered = 0;
ability->forceDestroy = 1;
deleteAbility = 1;
}
@@ -269,6 +270,28 @@ public:
}
};
//Copier. TargetAbility
class ACopier:public TargetAbility{
public:
ACopier(int _id, MTGCardInstance * _source, TargetChooser * _tc = NULL, ManaCost * _cost=NULL):TargetAbility(_id,_source, _tc,_cost,0,0){
if (!tc) tc = NEW CreatureTargetChooser();
}
int resolve(){
MTGCardInstance * _target = tc->getNextCardTarget();
if(_target){
source->copy(_target);
return 1;
}
return 0;
}
const char * getMenuText(){
return "Copy";
}
};
//Destroyer. TargetAbility
class ADestroyer:public TargetAbility{
public:

View File

@@ -41,6 +41,7 @@ class MTGAbility: public ActionElement{
GameObserver * game;
public:
int forceDestroy;
ManaCost * cost;
Damageable * target;
int aType;

View File

@@ -93,7 +93,7 @@ class MTGCardInstance: public MTGCard, public Damageable, public Targetable {
int addProtection(CardDescriptor * cd);
int removeProtection(CardDescriptor *cd, int erase = 0);
int protectedAgainst(MTGCardInstance * card);
void copy(MTGCardInstance * card);
// in game
int isTapped();
void untap();

View File

@@ -333,6 +333,25 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
continue;
}
//Copy a target
found = s.find("copy ");
if (found != string::npos){
if (dryMode) return BAKA_EFFECT_GOOD; //TODO :
if (tc){
ACopier * a = NEW ACopier(id,card,tc,cost);
if (may){
game->addObserver(NEW MayAbility(id,a,card));
OutputDebugString("may!\n");
}else{
game->addObserver(a);
}
}else{
//TODO
}
result++;
continue;
}
//Bury
found = s.find("bury");
if (found != string::npos){
@@ -1553,6 +1572,7 @@ MTGAbility::MTGAbility(int id, MTGCardInstance * card):ActionElement(id){
target = card;
aType = MTGAbility::UNKNOWN;
cost = NULL;
forceDestroy = 0;
}
MTGAbility::MTGAbility(int id, MTGCardInstance * _source,Damageable * _target ):ActionElement(id){
@@ -1561,6 +1581,7 @@ MTGAbility::MTGAbility(int id, MTGCardInstance * _source,Damageable * _target ):
target = _target;
aType = MTGAbility::UNKNOWN;
cost = NULL;
forceDestroy = 0;
}
MTGAbility::~MTGAbility(){
@@ -1570,6 +1591,8 @@ MTGAbility::~MTGAbility(){
//returns 1 if this ability needs to be removed from the list of active abilities
int MTGAbility::testDestroy(){
if (game->mLayers->stackLayer()->has(this)) return 0;
if (waitingForAnswer) return 0;
if (forceDestroy) return 1;
if (!game->isInPlay(source) ){
OutputDebugString("Destroying Ability !!!\n");
return 1;

View File

@@ -31,6 +31,47 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to):
}
void MTGCardInstance::copy(MTGCardInstance * card){
MTGCard * source = card->model;
for (int i = 0; i< Constants::NB_BASIC_ABILITIES; i++){
basicAbilities[i] = source->basicAbilities[i];
}
for (int i = 0; i< MAX_TYPES_PER_CARD; i++){
types[i] = source->types[i];
}
nb_types = source->nb_types;
for (int i = 0; i< Constants::MTG_NB_COLORS; i++){
colors[i] = source->colors[i];
}
manaCost.copy(source->getManaCost());
text = source->text;
name = source->name;
//strcpy(image_name, source->image_name);
//rarity = source->rarity;
power = source->power;
toughness = source->toughness;
life = toughness;
lifeOrig = life;
//mtgid = source->mtgid;
//setId = source->setId;
formattedTextInit = 0;
magicText = source->magicText;
spellTargetType = source->spellTargetType;
alias = source->alias;
//Now this is dirty...
int backupid = mtgid;
mtgid = source->getId();
Spell * spell = NEW Spell(this);
AbilityFactory af;
GameObserver * g = GameObserver::GetInstance();
af.addAbilities(g->mLayers->actionLayer()->getMaxId(), spell);
delete spell;
mtgid = backupid;
}
MTGCardInstance::~MTGCardInstance(){
LOG("==Deleting MTGCardInstance==");
SAFE_DELETE(blockers);