Page 4 of 7

Re: Implementing NEW stuff to Magarena

PostPosted: 12 Feb 2014, 06:20
by melvin
I don't see any obvious issues with the code. What do you mean by "scores are going all over the place"?

Re: Implementing NEW stuff to Magarena

PostPosted: 12 Feb 2014, 11:59
by ShawnieBoy
I'm basically trying to get the AI to use Vampire Hexmage properly (I think it's the only card that uses the MagicCountersTargetPicker at the moment, I'm wanting to add more cards that use it, but if it's not working properly...)

Here's a snippet of the log from the casting of the Vampire to acutally using it:

Code: Select all
LOG (C): Put Vampire Hexmage onto the battlefield.
MMAB cheat=false index=1 life=20 turn=22 phase=DeclareAttackers slice=8000 time=337
  [25/28/-480 at 8] ([Ivy Elemental])
* [25/32/395 at 8] ([])
MMAB cheat=false index=1 life=20 turn=22 phase=SecondMain slice=8000 time=343
* [25/28/-644 at 9] (pass)
  [25/11/-1209 at 12] (Vampire Hexmage)
  [25/8/-1209 at 12] (Vampire Hexmage)
MMAB cheat=false index=1 life=20 turn=23 phase=Upkeep slice=8000 time=359
  [25/22/-1464 at 9] (pass)
* [25/16/-1160 at 11] (Vampire Hexmage)
  [25/10/-1160 at 11] (Vampire Hexmage)
MMAB cheat=false index=1 life=20 turn=23 phase=Upkeep slice=2000 time=535
  [25/15/-910 at 7] (Chimeric Egg)
* [25/10/204 at 9] (Ivy Elemental)
  [25/17/-910 at 7] (Serrated Arrows)
  [25/25/-604 at 7] (Shifting Wall)
  [25/24/-604 at 7] (Shifting Wall)
  [25/17/-1464 at 8] (Swamp)
  [25/2/-1464 at 8] (Vampire Hexmage)
  [25/0/-1464 at 8] (Vivid Grove)
  [25/0/-1464 at 8] (Vivid Grove)
  [25/0/-1464 at 8] (Vivid Grove)
  [25/0/-1464 at 8] (Vivid Marsh)
  [25/0/-1464 at 8] (Vivid Marsh)
  [25/0/-1464 at 8] (Vivid Marsh)
  [25/0/-1464 at 8] (Forest)
  [25/0/-1464 at 8] (Forest)
  [25/2/-1304 at 8] (Ivy Elemental)
  [25/0/-1464 at 8] (Swamp)
  [25/0/-1464 at 8] (Swamp)
  [25/0/-1464 at 8] (Swamp)
  [25/0/-1464 at 8] (Vampire Hexmage)
  [25/0/-1464 at 8] (Vivid Grove)
  [25/0/-1464 at 8] (Vivid Grove)
  [25/0/-1464 at 8] (Vivid Marsh)
LOG (C): Sacrifice Vampire Hexmage. Play activated ability of Vampire Hexmage.
LOG (P): Ivy Elemental is put into its owner's graveyard.
LOG (C): Remove all counters from target permanent (Ivy Elemental).
MMAB cheat=false index=1 life=20 turn=23 phase=Upkeep slice=8000 time=650
* [25/30/-111 at 12] (pass)
  [25/22/-1869 at 11] (Vampire Hexmage)
LOG (P): Sacrifice Serrated Arrows.
LOG (P): Play Dark Depths. Dark Depths enters the battlefield with 10 ice counters on it.
LOG (P): Sacrifice Vampire Hexmage. Play activated ability of Vampire Hexmage.
MMAB cheat=false index=1 life=20 turn=23 phase=FirstMain slice=8000 time=987
* [25/55/-13992 at 7] (pass)
  [25/41/-99900000 at 4] (Vampire Hexmage)
LOG (P): Remove all counters from target permanent (Dark Depths).
LOG (P): Tap Swamp. Tap Vivid Grove. Tap Vivid Grove. Pay {3}. Play activated ability of Dark Depths.
MMAB cheat=false index=1 life=20 turn=23 phase=FirstMain slice=8000 time=1984
* [25/56/-99900000 at 9] (pass)
  [25/58/-99900000 at 3] (Vampire Hexmage)
LOG (P): Remove an ice counter from Dark Depths. If Dark Depths has no ice counters on it, sacrifice it and put a legendary 20/20 black Avatar creature token with flying and indestructible named Marit Lage onto the battlefield.
MMAB cheat=false index=1 life=20 turn=23 phase=FirstMain slice=8000 time=1466
* [25/69/-99900000 at 8] (pass)
  [25/29/-99900000 at 2] (Vampire Hexmage)
MMAB cheat=false index=1 life=20 turn=23 phase=SecondMain slice=8000 time=2067
* [25/79/-99900000 at 7] (pass)
  [25/29/-99900000 at 2] (Vampire Hexmage)
MMAB cheat=false index=1 life=20 turn=24 phase=FirstMain slice=8000 time=2514
  [25/123/-99900000 at 7] (pass)
  [25/89/-99900000 at 5] (Vampire Hexmage)
* [25/112/-99900000 at 8] (Thallid Shell-Dweller)
MMAB cheat=false index=1 life=20 turn=24 phase=FirstMain slice=8000 time=3495
* [25/147/-99900000 at 8] ()
  [25/114/-99900000 at 8] ()
  [25/96/-99900000 at 8] ()
  [25/97/-99900000 at 8] ()
  [25/106/-99900000 at 8] ()
LOG (C): Pay {1}{G}. Tap Vivid Grove. Tap Vivid Grove. Play Thallid Shell-Dweller.
LOG (P): Player puts a charge counter on Chimeric Egg.
LOG (C): Put Thallid Shell-Dweller onto the battlefield.
MMAB cheat=false index=1 life=20 turn=24 phase=DeclareAttackers slice=8000 time=1439
  [25/36/-99900000 at 4] ([Ivy Elemental, Vampire Hexmage])
* [25/43/-99900000 at 7] ([Ivy Elemental])
  [25/75/-99900000 at 4] ([Vampire Hexmage])
  [25/35/-99900000 at 6] ([])
LOG (C): Computer attacks with Ivy Elemental.
LOG (P): Player blocks with Shifting Wall.
MMAB cheat=false index=1 life=20 turn=24 phase=DeclareBlockers slice=8000 time=2665
* [25/42/-99900000 at 5] (pass)
  [25/122/-99900000 at 2] (Vampire Hexmage)
LOG (C): Ivy Elemental is destroyed.
MMAB cheat=false index=1 life=20 turn=24 phase=SecondMain slice=8000 time=1019
* [25/53/-99900000 at 4] (pass)
  [25/45/-99900000 at 2] (Vampire Hexmage)
LOG (P): Tap Vivid Grove. Tap Swamp. Tap Vivid Grove. Tap Vivid Grove. Tap Vivid Marsh. Tap Vivid Marsh. Tap Vivid Marsh. Pay {X}{G} (X is 6). Play Ivy Elemental.
MMAB cheat=false index=1 life=20 turn=25 phase=FirstMain slice=8000 time=2455
* [25/69/-99900000 at 4] (pass)
  [25/166/-99900000 at 2] (Vampire Hexmage)
LOG (P): Put Ivy Elemental onto the battlefield.
MMAB cheat=false index=1 life=20 turn=25 phase=FirstMain slice=8000 time=1051
* [25/94/-99900000 at 2] (pass)
  [25/60/-99900000 at 2] (Vampire Hexmage)
MMAB cheat=false index=1 life=20 turn=25 phase=SecondMain slice=8000 time=1503
* [25/113/-99900000 at 8] (pass)
  [25/64/-99900000 at 2] (Vampire Hexmage)
LOG (C): Put a spore counter on Thallid Shell-Dweller.
MMAB cheat=false index=1 life=20 turn=26 phase=FirstMain slice=8000 time=1918
* [25/144/-99900000 at 8] (pass)
  [25/33/-99900000 at 3] (Vampire Hexmage)
  [25/91/-99900000 at 8] (Swamp)
As you can see, once she's been activated, scores become -99900000 for all targets for the next Vampire Hexmage.

Re: Implementing NEW stuff to Magarena

PostPosted: 12 Feb 2014, 13:00
by melvin
Score of -99900000 just means AI think it will lose (in the future) with this move. Is this test stacked against the AI? Or it is it possible for the AI to win with judicious use of Vampire Hexmage?

Re: Implementing NEW stuff to Magarena

PostPosted: 12 Feb 2014, 21:59
by ShawnieBoy
Ahh, that makes more sense - Thanks. I've still yet to get my head around the Test scenarios, this was a mirror-match with me playing prime targets for Vampire Hexmage :) Not as broken as I first thought then, and to be fair the AI has come up with some interesting plays.

Could really do with a MagicWhenCountersChangeTrigger though...

Re: Implementing NEW stuff to Magarena

PostPosted: 24 Feb 2014, 18:25
by ShawnieBoy
Just an idea:

Would it be worth combining:

combat damage discard <n>
combat damage draw card
combat damage <creature/player> grow
combat damage may draw card <n>
damage discard card
damage <creature/player> grow
damage opponent discard random card
damage opponent draw card

into
combat damage <creature/player> <effect>
damage <creature/player/opponent> <effect> ?

Re: Implementing NEW stuff to Magarena

PostPosted: 25 Feb 2014, 01:27
by melvin
Yes! A more regular syntax for abilities would make it easier to explain and use.

Re: Implementing NEW stuff to Magarena

PostPosted: 26 Feb 2014, 16:25
by ShawnieBoy
What about a wordier, but more card-correct:

Whenever SN deals (<combat>) damage (<to a player/to an opponent>), <effect>

I've done some changes locally, but having 'cheated' the rules into that format.

Re: Implementing NEW stuff to Magarena

PostPosted: 27 Feb 2014, 02:00
by melvin
ShawnieBoy wrote:What about a wordier, but more card-correct
Looks good :D

On a related note, I was looking into supporting alternate casting cost as an ability with the following syntax:
alt cost <cost>, <cost>, ... named <name>
where name is show in the UI button when player cast the card. The default casting is named "Cast"

Then I realized the current prefix of "pay" for activated abilities can lead to oddities such as "pay Pay 2 life: <effect>" so perhaps we should change it from "pay" to "cost" which would give us "cost Pay 2 life: <effect>"

Thoughts/comments?

Re: Implementing NEW stuff to Magarena

PostPosted: 27 Feb 2014, 03:23
by ShawnieBoy
Cost is definitely better. :D

602.1. Activated abilities have a cost and an effect. They are written as "[Cost]: [Effect.] [Activation instructions (if any).]"

Re: Implementing NEW stuff to Magarena

PostPosted: 27 Feb 2014, 12:54
by melvin
Done! Converted all activated abilities to use "cost <comma separated costs>: <effect>". This part was tricky as the word pay is also used in other abilities.

Syntax for alternate cost is also implemented.

Re: Implementing NEW stuff to Magarena

PostPosted: 02 Mar 2014, 02:16
by melvin
ShawnieBoy wrote:What about a wordier, but more card-correct:

Whenever SN deals (<combat>) damage (<to a player/to an opponent>), <effect>

I've done some changes locally, but having 'cheated' the rules into that format.
I tried to implement the discard as an 'effect' but I'm unable to express "that player", i.e. the player that received the damage. How do you solve this?

Re: Implementing NEW stuff to Magarena

PostPosted: 02 Mar 2014, 07:51
by ShawnieBoy
That's where I was getting stuck - hence why I wasn't pushing anything. I was also distracted with the idea of having a generic 'Whenever' uber-ability: Whenever <action/event> <effect> which is even more difficult.

Re: Implementing NEW stuff to Magarena

PostPosted: 02 Mar 2014, 08:41
by melvin
I see, but the idea of a general damage trigger with effect is good. Manage to clean up the others like draw card, put token etc.

Re: Implementing NEW stuff to Magarena

PostPosted: 04 Mar 2014, 04:06
by ShawnieBoy
While trying to make Artificer's Hex work, I think we should rename the .getEnchantedCreature() to .getEnchantedPermanent() - An enchantment that is focused on the creature an enchanted equipment is attached to is making my head spin without strangeness such as: event.getPermanent().getEnchantedCreature().getEquippedCreature()
:lol:

Re: Implementing NEW stuff to Magarena

PostPosted: 04 Mar 2014, 05:23
by melvin
Agree, we have grown beyond creature enchantments. Will rename to getEnchantedPermanent. On a separate note, I was thinking we should consolidate enchanted, equipped, paired to just one attachedPermanent.