- 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

View File

@@ -670,6 +670,18 @@ toughness=3
abilities=reach
[/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
id=29782
name=Leaf Dancer

View File

@@ -932,17 +932,6 @@ subtype=Human Druid
toughness=1
[/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.
id=29937
name=Laquatus's Creativity

View File

@@ -183,6 +183,7 @@ name=Black Vise
rarity=U
type=Artifact
mana={1}
auto=@each opponent upkeep:foreach(*|opponenthand) damage:1 opponent >4
[/card]
[card]
text=Enchant creature Enchanted creature has protection from black. This effect doesn't remove Black Ward.

View File

@@ -7,3 +7,17 @@ text={3}, {T}, Sacrifice Ark of Blight: Destroy target land.
auto={3}{T}{S}:destroy target(land)
rarity=U
[/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]

View File

@@ -76,6 +76,7 @@ basal_sliver.txt
beacon_of_unrest.txt
belligerent_hatchling.txt
benalish_knight.txt
black_vise.txt
blessed_wine.txt
blinking_spirit.txt
bloodfire_colossus.txt
@@ -180,6 +181,8 @@ keldon_warlord.txt
keldon_warlord2.txt
kird_ape.txt
kjeldoran_frostbeast1.txt
krosan_beast.txt
krosan_beast2.txt
kraken_eye.txt
kraken_eye2.txt
kraken_eye3.txt

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]

View File

@@ -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]

View File

@@ -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]

View File

@@ -1510,7 +1510,8 @@ class AAsLongAs:public ListMaintainerAbility{
MTGAbility * ability;
MTGAbility * a;
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;
includeSelf = _includeSelf;
tc->targetter = NULL;
@@ -1532,19 +1533,31 @@ class AAsLongAs:public ListMaintainerAbility{
return 1;
}
int addAbilityToGame(){
if (a) return 0;
a = ability->clone();
if (a->oneShot){
a->resolve();
SAFE_DELETE(a);
}else{
a->addToGame();
}
return 1;
}
int removeAbilityFromGame(){
if (!a) return 0;
game->removeObserver(a);
a = NULL;
return 1;
}
int _added(Damageable * d){
if (cards.size()== 1){
a = ability->clone();
if (a->oneShot){
a->resolve();
SAFE_DELETE(a);
}else{
a->addToGame();
}
return 1;
}
return 0;
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){
@@ -1557,12 +1570,11 @@ class AAsLongAs:public ListMaintainerAbility{
int removed(MTGCardInstance * card){
if (cards.size()== 0 && a){
game->removeObserver(a);
a = NULL;
return 1;
}
return 0;
size_t size = cards.size();
if (mini && (int)size <= mini) return removeAbilityFromGame();
if (maxi && (int)size == maxi-1) return addAbilityToGame();
if (!mini && !maxi && size !=0) return 0;
return removeAbilityFromGame();
}
~AAsLongAs(){
@@ -1583,6 +1595,7 @@ class ALord:public ListMaintainerAbility{
MTGAbility * ability;
int includeSelf;
map<Damageable *, MTGAbility *> abilities;
ALord(int _id, MTGCardInstance * card, TargetChooser * _tc, int _includeSelf, MTGAbility * a):ListMaintainerAbility(_id,card), ability(a){
tc = _tc;
tc->targetter = NULL;
@@ -1656,8 +1669,10 @@ class AForeach:public ListMaintainerAbility{
public:
MTGAbility * ability;
int includeSelf;
int mini;
int maxi;
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->targetter = NULL;
includeSelf = _includeSelf;
@@ -1670,6 +1685,9 @@ class AForeach:public ListMaintainerAbility{
}
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();
a->target = target;
if (a->oneShot){

View File

@@ -347,12 +347,19 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
if (i == 3) oneShot = 1;
if (a->oneShot) oneShot = 1;
Damageable * _target = NULL;
if (spell) _target = spell->getNextDamageableTarget();
if (spell) _target = spell->getNextDamageableTarget();
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){
case 0: result = NEW ALord(id, card, lordTargets, lordIncludeSelf, a); break;
case 1: result = NEW AForeach(id, card, _target,lordTargets, lordIncludeSelf, a); break;
case 2: result = NEW AAsLongAs(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,mini,maxi); break;
case 3: result = NEW ALord(id, card, lordTargets, lordIncludeSelf, a); break;
default: result = NULL;
}
@@ -927,11 +934,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver(ability);
break;
}
case 1097: //Black Vise
{
game->addObserver( NEW ALifeZoneLink(_id ,card, Constants::MTG_PHASE_UPKEEP, 4));
break;
}
case 1191: //Blue Elemental Blast
{
if (card->target){
@@ -1148,11 +1151,13 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver( NEW ASoulNet(_id ,card));
break;
}
case 1139: //The Rack
{
game->addObserver( NEW ALifeZoneLink(_id ,card, Constants::MTG_PHASE_UPKEEP, -3));
break;
}
case 1140: //Throne of Bone
{
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 1};