- Fixed a bug with control magic (see tests/control_magic2.txt)
This commit is contained in:
wagic.the.homebrew
2008-11-29 06:47:03 +00:00
parent 5d6a7232cd
commit 58a50705de
6 changed files with 41 additions and 28 deletions
+1
View File
@@ -19,6 +19,7 @@ ascendant_evincar2.txt
brass_man.txt brass_man.txt
castle.txt castle.txt
control_magic.txt control_magic.txt
control_magic2.txt
counsel_of_the_soratami.txt counsel_of_the_soratami.txt
counterspell.txt counterspell.txt
counterspell2.txt counterspell2.txt
@@ -0,0 +1,35 @@
#Testing Control Magic on a serra angel in opponent's play, then testing what happens with sword to plowshares
[INIT]
FIRSTMAIN
[PLAYER1]
hand:1194
manapool:{2}{U}{U}
[PLAYER2]
hand:1367
inplay:1366,1397
[DO]
1194
1366
eot
#untap
next
#upkeep
next
#draw
next
#main 1
1397
1367
1366
[ASSERT]
FIRSTMAIN
[PLAYER1]
graveyard:1194
manapool:{0}
life:24
[PLAYER2]
graveyard:1367
inplay:1397
manapool:{0}
life:20
[END]
+3 -2
View File
@@ -1131,8 +1131,9 @@ class ATakeControlAura:public MTGAbility{
int destroy(){ int destroy(){
MTGCardInstance * _target = (MTGCardInstance *) target; MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target->controller()->game->inPlay->hasCard(_target)){ Player * p = _target->controller();
_target->controller()->game->putInZone(_target, _target->controller()->game->inPlay, previousController->game->inPlay); if (p && p->game->inPlay->hasCard(_target)){
p->game->putInZone(_target, p->game->inPlay, previousController->game->inPlay);
} }
return 1; return 1;
} }
-2
View File
@@ -40,8 +40,6 @@ template <typename T, size_t N>
int lowercase(string source); int lowercase(string source);
int substr_copy(char *source, char *target, int start, int len);
int append_str(char * s1, char * s2, char * target);
int filesize(const char * filename); int filesize(const char * filename);
int read_file (const char * filename, char * buffer, int filesize); int read_file (const char * filename, char * buffer, int filesize);
int readline (char * in_buffer, char * out_buffer, int cursor); int readline (char * in_buffer, char * out_buffer, int cursor);
+1 -1
View File
@@ -1299,7 +1299,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
break; break;
} }
case 1367: //Sword to Plowshares case 1367: //Swords to Plowshares
{ {
card->target->controller()->life+= card->target->power; card->target->controller()->life+= card->target->power;
card->target->controller()->game->inPlay->removeCard(card->target); card->target->controller()->game->inPlay->removeCard(card->target);
+1 -23
View File
@@ -9,28 +9,6 @@ int lowercase(string sBuffer) {
} }
int substr_copy(char *source, char *target, int start, int len){
int i=0;
int not_over = 1;
while (not_over){
if (source[i+start] == 0 || i == len-1){
not_over = 0;
}
target[i] = source[i + start];
i++;
if (i == len){
target[i] = 0;
}
}
return i;
}
int append_str(char * s1, char * s2, char * target){
int len = substr_copy(s1,target, 0,0);
substr_copy(s2,target+len-1,0,0);
return 0;
}
@@ -69,7 +47,7 @@ int read_file (const char * filename, char * buffer, int file_size){
sceIoClose(file); sceIoClose(file);
#endif #endif
fprintf(stderr, "The first string in the file is %d characters long.\n", strlen(&buffer[0]) ); fprintf(stderr, "%s is %d characters long.\n", filename, strlen(&buffer[0]) );
return a; return a;
} }