It is currently 18 Apr 2024, 08:48
   
Text Size

Puzzle Mode

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: Puzzle Mode

Postby Xitax » 31 Jul 2017, 03:05

Using the current nightly.
Perplexing Chimera (GatheringMagic.com) 063015 - Turning the Wurm: Coded. Pentarch Ward doesn't want to attach.
Last edited by Xitax on 02 Aug 2017, 02:01, edited 1 time in total.
Xitax
 
Posts: 918
Joined: 16 May 2010, 17:19
Has thanked: 183 times
Been thanked: 133 times

Re: Puzzle Mode

Postby Agetian » 31 Jul 2017, 03:45

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
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Agetian » 31 Jul 2017, 04:05

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
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Agetian » 31 Jul 2017, 05:22

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
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Agetian » 01 Aug 2017, 06:39

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
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Agetian » 01 Aug 2017, 10:30

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
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Xitax » 02 Aug 2017, 01:24

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
Last edited by Xitax on 07 Aug 2017, 01:46, edited 1 time in total.
Xitax
 
Posts: 918
Joined: 16 May 2010, 17:19
Has thanked: 183 times
Been thanked: 133 times

Re: Puzzle Mode

Postby Agetian » 02 Aug 2017, 04:31

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
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Xitax » 05 Aug 2017, 02:06

For testing
Perplexing Chimera (GatheringMagic.com) 042815 - Dracophobia
The goal is to destroy all the opponent's dragons.
Last edited by Xitax on 07 Aug 2017, 01:46, edited 1 time in total.
Xitax
 
Posts: 918
Joined: 16 May 2010, 17:19
Has thanked: 183 times
Been thanked: 133 times

Re: Puzzle Mode

Postby Agetian » 05 Aug 2017, 09:26

Ok, I'll think about what can be done to support this!

- Agetian
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Agetian » 05 Aug 2017, 10:15

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
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Xitax » 06 Aug 2017, 19:46

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.
Last edited by Xitax on 10 Aug 2017, 02:11, edited 1 time in total.
Xitax
 
Posts: 918
Joined: 16 May 2010, 17:19
Has thanked: 183 times
Been thanked: 133 times

Re: Puzzle Mode

Postby Agetian » 07 Aug 2017, 03:29

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
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Agetian » 07 Aug 2017, 03:30

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
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Xitax » 07 Aug 2017, 23:19

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.
Xitax
 
Posts: 918
Joined: 16 May 2010, 17:19
Has thanked: 183 times
Been thanked: 133 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 45 guests


Who is online

In total there are 45 users online :: 0 registered, 0 hidden and 45 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 45 guests

Login Form