Commit Graph

858 Commits

Author SHA1 Message Date
omegablast2002@yahoo.com
dbc5376135 added "abilities=canattack"
Warmonger's Chariot
6/15/2010: The second ability doesn't cause the equipped creature to lose defender. It just lets it attack.
2011-03-31 16:39:28 +00:00
omegablast2002@yahoo.com
476a74340a little bit of hard code clean up, soft coded the following cards and removed thier hard codes
Angelic Chorus
Lavaborn Muse
Pestilence
Living Artifact
Hypnotic Specter
there is test for each of these.
btw living artifact hard code was wrong, it was allowing you to remove counters at any phase, the soft code is actually correct. updated living artifact test to the correct version in next rev
also fixed a case where "thatmuch" was never set, i now also store the amount on the source of the trigger as well.
2011-03-31 16:15:30 +00:00
wagic.the.homebrew@gmail.com
3c691b6741 - Fix for issue 614 (removed hardcoded Howling Mine)
- Fix for issue 615 (Linux/PSP compilation error)
2011-03-31 09:38:04 +00:00
omegablast2002@yahoo.com
257de9962a just cleaning up a memleak i created, moving the parsing of the "newability" in transforms into the resolve rather then creating an object that might not be used. 2011-03-30 22:10:45 +00:00
omegablast2002@yahoo.com
6881787d7d moved parsing of the power and toughness for token gen into the resolve. 2011-03-30 19:25:48 +00:00
omegablast2002@yahoo.com
a645b06433 tiny change, just changed a line to allow ninjutsu to be targeted. 2011-03-30 04:13:28 +00:00
omegablast2002@yahoo.com
d25424cb6c 3 changes
1st 
had to revise the syntax for my "type:" variable it is now type:blah:location, using the pipe line created nasty returns in some combinations of abilities as the parser confused the pipeline in type: with the one in TC.
2nd
more of a correction then a bug fix, i noticed that upcost had instances where it could still trigger its effect in the draw phase becuase the condiational for the ability resolve was in the update, i left the class mostly untouched but move the resolve out of update and into a receiveEvent for upcost, which triggers only once after you declared that you are leaving the upkeep before draw step begins.
3rd
reworked the construction of multiability to only produce a single multiability with all the abilities in the string instead of nested multiabilities, it is considerabily easier to debug and creates 1/3 less objects for the engine to deal with in comparison to the old method.
2011-03-30 01:01:11 +00:00
omegablast2002@yahoo.com
f0d104363f first moved regenerate lower on the parser, 2nd fixed an unforeseen bug with the newability subkeyword and the parser, i now store the string value of the transforms ability and remove it from the main string until transforms is parsed, if I leave it during the whole parsing any ability listed above transforms will not work correctly when granted with this ability.
also noticed issues with transforms parsing which i was able to easily correct by making it parse transforms in double brackets, transforms((effects))...updated primitive in next revision.
test suite passes, and varified that the fix doesn't effect how "&&" ability works with transforms.
2011-03-29 20:28:03 +00:00
omegablast2002@yahoo.com
306c98c02f had to separate my vectors right bracket from the map bracket for pspsdk. 2011-03-28 23:47:33 +00:00
omegablast2002@yahoo.com
c03a444525 corrected Prismatic omen issue,
added newability[whatever ability] to transforms classes.
this allows for transforms to also add activated or mtgabilities to cards it targets.
example Prismatic omen:
auto=lord(land|myBattlefield) transforms(plains forest mountain swamp island,newability[{t}:add{w}],newability[{t}:add{g}],newability[{t}:add{r}],newability[{t}:add{b}],newability[{t}:add{u}])
Issue: 573
2011-03-28 23:39:29 +00:00
omegablast2002@yahoo.com
565ee57372 it was reported to me that cards such as Isleback Spawn were not actually working correctly, to fix these i added a compareZone function to aslongas and a tag to use when you want to compare different like zones, example:
lets say in the case of Isleback Spawn you want to see if ANY player has less then 20 cards.

auto=aslongas(*|library) 4/8 <21 compare

this will check if either you or your opponent has less then 20 cards. rather then adding the total cards in both libraries.

over the last weeks ive seen this cards code change atleast 3 times. this should be the final version for it and any other cards like it.
2011-03-28 16:39:30 +00:00
omegablast2002@yahoo.com
7d98628355 added a "while " tag for aslongas effects which are not supposed to be treated as oneshot abilities. adding it as a tag allows for maximum flexibility in the code.
while i was at it reworked the aslongas class completely, i promised myself if another bug popped up with aslongas i would rewrite it. 20 hours later, we have an aslongas which does not care about when cards come or go.
aslongas should never have used the added/removed to determine the validity of its effect. i allow update to sort it out now in the update function of aslongas...also added a new function to it called sorterfunction tho it looks as it could be reduced in code i would appreciate that it remains as it is, simply because of the nightmare i went through fixing the previous 7 bugs or more reported for aslongas. the logic was far to jumbled up. this i hope is atleast cleaner and easier to understand for the future devs that might work on it.

note: all test passed, all manual testing also passed.

new while tag is used as follows.

[card]
name=Emperor Crocodile
auto=aslongas(other creature|myBattlefield) all(this) sacrifice while <1
text=When you control no other creatures, sacrifice Emperor Crocodile.
mana={3}{G}
type=Creature
subtype=Crocodile
power=5
toughness=5
[/card]

this will denote that the ability is NOT a oneshot ability and should remain effective for the entire time the card is in the field.
Issue: 613
2011-03-27 14:37:12 +00:00
omegablast2002@yahoo.com
966d8b453d reworked landhome ability, to fix a reported bug where it simply becomes tapped on opponents turn for no reason. 2011-03-22 10:46:32 +00:00
omegablast2002@yahoo.com
06ca82929b removed clockwork beast alias and hard code. it is no longer needed as i added a soft coding method that was far more generic and leaving this is was causing conflicts with the new code. players reported that using the 4th edition clockworks beast was loading the card with the alias even tho i removed the alais in the primitives. 2011-03-22 03:44:54 +00:00
omegablast2002@yahoo.com
65f2706f1e fixed a bug where cards with vanishing (new vanishing) were given "vanishing as a menu item during combat. 2011-03-22 03:41:45 +00:00
omegablast2002@yahoo.com
aeb4a839b2 fixed a report crash with auras that "teach(" an activated ability to a creature which can phaseout. 2011-03-22 02:25:02 +00:00
omegablast2002@yahoo.com
f2c905225b cleaned up resetting cost for altercost code, its *almost* where i want it to be, removed the need to have "resetcost" coding on card code. removed "resetcost" keyword.
i was not 100% successful in getting the correct cost on altercost which reduced the amounts. however altercost which increased the amounts are now clean code. so the reducers are still using a dirty method of putting the card from the hand back into the hand to get the correct amounts.

the issue i ran into is how to get the correct amount in this situation.
target cost {5} 
have 3 reducers that - {2}
thats {1} of overkill reduce...
heres the issue. now remove all the reducers from play. the cost returns to {6} instead of 5. 
you would think, will have it track the over kill. which leads to another. have the 3rd card which would contain the overkill removed first, i factor the overkill and increase the amount by what was reduced, but that would not be correct. since the reduce was {2} the increase of removing the overkill card should increase the targets cost by {2} not the amount it actually reduced. as you can see, it is extremely complex. so for now im leaving it dirty, but removing the resetcost code.
2011-03-22 01:12:33 +00:00
Xawotihs
f9be0a6341 - reworked completly the JNetwork, JSocket interface (had to ifdef out the PSP socket code)
- added 2 menus to wait for connection and wait for deck selection
- tested compilation on Qt Linux, Qt Windows and PSP
- deactivated everywhere (NETWORK_SUPPORT to activate).
2011-03-13 21:19:02 +00:00
omegablast2002@yahoo.com
64a234ef44 added support for customphasering construction in rules txt...
exsample

[INIT]
mode=mtg
[PLAYERS]
life:2000
poisoncount:4
customphasering:untap,firstmain,firstmain,draw,firstmain,upkeep,draw
auto=shuffle
auto=draw:7
auto=@each my draw:draw:1
auto=maxPlay(land)1

by default every turn will have normal order we've always been use to
however
before begins --required added automatically
anything you want in any order
anything you want in any order
anything you want in any order
anything you want in any order
anything you want in any order
anything you want in any order
anything you want in any order
anything you want in any order
cleanup---required added automatically
after end of turn---required added automatically

svntax 
customphasering:blah,blah,blah
listed in the order you want it to go. you can repeat a phase as often as you want, you can omit phases.

please note, this was not designed with MTG in mind..some of the rules require certain phases to work...this is for CUSTOM game building...i repeat NOT DESIGNED FOR MTG...tho it can be used with most(almost all, with the exception of those which require certain phases to work, exsample, ninjitsu will only work in a phasering which contains blockers and attackers)

enjoy.....
2011-03-02 21:33:42 +00:00
wagic.the.homebrew@gmail.com
b021417324 Erwan
-fix for issue 604 (Land play limitation should not apply in all cases)
-- this adds a "castMehod" variable to MTGCardInstance. IF this variable is 0, the card was not "cast" (or for lands, "put into play" as part of the lands rule), but "added" to the battlefield with some other effect. On the other hand, if this variable is set, it means the card was cast 
-- as we discussed, I did not touch the "alternateCostPaid" variable, as I'm still not really sure these two concepts are actually the same
2011-03-02 13:41:24 +00:00
wrenczes@gmail.com
7b53f30519 Removed an unneeded include. 2011-03-01 09:30:23 +00:00
wrenczes@gmail.com
9308c743a5 This adds a true 'boost::thread' equivalent for the psp, which in turn allows me to eliminate the need for #ifdef PSP vs #ifdef Win/Linux/iOS in my threaded cache implementation code. 2011-03-01 08:51:42 +00:00
omegablast2002@yahoo.com
2153a8d308 added menutext returns for "protection from(" 2011-02-27 16:09:26 +00:00
omegablast2002@yahoo.com
c4ecfb7b00 opps, pspsdk didnt like this, i wish it wasnt so whiny sometimes.... 2011-02-25 22:41:43 +00:00
omegablast2002@yahoo.com
3f090c7be8 added basic suspend.
syntax
suspend(number of time counter)={cost}
suspend(3)={g}
2011-02-25 18:40:23 +00:00
omegablast2002@yahoo.com
6f792e5546 2011-02-22 14:38:07 +00:00
wagic.the.homebrew@gmail.com
dc48b5472b Erwan
- fixing incorrect case for include of PlayRestrictions.h
2011-02-19 16:52:37 +00:00
wagic.the.homebrew@gmail.com
db0c55b4dd Erwan
- Fixed an issue with maxCast targeting opponent
2011-02-16 14:35:49 +00:00
wagic.the.homebrew@gmail.com
8dd6856453 Erwan
- fixed issue 595 (MaxCast not working). Root cause was the stupidest typo ever in the code (maxCost instead of maxCast...)
- fixed an issue with Storm mentioned by zethfox (was counting only spells played by current player)
- Moved "max lands per turn" rule outside of the code (yay!) Please be sure to update your Rules folder!
2011-02-15 14:17:34 +00:00
techdragon.nguyen@gmail.com
f4d1154cd6 reverted latest change 2011-02-14 09:35:43 +00:00
techdragon.nguyen@gmail.com
d9efb408e5 * optimized card loading. There was some redundant code that wasn't necessary.
* getCardByName seemed to have a initialization error if you tried to use it before the entire game loaded.  The cache would
throw an exception if you tried to use find and it was empty.  I put a guard around it to avoid this issue.

* refactored Zeth's "toggledifficuly" feature to be stored in meta data.  http://code.google.com/p/wagic/source/detail?r=3106
 -- This is slightly modified as it forces a 1 for 1 swap of cards that are specified.
    from the example given this is how it seemed to be used anyways.
 -- since all the information is stored in the meta data, there's no need to alter the deck's
    definition.
2011-02-14 08:14:35 +00:00
omegablast2002@yahoo.com
ecd2217139 reordered these varibles pspsdk doesnt like it when things are not int'ed in order. 2011-02-14 01:18:41 +00:00
wagic.the.homebrew@gmail.com
6b89899d1b Erwan
- deprecated the following keywords (see list below for new usage)
-- cantcreaturecast => auto=maxCast(creature)0
-- cantspellcast => auto=maxCast(*)0
-- onlyonecast => auto=maxCast(*)1 
-- bothcantcast => auto=maxCast(*)0 auto=maxCast(*)0 opponent
-- bothnocreature => auto=maxCast(creature)0 auto=maxCast(creature)0 opponent
-- oneboth => auto=maxCast(*)1 auto=maxCast(*)1 opponent

Strangely enough, I couldn't find most of these keywords in mtg.txt?

I also removed variables such as "spellCastedThisTurn" and stuff like that... now if you want to know how many spells were cast in one turn by a given player, use player->game->stack->seenThisTurn("*").
seenThisTurn can take a string representing a TargetChooser, or better, a TargetChooser.

I can't guarantee I didn't break anything, but the test suite passes and the AI seems to run ok
2011-02-13 11:23:51 +00:00
wagic.the.homebrew@gmail.com
8eac9c587e Erwan
- added maxCast and maxPlay abilities, this deprecates the following abilities: nospells,nocreatures,onlyonespell,land
I usually don't like to deprecate abilities, but the existing ones, despite having easy to remember names, were really not flexible enough.

If you want to use these old keywords, instead use:
-- nospells  =>  maxCast(*)0
-- onlyOneSpell => maxCast(*)1
--nocreatures => maxCast(creature)0
--land:1 => maxplay(land)+1

note maxPlay and maxCast. They follow similar rules, but maxPlay monitors the number of cards that are going on the Battlefield, while maxCast monitors the stack. In most cases, maxCast should be the one to use, but lands are a special case because they go directly to play.

I unfortunately cannot guarantee I didn't break anything, especially in the AI, but the test suite passes ,and I added a few additional tests yesterday and today, to feel more confident about the change.

next step is removing the creatures keywords that do the same kind of thing (cantcast, etc...) and replace them with maxCast
2011-02-13 08:01:13 +00:00
wagic.the.homebrew@gmail.com
60017a6652 Erwan
- replaced variables canPutLandsIntoPlay and landsPlayerCanStillPlay with a PlayRestrictions class.
- Added  seenThisTurn(TargetChooser * tc) in MTGGameZones, which allows to count how many cards matching a targetChooser have been in a given zone in the current turn. With minor work, this can probably be reused by the ability parser for some cards that need to count how many **** where played or put on the stack during a turn.
-- for example player->game->stack->seenThisTurn([put a TypeTargetChooser("creature") here]) would give you the number of creature spells cast by the player this turn.
- This is the first step of a refactor that aims at removing all the adhoc variables for "cant cast". I plan to get rid of the following variables in Player.h (and the associated code, which hopefully will become smaller):  
    int castedspellsthisturn;
    bool onlyonecast;
    int castcount;
    bool nocreatureinstant;
    bool nospellinstant;
    bool onlyoneinstant;
    bool castrestrictedcreature;
    bool castrestrictedspell;
    bool onlyoneboth;
    bool bothrestrictedspell;
    bool bothrestrictedcreature;

They will be replaced by the PlayRestrictions system, and hopefully I'll have time to update the parser to make this more generic as well.
My initial goal with this change was to move the limit of 1 land per turn outside of the code, and make it an external rule in Rules/mtg.txt. I have yet to do it.
2011-02-12 16:31:07 +00:00
omegablast2002@yahoo.com
2690a3f9a0 updated variable "type:" to act more like a targetchooser...
draw:type:creature|opponentbattlefield
will draw a card for each creature on the opponents battlefield

this defualts to "|mybattlefield" however any target zone can be used, hand, library ect....
this will add support to some cards which werent possible with previous version of it, without having to create new word variables to do the same exact thing as can now be done with this.
2011-02-12 16:21:54 +00:00
omegablast2002@yahoo.com
0a60979554 fix and completely reworked affinity AGAIN.
moved it out of rules, it was FAR to error prone and after fixing bugs on this ability about 12 times, im done with it.

noticed yesterday that it was removing the completely wrong amounts, and not maintaining its cost AT ALL. so i got sick of adjusting it as a rule, its now a statebased effect, called through gamestatebasedeffect as a side function.

the new affinity is less then 100 lines of code, down from 300. to acomplish the effect with FAR less effort. it is also FAR easier to maintain in the future if i die or leave the scene or whatever.

added a new count tool for MTGGameZones canByCanTarget...which allows for returns of amounts based on if it can be targetted by a tc. much like how listmaintainer does it. affinitygreencreature will not be the only ability to use this function, just a heads up. its just the first to do so.

hopefully this much more accurate affinity will be the last version...considering adding the other types which old affinity couldnt handle :D
2011-02-12 15:06:28 +00:00
omegablast2002@yahoo.com
19c3e903bc just cleaning, removed a double check i added ages ago that isnt really needed anymore, ai handles fine now without having to double check if it can cast after it already did so. 2011-02-12 03:00:45 +00:00
omegablast2002@yahoo.com
76653b6f54 going to go ahead and commit this now as updating the ai decks to use this tool is going to be a huge task...i originally wanted to commit this when i had a substantial amount of ai decks using it, to show case how it makes a huge difference.
it is a feature that is for ai deck building
what it will do is as follows

#NAME:sample deck
#DESC:The forces of fire and nature unite. 
#DESC: 
#DESC:Can you withstand 
#DESC:their combined fervor? 

toggledifficulty:lotus petal|black lotus (*) * 4
grizzly bear (*) * 4
someCard (8) *4

notice the toggle dificulty?
syntax is ....toggledifficulty:easy card name or number|hard card (optional set if both belong to same set otheriwse use * ) *howmany

toggledifficulty:frying pan|machine gun
toggledifficulty:tomatoe|pumpkin (MBS) * 3
toggledifficulty:tomatoe|squash
grizzly bear (*) * 4

the above exsample as easy will have a deck with:
frying pan
4X tomatoe
4X grizzly bear

and on hard it will have:
machine gun
3x pumpkin
squash
4X grizzly bears

the entire deck can be built with toggledifficulty cards....its not limited to just a single use.
you can also mix it up, some can be toggledifficulty some can be just like normal, you are not limited to having to have a complete deck of toggled cards...

if your currently selected deck has an over all win ratio of 65% or higher...this deck will have 4 black lotuses in it...if youre overall win with the current deck you are playing is below 65% then those 4 black lotuses are replaced by 4 lotus petals instead...effectively making it an easier ai deck...

note, the 2 cards used are exsamples...its a great way to show you the potential this change can have...an ai deck with 4 black lotuses will do WAY better then the same deck with 4 lotus petal...if you catch my drift...
2011-02-11 18:01:50 +00:00
omegablast2002@yahoo.com
25fe86ad89 added "turnlimited" restriction for blocked, blocking, combatdamaged, and damaged triggers. 2011-02-10 19:50:09 +00:00
techdragon.nguyen@gmail.com
93c63cef3d reimplemented mana color display for deck selection. This is now totally controlled by
stats generation.  No data needs to be written to the deck master files themselves.
Now the mana colors will only show if you have battled with a particular deck at least once.
This is not retroactive, so you will need to battle the ai again.  This can not be edited manually
either to prevent tampering with the statistical data.  Player deck mana color display is also
covered this way.

Decks will still be saved in the new layout if a disk write is necessary.  So any changes via
the deck editor will result in a deck file rewrite is was always the case.:)
2011-02-10 17:19:11 +00:00
techdragon.nguyen@gmail.com
9c8ff0e27a updated ManaCost copy constructor to do a true deep copy.
added copy constructors to ManaCostHybrid.
2011-02-09 20:42:19 +00:00
wagic.the.homebrew@gmail.com
7f4c001a1d Erwan
- minor cleanup of MTGRules.cpp based on my comments in r3084. I visually verified that I didn't break the fix in r3084. Also ran the test suite.
-- in case somebody wonders about some of the tests I deleted, most of these tests are useless because all callers make sure alternateCost is not null (in isReactingToClick) and that the manapool can afford the cost, before doing the call to reacttoclick. Proving it by adding an assert, and also making the function protected, to be sure it is only called by the authorized children.
2011-02-09 14:33:09 +00:00
techdragon.nguyen@gmail.com
4cbf3ddeb5 removed extraneous function. Not meant for last check in 2011-02-09 13:21:26 +00:00
techdragon.nguyen@gmail.com
2c0da5e7e6 added copy constructor with operator=
updated constructor for ManaCost*

TODO:  May have to look at ManaPool in case that needs updates as well.
2011-02-09 12:03:15 +00:00
omegablast2002@yahoo.com
f7b34295fb added a way to set the max amount a counter ability can give you...aka the clockworks effect...as per mtg rules, you are still allowed to activate the effect but if it would put the target counters higher then the max allowed by that ability, then it will do nothing.
it strings exactly like normal counters did, except now after the name you can add yet another "," and a number or word varible...if you will not have a name it is still required that you add the extra comma, as it is a seperator for the parser. so clock works swarm would be counter(1/0,1,,4)...no matter what, this ability will do nothing if the amount of the target counter is already higher then the max allowed, in this case 4...other effects can give the creature more counters...however..this ability will resolve to nothing if youve exceeded the limit. until you are under the amount again.
2011-02-08 15:12:14 +00:00
omegablast2002@yahoo.com
bf427b6402 i actually misinterperated the fading rule...
the difference between vainshing and fading is...
fading sac triggers the NEXT time you try to remove a fade counter but cant, vanishing sac triggers WHEN you remove the last counter.
2011-02-06 18:48:08 +00:00
omegablast2002@yahoo.com
de6e5ed7eb extended "vanishing" to support "fading" these 2 abilities are the same with the exception of the name of the counter the creature receive. 2011-02-06 18:20:59 +00:00
omegablast2002@yahoo.com
156fd4a601 fixed handsize issue in demo.
Issue: 587
2011-02-06 14:50:02 +00:00
Xawotihs
b7b584113b - Moved the card collection out of the GameApp class to clean up the dependencies
- Added method to build a card collection independently of the GUI to ease my unitary test application
- Added part of some network GUI I'm working on, it's #ifdef out, I'm only committing this part to ease later merges
- Added the beginning of a serialization code of the Player and related classes used for network support
- various other minor cleanup
2011-02-06 11:35:40 +00:00