added zone position (adjust dynamically), also inverts the display of
the zone so we always get the top/recent one... the library zpos is
inverted so if we choose to target the top 5 zpos like
target(*[zpos>=5|mylibrary), it will do from top to bottom... this is
only for AI so we can add alternate code for them since they cant use
reveal atm, we can make them target within allowed range...
Also this commit disabled the new legend and planeswalker rule since it
conflicts with reveal ability, unless I/We figure it out, I recommend to
use the old one...
added abilities:
proliferate
ProliferateChooser:new targetchooser for cards with counter and poison counters "proliferation".
MenuAbility:new internal ability to create custom menus of abilities which can be activated in sequence one after another.
multikicker, syntax kicker=multi{b}
works with variable word "kicked", the amount of times it was kicked.
target=<number>tc,target=<upto:>tc,target=<anyamount>tc,target(<number>tc),target(<upto:>tc),target(<anynumber>tc);
multitarget is now supported with the exception of "devided any way you choose" which can not be supported becuase we allow detoggling of targeted cards with a "second" click....so you can not click the same card 2 times to add it to the targets list twice for example.
this is minor, as the bulk of multitarget is not "devided"
removed 's' parsing for multitarget, added a limit of 1000 to "unlimited" for easier handling; we currently can't handle activation of an ability on a 1000 cards very well on any platform(infact i don't suggest it)
Countershroud(counterstring), this MTGAbility allows you to denote that a card can not have counters of the type "counterstring" put on it.
"any" is for no counters allowed at all. this is a replacement effect. cards state that they can still be the targets of counter effects, however on resolve nothing is placed on them instead.
@counteradded(counterstring) from(target):,@counterremoved(counterstring) from(target):: these are triggers for cards which state "whenever you add a counter of "counterstring" to "target"; added counterEvents struct;
other changes:
added support for ai handling of multitargeted spells.
changed a few of delete( into SAFE_DELETE(, safed up a couple areas where they did not seem safe to me;
added better handling of menus presented to ai, it will try to select the best based on eff returns.
added varible lastactioncontroller for ai use, it keeps it truely from ever tripping over itself and brings ai more inline with MTG rules.
converted TC into a protected member.
added "abilitybelongsto" string to tc, and set "owner" of the tc. a tc should never belong to "no one" it should always have a owner.
abilitybelongs to string is solely for easier debugging, i found it was a pain to never know what ability created a tc while i coded multitarget. the owner of the tc is the only one that should be using it, if an ability needs to declare the opponent as the owner (choose discard which is currently unsupported for example) this will allow us to better handle that situation by setting the tc owner in the ability which called it.
rewrote the logic of "checkonly" in ai choose targets, the only time it is "checkonly" is when it is trying to see if it had a target for a spell before it cast it, i now set this in the actual function call instead, the old method was far to error prone.
wrote logic for ai checking of menu objects presented to it,
ai will now make better choices when a menu is presented to it based on what it already knows. this changes it from it's old method of "just click the first option".
taught ai how to use multi-mana producers such as birds and duel lands by adding a method for it to find it's mana for a payment. it can effectively use cards like birds of paradise and sol ring(without locking up). It's primary method of pMana searching was maintain for performance(no need to deep search if we have it in pMana).
added a vector to actionlayer to store mana abilities for pMana. this provides us with a dramatic improvement when mana lords are present by reducing the amount of objects that need checking when ai checks pMana.
with 80 mana objects and a ton of lords one instance i checked went from 8000ish checks down to 80<===big difference.
added "tapped" green coloring(sorry i missed that!)...added red coloring to current actionLayers current action card (usually the source).
changed "type(" restrictions second amount from atoi into wparsedint for more flexiable coding.
add "&" parsing to CD targetchooser, removed "iscolorandcolor" variables and functions becuase they were a hack the real fix was this.
cretaure[dragon&black&blue] a creature that is a dragon, and black and also blue.
changed some of the ai computeactions and
removed unneeded gaurds in ai chooseblockers, they did more harm then good.
this(damaged)
added
targetchooser [damaged] status
added
targetchooser [controllerdamager]
targetchooser [opponentdamager]
basically checks for whos doing damage to who in a match per turn.
added new card discriptor [share!variable!]
the variables for this so far are
name <---eradicate effect targetting
color <--radiance effect targetting
types <--the plague cycles
it is important to note that a target IS REQUIRED before this, meaning it has to be used below a target= or after the targetting of an && ability...otherwise it will simply default to the source cards variables.
this solution provides a much more generic version without sacrificing the effectiveness of the eradicate set which was limited only to eradicate style cards(which ALSO required a target)
coding exsample
[card]
name=Eradicate
target=creature[-black]
auto=all(*[share!name!]|targetcontrollerhand) moveto(exile)
auto=all(*[share!name!]|targetcontrollerlibrary) moveto(exile)
auto=all(*[share!name!]|targetcontrollergraveyard)moveto(exile)
auto=all(*[share!name!]|targetcontrollerbattlefield) moveto(exile)
mana={2}{b}{b}
type=sorcery
[/card]
you will notice something strange above, for this change to work i had to fix the bug with "targetcontrollerBLAH" zone targetting...tho my fix was a patchwork fix, it does indeed provide the targets controller...we need to find the root cause of why initToZone is not returning the correct "target" variable to this function.
if the source does not have a target it defaults to source.
before it there was no target, which there never is a correct target returned as noted by the fact that 0 cards exist with targetcontroller zone targetting in WAGIC however theres a considerably large card pool for this.
enjoy :)
docs going to kill me for this lol.
ok i WAS going to write a full change log with code exsamples ect, but since im rushed you will get the short version of this log.
first bug fixes, and there were many,
indestructible creature bug fixed
halimar execavator *embearessing youtube video" bug is fixed
token text now displays source name and tokens abilities
fixed a card view null pointer in an iterator when code used combinations of foreach and aslongas with CD.
epic struggle bug fixed, aslongas was only parsing one space to the right of the operator.
extra cost containing targetting fixed, cards can now have multiple extra cost in all mana...this includes giving a card 2 targeted sacrifices as its main cost.
angelic chorus bug fixed, the card will be soft coded now.
and many other minor bugs fixed, hard to remember all which were fixed.
now, new abilities = words
"legendarylandwalk",
"desertlandwalk",
"snowforestlandwalk",
"snowplainslandwalk",
"snowmountainlandwalk",
"snowislandlandwalk",
"snowswamplandwalk",
"snowlandwalk",
"nonbasiclandwalk",
"strong",//cant be blocked by creature with less power
"weak",//cant block creatures with more power
"phasing",
all true landwalks will now be supported.
new cost types:
morph which is coded as follows
[card]
name=Bloodstoke Howler
facedown={3}
autofacedown={6}{R}:morph
autofaceup=3/0 all(beast|mybattlefield))
text=Morph {6}{R} (You may cast this face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.) -- When Bloodstoke Howler is turned
face up, Beast creatures you control get +3/+0 until end of turn.
mana={5}{R}
type=Creature
subtype=Beast
power=3
toughness=4
[/card]
you will notice new auto lines autofaceup and autofacedown
these are abilities the cards will have when theyre in that state.
the cost is coded as
facedown={cost}
when a card is faced up it gains auto= lines also.
tho is played normally it will NOT gain autofaceup=lines
card restrictions:
cards can now have restrictions placed on them the restrictions are.
all previous restrictions usable in activated abilities
with the follow additions
control two or more vampires
control less creatures
control snow land
casted a spell
one of a kind
fourth turn
before battle damage
after battle
during battle
[card]
name=Blood Frenzy
target=creature[attacking;blocking]
restriction=before battle damage
auto=4/0
auto=treason
text=Cast Blood Frenzy only before the combat damage step. -- Target attacking or blocking creature gets +4/+0 until end of turn. Destroy that creature
at the beginning of the next end step.
mana={1}{R}
type=Instant
[/card]
other cost now can have specail restrictions also:
otherrestriction=mytypemin:1 type(swamp),opponenttypemin:1 opponenttype(plains)
these are minimums required inplay of a type
it can be just you, or you and opponent or just opponent
you can also use the words "more" and "less" and * to compare the 2 players fields.
[card]
name=Cho-Arrim Legate
abilities=protection from black
other={0}
otherrestriction=mytypemin:1 type(swamp) , opponenttypemin:1 opponenttype(plains)
text=Protection from black -- If an opponent controls a Swamp and you control a Plains, you may cast Cho-Arrim Legate without paying its mana cost.
mana={2}{W}
type=Creature
subtype=Human Soldier
power=1
toughness=2
[/card]
activated ability gained a new restriction "opponentturnonly"
variables will now be recalculated during the resolve of the major abilities to produce the most current number.
{x}:draw:x <----
new number variables words:
using draw as an exsample
draw:auras <--auras on a creature
draw:type:ally <---counts the allys in your field. self explanitory
draw:thatmuch <--mostly a triggered effects number.
when you take damage draw that much
draw:lifelost
draw:oplifelost
these return the value of the life lost that turn.
new TRIGGER restricitions
sourcenottap
sourceTap
foelostthree<--card cycle uses opponent lost life
foelosttwo<--same as above
once<--this trigger will only ever trigger one time and never again.
new card discriptor words
[multicolor]
[leveler]
[enchanted]
[blackandgreen]
[blackandwhite]
[redandblue]
[blueandgreen]
[redandwhite]
CD will now recalculate the number again on resolve
meaning {x}:target(CreatureTargetChooser[manacost <=x]) will work, with an added bonus {x}:target(CreatureTargetChooser[manacost <=any word variable])
new this(:
this(tapped)<--for strange case cards.
this(untapped)
this(auras)
new MTGAbility keywords
(blink)
(blink)forsrc <--stay blinked while source inplay
hand(blink <---adding hand to the front makes it target hand.
livingweapon
this is an extension of token, simple attach the words "livingweapon" to the front of token( and it will autoamtically token that and attach the card to it.
token( gained:
"targetcontroller" targetting.
"battleready" if put in the tokens abilities it will be a attacker and tapped as it is entering play.
phaseout <--self explanitory
spiritlink <--stacking lifelink style effect that benifits the OWNER of the card.
combatspiritlink same as above.
stacking flanking, requires 2 abilities unfortunately
[card]
name=Agility
target=creature
auto=teach(creature) flanker
auto=teach(creature) flanking
text=Enchant creature -- Enchanted creature gets +1/+1 and has flanking. (Whenever a creature without flanking blocks this creature, the blocking
creature gets -1/-1 until end of turn.)
mana={1}{R}
type=Enchantment
subtype=Aura
[/card]
removeallcounters(number/number,name)
removes all counters of the type from a card, can all be
"all"
vampire hexmage effect.
added new tools for transforms
,setpower=number
,settoughness=number
removetypes
morph
autofacedown={0}:morph
eradicate <---same as the card name.
cumulativeupcost[ <--self explanitory
upcostmulti[ <--an upcost that will resolve with a && ability
phaseaction[ phase name ] ability
an ability that will trigger on the stated phase name.
also support for phaseactionmulti[
new triggers added:
@vampired( <--sengir vampire effect
@targeted(
@lifeloss(
@lifed(
add a special ability builder called dynamicability
it acts alot like a choose your own adventure book
dynamicability<! variable 1, variable 2, variable 3,variable 4!> optional ability targetting the original target.
variable list 1:
this is the primary amount source
source
mytgt
myself
myfoe
variable list 2:
this is the variable we're after, or the amount
power
toughness
manacost
colors
age
charge
oneonecounters
thatmuch
variable list 3:
this is the main effect
strike
draw
lifeloss
lifegain
pumppow
pumptough
pumpboth
deplete
countersoneone
variable list 4:
how it will do this effect to.
itself
eachother
targetcontroller
targetopponent
tosrc
srccontroller
srcopponent
the best way to explain its usage is to look at cards coded with this ability. or experiment with combinations.
new gameoption
First turn player:player, opponent, random
who takes the first turn
added poisoned status, tho not complete since MBS hasnt spoiled enough cards to see where this variable will be used.
taught ai how to counter spell
improved ai, it will now cast instants during interupts and during your turn.
previously ai treated instant cards the same as it treated sorceries, which was not fair to the ai.
im sure there is some messed items, but the rev directly before this one had formatting in the code that created hundreds of conflicts with this one, so i had to dig this info out of red and green sections.
cards and test are coming soon, i ask PLEASE do not alter these new additions until the test are commited.
im commiting without the test because instead of allowing me to proceed with my beta test period, there are some that wish to rush me into a commit. if you do not like this commit revert it, i absolutely on no grounds give permission to recommit afterwards. and i will not recommit if a revert is called.
finishing up my reformatting of the source from November/December following the guidelines that were posted.
some extra things I added:
* Any empty virtual declarations were kept to one line.
* Enums were split up into separate lines to promote uniformity across all headers. ( each header file had a different style for enums)
Salmelo:"Here is another patch, this time adding counters to target specifications, so now you should be able to target things with counters on them as well as use counters for criterion for Lord, aslongas, foreach, etc.
I had to muddle the syntax a little bit though, so heres an example, taken from gwafa hazid, whom I added to the primitives to test with.
lord(creature[counter{0/0.1.Bribe}]|opponentbattlefield) cantattack
obviously the part we are worried about is the counter part, note that those are curly braces { } and periods . instead of parentheses ( ) and commas , this is so that it does not conflict with how targets are normally parsed, which it did before I changed those. Counters still work the same way everywhere else though, you only need to use { } and periods in target code.
Also, you can use counter{any} to specify that it should look for things with any kind of counter on them, not just specific ones, this is used by Kulrath Knight, for example.
I also consolidated most of the code used to parse counter specifications, as it seemed unnecessary duplicating it three times.
Anyway, aside from this major addition, I also added Gwafa Hazid, Profiteer; and Kulrath Knight to the primitives, as well as a test file for each to make sure it worked.
Hopefully y'all will find this patch useful.
Oh, and I should point out that it only works with one Counter in the target specification, i imagine if you put two in the same one then it would either overwrite the first with the second or merge them into some sort of hybrid counter monstrosity, either way, I wouldn't suggest it. "
Cards with vanishing are also codable now. Have a look at the comments for explanation.
daily_build.
Limitations:
- Operators for "greater than", "less than", "unequal" have not been implemented, but if a card actually needs them, you can use a preceding minus sign to negate a comparison. Example: -power=3 means "power not equal to 3", -toughness<=3 means "toughness>3".
- You can't use spaces when specifying such restrictions. Write "power<=3" instead of "power <= 3"
- You now need to use a space before the "<" and ">" commands that count the matches for lord(), foreach(), all() and aslongas(). So far we always did use spaces in front of them without actually needing to, now we need to.
- manacost restrictions don't take "X" costs into account. Example: Mistmeadow Skulkin (FUT) has protection from manacost>=3. Blaze has a converted manacost of 1, but when you cast it with an X of 2, then it actually has a converted manacost of 3 while on the stack, and Mistmeadow Skulkin would be protected from it, but currently it isn't.
Please review the code, I'll add a few remarks/questions of my own.
- fixed a few bugs with the parser for subtypes
- fixed a bug for plague rats
- fixed a bug for P/T parser
- First release for the following sets: Mirrodin, Mirage, Lorwyn
- Added the possibility to narrow a spell/ability target according to color,tapped status, attacker/blocker, abilities...
- Changed the games phase system to become a phaseRing. This allows to add cards that have an impact on the phases, such as stasis
- Added a few cards
- Fixed a (windows) bug in gatherer tool
- Adding stdint.h for VC++ (see wikipedia->stdint.h)
- deleting the compiled PSP lib to avoid confusion. People who work from the sourcehave to compile the lib by themselves.