Erwan
- fixed a bug with creature bond - fixed a bug with control magic
This commit is contained in:
@@ -25,6 +25,7 @@ control_magic2.txt
|
||||
counsel_of_the_soratami.txt
|
||||
counterspell.txt
|
||||
counterspell2.txt
|
||||
creature_bond.txt
|
||||
drain_life.txt
|
||||
flare.txt
|
||||
force_of_nature.txt
|
||||
|
||||
43
projects/mtg/bin/Res/test/creature_bond.txt
Normal file
43
projects/mtg/bin/Res/test/creature_bond.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
#Testing Creature Bond on a fire elemental in opponent's play, then testing what happens when the elemental gets killed.
|
||||
#opponent should lose life
|
||||
[INIT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
hand:1197
|
||||
inplay:1239
|
||||
manapool:{1}{U}
|
||||
[PLAYER2]
|
||||
inplay:1290
|
||||
[DO]
|
||||
1197
|
||||
1290
|
||||
eot
|
||||
#untap
|
||||
next
|
||||
#upkeep
|
||||
next
|
||||
#draw
|
||||
next
|
||||
#main 1
|
||||
next
|
||||
#cbt begins
|
||||
next
|
||||
#attackers
|
||||
1290
|
||||
next
|
||||
#defensers
|
||||
1239
|
||||
next
|
||||
#damage
|
||||
next
|
||||
#combat end
|
||||
[ASSERT]
|
||||
COMBATEND
|
||||
[PLAYER1]
|
||||
graveyard:1197,1239
|
||||
manapool:{0}
|
||||
life:20
|
||||
[PLAYER2]
|
||||
graveyard:1290
|
||||
life:16
|
||||
[END]
|
||||
@@ -1108,12 +1108,12 @@ class AControlStealAura: public MTGAbility{
|
||||
|
||||
int destroy(){
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if (_target->controller()->game->inPlay->hasCard(_target)){ //if the target is still in game -> spell was destroyed
|
||||
Player * p = _target->controller();
|
||||
if (p && p->game->inPlay->hasCard(_target)){ //if the target is still in game -> spell was destroyed
|
||||
_target->changeController(originalController);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
//TODO put it back into owners's graveyard if needed...
|
||||
};
|
||||
|
||||
|
||||
@@ -1481,15 +1481,20 @@ class AConservator: public MTGAbility{
|
||||
//Creature bond
|
||||
class ACreatureBond:public TriggeredAbility{
|
||||
public:
|
||||
int mTriggered;
|
||||
int resolved;
|
||||
ACreatureBond(int _id, MTGCardInstance * _source, MTGCardInstance * _target):TriggeredAbility(_id,_source,_target){
|
||||
resolved = 1;
|
||||
mTriggered = 0;
|
||||
resolved = 0;
|
||||
}
|
||||
|
||||
int trigger(){
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
for (int i = 0; i < 2; i++){
|
||||
if (game->players[i]->game->graveyard->hasCard(_target)) return 1;
|
||||
if (!mTriggered && game->players[i]->game->graveyard->hasCard(_target)){
|
||||
mTriggered = 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -999,7 +999,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1194: //Control Magic
|
||||
{
|
||||
game->addObserver(NEW ATakeControlAura(_id, card, card->target));
|
||||
game->addObserver(NEW AControlStealAura(_id, card, card->target));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user