141 Commits

Author SHA1 Message Date
valfieri
8645cb9e1e Fix date in Dat files, Added IKO and HA3 sets, updated the manifest and build files, Added SD card support for Android, Fix the Android app crash when resuming from background, Improved Android downloader, added finger sliding popup menu for Android devices without sidebar menu, fixed several crashes during game, added the mutating card ability, fixed the adventure card ability, added new borderline primitives. 2020-06-10 00:10:59 +02:00
Anthony Calosa
ed42c3fd29 support andability in mana producer
so cards that parse mana abilities can be read (reflecting pool. etc..
fixes issue #700 but we need to update the code from add{mana} && do
something to add{mana} and!( do something)! )
2017-02-19 21:11:02 +08:00
Anthony Calosa
2d383e237f hiddenview
if the target is in library and the source has the hiddenface ability
then hide it
2017-02-14 05:09:28 +08:00
Anthony Calosa
8e47927805 some corrections 2017-02-10 16:03:03 +08:00
Anthony Calosa
e2c1d62552 modified Momir 2017-02-05 22:14:20 +08:00
Anthony Calosa
f3dd1be125 rebounded trigger
for use with rebound cards only
2016-08-25 22:25:34 +08:00
Anthony Calosa
ae33977e10 Add Snapcaster Mage Ability
tempflashback - flashback using manacost
2016-07-26 09:56:13 +08:00
Anthony Calosa
4da7f77089 Cleanup tabs 2016-07-07 13:25:36 +08:00
zethfoxster
6ee00c138c Pretty huge patch here(sorry old habits never die :( )
lots of changes, many bug fixes,
first
added auto=count(targetchooser)
and countedamount wparsed int
they work together for cards where it is difficult to get working without knowing in advance how many we had ie: exile blah creatures, for each creature you exiled do effect.
auto=count(creature|mybattlefield)
auto=moveto(exile)
auto=draw:countedamount
it takes into account token creatures, which our old methods did not.

second, added "freeze" which is a "frozen" that automatically taps your target for you, for use when nesting or whenever needed where it was difficult to nest the ability with tap included.

added devotion for "iroas"

added reveal:x and scry x
reveal contains optionone/optiononeend ; optiontwo/optiontwoend ; repeat; afterrevealed/afterrevealed end.

this ability has heavy use of targetListIsSet(<amount>) and upto:amount, you MUST be certain that all cards being revealed have an action that removes them from reveal either in the first, second, or 3rd ability.
there are over 300 examples in the new card code, the ability is VERY easy to understand.

scry contains automatic put on top, put on bottom, then scrycore/scrycoreend which is an ability to fire.
it also contains keywords, dontshow which is nested in scrycore, scry reveals, puts on top or bottom, then reveal AGAIN, and does an effect, dontshow eliminates the 2nd revealing.
is also contains "delayed" keyword, which delays the ability until AFTER the core fires.

added bestow. update rules mtg.txt!!!!
examples are in primitives, every bestow card was supported.

added a new lord based on varibles and restrictions
while(restriction{morbid})
while(varible:blah)
this simplifies and expands on this(, allowing you to even use while(cantarget together and check if a card is targetable by the variable. examples are in primitives

added token(by card name)
auto=token(Eldrazi Scion) 
will search primitives and card dats for this card and give it to you as a token.
valid card dat info is still required.

added variable delirium
added restriction madnessplayed to allow checking if the card was played with madness.

added restriction "geared" for checking if a card has equipment on it.

added abilities words
skulk

menace <--cant be blocked except by 2 or more, if you dont block it with 2 or more we automatically unassign the single blocker and the creature is considered not blocked.

nosolo <--cant attack alone

mustblock <---if you dont assign as a blocker, we assign automatically the first thing it can block legally.

changed iscolorless back to "colorless"

enjoy, cards coming soon, theyre coded but im debating on not alpha sorting, cards being added this patch 965 uniques.

there is a section of the commit which was just VS2016 normalizing line ends, sorry if it makes it a cluster mess.
2016-06-28 18:40:55 -04:00
Anthony Calosa
b38275123a Block Cost Rule
Update rules folder
2016-06-15 22:26:55 +08:00
Anthony Calosa
1f54c7933b Attack Cost Rule
Update your rules folder
2016-06-14 19:40:02 +08:00
Anthony Calosa
cd1b629191 Fix Segmentation Fault & Formatting 2015-11-10 11:58:36 +08:00
Anthony Calosa
406f68ac5b Overload Cards
the alias is for the Overload Check and Alternate Cost Restriction...
???Bestow???
2015-11-09 19:04:31 +08:00
Anthony Calosa
e35c9f6087 AI plays zerocast cards, Update Rules folder!
Its basic pay zero for now...
Omniscience is possible :)
2015-11-07 09:59:30 +08:00
Anthony Calosa
4f54e30e0e Libraryeater and Canplayfromexile
extend canplayfromgraveyard with canplayfromexile
libraryeater for undead alchemist
2015-11-05 07:16:49 +08:00
Anthony Calosa
60ba4e3eeb altercost should affect retrace, flashback, buyback costs 2015-11-04 06:41:59 +08:00
Tobias Loose
69c6745f53 Make getMenuText() return string. 2013-11-29 13:33:33 +01:00
omegablast2002@yahoo.com
b61cd2f69a megapatch contents
added
"whenever a creature enters the battlefield you may pay {1}, if you do gain one life"
conditional may pay({cost}) effect 
this version is a super type ability, and can only be used in certain combos.

to nest you will need to use it in its subtype pay[[{cost}]] effect
pay keyword can have sideeffects coded as follows
pay[[{1}]] life:1?life:-1
pay one mana and gain 1 life, if you dont then you lose one life. notice no space between the abilities and the question mark.

added castcard()
a method to cast a targeted card, this contains the following subkeywords which can be used in combinations
(normal)
(restricted)
(copied)
(noevent)
castcard(restricted copied noevent) for example will cast a card that is a copy or the spell without sending a cast event only when the spell is castable.
"normal" subkeyword cast the actual spell, not a copy.

extended the use of exiledeath to everyzone, any card going from any zone to graveyard is placed in exile if it has exiledeath.

limited swipe left to open hand only when hand is closed view.

"moveto(" can now be named.
2013-06-18 01:41:34 +00:00
Xawotihs@gmail.com
26ab65860e Fixed a gazillion of warnings occuring when compiling Wagic with Clang with Werror. 2013-06-09 21:16:39 +00:00
omegablast2002@yahoo.com
3c15357c38 added poolsave(COLOR) its an ability that works only on permanents in play.
opponentpoolsave(
mypoolsave(
ex:Upwelling


added a tag for mana, doesntempty
add{g}{g}{g} doesntempty
what this does is make THAT mana remain in the pool until end of turn.
ex:
Sakura-Tribe Springcaller
2013-02-09 06:48:16 +00:00
omegablast2002@yahoo.com
30b379e1da fixed Issue 819, changed the parsing of and(()) to and!()!, i no longer share the storedstring of transformer, so you can ability$!transforms(( now.... 2012-03-26 13:51:44 +00:00
omegablast2002@yahoo.com
c5128b35e0 fix for sorins destroy andability, actually a fix for and(( in general..have to hide the and(( string from the parser till we need it. 2012-03-26 11:48:22 +00:00
omegablast2002@yahoo.com
a497ef49c8 added support for doubling cube, recoded the curses to follow the rules better, with the exception of 1 which can not quite be supported
Curse of Oblivion moved back to unsupported.
added support for targeting a zone by targeting a player...
any time you have targeted a player, you can access items in thier zones by using 
targetedpersonsZONE
targetedpersonsbattlefield for example...
added "targetedplayer" as a targetchooser and who.
added "mycurses" targetchooser.
added "targetedcurses" word variable.
2012-03-15 06:18:08 +00:00
omegablast2002@yahoo.com
39e8bd1f30 in this commit i added a creature subtype specific vector, added a couple variables for new abilities, and a sort for the creature variable to avoid the long lag out everytime we play a card or ability that needs this vector. 2012-03-13 16:32:26 +00:00
Xawotihs
3514476812 - Created a GamePhase type to ease debug.
- Modified the testsuite and gameobserver to be able to replay all the testcases based on the actions logged during the first pass. This allows to test the action logging and replay used during undo. It's only activated in multithreaded mode and it does not work on Momir tests.
-  Modified choice logging and replay to use menuId instead of ability index, as, for some obscur reasons related to Lord, those ability indexes may change.
- Fixed bug in nextphase logging wrongly generating click actions
- Added a "stack" zone to the click ability logging to be able to replay properly interrupt
- Fixed a wonderful bug mixing card names with zone names in the actions execution engine
- Added a "combatok" action logging/execution
- Added a "clone" virtual method to MTGCardInstance and Token to be able to clone correctly the right object type. Used that in MTGGameZones::removeCard
2011-11-29 21:50:16 +00:00
Xawotihs
c3dc51aed1 I just played 3 long games and I was able to undo two fully and got an assert on the third one after more than 1000 actions... so I commit what I have:
- Modified undo to stop at "next phase" action
- Added "muligan" and "force library shuffling" to the list of logged action
- Fixed random logging
- Fixed double logging of actions
- Merged all the "next game" functions into a single one
- Created a PlayerType type instead of using int
- Moved the player loading code into the GameObserver and out of GameStateDuel to avoid having player references in both and simplify the initialization and termination. Tweeked a bit the humanplayer class to be able to do that.
- Added a "load" menu available in testsuite mode, I use that to load problematique game. To use it, just copy-paste a game from the traces into Res/test/game/timetwister.txt. Game in traces starts by "rvalues:..." and ends by "[end]"
- Added some untested and commented out code in GuiCombat to use the mouse/touch to setup the damage on the blockers
- Broke the network game ... hoh well, I'll repair it when everything else works !!
- various code cleanup and compilation fixes on Linux
2011-10-26 22:14:12 +00:00
Xawotihs
9adb9d625d - reworked the testsuite and the rules (storyflow) to use the same game deserialization code, moved that code to the players and zone classes
- removed every references to the gameobserver singleton. This object can now be instantiated several times as it's needed for minmax. To be able to do that, I mostly added a reference to a gameobserver from any targetable object (cards, players, spells) and abilities.
2011-10-01 13:30:30 +00:00
wagic.the.homebrew
d6db0c4f63 Simplified some restriction-parsing related functions 2011-10-01 03:07:58 +00:00
omegablast2002@yahoo.com
3417799eda removed the phase restrictions enum from activatedability, it inherited this from MTGAbility, the only difference is actiavted ability had opponentturnonly listed as 69, so in some cases it would be 60 and sometimes 69, it will now always be 60 following the enum in mtgability. 2011-09-25 17:02:39 +00:00
wagic.the.homebrew
f649fee465 - Minor refactor of a few files: removed some unnecessary calls, etc... 2011-09-22 10:07:05 +00:00
omegablast2002@yahoo.com
d04b4eca38 ai bug fixes, minor refactor of phaseaction/phaseactionmulti/upcost/upcostmulti, counter cost was safed wrong, sorry!, and fixed parsing of upcost..it was chopping the last bracket of the cost when used for things like echo, it required us to add {0} to those cost...that is no longer required. 2011-09-14 20:35:04 +00:00
omegablast2002@yahoo.com
1fefc33777 removed a compile error, variables that were unreferenced.
small add with big impact:
added the useage of castrestriction on triggers and activated abilities. 
this can be used to create such cards as library of alexandria. 
{t}:draw:1 restriction{type(*|myhand)~equalto~7}
and replace instances were we were putting false triggers on the stack from abilities which contained nested aslongas...
meaning cards like epic struggle, won't need to be triggered every turn even if you have no creatures...
for epic struggle here is an example of how to replace it
@each myupkeep restriction{type(creature|mybattlefield)~morethan~19}:wingame controller
any of the current cast and other restrictions can be used. this includes turn:1 <===and various others such as phase based checking.
syntax is 
restriction{ whatever casting/other restriction you want }
a nice quality of life fix for false triggers (which don't mean theyre incorrect, just annoying when they trigger when they will do nothing)
another example would be the triggers on cards like 
skullcage.
auto=@each opponent upkeep:aslongas(*|opponenthand) damage:2 opponent >4
auto=@each opponent upkeep:aslongas(*|opponenthand) damage:2 opponent <3
becomes
auto=@each opponent upkeep restriction{type(*|opponenthand)~morethan~4}:damage:2 opponent
auto=@each opponent upkeep restriction{type(*|opponenthand)~lessthan~3}:damage:2 opponent

now instead of triggering every opponent upkeep even without a resolve...it will only triggers when the restriction requirement is met.

enjoy :)
note:all test pass.
2011-09-09 10:34:05 +00:00
omegablast2002@yahoo.com
6399917d25 changes:
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.
2011-09-01 20:03:26 +00:00
wagic.the.homebrew
9631171ad1 Cleanup of some Trigger code 2011-07-28 13:51:42 +00:00
wagic.the.homebrew
ef5e011e23 - Removed "isClone" flag. This flag was error prone. The "core" classes now have decent copy constructors, and ideally long term we should create copy constructors for the abilities that have additional pointers in them.
-- The test suite passes but this is a big change. I might have introduced some memory leaks or bugs. I might have fixed some bugs, too
2011-07-27 14:31:27 +00:00
omegablast2002@yahoo.com
bd1c31b6f9 moved the parsing of cast restriction into abilityfactory and out of mtgability...this is so new abilities can take adventage of these checks through the use of AbilityFactory af. 2011-07-23 09:03:33 +00:00
omegablast2002@yahoo.com
a59dec1500 added "once" support for the remaining triggers that did not have it.
this is basically one activation for the existence of the trigger, meaning if it is used on a card, and the trigger exist for inplay, it will only activate one time while that card is inplay, it will activate again if the card leaves play and is put back in play again by another effect, 
this was originally added for cards such as the hidden enchantment cycle.
2011-07-05 14:14:18 +00:00
wrenczes@gmail.com
bed971c84c Last of my warning cleanup - as of this revision, all warnings in the windows build are gone. I've turned on the 'treat warnings as errors' option in the mtg project to mirror our makefile behaviour on psp. 2011-06-03 01:07:48 +00:00
omegablast2002@yahoo.com
cb9e5f2e95 as requested by doc, added a tag for lords to allow an over-ride for effect so theyre not removed from the game by GameObserver until the lords remove it themselves.
ie:
Card Name:
Quick Sliver
Mana Cost:
Converted Mana Cost:2
Types:Creature — Sliver
Card Text:Flash
Any player may cast Sliver cards as though they had flash.

without an over-ride testdestroy removes the observer before it can be any use to us.

i only enabled this for the lords/this'es....
2011-06-02 23:46:44 +00:00
omegablast2002@yahoo.com
4793ba76bb taught ai how to use ability fizzlers such as Glen Elendra Archmage...reworked fizzle to cover both cases of ai trying to target a card on the stack. 2011-05-17 13:58:28 +00:00
wagic.the.homebrew
748af5b461 - Adding a generic "ueot" effect. This will be initially confusing, but the ultimate goal is to get rid of all the particular cases we handled with "until end of turn" effects. this "ueot " works like "may " and "choice ", it has to be at the very beginning of the ability(ies) it targets. The reason is to avoid conflicts with the existing "ueot" we have all over the place. I have only tested it with transforms and loseabilities for now (see "ovinize") but hopefully this will become the new norm. This should also reduce the code inside the parser, long term.
- Adding "Ovinize" as an example of this new keyword.
- moved "parseBetween" in utils as I am using it in other files for wome work in Progress.
2011-05-05 06:18:50 +00:00
wagic.the.homebrew
0b9ff076e6 Please update your rules folder
- "Manapool empties at the end of each step" becomes an ability, and was moved into the external rules file. "removemana(*) to remove all, removemana(*{G}) to remove all green, removemana(*{G}{B}{R}) to remove all green black red, removemana({G}{G}{B}{U}) (no "*") to remove a specific value.
- Added a possibility to make abilities non interruptible. With little work, this could be added to the parser if needed. Please use with care, let's discuss what is an acceptable usage of this now functionality, if needed.
2011-05-03 11:59:27 +00:00
wagic.the.homebrew
53f45a8b8e cleanup: Remove "computeXX" functions and XX variables, these were always returning X/2 in all cases.
Test suite passes
2011-05-02 11:28:04 +00:00
wagic.the.homebrew
e100bd826c Refactor of the parser. The goal is to reduce maintenance cost, by refactoring some of the most frequent "copy/paste" we have in there. This removes roughly 500 lines, going from 4850 to 4350 lines. I'm getting closer to my goal of getting this file back to 4000 lines :)
Crossing fingers I didn't break anything major. The test suite passes, though I expect some edge case bugs to appear. Apologies in advance, I think this change is worth it.
2011-05-01 15:53:13 +00:00
wagic.the.homebrew
8b6400e12d Cleanup of some trigger parsing 2011-04-30 15:52:48 +00:00
omegablast2002@yahoo.com
6e6ccddbde fixed a crash witnessed when ai was trying to get the efficiency return of aamover the ai had a target, but the ability did not have a target, when "destinationZone()" was run, the game would crash due to a null pointer.
increase the "random" chance to use unknown, the old method almost always returned 0.
2011-04-26 14:49:15 +00:00
omegablast2002@yahoo.com
ad56dfa8d0 3 things here
first as requested, kicker will now act like the other cost, offering a menu choice, heres the catch tho, 
it was also thought up that we should maintain the "pay automatically" method of it as it feels more natural to some(even tho as per MTG rules its supposed to be a choice).
so here is what i did that i hope satisfies everyone, i added a new menu option under advanced tab..."kicker payment" with 2 setting, by defualt "always pay" but also an option to "always offer choice"...

2nd, minor tweaks to player avatar, every tme i saw it i was like "i need to do something about that", the avatar getting completely sucked into the corner just looked bad imo, so i about doubled the "inactive" size, so it looks a little more uniform with the opponents avatar. also move the library and grave icons just a thin hair to the left so they don't grossly overlap the players avatar as much when active, and increased the dark box theyre contained in my just a few pixels.

3rd, something else thats really bothered me to no end was that the title text of simple menus which display the cards name which owns the box was using small face font, which on pc was *barely* ok...but on psp(smaller devices) looks like white smears and dots. i changed it to share the font and size used inside the menubox itself, the end result is a lot nicer look...and alot easier to read on psp. now if only we can convince wololo that "spades" is alot like a lava lamp, cool at first, but *extremely* dated. the menu box should have a much slicker look, maybe rounded corners instead and lose the street light poles?

minor fix for phaseaction, becuase of the nature of this ability finding a happy safe medium without losing function is tough. hopefully this corrects it for good.

dropped cast methods menutext returns to lower case, for uniformity.
2011-04-22 11:17:20 +00:00
wrenczes@gmail.com
7203ce9436 Style formatting - no code changes here. 2011-04-22 04:31:55 +00:00
omegablast2002@yahoo.com
20590c3a0d removed the variable doTap in Tap from all classes, all test pass but there could be an edge case where i missed removing one...if so just let me know, tweaked some ai eff returns, trying to teach it to use counters more effectively, i noticed it was not using -1/-1 counters on the players creature and was using off counters +1/-1 on its own creatures to the point where they died.
doTap now only serves a single purpose, to pass Tap variable to amanaproducer class so that "tappedformana" will trigger is a manaproducer was tapped for mana.
2011-04-19 17:31:19 +00:00
omegablast2002@yahoo.com
158164d694 2 things here, bug fixes, aphaseaction used in a trigger is set to oneshot = 0, for the purpose of reusing the ability. so on combat triggers the event would contenue to activate as tho it was not a oneshot, this would cause a crash if the target of the ability was killed before the effect resolved, so i set the target to NULL after the effect resolves if the target was not the source.
also restricted it to _target->isInPlay() i read through all the cards which use this and none of them targetted a source that was not in play, or not being moved to inplay...

2nd, found out today that certain activated abilities can use either target click or object click, find the difference between the 2 was impossible, exsample, {2}{t}:foreach(blah) add{b}
{t}:foreach(blah) add{b}
so i figured i would need to remove those foreach mana abilities from the stack and add that same code for the bottom half...after noticing that both the reactToClick and reactToTargetClick did EXACTLY the same things after the "cost" portion...i decided to create a new virtual int activateAbility the activatedAbility parent. this way incase i need to change any further code in there, both functions resolve the same. This was a nice lesson in why copy paste coding is stupid. you think you solved the bug becuase it works in one function call, but you actually didnt.
2011-04-17 17:01:58 +00:00