Profane Command
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
25 posts
• Page 1 of 2 • 1, 2
Profane Command
by moomarc » 04 Oct 2012, 08:54
Okey dokey, I'm trying to convert Profane Command to script because it's a monster piece of code (about 500 lines) that could be taken out when I get this right. So far I've got the script (that is, each of the charm's abilities work as expected). I've also expanded Sol's work on XCantBe0 so that X has to be larger than a specified SVar or integer (my stuff id separate from the XCantBe0 stuff for now, although they could probably be merged at some stage). This allows us to actually choose a value for X other than a targeted card's cmc (or whatever else) for cards such as Postmortem Lunge or Minamo Sightbender. Not sure when you might want to, but at least you'd have the option. (Edit: I suppose if the AI were smarter and you had a permanent that could boost power, then it might add a little extra to an activation of Minamo Sightbender so that you don't pump the target's power above X.
)
Anyway, this would enable Profane Command to work as a scripted card IF I could find a way to get the Targeted$CardManaCost and Targeted$Amount of the specific Charm sa. At the moment Targeted$CardManaCost return the cmc of either of the last three abilities when I only need the cmc of the card targeted by the second choice. Likewise, Targeted$Amount needs to only return the number targeted by the last ability.
Any idea's on how to do this? Ideally what I'd want is something similar to StoreSVar for targeting that lets you set a specific SVar based on a specified expression.

Anyway, this would enable Profane Command to work as a scripted card IF I could find a way to get the Targeted$CardManaCost and Targeted$Amount of the specific Charm sa. At the moment Targeted$CardManaCost return the cmc of either of the last three abilities when I only need the cmc of the card targeted by the second choice. Likewise, Targeted$Amount needs to only return the number targeted by the last ability.
Any idea's on how to do this? Ideally what I'd want is something similar to StoreSVar for targeting that lets you set a specific SVar based on a specified expression.
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Profane Command
by friarsol » 04 Oct 2012, 12:17
I think what Targeted$ is doing is gathering up every target in an SAs chain of abilities, and using all of those to base its calculation off of. We can probably check each SA that actually uses the Targeted$ format and see if any of them actually need "all" of the targets. I'm not sure if bubbling up through the SAs is necessary (once you actually find some targets). I know certain Targeted$ things do rely on looking at the parent abilities targets.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Profane Command
by moomarc » 04 Oct 2012, 16:54
Am I right in thinking that Charm adds the selected mode/s as a subability?
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Profane Command
by Sloth » 04 Oct 2012, 18:19
Yes.moomarc wrote:Am I right in thinking that Charm adds the selected mode/s as a subability?
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Profane Command
by moomarc » 04 Oct 2012, 18:41
In that case I think I know how to get this right. Will see in the morning if it works, but should be able to use something like CharmTargeted$CardManaCost. Then at the start of CalculateAmount, before the method starts checking what type it is, check the subabilities for a param XCountRefsThis. Pass that sa (instead of the default ability) through the rest of CalculateAmount replacing CharmTargeted with Targeted (coded a bit more generically obviously).
Does that sound plausible?
Does that sound plausible?
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Profane Command
by friarsol » 04 Oct 2012, 19:22
Sounds like it would work, I'd probably use different nomenclature for this than CharmTargeted (since non-charm SAs could actually use this beneficially) but I'm not sure what I would call it.moomarc wrote:In that case I think I know how to get this right. Will see in the morning if it works, but should be able to use something like CharmTargeted$CardManaCost. Then at the start of CalculateAmount, before the method starts checking what type it is, check the subabilities for a param XCountRefsThis. Pass that sa (instead of the default ability) through the rest of CalculateAmount replacing CharmTargeted with Targeted (coded a bit more generically obviously).
Does that sound plausible?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Profane Command
by moomarc » 04 Oct 2012, 19:34
I'll probably go with SpecifiedTargeted or just SpecTargeted. Or perhaps SpecSATargeted is more descriptive?
If that works, all I have to do then is get the XNotLessThan<var> code to take two svars and use the biggest (I can't think of any situation where we'd need to compare more than two svars).
I'm quite happy with how the code is turning out. Nice and clean (at least I think it is). Two months ago this would still have been beyond me but I've learnt enough java now to learn quickly
If that works, all I have to do then is get the XNotLessThan<var> code to take two svars and use the biggest (I can't think of any situation where we'd need to compare more than two svars).
I'm quite happy with how the code is turning out. Nice and clean (at least I think it is). Two months ago this would still have been beyond me but I've learnt enough java now to learn quickly

-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Profane Command
by friarsol » 05 Oct 2012, 00:26
SpecificTargeted works for me. I wouldn't put SA in there since it would mean something a bit different to me. Glad to see some of the most brutal hardcoded cards disappearing.moomarc wrote:I'll probably go with SpecifiedTargeted or just SpecTargeted. Or perhaps SpecSATargeted is more descriptive?
If that works, all I have to do then is get the XNotLessThan<var> code to take two svars and use the biggest (I can't think of any situation where we'd need to compare more than two svars).
I'm quite happy with how the code is turning out. Nice and clean (at least I think it is). Two months ago this would still have been beyond me but I've learnt enough java now to learn quickly
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Profane Command
by moomarc » 05 Oct 2012, 08:50
](./images/smilies/eusa_wall.gif)
- Code: Select all
Choose two - Target player loses X life; or return target creature card with converted mana cost X or less from your graveyard to the battlefield; or target creature gets -X/-X until end of turn; or up to X target creatures gain fear until end of turn. (They can't be blocked except by artifact creatures and/or black creatures.) Target player loses X life. Target creature gets -X/-X until end of turn.
- Code: Select all
Choice1 Choice2 Choice3 Choice4 Chosen1 Chosen2

-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Profane Command
by friarsol » 05 Oct 2012, 13:08
Post your card and your diff of whatever source you changed, I'll take a look this afternoon.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Profane Command
by moomarc » 05 Oct 2012, 13:16
The calculateAmount bit deteriorated into a mass of println's trying to find out what was happening, and I never got around to finalizing returning the larger of two calculated amounts (seeing as I was still trying to get the amounts). So I just need to get it back into some sort of "this should have worked" state then I'll post here. Thanks for looking into it.
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Profane Command
by friarsol » 05 Oct 2012, 13:30
We do already have LimitMax for finding the larger of two values (in the count structure). It looks like Ana Sanctuary (and other APC Sanctuaries) uses them.
Edit: Ugh. These are poorly named, since LimitMax actually finds the Minimum of two values, and LimitMin finds the Maximum of two values.
It doesn't seem like anything actually uses LimitMin, but that's the one you'd want.
Edit: Ugh. These are poorly named, since LimitMax actually finds the Minimum of two values, and LimitMin finds the Maximum of two values.
It doesn't seem like anything actually uses LimitMin, but that's the one you'd want.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Profane Command
by moomarc » 05 Oct 2012, 13:45
For my purposes it was easier to just usefriarsol wrote:We do already have LimitMax for finding the larger of two values (in the count structure). It looks like Ana Sanctuary (and other APC Sanctuaries) uses them.
Edit: Ugh. These are poorly named, since LimitMax actually finds the Minimum of two values, and LimitMin finds the Maximum of two values.
It doesn't seem like anything actually uses LimitMin, but that's the one you'd want.
- Code: Select all
for (final String xGEvar : xGESplit) {
int amount = AbilityFactory.calculateAmount(sa.getSourceCard(), xGEvar, sa);
if (amount > xGE) {
xGE = amount;
}
}
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Profane Command
by Hellfish » 05 Oct 2012, 15:38
I named em that because they Limit to a max or min value.I swear ot made sense at the time. 

So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: Profane Command
by moomarc » 05 Oct 2012, 16:15
I remember it making sense within context of its use. LimitMax limits the maximum value that will be returned by an xCount, it just happens to do that by returning the min.Hellfish wrote:I named em that because they Limit to a max or min value.I swear ot made sense at the time.

-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
25 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 22 guests