Page 5 of 10

Re: Puzzle Mode

PostPosted: 31 Jul 2017, 03:05
by Xitax
Using the current nightly.
Perplexing Chimera (GatheringMagic.com) 063015 - Turning the Wurm: Coded. Pentarch Ward doesn't want to attach.

Re: Puzzle Mode

PostPosted: 31 Jul 2017, 03:45
by Agetian
Xitax wrote:Using the current nightly.
Perplexing Chimera (GatheringMagic.com) 063015 - Turning the Wurm: Coded. Pentarch Ward doesn't want to attach.
Added upstream :) The problem with Pentarch Ward was a simple syntax issue - you had "Attaching 422" instead of "Attaching:422" in the file, which is why it didn't see the ID to attach to.

- Agetian

Re: Puzzle Mode

PostPosted: 31 Jul 2017, 04:05
by Agetian
drdev wrote:Keep up the great work guys. Just tried this mode out for the first time. Really fun.
Thanks, Dan! Glad you're following the project! :)

- Agetian

Re: Puzzle Mode

PostPosted: 31 Jul 2017, 05:22
by Agetian
Hehe, I got Suspension Field working, although with a bit of a hack (that needs manual editing of the puzzle file; Save Game State can't preserve it that way, at least yet). Need some more time to test, but will keep you posted ;)

EDIT: Here, check out this commit to see how it works: http://svn.slightlymagic.net/websvn/fil ... &rev=34873
Basically, you can use "|ExecuteScript:svar->targetID" to execute the portion of the script stored in the "svar" on a card, possibly with the target set to targetID. If targeting is not necessary, "|ExecuteScript:svar" can be used instead. Note that I removed the blank effect from humancommandzone that was put there by the dump command but that did nothing.

- Agetian

Re: Puzzle Mode

PostPosted: 01 Aug 2017, 06:39
by Agetian
UPDATE: There is now a new goal type, "Survive", available for puzzles. If you set "Goal:Survive", you will automatically win on the turn which follows the one defined in the turn limit (so, with Goal:Survive and Turns:2, you'll win in the beginning (upkeep) of turn 3, which means that you have to survive for 2 turns).

Also, improved the robustness of attachments (again), multiple attachments on the same card should work correctly now. Remembered cards and the ExiledWith flag are now also correctly preserved with the dump command and restored with the setup game state command (and thus work in puzzles too).

- Agetian

Re: Puzzle Mode

PostPosted: 01 Aug 2017, 10:30
by Agetian
UPDATE: It is now possible to script puzzles that start in the Declare Attackers or Declare Blockers step with the creatures attacking. Attacking creatures should be marked as "|Attacking". If a creature is attacking a planeswalker, you can specify "|Attacking:id", where "id" is the ID of the planeswalker card under attack. Dump game state should be able to preserve this information as well.

- Agetian

Re: Puzzle Mode

PostPosted: 02 Aug 2017, 01:24
by Xitax
Thanks! I'll upload some more tonight.

How much trouble would it be to add a game goal to destroy creature(s)?

Update:
Using 8/1 build, working with Perplexing Chimera (GatheringMagic.com) 041415 - Plans Within Plans, the following puzzle file does not return the exiled Mistfire Adept after bouncing my Suspension Field.

Perplexing Chimera (GatheringMagic.com) 063015 - Turning the Wurm: Updated - I had to add 40 dummy cards to human library to make the puzzle work.

Perplexing Chimera (GatheringMagic.com) 070715 - Saving Grace: Works - sort of. AI doesn't give the Precursor Golem reach in response to killing Aquastrand Spider therefore invalidating the necessity of a previous step.

Perplexing Chimera (GatheringMagic.com) 071415 - No Matter What: Works

Re: Puzzle Mode

PostPosted: 02 Aug 2017, 04:31
by Agetian
Thanks, Xitax! I'll update the puzzles upstream.
As for Plans within Plans, yeah, that's not going to work (Suspension Field is too tricky for Dump Game State to correctly preserve it automatically). There is already a correct version of the puzzle upstream, which features a manual parameter to execute the portion of the Suspension Field script in order to properly set it up. Check this out for details: http://svn.slightlymagic.net/websvn/fil ... &rev=34873

And I'll look into implementing the destroy creature(s) condition; sounds a bit tricky since I'll have to rely on the game script (for the most part) in order to set this up, but I think I may have a couple ideas. Do you have an example code for a puzzle that would require this? (You can, for the time being, set up the Goal as "Goal:Destroy id,id,id...", with the ids of cards that you need destroyed. I'll use that as a reference for testing. No promises on getting it accomplished quickly, but I'll try :)

- Agetian

Re: Puzzle Mode

PostPosted: 05 Aug 2017, 02:06
by Xitax
For testing
Perplexing Chimera (GatheringMagic.com) 042815 - Dracophobia
The goal is to destroy all the opponent's dragons.

Re: Puzzle Mode

PostPosted: 05 Aug 2017, 09:26
by Agetian
Ok, I'll think about what can be done to support this!

- Agetian

Re: Puzzle Mode

PostPosted: 05 Aug 2017, 10:15
by Agetian
UPDATE: Added support for a new goal type in Puzzle Mode that requires the player to destroy specific permanents on the battlefield defined by a target line. Added PC_042815 as an example of this type of goal.

The goal is defined by two lines in the puzzle file:

The statement of the goal itself should be one of the following lines, which are synonymous and interchangeable (you can pick the one that most closely corresponds to what you want the player to do):
Code: Select all
Goal:Destroy Specified Permanents
Goal:Destroy Specified Creatures
Goal:Kill Specified Creatures
Goal:Remove Specified Permanents from the Battlefield
The target line should start with the tag "Targets:" followed by the declaration of the permanents that should be destroyed/removed/etc., in terms of the valid card specification used by the Forge scripting language. For example:

Code: Select all
Targets:Creature.OppCtrl               # all creatures that the opponent controls
Targets:Creature.Dragon+OppCtrl        # all Dragon creatures that the opponent controls
Targets:Artifact.cmcGE6+OppCtrl        # all opponent's artifacts with CMC 6 or greater
etc.
The player wins as soon as the last target card leaves the battlefield. The normal puzzle loss condition in the form of turns limit (specified by Turns:X) applies.

This goal currently has two limitations:
1) It doesn't matter how exactly the cards leave the battlefield (they can be bounced, exiled, or destroyed). All that matters is that they are no longer on the battlefield.
2) There is no way to selectively specify cards by ID, which is tricky to implement. Thus, targets must be specifiable in some kind of a generic form.

Example code for PC_042815 follows (added upstream):

Code: Select all
[metadata]
Name:Perplexing Chimera (GatheringMagic.com) 042815 - Dracophobia
URL:http://www.gatheringmagic.com/seanuy-042815-perplexing-chimera-5-dracophobia/
Goal:Destroy Specified Creatures
Targets:Creature.Dragon+OppCtrl
Turns:1
Difficulty:Hard
Description:Destroy all opponent's Dragons. Windstorm is on top of your library.
[state]
ActivePlayer=human
ActivePhase=Main1
HumanLife=5
AILife=17
humanhand=Sidisi's Faithful|Set:DTK; Sudden Reclamation|Set:FRF; Trap Essence|Set:KTK; Mystic of the Hidden Way|Set:KTK
humangraveyard=Servant of the Scale|Set:DTK; Naturalize|Set:DTK; Savage Punch|Set:KTK; Sultai Skullkeeper|Set:FRF; Bathe in Dragonfire|Set:FRF; Write into Being|Set:FRF
humanlibrary=Windstorm|Set:KTK
humanbattlefield=Island|Set:DTK; Island|Set:DTK; Island|Set:DTK; Mountain|Set:DTK; Mountain|Set:DTK; Forest|Set:DTK; Forest|Set:DTK; Rugged Highlands|Set:FRF; Whisperer of the Wilds|Set:FRF; Heir of the Wilds|Set:KTK; Roar of Challenge|Set:KTK|FaceDown; Den Protector|Set:DTK|FaceDown; Herdchaser Dragon|Set:DTK; Briber's Purse|Set:KTK
aibattlefield=t:Dragon,P:4,T:4,Cost:no cost,Types:Creature-Dragon,Keywords:Flying,Image:r_4_4_dragon_dtk|Id:420; t:Dragon,P:4,T:4,Cost:no cost,Types:Creature-Dragon,Keywords:Flying,Image:r_4_4_dragon_dtk|Id:421; t:Dragon,P:4,T:4,Cost:no cost,Types:Creature-Dragon,Keywords:Flying,Image:r_4_4_dragon_dtk|Id:422; t:Dragon,P:4,T:4,Cost:no cost,Types:Creature-Dragon,Keywords:Flying,Image:r_4_4_dragon_dtk|Id:423; Sultai Runemark|Attaching:424|Set:FRF; Herdchaser Dragon|Set:DTK|Counters:P1P1=1|Id:424; Plains|Set:DTK|Tapped; Island|Set:DTK|Tapped; Swamp|Set:DTK|Tapped; Mountain|Set:DTK|Tapped; Mountain|Set:DTK|Tapped; Forest|Set:DTK|Tapped; Forest|Set:DTK|Tapped; Scoured Barrens|Set:KTK|Tapped; Swiftwater Cliffs|Set:FRF|Tapped; Thornwood Falls|Set:FRF|Tapped
aihand=
aigraveyard=
ailibrary=
aiexile=
- Agetian

Re: Puzzle Mode

PostPosted: 06 Aug 2017, 19:46
by Xitax
Perplexing Chimera (GatheringMagic.com) 072115 - Stand Against the Waves: Even with the attacking code, doesn't quite work. If there were a way to specify P/T until end of turn, maybe.
Perplexing Chimera (GatheringMagic.com) 072815 - Come Undone: Works.
Perplexing Chimera (GatheringMagic.com) 080415 - Variations on a Theme: The official challenge was to draw one of three cards and win with each one. I added an Island and a Ponder so that the player could choose to draw one of the three cards.
Perplexing Chimera (GatheringMagic.com) 081115 - Elementally My Dear: Works.

Re: Puzzle Mode

PostPosted: 07 Aug 2017, 03:29
by Agetian
Thanks! :)
I think for 072115, maybe I'll implement a way to force-cast a spell at the beginning of the puzzle (with split second or something like that), so that +3/+3 and must be blocked effect can be simulated. I'll think about how to do that. ;)

- Agetian

Re: Puzzle Mode

PostPosted: 07 Aug 2017, 03:30
by Agetian
Oh, btw, looks like you forgot to attach 072815, and you attached 080415 twice for some reason (but the files are different, so I'm confused which one is the final version) :/ I think the one with the Island on top of the AI's library, right?

UPDATE: It is now possible to precast simple spells in the beginning of the puzzle (untargeted ones, e.g. Joraga Invocation, or with one directly and immediately specified target, e.g. Lightning Bolt or Giant Growth). The definition is as follows (it must be specified after the zone definitions such as AIBattlefield, HumanGraveyard, etc.):

HumanPrecast=cardname[->target];cardname[->target]...
AIPrecast=cardname[->target];cardname[->target]...

For example:

Code: Select all
# AI will precast Joraga Invocation
AIPrecast=Joraga Invocation            # AI will cast Joraga Invocation

# AI will precast Lightning Bolt targeting card ID 420
AIPrecast=Lightning Bolt->420          # AI will cast Lightning Bolt targeting card ID 420

# Human will precast Giant Growth on card ID 100 and Joraga Invocation
HumanPrecast=Giant Growth->100;Joraga Invocation

# AI will precast Lightning Bolt targeting Human, Human will precast Lightning Bolt targeting AI
AIPrecast=Lightning Bolt->Human
HumanPrecast=Lightning Bolt->AI
Note that precast spells will be shown in the game log and the will cause triggers to happen, if any apply.

Complex spells (with multiple targets, setting up effects, targeting from a subability, etc.) are not supported yet.

- Agetian

Re: Puzzle Mode

PostPosted: 07 Aug 2017, 23:19
by Xitax
Agetian wrote:Thanks! :)
I think for 072115, maybe I'll implement a way to force-cast a spell at the beginning of the puzzle (with split second or something like that), so that +3/+3 and must be blocked effect can be simulated. I'll think about how to do that. ;)

- Agetian
There's a second problem. If a creature gets a buff from another source, such as by attacking, you still can't specify it. I thought that perhaps being able to literally specify the temporary buff would fix both the previously cast spell buff issue and any others.