Page 1 of 1

Creating abit more advanved cards - ISSUE

PostPosted: 12 Oct 2010, 14:10
by zaxxz
Hi I recently stumbled upon your GENIOUS - MagicWars. And as an old MTG card player I must say I'm willing to become rather addicted again. Thanks for a great program so far mate(s)! :) Good job!

However, I have a problem adding some cards that I would like added. As I played 'Buried Alive' style with MTG I would like to do that in MagicWars as well, but I can't seem to get it loaded into the card database so far I kinda copied the Demonic Tutor as it with a few changes would be able do to what I want, oh well hope you can help me get this card added:


name = "Buried Alive"
manacost = "2 B"
types = [ "Sorcery" ]
text = ["Search your library for up to three creature cards and put them into your graveyard. Then shuffle your library."]

prints = [
["10E", "C", 135199, 182],
["MRD", "C", 45988, 79],
["6ED", "C", 16624, 160]
]

script = '''\

addSpell(
effect:{
def search = Search(
source:$this,
effect:{
moveToZone(from:GameZone.Library, to:GameZone.Graveyard, card:$chosen)
shuffleLibrary($this.controller)
},
choose: {$card.type('Creature')
)
run(search)

},
)

I did read the post where a similar problem was named, but I tried to both Alt+U and also the "New Constructed (All cards)" option, but it won't appear.

Hope you can help me out.

//Zaxxz

Re: Creating abit more advanved cards - ISSUE

PostPosted: 13 Oct 2010, 14:54
by nantuko84
Hi,
I'm glad that you liked MagicWars. Nice to hear such complements, especially as the project is not so popular as others.

Anyway, I've looked into your script and it has at least two mistypes: comma after curly braces and missing ''' at the end. This explains why you couldn't find it in deckeditor, it just wasn't compiled.


But there are another two problems with that card:
bug in api.mw (I checked and Demonic Tutor actually doesn't work either) and no possibility to choose "up to N" cards (easy to fix).

So if you want to try it, just replace the Object Search(Map params) method in /cards/groovy/api.mw by this:
Code: Select all
Object Search(Map params) {
   def source = params.source?:$this
   if(params.effect != null) {
      def playerId = params.player?: source.controller
      getPlayer(playerId).getGameStatistics().searchedLibraryForCardThisTurn = true
      def action = Action(params)
      params.zone = params.zone?:GameZone.Library
      if(params.choose != null && params.zone != null) {
         action.setNeedsToChooseCard(playerId, params.zone, params.choose)
      }
      if(params.countUpTo != null) {
         action.setTargetCount(params.countUpTo)
         action.setExactCount(false)
      }
      return action
   } else {
      builder.logError($this, "Error: not enough parameters Search(effect[,...])")
   }
}
After that Buried Alive will work in 1.3.4.1, here is your script, updated a little:
Code: Select all
name = "Buried Alive"
manacost = "2 B"
types = [ "Sorcery" ]
text = ["Search your library for up to three creature cards and put them into your graveyard. Then shuffle your library."]

prints = [
   ["10E", "C", 135199, 182],
   ["MRD", "C", 45988, 79],
   ["6ED", "C", 16624, 160]
]

script = '''\

addSpell(
   effect:{
      def search = Search(
         source:$this,
         effect:{
            moveToZone(from:GameZone.Library, to:GameZone.Graveyard, card:$chosen)
            shuffleLibrary($this.controller)
         },
         choose: {$card.type('Creature')},
         countUpTo: 3
      )
      run(search)
   }
)

'''
Checked twice, it works. If you want to choose only one or two cards, just press Cancel.

Hope you know how to test cards quickly, you may put any card directly to your hand (no need to create deck and wait until you draw a card) and put any cards onto battlefield, graveyard or top of your library.

~regards

Re: Creating abit more advanved cards - ISSUE

PostPosted: 13 Oct 2010, 20:27
by Huggybaby
nantuko84 wrote:Hi,
I'm glad that you liked MagicWars. Nice to hear such complements, especially as the project is not so popular as others.
Don't worry nantuko, popularity is partially a function of time and persistence. And screenshots help!

Image

Re: Creating abit more advanved cards - ISSUE

PostPosted: 14 Oct 2010, 12:27
by ProphetSword
nantuko84 wrote:Hi,
I'm glad that you liked MagicWars. Nice to hear such complements, especially as the project is not so popular as others.
Personally, I love Magic Wars. I consider it the program to watch, as I think it has a better Graphical Interface than most of the other programs.

The problem I have right now is that the version I have only lets the AI play one deck. And it gets boring battling the same deck over and over again.

I noticed in these screenshots, people are using different versions than I have. Are there releases going on that I'm not hearing about?

Re: Creating abit more advanved cards - ISSUE

PostPosted: 27 Oct 2010, 19:35
by zaxxz
Sorry for the late reply - been busy like hell. I dont know what I'm doing wrong, but I still cant get the card to even show up in my deck builder. I tried 're-unpacking' the game and doing it all over, but cant even get the card visible to me. :/

Re: Creating abit more advanved cards - ISSUE

PostPosted: 28 Oct 2010, 05:56
by nantuko84
ProphetSword> the screen is from not published version from svn

zaxxz> Have you tried my scripts and did you made a fix to api.mw I wrote about above?

Re: Creating abit more advanved cards - ISSUE

PostPosted: 28 Oct 2010, 11:19
by zaxxz
Yes I did, copying the correction you wrote to the card and making the changes in the api.mw

Can't see what I'm doing wrong. Hmm.

Re: Creating abit more advanved cards - ISSUE

PostPosted: 01 Nov 2010, 03:27
by nantuko84
if you want, I can't pack my working version and upload it to some public server

from other side, magicwars is not developed anymore (viewtopic.php?f=45&t=3483). just wait few weeks when mage will be released with lots of new cards, new gui and competitive ai.

Re: Creating abit more advanved cards - ISSUE

PostPosted: 01 Nov 2010, 18:54
by zaxxz
Yes I saw that mate, looking forward to what you guys get mixed together! :) And no worries I will just wait a few weeks for the next version of mage. But if you would be a cool guy and add Buried Alive I would send you sweet thoughts! :D

Re: Creating abit more advanved cards - ISSUE

PostPosted: 02 Nov 2010, 07:10
by nantuko84
:) seems I found the problem, just wonder the Buried Alive script worked previously (though it was on another environment). as I said, you always need to look into console messages as they may help to find out what was wrong. I've downloaded 1.3.4.1 again and added the script and api.mw fix, and here what I've got:

Code: Select all
FATAL [2010-11-02 09:48 [06:982]] ReadGroovyCards$1[RMI TCP Connection(2)-169.25
4.181.126]: Couldn't load a card: mw.server.card.Terror. Exception: java.lang.Ex
ception: This multiverse id (135199) is already used for Buried Alive. Multivers
e id numbers should be unique.
So Terror and Buried Alive have the same multiverse id. Then I went to gatherer and found out this: http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=29846

and now everything is easier, Buried Alive.card should have had:

Code: Select all
prints = [
   ["ODY", "C", 29846, 118]
]
also there should be $chosenCards, not $chosen in moveToZone(...,cards:)

But anyway, not to spend time, I've uploaded 1.3.4.2 with this additional card:
http://www.2shared.com/file/-aapbQdG/Magic_Wars_v1342.html

p.s. you also can check watchdog.log that collects all errors and fatal errors while application is running.

Re: Creating abit more advanved cards - ISSUE

PostPosted: 03 Nov 2010, 17:05
by zaxxz
Wow, thats some service, ty mate! :)