- Added ">" and "<" for foreach and aslongas. Can be used to code threshold cards. See black vise (RV) and korsan beast (ODY)
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-11-18 14:37:28 +00:00
parent 7f9d22e0aa
commit 1d55211245
10 changed files with 145 additions and 38 deletions
+12
View File
@@ -670,6 +670,18 @@ toughness=3
abilities=reach abilities=reach
[/card] [/card]
[card] [card]
text=Threshold - Krosan Beast gets +7/+7 as long as seven or more cards are in your graveyard.
auto=aslongas(*|mygraveyard) 7/7 >6
id=30549
name=Krosan Beast
rarity=R
type=Creature
mana={3}{G}
power=1
subtype=Squirrel Beast
toughness=1
[/card]
[card]
text=Forestwalk text=Forestwalk
id=29782 id=29782
name=Leaf Dancer name=Leaf Dancer
-11
View File
@@ -932,17 +932,6 @@ subtype=Human Druid
toughness=1 toughness=1
[/card] [/card]
[card] [card]
text=Threshold - Krosan Beast gets +7/+7 as long as seven or more cards are in your graveyard.
id=30549
name=Krosan Beast
rarity=R
type=Creature
mana={3}{G}
power=1
subtype=Squirrel Beast
toughness=1
[/card]
[card]
text=Target player draws cards equal to the number of cards in his or her hand, then discards that many cards. text=Target player draws cards equal to the number of cards in his or her hand, then discards that many cards.
id=29937 id=29937
name=Laquatus's Creativity name=Laquatus's Creativity
+1
View File
@@ -183,6 +183,7 @@ name=Black Vise
rarity=U rarity=U
type=Artifact type=Artifact
mana={1} mana={1}
auto=@each opponent upkeep:foreach(*|opponenthand) damage:1 opponent >4
[/card] [/card]
[card] [card]
text=Enchant creature Enchanted creature has protection from black. This effect doesn't remove Black Ward. text=Enchant creature Enchanted creature has protection from black. This effect doesn't remove Black Ward.
+14
View File
@@ -7,3 +7,17 @@ text={3}, {T}, Sacrifice Ark of Blight: Destroy target land.
auto={3}{T}{S}:destroy target(land) auto={3}{T}{S}:destroy target(land)
rarity=U rarity=U
[/card] [/card]
[card]
id=42024
name=Bladewing the Risen
mana={3}{B}{B}{R}{R}
type=Creature
subtype=Zombie Dragon
power=4
toughness=4
text=Flying When Bladewing the Risen enters the battlefield, you may return target Dragon permanent card from your graveyard to the battlefield. {B}{R}: Dragon creatures get +1/+1 until end of turn.
abilities=Legendary,Flying
auto=may moveTo(myBattlefield) target(dragon[-instant;_sorcery]|mygraveyard)
auto={B}{R}:lord(dragon) 1/1
rarity=R
[/card]
+3
View File
@@ -76,6 +76,7 @@ basal_sliver.txt
beacon_of_unrest.txt beacon_of_unrest.txt
belligerent_hatchling.txt belligerent_hatchling.txt
benalish_knight.txt benalish_knight.txt
black_vise.txt
blessed_wine.txt blessed_wine.txt
blinking_spirit.txt blinking_spirit.txt
bloodfire_colossus.txt bloodfire_colossus.txt
@@ -180,6 +181,8 @@ keldon_warlord.txt
keldon_warlord2.txt keldon_warlord2.txt
kird_ape.txt kird_ape.txt
kjeldoran_frostbeast1.txt kjeldoran_frostbeast1.txt
krosan_beast.txt
krosan_beast2.txt
kraken_eye.txt kraken_eye.txt
kraken_eye2.txt kraken_eye2.txt
kraken_eye3.txt kraken_eye3.txt
+19
View File
@@ -0,0 +1,19 @@
#Test ">" symbol in foreach
[INIT]
SECONDMAIN
[PLAYER1]
inplay:black vise
[PLAYER2]
hand:act of treason,mountain,plains,swamp,forest,island
[DO]
eot
next
#upkeep
[ASSERT]
UPKEEP
[PLAYER1]
inplay:black vise
[PLAYER2]
hand:act of treason,mountain,plains,swamp,forest,island
life:18
[END]
@@ -0,0 +1,23 @@
#Test Threshold
[INIT]
COMBATATTACKERS
[PLAYER1]
graveyard:island,swamp,mountain,plains,forest,grizzly bears,raging goblin
inplay:krosan beast
[PLAYER2]
[DO]
krosan beast
next
#blockers
next
#damage
next
#end combat
[ASSERT]
COMBATEND
[PLAYER1]
graveyard:island,swamp,mountain,plains,forest,grizzly bears,raging goblin
inplay:krosan beast
[PLAYER2]
life:12
[END]
@@ -0,0 +1,23 @@
#Test Threshold
[INIT]
COMBATATTACKERS
[PLAYER1]
graveyard:island,swamp,mountain
inplay:krosan beast
[PLAYER2]
[DO]
krosan beast
next
#blockers
next
#damage
next
#end combat
[ASSERT]
COMBATEND
[PLAYER1]
graveyard:island,swamp,mountain
inplay:krosan beast
[PLAYER2]
life:19
[END]
+30 -12
View File
@@ -1510,7 +1510,8 @@ class AAsLongAs:public ListMaintainerAbility{
MTGAbility * ability; MTGAbility * ability;
MTGAbility * a; MTGAbility * a;
int includeSelf; int includeSelf;
AAsLongAs(int _id, MTGCardInstance * _source, Damageable * _target, TargetChooser * _tc, int _includeSelf, MTGAbility * a):ListMaintainerAbility(_id, _source,_target),ability(a){ int mini,maxi;
AAsLongAs(int _id, MTGCardInstance * _source, Damageable * _target, TargetChooser * _tc, int _includeSelf, MTGAbility * ability,int mini = 0, int maxi = 0):ListMaintainerAbility(_id, _source,_target),ability(ability),mini(mini),maxi(maxi){
tc = _tc; tc = _tc;
includeSelf = _includeSelf; includeSelf = _includeSelf;
tc->targetter = NULL; tc->targetter = NULL;
@@ -1532,9 +1533,8 @@ class AAsLongAs:public ListMaintainerAbility{
return 1; return 1;
} }
int addAbilityToGame(){
int _added(Damageable * d){ if (a) return 0;
if (cards.size()== 1){
a = ability->clone(); a = ability->clone();
if (a->oneShot){ if (a->oneShot){
a->resolve(); a->resolve();
@@ -1544,7 +1544,20 @@ class AAsLongAs:public ListMaintainerAbility{
} }
return 1; return 1;
} }
return 0;
int removeAbilityFromGame(){
if (!a) return 0;
game->removeObserver(a);
a = NULL;
return 1;
}
int _added(Damageable * d){
size_t size = cards.size();
if (mini && (int)size <= mini) return 0;
if (maxi && (int)size >= maxi) return removeAbilityFromGame();
if (!mini && !maxi && size !=1) return 0;
return addAbilityToGame();
} }
int added(MTGCardInstance * card){ int added(MTGCardInstance * card){
@@ -1557,12 +1570,11 @@ class AAsLongAs:public ListMaintainerAbility{
int removed(MTGCardInstance * card){ int removed(MTGCardInstance * card){
if (cards.size()== 0 && a){ size_t size = cards.size();
game->removeObserver(a); if (mini && (int)size <= mini) return removeAbilityFromGame();
a = NULL; if (maxi && (int)size == maxi-1) return addAbilityToGame();
return 1; if (!mini && !maxi && size !=0) return 0;
} return removeAbilityFromGame();
return 0;
} }
~AAsLongAs(){ ~AAsLongAs(){
@@ -1583,6 +1595,7 @@ class ALord:public ListMaintainerAbility{
MTGAbility * ability; MTGAbility * ability;
int includeSelf; int includeSelf;
map<Damageable *, MTGAbility *> abilities; map<Damageable *, MTGAbility *> abilities;
ALord(int _id, MTGCardInstance * card, TargetChooser * _tc, int _includeSelf, MTGAbility * a):ListMaintainerAbility(_id,card), ability(a){ ALord(int _id, MTGCardInstance * card, TargetChooser * _tc, int _includeSelf, MTGAbility * a):ListMaintainerAbility(_id,card), ability(a){
tc = _tc; tc = _tc;
tc->targetter = NULL; tc->targetter = NULL;
@@ -1656,8 +1669,10 @@ class AForeach:public ListMaintainerAbility{
public: public:
MTGAbility * ability; MTGAbility * ability;
int includeSelf; int includeSelf;
int mini;
int maxi;
map<Damageable *, MTGAbility *> abilities; map<Damageable *, MTGAbility *> abilities;
AForeach(int _id, MTGCardInstance * card,Damageable * _target, TargetChooser * _tc, int _includeSelf, MTGAbility * a):ListMaintainerAbility(_id,card,_target), ability(a){ AForeach(int _id, MTGCardInstance * card,Damageable * _target, TargetChooser * _tc, int _includeSelf, MTGAbility * a, int mini = 0, int maxi = 0):ListMaintainerAbility(_id,card,_target), ability(a),mini(mini),maxi(maxi){
tc = _tc; tc = _tc;
tc->targetter = NULL; tc->targetter = NULL;
includeSelf = _includeSelf; includeSelf = _includeSelf;
@@ -1670,6 +1685,9 @@ class AForeach:public ListMaintainerAbility{
} }
int added(MTGCardInstance * card){ int added(MTGCardInstance * card){
if (mini && cards.size() <= (size_t)mini) return 0;
if (maxi && cards.size() >= (size_t)maxi) return 0;
MTGAbility * a = ability->clone(); MTGAbility * a = ability->clone();
a->target = target; a->target = target;
if (a->oneShot){ if (a->oneShot){
+12 -7
View File
@@ -349,10 +349,17 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
Damageable * _target = NULL; Damageable * _target = NULL;
if (spell) _target = spell->getNextDamageableTarget(); if (spell) _target = spell->getNextDamageableTarget();
if (!_target) _target = target; if (!_target) _target = target;
int mini = 0;
int maxi = 0;
found = s.find(">");
if (found !=string::npos) mini = atoi(s.substr(found+1,1).c_str());
found = s.find("<");
if (found !=string::npos) maxi = atoi(s.substr(found+1,1).c_str());
switch(i){ switch(i){
case 0: result = NEW ALord(id, card, lordTargets, lordIncludeSelf, a); break; case 0: result = NEW ALord(id, card, lordTargets, lordIncludeSelf, a); break;
case 1: result = NEW AForeach(id, card, _target,lordTargets, lordIncludeSelf, a); break; case 1: result = NEW AForeach(id, card, _target,lordTargets, lordIncludeSelf, a,mini,maxi); break;
case 2: result = NEW AAsLongAs(id, card, _target,lordTargets, lordIncludeSelf, a); break; case 2: result = NEW AAsLongAs(id, card, _target,lordTargets, lordIncludeSelf, a,mini,maxi); break;
case 3: result = NEW ALord(id, card, lordTargets, lordIncludeSelf, a); break; case 3: result = NEW ALord(id, card, lordTargets, lordIncludeSelf, a); break;
default: result = NULL; default: result = NULL;
} }
@@ -927,11 +934,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver(ability); game->addObserver(ability);
break; break;
} }
case 1097: //Black Vise
{
game->addObserver( NEW ALifeZoneLink(_id ,card, Constants::MTG_PHASE_UPKEEP, 4));
break;
}
case 1191: //Blue Elemental Blast case 1191: //Blue Elemental Blast
{ {
if (card->target){ if (card->target){
@@ -1148,11 +1151,13 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver( NEW ASoulNet(_id ,card)); game->addObserver( NEW ASoulNet(_id ,card));
break; break;
} }
case 1139: //The Rack case 1139: //The Rack
{ {
game->addObserver( NEW ALifeZoneLink(_id ,card, Constants::MTG_PHASE_UPKEEP, -3)); game->addObserver( NEW ALifeZoneLink(_id ,card, Constants::MTG_PHASE_UPKEEP, -3));
break; break;
} }
case 1140: //Throne of Bone case 1140: //Throne of Bone
{ {
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 1}; int cost[] = {Constants::MTG_COLOR_ARTIFACT, 1};