added ability to have triggered abilities target based on the event that triggered, bramblewood paragon, graft, etc.
use "trigger" inside target code of triggered ability. does not work with @each and @next. @damaged can use trigger[to] and trigger[from] to specify the target or source of the damage, respectively. Adds cards: Aether Flash Bramblewood Paragon In the Web of War Juniper Order Ranger Mortuary Primal Forcemage Fungus Sliver Simic Initiate as well as a test file for feral hydra, missing from my last commit. and daily build.
This commit is contained in:
@@ -30,6 +30,13 @@ power=1
|
|||||||
toughness=1
|
toughness=1
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
|
name=AEther Flash
|
||||||
|
auto=@movedto(creature|battlefield):all(trigger) damage:2
|
||||||
|
text=Whenever a creature enters the battlefield, Æther Flash deals 2 damage to it.
|
||||||
|
mana={2}{R}{R}
|
||||||
|
type=Enchantment
|
||||||
|
[/card]
|
||||||
|
[card]
|
||||||
name=AEther Mutation
|
name=AEther Mutation
|
||||||
target=creature
|
target=creature
|
||||||
auto=moveTo(ownerhand)
|
auto=moveTo(ownerhand)
|
||||||
@@ -5017,6 +5024,17 @@ power=0
|
|||||||
toughness=3
|
toughness=3
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
|
name=Bramblewood Paragon
|
||||||
|
auto=@movedto(other warrior|myBattlefield):all(trigger) counter(1/1,1)
|
||||||
|
auto=lord(creature[counter{1/1.1}]|myBattlefield) trample
|
||||||
|
text=Each other Warrior creature you control enters the battlefield with an additional +1/+1 counter on it. -- Each creature you control with a +1/+1 counter on it has trample.
|
||||||
|
mana={1}{G}
|
||||||
|
type=Creature
|
||||||
|
subtype=Elf Warrior
|
||||||
|
power=2
|
||||||
|
toughness=2
|
||||||
|
[/card]
|
||||||
|
[card]
|
||||||
name=Branded Brawlers
|
name=Branded Brawlers
|
||||||
auto=aslongas(land[-tapped]|opponentBattlefield) cantattack
|
auto=aslongas(land[-tapped]|opponentBattlefield) cantattack
|
||||||
auto=aslongas(land[-tapped]|myBattlefield) cantblock
|
auto=aslongas(land[-tapped]|myBattlefield) cantblock
|
||||||
@@ -14821,6 +14839,16 @@ type=Enchantment
|
|||||||
auto={G}{G}:counter(0/0,1,Spore) target(fungus)
|
auto={G}{G}:counter(0/0,1,Spore) target(fungus)
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
|
name=Fungus Sliver
|
||||||
|
auto=@damaged(sliver):all(trigger[to]) counter(1/1)
|
||||||
|
text=All Sliver creatures have "Whenever this creature is dealt damage, put a +1/+1 counter on it." (The damage is dealt before the counter is put on.)
|
||||||
|
mana={3}{G}
|
||||||
|
type=Creature
|
||||||
|
subtype=Fungus Sliver
|
||||||
|
power=2
|
||||||
|
toughness=2
|
||||||
|
[/card]
|
||||||
|
[card]
|
||||||
name=Fungusaur
|
name=Fungusaur
|
||||||
auto=@damaged(this):counter(1/1,1)
|
auto=@damaged(this):counter(1/1,1)
|
||||||
text=Whenever Fungusaur is dealt damage, put a +1/+1 counter on it.
|
text=Whenever Fungusaur is dealt damage, put a +1/+1 counter on it.
|
||||||
@@ -19324,6 +19352,14 @@ type=Enchantment
|
|||||||
subtype=Aura
|
subtype=Aura
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
|
name=In the Web of War
|
||||||
|
auto=@movedto(creature|myBattlefield):all(trigger) 2/0 ueot
|
||||||
|
auto=@movedto(creature|myBattlefield):all(trigger) haste ueot
|
||||||
|
text=Whenever a creature enters the battlefield under your control, it gets +2/+0 and gains haste until end of turn.
|
||||||
|
mana={3}{R}{R}
|
||||||
|
type=Enchantment
|
||||||
|
[/card]
|
||||||
|
[card]
|
||||||
name=Incendiary
|
name=Incendiary
|
||||||
target=creature
|
target=creature
|
||||||
auto=@each my upkeep:counter(0/0,1,Fuse)
|
auto=@each my upkeep:counter(0/0,1,Fuse)
|
||||||
@@ -20562,6 +20598,17 @@ power=1
|
|||||||
toughness=1
|
toughness=1
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
|
name=Juniper Order Ranger
|
||||||
|
auto=@movedto(other creature|myBattlefield):counter(1/1,1)
|
||||||
|
auto=@movedto(other creature|myBattlefield):all(trigger) counter(1/1)
|
||||||
|
text=Whenever another creature enters the battlefield under your control, put a +1/+1 counter on that creature and a +1/+1 counter on Juniper Order Ranger.
|
||||||
|
mana={3}{G}{W}
|
||||||
|
type=Creature
|
||||||
|
subtype=Human Knight
|
||||||
|
power=2
|
||||||
|
toughness=4
|
||||||
|
[/card]
|
||||||
|
[card]
|
||||||
name=Junk Diver
|
name=Junk Diver
|
||||||
abilities=flying
|
abilities=flying
|
||||||
auto=@movedTo(this|graveyard) from(battlefield):moveTo(myhand) target(other artifact|mygraveyard)
|
auto=@movedTo(this|graveyard) from(battlefield):moveTo(myhand) target(other artifact|mygraveyard)
|
||||||
@@ -25793,6 +25840,13 @@ power=*
|
|||||||
toughness=*
|
toughness=*
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
|
name=Mortuary
|
||||||
|
auto=@movedTo(creature|mygraveyard) from(myBattlefield):all(trigger) moveTo(myLibrary)
|
||||||
|
text=Whenever a creature is put into your graveyard from the battlefield, put that card on top of your library.
|
||||||
|
mana={2}{B}
|
||||||
|
type=Enchantment
|
||||||
|
[/card]
|
||||||
|
[card]
|
||||||
name=Mosquito Guard
|
name=Mosquito Guard
|
||||||
abilities=first strike
|
abilities=first strike
|
||||||
autohand={1}{W}{S}:counter(1/1,1) target(creature)
|
autohand={1}{W}{S}:counter(1/1,1) target(creature)
|
||||||
@@ -29700,6 +29754,16 @@ mana={2}{G}
|
|||||||
type=Instant
|
type=Instant
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
|
name=Primal Forcemage
|
||||||
|
auto=@movedto(creature|myBattlefield):all(trigger) 3/3 ueot
|
||||||
|
text=Whenever another creature enters the battlefield under your control, that creature gets +3/+3 until end of turn.
|
||||||
|
mana={2}{G}
|
||||||
|
type=Creature
|
||||||
|
subtype=Elf Shaman
|
||||||
|
power=2
|
||||||
|
toughness=2
|
||||||
|
[/card]
|
||||||
|
[card]
|
||||||
name=Primal Frenzy
|
name=Primal Frenzy
|
||||||
target=Creature
|
target=Creature
|
||||||
auto=trample
|
auto=trample
|
||||||
@@ -35556,6 +35620,17 @@ text=Simic Growth Chamber enters the battlefield tapped. -- When Simic Growth Ch
|
|||||||
type=Land
|
type=Land
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
|
name=Simic Initiate
|
||||||
|
text=Graft 1 (This creature enters the battlefield with a +1/+1 counter on it. Whenever another creature enters the battlefield, you may move a +1/+1 counter from this creature onto it.)
|
||||||
|
auto=counter(1/1)
|
||||||
|
auto=@movedto(creature|battlefield):this(counter{1/1}) all(trigger) counter(1/1) && this(counter{1/1}) counter(1/1,-1)
|
||||||
|
mana={G}
|
||||||
|
type=Creature
|
||||||
|
subtype=Human Mutant
|
||||||
|
power=0
|
||||||
|
toughness=0
|
||||||
|
[/card]
|
||||||
|
[card]
|
||||||
name=Simic Ragworm
|
name=Simic Ragworm
|
||||||
auto={U}:untap
|
auto={U}:untap
|
||||||
text={U}: Untap Simic Ragworm.
|
text={U}: Untap Simic Ragworm.
|
||||||
@@ -47259,4 +47334,5 @@ type=Creature
|
|||||||
subtype=Human Wizard
|
subtype=Human Wizard
|
||||||
power=1
|
power=1
|
||||||
toughness=1
|
toughness=1
|
||||||
[/card]
|
[/card]
|
||||||
|
###########
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
########################
|
########################
|
||||||
#Generic engine features
|
#Generic engine features
|
||||||
########################
|
########################
|
||||||
zzz.txt
|
|
||||||
generic/attacks_each_turn.txt
|
generic/attacks_each_turn.txt
|
||||||
generic/cycling.txt
|
generic/cycling.txt
|
||||||
generic/cycling2.txt
|
generic/cycling2.txt
|
||||||
@@ -73,6 +72,7 @@ generic/wither.txt
|
|||||||
act_of_treason.txt
|
act_of_treason.txt
|
||||||
aegis_of_the_meek.txt
|
aegis_of_the_meek.txt
|
||||||
aether_mutation.txt
|
aether_mutation.txt
|
||||||
|
aether_flash.txt
|
||||||
afflict.txt
|
afflict.txt
|
||||||
akron_legionnaire.txt
|
akron_legionnaire.txt
|
||||||
alluring_siren.txt
|
alluring_siren.txt
|
||||||
@@ -140,6 +140,7 @@ boggart_arsonists.txt
|
|||||||
borderland_behemoth.txt
|
borderland_behemoth.txt
|
||||||
bottle_gnomes.txt
|
bottle_gnomes.txt
|
||||||
bottle_gnomes2.txt
|
bottle_gnomes2.txt
|
||||||
|
bramblewood_paragon.txt
|
||||||
brass_man.txt
|
brass_man.txt
|
||||||
brass_man_i161.txt
|
brass_man_i161.txt
|
||||||
cage_of_hands.txt
|
cage_of_hands.txt
|
||||||
@@ -216,6 +217,7 @@ farmstead.txt
|
|||||||
fastbond.txt
|
fastbond.txt
|
||||||
fastbond2.txt
|
fastbond2.txt
|
||||||
fault_line.txt
|
fault_line.txt
|
||||||
|
feral_hydra.txt
|
||||||
fire_tempest.txt
|
fire_tempest.txt
|
||||||
fists_of_ironwood.txt
|
fists_of_ironwood.txt
|
||||||
flagstones.txt
|
flagstones.txt
|
||||||
@@ -233,6 +235,7 @@ force_of_nature.txt
|
|||||||
force_of_nature2.txt
|
force_of_nature2.txt
|
||||||
force_of_nature3.txt
|
force_of_nature3.txt
|
||||||
fountain_of_youth.txt
|
fountain_of_youth.txt
|
||||||
|
fungus_sliver.txt
|
||||||
gamble.txt
|
gamble.txt
|
||||||
gempalm_avenger.txt
|
gempalm_avenger.txt
|
||||||
ghost_warden.txt
|
ghost_warden.txt
|
||||||
@@ -278,6 +281,7 @@ iron_will_i270.txt
|
|||||||
jodahs_avenger.txt
|
jodahs_avenger.txt
|
||||||
juggernaut.txt
|
juggernaut.txt
|
||||||
jump.txt
|
jump.txt
|
||||||
|
juniper_order_ranger.txt
|
||||||
karns_touch_i233.txt
|
karns_touch_i233.txt
|
||||||
keldon_warlord.txt
|
keldon_warlord.txt
|
||||||
keldon_warlord2.txt
|
keldon_warlord2.txt
|
||||||
@@ -313,6 +317,7 @@ millstone.txt
|
|||||||
misc01.txt
|
misc01.txt
|
||||||
moat.txt
|
moat.txt
|
||||||
mobile_fort.txt
|
mobile_fort.txt
|
||||||
|
mortuary.txt
|
||||||
nantuko_husk.txt
|
nantuko_husk.txt
|
||||||
necrogenesis.txt
|
necrogenesis.txt
|
||||||
Nevinyrrals_Disk.txt
|
Nevinyrrals_Disk.txt
|
||||||
@@ -383,6 +388,7 @@ shock.txt
|
|||||||
shock2.txt
|
shock2.txt
|
||||||
siege_gang_commander.txt
|
siege_gang_commander.txt
|
||||||
silent_arbiter.txt
|
silent_arbiter.txt
|
||||||
|
simic_initiate.txt
|
||||||
slate_of_ancestry.txt
|
slate_of_ancestry.txt
|
||||||
sleeper_agent.txt
|
sleeper_agent.txt
|
||||||
slith_bloodletter.txt
|
slith_bloodletter.txt
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
[init]
|
||||||
|
firstmain
|
||||||
|
[player1]
|
||||||
|
inplay:Aether Flash
|
||||||
|
hand:Grizzly Bears
|
||||||
|
manapool:{G}{G}
|
||||||
|
[player2]
|
||||||
|
[do]
|
||||||
|
Grizzly Bears
|
||||||
|
[assert]
|
||||||
|
firstmain
|
||||||
|
[player1]
|
||||||
|
inplay:Aether Flash
|
||||||
|
graveyard:Grizzly Bears
|
||||||
|
[player2]
|
||||||
|
[end]
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
[init]
|
||||||
|
firstmain
|
||||||
|
[player1]
|
||||||
|
inplay:Bramblewood Paragon
|
||||||
|
hand:Goblin Chariot
|
||||||
|
manapool:{2}{R}
|
||||||
|
[player2]
|
||||||
|
inplay:Drudge Skeletons
|
||||||
|
[do]
|
||||||
|
goblin chariot
|
||||||
|
next
|
||||||
|
next
|
||||||
|
goblin chariot
|
||||||
|
next
|
||||||
|
drudge skeletons
|
||||||
|
eot
|
||||||
|
[assert]
|
||||||
|
untap
|
||||||
|
[player1]
|
||||||
|
inplay:Bramblewood Paragon,Goblin Chariot
|
||||||
|
[player2]
|
||||||
|
life:18
|
||||||
|
graveyard:Drudge Skeletons
|
||||||
|
[end]
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
[init]
|
||||||
|
secondmain
|
||||||
|
[player1]
|
||||||
|
manapool:{5}{G}
|
||||||
|
hand:Feral Hydra
|
||||||
|
[player2]
|
||||||
|
[do]
|
||||||
|
Feral Hydra
|
||||||
|
eot
|
||||||
|
eot
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
Feral Hydra
|
||||||
|
eot
|
||||||
|
[assert]
|
||||||
|
untap
|
||||||
|
[player1]
|
||||||
|
inplay:feral hydra
|
||||||
|
[player2]
|
||||||
|
life:15
|
||||||
|
[end]
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
[init]
|
||||||
|
firstmain
|
||||||
|
[player1]
|
||||||
|
inplay:Fungus Sliver,Sliver Overlord,Fury Sliver
|
||||||
|
hand:Lightning Bolt,Resounding Thunder
|
||||||
|
manapool:{2}{R}{R}
|
||||||
|
[player2]
|
||||||
|
[do]
|
||||||
|
lightning bolt
|
||||||
|
sliver overlord
|
||||||
|
resounding thunder
|
||||||
|
fury sliver
|
||||||
|
next
|
||||||
|
next
|
||||||
|
sliver overlord
|
||||||
|
eot
|
||||||
|
[assert]
|
||||||
|
untap
|
||||||
|
[player1]
|
||||||
|
inplay:Fungus Sliver,Sliver Overlord
|
||||||
|
graveyard:Lightning bolt,resounding thunder,fury sliver
|
||||||
|
[player2]
|
||||||
|
life:12
|
||||||
|
[end]
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
[init]
|
||||||
|
firstmain
|
||||||
|
[player1]
|
||||||
|
inplay:Juniper Order Ranger
|
||||||
|
hand:eager cadet
|
||||||
|
manapool:{W}
|
||||||
|
[player2]
|
||||||
|
[do]
|
||||||
|
eager cadet
|
||||||
|
eot
|
||||||
|
eot
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
eager cadet
|
||||||
|
juniper order ranger
|
||||||
|
eot
|
||||||
|
[assert]
|
||||||
|
untap
|
||||||
|
[player1]
|
||||||
|
inplay:eager cadet,juniper order ranger
|
||||||
|
[player2]
|
||||||
|
life:15
|
||||||
|
[end]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
[init]
|
||||||
|
firstmain
|
||||||
|
[player1]
|
||||||
|
inplay:Mortuary,Raging Goblin
|
||||||
|
hand:Lightning Bolt
|
||||||
|
manapool:{R}
|
||||||
|
[player2]
|
||||||
|
[do]
|
||||||
|
lightning bolt
|
||||||
|
raging goblin
|
||||||
|
[assert]
|
||||||
|
firstmain
|
||||||
|
[player1]
|
||||||
|
inplay:Mortuary
|
||||||
|
graveyard:Lightning Bolt
|
||||||
|
library:Raging Goblin
|
||||||
|
[player2]
|
||||||
|
[end]
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
[init]
|
||||||
|
firstmain
|
||||||
|
[player1]
|
||||||
|
hand:simic initiate,grizzly bears
|
||||||
|
manapool:{G}{G}{G}
|
||||||
|
[player2]
|
||||||
|
[do]
|
||||||
|
simic initiate
|
||||||
|
grizzly bears
|
||||||
|
choice 0
|
||||||
|
eot
|
||||||
|
eot
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
next
|
||||||
|
grizzly bears
|
||||||
|
eot
|
||||||
|
[assert]
|
||||||
|
untap
|
||||||
|
[player1]
|
||||||
|
inplay:grizzly bears
|
||||||
|
graveyard:simic initiate
|
||||||
|
[player2]
|
||||||
|
life:17
|
||||||
|
[end]
|
||||||
Binary file not shown.
@@ -275,13 +275,12 @@ class AAFizzler:public ActivatedAbility{
|
|||||||
|
|
||||||
|
|
||||||
//MayAbility: May do ...
|
//MayAbility: May do ...
|
||||||
class MayAbility:public MTGAbility{
|
class MayAbility:public MTGAbility, public NestedAbility{
|
||||||
public:
|
public:
|
||||||
int triggered;
|
int triggered;
|
||||||
bool must;
|
bool must;
|
||||||
MTGAbility * ability;
|
|
||||||
MTGAbility * mClone;
|
MTGAbility * mClone;
|
||||||
MayAbility(int _id, MTGAbility * _ability, MTGCardInstance * _source, bool must = false):MTGAbility(_id,_source),must(must),ability(_ability){
|
MayAbility(int _id, MTGAbility * _ability, MTGCardInstance * _source, bool must = false):MTGAbility(_id,_source),must(must),NestedAbility(_ability){
|
||||||
triggered = 0;
|
triggered = 0;
|
||||||
mClone = NULL;
|
mClone = NULL;
|
||||||
}
|
}
|
||||||
@@ -389,13 +388,12 @@ public:
|
|||||||
|
|
||||||
//Generic Activated Ability
|
//Generic Activated Ability
|
||||||
|
|
||||||
class GenericActivatedAbility:public ActivatedAbility{
|
class GenericActivatedAbility:public ActivatedAbility, public NestedAbility{
|
||||||
public:
|
public:
|
||||||
MTGAbility * ability;
|
|
||||||
int limitPerTurn;
|
int limitPerTurn;
|
||||||
int counters;
|
int counters;
|
||||||
MTGGameZone * activeZone;
|
MTGGameZone * activeZone;
|
||||||
GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 0, int limit = 0, int restrictions = 0, MTGGameZone * dest = NULL):ActivatedAbility(_id, card,_cost,restrictions,_tap),ability(a),limitPerTurn(limit),activeZone(dest){
|
GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 0, int limit = 0, int restrictions = 0, MTGGameZone * dest = NULL):ActivatedAbility(_id, card,_cost,restrictions,_tap),NestedAbility(a),limitPerTurn(limit),activeZone(dest){
|
||||||
counters = 0;
|
counters = 0;
|
||||||
target = ability->target;
|
target = ability->target;
|
||||||
}
|
}
|
||||||
@@ -1399,10 +1397,9 @@ class APowerToughnessModifierUntilEndOfTurn: public ActivatedAbility{
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class GenericInstantAbility: public InstantAbility{
|
class GenericInstantAbility: public InstantAbility, public NestedAbility{
|
||||||
public:
|
public:
|
||||||
MTGAbility * ability;
|
GenericInstantAbility(int _id, MTGCardInstance * _source, Damageable * _target, MTGAbility * ability): InstantAbility(_id, _source, _target), NestedAbility(ability){
|
||||||
GenericInstantAbility(int _id, MTGCardInstance * _source, Damageable * _target, MTGAbility * ability): InstantAbility(_id, _source, _target), ability(ability){
|
|
||||||
ability->target = _target;
|
ability->target = _target;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1643,13 +1640,12 @@ class AConvertLandToCreatures:public ListMaintainerAbility{
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Generic Kird Ape
|
//Generic Kird Ape
|
||||||
class AAsLongAs:public ListMaintainerAbility{
|
class AAsLongAs:public ListMaintainerAbility, public NestedAbility{
|
||||||
public:
|
public:
|
||||||
MTGAbility * ability;
|
|
||||||
MTGAbility * a;
|
MTGAbility * a;
|
||||||
int includeSelf;
|
int includeSelf;
|
||||||
int mini,maxi;
|
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){
|
AAsLongAs(int _id, MTGCardInstance * _source, Damageable * _target, TargetChooser * _tc, int _includeSelf, MTGAbility * ability,int mini = 0, int maxi = 0):ListMaintainerAbility(_id, _source,_target),NestedAbility(ability),mini(mini),maxi(maxi){
|
||||||
tc = _tc;
|
tc = _tc;
|
||||||
includeSelf = _includeSelf;
|
includeSelf = _includeSelf;
|
||||||
tc->targetter = NULL;
|
tc->targetter = NULL;
|
||||||
@@ -1731,13 +1727,12 @@ class AAsLongAs:public ListMaintainerAbility{
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Lords (Merfolk lord...) give power and toughness to OTHER creatures of their type, they can give them special abilities, regeneration
|
//Lords (Merfolk lord...) give power and toughness to OTHER creatures of their type, they can give them special abilities, regeneration
|
||||||
class ALord:public ListMaintainerAbility{
|
class ALord:public ListMaintainerAbility, public NestedAbility{
|
||||||
public:
|
public:
|
||||||
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), NestedAbility(a){
|
||||||
tc = _tc;
|
tc = _tc;
|
||||||
tc->targetter = NULL;
|
tc->targetter = NULL;
|
||||||
includeSelf = _includeSelf;
|
includeSelf = _includeSelf;
|
||||||
@@ -1811,14 +1806,13 @@ class ALord:public ListMaintainerAbility{
|
|||||||
|
|
||||||
|
|
||||||
//Foreach (plague rats...)
|
//Foreach (plague rats...)
|
||||||
class AForeach:public ListMaintainerAbility{
|
class AForeach:public ListMaintainerAbility, public NestedAbility{
|
||||||
public:
|
public:
|
||||||
MTGAbility * ability;
|
|
||||||
int includeSelf;
|
int includeSelf;
|
||||||
int mini;
|
int mini;
|
||||||
int maxi;
|
int maxi;
|
||||||
map<Damageable *, MTGAbility *> abilities;
|
map<Damageable *, MTGAbility *> abilities;
|
||||||
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){
|
AForeach(int _id, MTGCardInstance * card,Damageable * _target, TargetChooser * _tc, int _includeSelf, MTGAbility * a, int mini = 0, int maxi = 0):ListMaintainerAbility(_id,card,_target), NestedAbility(a),mini(mini),maxi(maxi){
|
||||||
tc = _tc;
|
tc = _tc;
|
||||||
tc->targetter = NULL;
|
tc->targetter = NULL;
|
||||||
includeSelf = _includeSelf;
|
includeSelf = _includeSelf;
|
||||||
@@ -1877,12 +1871,11 @@ class AForeach:public ListMaintainerAbility{
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class AThis:public MTGAbility{
|
class AThis:public MTGAbility, public NestedAbility{
|
||||||
public:
|
public:
|
||||||
MTGAbility * ability;
|
|
||||||
MTGAbility * a;
|
MTGAbility * a;
|
||||||
ThisDescriptor * td;
|
ThisDescriptor * td;
|
||||||
AThis(int _id, MTGCardInstance * _source, Damageable * _target, ThisDescriptor * _td, MTGAbility * ability):MTGAbility(_id, _source,_target),ability(ability){
|
AThis(int _id, MTGCardInstance * _source, Damageable * _target, ThisDescriptor * _td, MTGAbility * ability):MTGAbility(_id, _source,_target),NestedAbility(ability){
|
||||||
td = _td;
|
td = _td;
|
||||||
ability->source = source;
|
ability->source = source;
|
||||||
ability->target = target;
|
ability->target = target;
|
||||||
@@ -1941,12 +1934,11 @@ class AThis:public MTGAbility{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class AThisForEach:public MTGAbility{
|
class AThisForEach:public MTGAbility, public NestedAbility{
|
||||||
public:
|
public:
|
||||||
MTGAbility * ability;
|
|
||||||
ThisDescriptor * td;
|
ThisDescriptor * td;
|
||||||
vector<MTGAbility *> abilities;
|
vector<MTGAbility *> abilities;
|
||||||
AThisForEach(int _id, MTGCardInstance * _source, Damageable * _target, ThisDescriptor * _td, MTGAbility * ability):MTGAbility(_id, _source,_target),ability(ability){
|
AThisForEach(int _id, MTGCardInstance * _source, Damageable * _target, ThisDescriptor * _td, MTGAbility * ability):MTGAbility(_id, _source,_target),NestedAbility(ability){
|
||||||
td = _td;
|
td = _td;
|
||||||
ability->source = source;
|
ability->source = source;
|
||||||
ability->target = target;
|
ability->target = target;
|
||||||
|
|||||||
@@ -83,6 +83,11 @@ class MTGAbility: public ActionElement{
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NestedAbility{
|
||||||
|
public:
|
||||||
|
MTGAbility * ability;
|
||||||
|
NestedAbility(MTGAbility * _ability);
|
||||||
|
};
|
||||||
|
|
||||||
class TriggeredAbility:public MTGAbility{
|
class TriggeredAbility:public MTGAbility{
|
||||||
public:
|
public:
|
||||||
@@ -164,9 +169,8 @@ class ActivatedAbility:public MTGAbility{
|
|||||||
virtual ostream& toString(ostream& out) const;
|
virtual ostream& toString(ostream& out) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TargetAbility:public ActivatedAbility{
|
class TargetAbility:public ActivatedAbility, public NestedAbility{
|
||||||
public:
|
public:
|
||||||
MTGAbility * ability;
|
|
||||||
TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost = NULL, int _playerturnonly = 0,int tap = 1);
|
TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost = NULL, int _playerturnonly = 0,int tap = 1);
|
||||||
TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _playerturnonly = 0,int tap = 1);
|
TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _playerturnonly = 0,int tap = 1);
|
||||||
virtual int reactToClick(MTGCardInstance * card);
|
virtual int reactToClick(MTGCardInstance * card);
|
||||||
@@ -233,16 +237,16 @@ class TriggerNextPhase:public TriggerAtPhase{
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class GenericTriggeredAbility:public TriggeredAbility{
|
class GenericTriggeredAbility:public TriggeredAbility, public NestedAbility{
|
||||||
public:
|
public:
|
||||||
TriggeredAbility * t;
|
TriggeredAbility * t;
|
||||||
MTGAbility * ability;
|
|
||||||
MTGAbility * destroyCondition;
|
MTGAbility * destroyCondition;
|
||||||
GenericTriggeredAbility(int id, MTGCardInstance * _source, TriggeredAbility * _t, MTGAbility * a,MTGAbility * dc = NULL, Targetable * _target = NULL);
|
GenericTriggeredAbility(int id, MTGCardInstance * _source, TriggeredAbility * _t, MTGAbility * a,MTGAbility * dc = NULL, Targetable * _target = NULL);
|
||||||
virtual int trigger();
|
virtual int trigger();
|
||||||
virtual int triggerOnEvent(WEvent * e);
|
virtual int triggerOnEvent(WEvent * e);
|
||||||
virtual int resolve();
|
virtual int resolve();
|
||||||
virtual int testDestroy();
|
virtual int testDestroy();
|
||||||
|
void setTriggerTargets(WEvent * e, MTGAbility * a);
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
virtual GenericTriggeredAbility* clone() const;
|
virtual GenericTriggeredAbility* clone() const;
|
||||||
const char * getMenuText();
|
const char * getMenuText();
|
||||||
|
|||||||
@@ -53,8 +53,6 @@ class TargetChooser: public TargetsList {
|
|||||||
virtual ~TargetChooser(){};
|
virtual ~TargetChooser(){};
|
||||||
int targetListSet();
|
int targetListSet();
|
||||||
virtual TargetChooser* clone() const = 0;
|
virtual TargetChooser* clone() const = 0;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -166,5 +164,15 @@ class DamageTargetChooser:public TargetChooser{
|
|||||||
virtual DamageTargetChooser * clone() const;
|
virtual DamageTargetChooser * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Should only be used for triggered abilities.
|
||||||
|
class TriggerTargetChooser:public TargetChooser{
|
||||||
|
public:
|
||||||
|
Targetable * target;
|
||||||
|
int triggerTarget;
|
||||||
|
TriggerTargetChooser(int _triggerTarget);
|
||||||
|
virtual bool targetsZone(MTGGameZone * z);
|
||||||
|
virtual bool canTarget(Targetable * _target);
|
||||||
|
virtual TriggerTargetChooser * clone() const;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -19,10 +19,18 @@ public:
|
|||||||
DAMAGE = 2,
|
DAMAGE = 2,
|
||||||
CHANGE_PHASE = 3,
|
CHANGE_PHASE = 3,
|
||||||
};
|
};
|
||||||
|
//for getTargets, in case event has more than one possible "target", like with damage events.
|
||||||
|
enum {
|
||||||
|
TARGET_NONE = 0,
|
||||||
|
TARGET_TO,
|
||||||
|
TARGET_FROM,
|
||||||
|
};
|
||||||
int type; //Deprecated, use dynamic casting instead
|
int type; //Deprecated, use dynamic casting instead
|
||||||
WEvent(int type = NOT_SPECIFIED);
|
WEvent(int type = NOT_SPECIFIED);
|
||||||
virtual ~WEvent() {};
|
virtual ~WEvent() {};
|
||||||
virtual std::ostream& toString(std::ostream& out) const;
|
virtual std::ostream& toString(std::ostream& out) const;
|
||||||
|
virtual int getValue() {return 0;};
|
||||||
|
virtual Targetable * getTarget(int target) {return 0;};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WEventZoneChange : public WEvent {
|
struct WEventZoneChange : public WEvent {
|
||||||
@@ -32,6 +40,7 @@ struct WEventZoneChange : public WEvent {
|
|||||||
WEventZoneChange(MTGCardInstance * card, MTGGameZone * from, MTGGameZone *to);
|
WEventZoneChange(MTGCardInstance * card, MTGGameZone * from, MTGGameZone *to);
|
||||||
virtual ~WEventZoneChange() {};
|
virtual ~WEventZoneChange() {};
|
||||||
virtual std::ostream& toString(std::ostream& out) const;
|
virtual std::ostream& toString(std::ostream& out) const;
|
||||||
|
virtual Targetable * getTarget(int target);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -39,6 +48,8 @@ struct WEventDamage : public WEvent {
|
|||||||
Damage * damage;
|
Damage * damage;
|
||||||
WEventDamage(Damage * damage);
|
WEventDamage(Damage * damage);
|
||||||
virtual std::ostream& toString(std::ostream& out) const;
|
virtual std::ostream& toString(std::ostream& out) const;
|
||||||
|
virtual int getValue();
|
||||||
|
virtual Targetable * getTarget(int target);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WEventPhaseChange : public WEvent {
|
struct WEventPhaseChange : public WEvent {
|
||||||
@@ -67,6 +78,7 @@ struct WEventCardTap : public WEventCardUpdate {
|
|||||||
bool before;
|
bool before;
|
||||||
bool after;
|
bool after;
|
||||||
WEventCardTap(MTGCardInstance * card, bool before, bool after);
|
WEventCardTap(MTGCardInstance * card, bool before, bool after);
|
||||||
|
virtual Targetable * getTarget(int target);
|
||||||
};
|
};
|
||||||
|
|
||||||
//Event when a card's "attacker" status changes
|
//Event when a card's "attacker" status changes
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ MTGAbility * AbilityFactory::getCoreAbility(MTGAbility * a){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Parses a string and returns the corresponding MTGAbility object
|
//Parses a string and returns the corresponding MTGAbility object
|
||||||
// Returns NULL if parsing failed
|
//Returns NULL if parsing failed
|
||||||
//Beware, Spell CAN be null when the function is called by the AI trying to analyze the effects of a given card
|
//Beware, Spell CAN be null when the function is called by the AI trying to analyze the effects of a given card
|
||||||
MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated, int forceUEOT, MTGGameZone * dest){
|
MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated, int forceUEOT, MTGGameZone * dest){
|
||||||
size_t found;
|
size_t found;
|
||||||
@@ -1805,6 +1805,10 @@ ostream& MTGAbility::toString(ostream& out) const
|
|||||||
<< " ; source : " << source;
|
<< " ; source : " << source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NestedAbility::NestedAbility(MTGAbility * _ability){
|
||||||
|
ability = _ability;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
ActivatedAbility::ActivatedAbility(int id, MTGCardInstance * card, ManaCost * _cost, int restrictions,int tap):MTGAbility(id,card), restrictions(restrictions), needsTapping(tap){
|
ActivatedAbility::ActivatedAbility(int id, MTGCardInstance * card, ManaCost * _cost, int restrictions,int tap):MTGAbility(id,card), restrictions(restrictions), needsTapping(tap){
|
||||||
@@ -1893,14 +1897,12 @@ ostream& ActivatedAbility::toString(ostream& out) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TargetAbility::TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost, int _playerturnonly,int tap):ActivatedAbility(id, card,_cost,_playerturnonly, tap){
|
TargetAbility::TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost, int _playerturnonly,int tap):ActivatedAbility(id, card,_cost,_playerturnonly, tap), NestedAbility(NULL){
|
||||||
tc = _tc;
|
tc = _tc;
|
||||||
ability = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetAbility::TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost, int _playerturnonly,int tap):ActivatedAbility(id, card,_cost,_playerturnonly, tap){
|
TargetAbility::TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost, int _playerturnonly,int tap):ActivatedAbility(id, card,_cost,_playerturnonly, tap), NestedAbility(NULL){
|
||||||
tc = NULL;
|
tc = NULL;
|
||||||
ability = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2187,10 +2189,9 @@ TriggerNextPhase* TriggerNextPhase::clone() const{
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericTriggeredAbility::GenericTriggeredAbility(int id, MTGCardInstance * _source, TriggeredAbility * _t, MTGAbility * a , MTGAbility * dc, Targetable * _target ): TriggeredAbility(id, _source,_target){
|
GenericTriggeredAbility::GenericTriggeredAbility(int id, MTGCardInstance * _source, TriggeredAbility * _t, MTGAbility * a , MTGAbility * dc, Targetable * _target ): TriggeredAbility(id, _source,_target), NestedAbility(a){
|
||||||
if (!target) target = source;
|
if (!target) target = source;
|
||||||
t = _t;
|
t = _t;
|
||||||
ability = a;
|
|
||||||
destroyCondition = dc;
|
destroyCondition = dc;
|
||||||
|
|
||||||
t->source = source;
|
t->source = source;
|
||||||
@@ -2209,7 +2210,30 @@ int GenericTriggeredAbility::trigger(){
|
|||||||
|
|
||||||
|
|
||||||
int GenericTriggeredAbility::triggerOnEvent(WEvent * e){
|
int GenericTriggeredAbility::triggerOnEvent(WEvent * e){
|
||||||
return t->triggerOnEvent(e);
|
if (t->triggerOnEvent(e)) {
|
||||||
|
|
||||||
|
setTriggerTargets(e,ability);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GenericTriggeredAbility::setTriggerTargets(WEvent * e,MTGAbility * a){
|
||||||
|
TriggerTargetChooser * ttc = dynamic_cast<TriggerTargetChooser *>(a->tc);
|
||||||
|
if (ttc) {
|
||||||
|
a->target = e->getTarget(ttc->triggerTarget);
|
||||||
|
ttc->target = e->getTarget(ttc->triggerTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
NestedAbility * na = dynamic_cast<NestedAbility *>(a);
|
||||||
|
if (na) setTriggerTargets(e,na->ability);
|
||||||
|
|
||||||
|
MultiAbility * ma = dynamic_cast<MultiAbility *>(a);
|
||||||
|
if (ma) {
|
||||||
|
for (int i = 0; i < ma->abilities.size(); i++) {
|
||||||
|
setTriggerTargets(e,ma->abilities[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericTriggeredAbility::Update(float dt){
|
void GenericTriggeredAbility::Update(float dt){
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "../include/GameObserver.h"
|
#include "../include/GameObserver.h"
|
||||||
#include "../include/Subtypes.h"
|
#include "../include/Subtypes.h"
|
||||||
#include "../include/Counters.h"
|
#include "../include/Counters.h"
|
||||||
|
#include "../include/WEvent.h"
|
||||||
|
|
||||||
|
|
||||||
TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInstance * card, MTGAbility * ability){
|
TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInstance * card, MTGAbility * ability){
|
||||||
@@ -29,6 +29,16 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
s=s.substr(6);
|
s=s.substr(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
found = s.find("trigger");
|
||||||
|
if (found == 0){
|
||||||
|
if (s.length() > 7 && s.find("[") == 7) {
|
||||||
|
string s1 = s.substr(7,s.find("]"));
|
||||||
|
if (s1.find("to") != string::npos) return NEW TriggerTargetChooser(WEvent::TARGET_TO);
|
||||||
|
if (s1.find("from") != string::npos) return NEW TriggerTargetChooser(WEvent::TARGET_FROM);
|
||||||
|
}
|
||||||
|
return NEW TriggerTargetChooser(1);
|
||||||
|
}
|
||||||
|
|
||||||
found = s.find("player");
|
found = s.find("player");
|
||||||
if (found != string::npos){
|
if (found != string::npos){
|
||||||
int maxtargets = 1;
|
int maxtargets = 1;
|
||||||
@@ -761,3 +771,22 @@ bool DamageTargetChooser::canTarget(Targetable * target){
|
|||||||
DamageTargetChooser * a = NEW DamageTargetChooser(*this);
|
DamageTargetChooser * a = NEW DamageTargetChooser(*this);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TriggerTargetChooser::TriggerTargetChooser(int _triggerTarget){
|
||||||
|
triggerTarget = _triggerTarget;
|
||||||
|
target = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TriggerTargetChooser::targetsZone(MTGGameZone * z){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TriggerTargetChooser::canTarget(Targetable * _target){
|
||||||
|
if (_target == target) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TriggerTargetChooser * TriggerTargetChooser::clone() const{
|
||||||
|
TriggerTargetChooser * a = NEW TriggerTargetChooser(*this);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
@@ -30,6 +30,30 @@ WEventEmptyManaPool::WEventEmptyManaPool(ManaPool * source) : WEvent(), source(s
|
|||||||
|
|
||||||
WEventCombatStepChange::WEventCombatStepChange(CombatStep step) : WEvent(), step(step) {};
|
WEventCombatStepChange::WEventCombatStepChange(CombatStep step) : WEvent(), step(step) {};
|
||||||
|
|
||||||
|
Targetable * WEventDamage::getTarget(int target) {
|
||||||
|
switch (target) {
|
||||||
|
case TARGET_TO :
|
||||||
|
return damage->target;
|
||||||
|
case TARGET_FROM :
|
||||||
|
return damage->source;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int WEventDamage::getValue() {
|
||||||
|
return damage->damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
Targetable * WEventZoneChange::getTarget(int target) {
|
||||||
|
if (target) return card;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Targetable * WEventCardTap::getTarget(int target){
|
||||||
|
if (target) return card;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream& WEvent::toString(std::ostream& out) const
|
std::ostream& WEvent::toString(std::ostream& out) const
|
||||||
{
|
{
|
||||||
return out << "EVENT";
|
return out << "EVENT";
|
||||||
|
|||||||
Reference in New Issue
Block a user