TgtP
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
24 posts
• Page 2 of 2 • 1, 2
Re: TgtP
by slapshot5 » 17 Nov 2010, 23:40
And eventually, if Valid get smart enough to parse the hasProperty stuff, we can use:
without having backwards compat issues.
-slapshot5
- Code: Select all
Tgt$Creature.Blue+YouCtrl
without having backwards compat issues.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: TgtP
by zerker2000 » 18 Nov 2010, 03:17
I would like to note that, when Valid gets that smart, it should also be able to parse " target blue creature you control", and restrict such unwieldy constructions to in-program use.slapshot5 wrote:And eventually, if Valid get smart enough to parse the hasProperty stuff, we can use:and the prompt would just magically be: "Select target blue creature you control"
- Code: Select all
Tgt$Creature.Blue+YouCtrl
without having backwards compat issues.
-slapshot5
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: TgtP
by slapshot5 » 18 Nov 2010, 04:32
You don't need TgtPrompt.friarsol wrote:So what's the difference between that and just using ValidTgts?So, Tgt$Artifact,Creature,Land instead of Tgt$A,C,L
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: TgtP
by friarsol » 18 Nov 2010, 04:42
Why not just add something like this in AbilityFactory?
- Code: Select all
if (hasValid){
String prompt = mapParams.containsKey("TgtPrompt") ? mapParams.get("TgtPrompt") : "Select target " + mapParams.get("ValidTgts");
abTgt = new Target(prompt, mapParams.get("ValidTgts").split(","), min, max);
}
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: TgtP
by slapshot5 » 18 Nov 2010, 16:27
Is there any reason then that we need ValidTgts$ instead of just Tgt$ ?
That should simplify the syntax if everything uses something like this:
Tgt$Creature
Tgt$Enchantment.Blue+YouDontCtrl|TgtPrompt$Select target blue enchantment opponent controls.
Tgt$Artifact,Land
Tgt$Permanent.White
and TgtPrompt is just optional. We can put some kind of println or Log message (or runtime exception?) when it parses a Tgt$ that it can't generate a promper prompt for?
-slapshot5
That should simplify the syntax if everything uses something like this:
Tgt$Creature
Tgt$Enchantment.Blue+YouDontCtrl|TgtPrompt$Select target blue enchantment opponent controls.
Tgt$Artifact,Land
Tgt$Permanent.White
and TgtPrompt is just optional. We can put some kind of println or Log message (or runtime exception?) when it parses a Tgt$ that it can't generate a promper prompt for?
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: TgtP
by friarsol » 18 Nov 2010, 17:08
I think you have this whole thing a little backwards. ValidTgts came to be because Tgt$ was being used for backwards compatibility. Tgt$ is the "non-default" parameter here. This is why in the beginning (of this thread) I was trying to press TgtP not being used at all.Is there any reason then that we need ValidTgts$ instead of just Tgt$ ?
However, if you want to overwrite how Tgt$ works with what ValidTgts is already doing and eliminate ValidTgts$ this is what it requires:
1. Convert about 95 of the Tgt$ to their appropriate strings. For Damage spells that have P that means Player,Planeswalker+YouDontCtrl, a TgtPrompt needs to be added for any of those cases.
2. Next, you need to do a straight find/replace for ValidTgts$ to Tgt$ in the data files.
3. This section of code needs to be changed in AbilityFactory:
- Code: Select all
if (mapParams.containsKey("ValidTgts"))
{
hasValid = true;
isTargeted = true;
}
if (mapParams.containsKey("Tgt"))
{
isTargeted = true;
}
if (isTargeted)
{
int min = mapParams.containsKey("TargetMin") ? Integer.parseInt(mapParams.get("TargetMin")) : 1;
int max = mapParams.containsKey("TargetMax") ? Integer.parseInt(mapParams.get("TargetMax")) : 1;
if (hasValid){
abTgt = new Target(mapParams.get("TgtPrompt"), mapParams.get("ValidTgts").split(","), min, max);
}
else
abTgt = new Target(mapParams.get("Tgt"), min, max);
if (mapParams.containsKey("TgtZone")) // if Targeting something not in play, this Key should be set
abTgt.setZone(mapParams.get("TgtZone"));
}
- Code: Select all
if (mapParams.containsKey("Tgt"))
{
isTargeted = true;
int min = mapParams.containsKey("TargetMin") ? Integer.parseInt(mapParams.get("TargetMin")) : 1;
int max = mapParams.containsKey("TargetMax") ? Integer.parseInt(mapParams.get("TargetMax")) : 1;
String prompt = mapParams.containsKey("TgtPrompt") ? mapParams.get("TgtPrompt") : "Target " + mapParams.get("ValidTgts");
abTgt = new Target(prompt, mapParams.get("Tgt").split(","), min, max);
if (mapParams.containsKey("TgtZone")) // if Targeting something not in play, this Key should be set
abTgt.setZone(mapParams.get("TgtZone"));
}
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: TgtP
by slapshot5 » 18 Nov 2010, 19:22
Right. I understand that. But backwards compat is no longer needed, right? And typing "Tgt$" is easier than "ValidTgts$". "Valid" has lost its meaning since everything uses valid behind the scenes (is this right?).friarsol wrote:Tgt$ is the "non-default" parameter here. This is why in the beginning (of this thread) I was trying to press TgtP not being used at all.
I don't feel a burning desire to change this part unless there is concensus.
I would definitely like to make the TgtPrompt optional when it is one of the simple cases I outlined above.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: TgtP
by friarsol » 18 Nov 2010, 19:55
I'm not sure what you mean by "needed." Until cards using the shorthand are converted, it is still necessary. What they use behind the scenes, and how they are coded in the data files are completely different things. If you tried to be put Tgt$Creature right now it would not work because that Constructor expects shorthand.
Correct me if I'm wrong, but it mostly seems that you want to type less for the Tgt parameter. Good. I'm glad Ability_Factory is making things easier for everyone. So let's do things like this:
I whole-heartily approve with making Prompt optional. I even posted a two-liner that would make this happen. I'm not sure if you missed this when you shifted gears to the ValidTgt thing.
It may sound otherwise, but the changes you are proposing fall in line with what I had wanted originally, not using the Shorthand.
I just wanted you to be aware what went into this before you jumped in.
Correct me if I'm wrong, but it mostly seems that you want to type less for the Tgt parameter. Good. I'm glad Ability_Factory is making things easier for everyone. So let's do things like this:
I whole-heartily approve with making Prompt optional. I even posted a two-liner that would make this happen. I'm not sure if you missed this when you shifted gears to the ValidTgt thing.
It may sound otherwise, but the changes you are proposing fall in line with what I had wanted originally, not using the Shorthand.
I just wanted you to be aware what went into this before you jumped in.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
24 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: ArchieRoW and 12 guests