Quick Solution for non-Permanent Kicker spells
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
9 posts
• Page 1 of 1
Quick Solution for non-Permanent Kicker spells
by moomarc » 14 Mar 2012, 13:23
I've implemented a slightly hacky solution for setting non-Permanent spells as kicked. Very simply MagicStack now checks the spell params for 'SetKicked$ True'.
Edit: Also, I fixed up Ertai's Trickery script for testing this as a bonus
But it does seem like my changes are causing some crashes. Trying to fix it 
- Code: Select all
if (sp.isKickerAbility() || sp.getAbilityFactory().getMapParams().containsKey("SetKicked")) {
sp.getSourceCard().setKicked(true);
Edit: Also, I fixed up Ertai's Trickery script for testing this as a bonus


-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: Quick Solution for non-Permanent Kicker spells
by moomarc » 14 Mar 2012, 16:18
Okay... Found a much safer solution but please let me know if there's pitfalls to watch out for with this one.
This time, instead of working forwards from CardFactoryUtil.postFactoryKeywords (where the main kicker code is) and trying to set the card kicked, I realised that MagicStack, GameAction and TriggerHandler all look for isKickerAbility so started working backwards from there... Back to CardFactoryUtil. So I decided the best option was to setKickerAbility in addAbilityFactoryAbilities. So that now reads
This time, instead of working forwards from CardFactoryUtil.postFactoryKeywords (where the main kicker code is) and trying to set the card kicked, I realised that MagicStack, GameAction and TriggerHandler all look for isKickerAbility so started working backwards from there... Back to CardFactoryUtil. So I decided the best option was to setKickerAbility in addAbilityFactoryAbilities. So that now reads
- Code: Select all
public static final void addAbilityFactoryAbilities(final Card card) {
// **************************************************
// AbilityFactory cards
final ArrayList<String> ia = card.getIntrinsicAbilities();
if (ia.size() > 0) {
for (int i = 0; i < ia.size(); i++) {
final AbilityFactory af = new AbilityFactory();
// System.out.println(cardName);
final SpellAbility sa = af.getAbility(ia.get(i), card);
if (sa.getAbilityFactory().getMapParams().containsKey("SetKicked")) {
sa.setKickerAbility(true);
}
card.addSpellAbility(sa);
// Buyback block
}
}
}
}
-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: Quick Solution for non-Permanent Kicker spells
by moomarc » 14 Mar 2012, 16:46
Well it definitely triggers Saproling Infestation. Rumbling Aftershocks needs some code updats though before it can count the kicker activations.
-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: Quick Solution for non-Permanent Kicker spells
by moomarc » 14 Mar 2012, 17:00
Not related to my work, but multikicker doesn't trigger kicked card triggers. I'll look into it tomorrow.
-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: Quick Solution for non-Permanent Kicker spells
by moomarc » 23 Mar 2012, 13:27
Been trying to fix it without luck. So could one of the java gurus please tell me why this doesn't work to make "kicked" in isValid return false when a spell has a been multikicked? Is it just a timing issue or are you laughing at me for my complete lack of knowledge?moomarc wrote:Not related to my work, but multikicker doesn't trigger kicked card triggers. I'll look into it tomorrow.
- Code: Select all
else if (property.startsWith("kicked")) {
int multikicked = this.getMultiKickerMagnitude();
if (!this.isKicked() && (multikicked <= 0)) {
return false;
}
}
-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: Quick Solution for non-Permanent Kicker spells
by Sloth » 23 Mar 2012, 22:06
What exactly did you test? Gnarlid Pack and similar cards have the line "card.setMultiKickerMagnitude(0);" when they enter the battlefield.moomarc wrote:Been trying to fix it without luck. So could one of the java gurus please tell me why this doesn't work to make "kicked" in isValid return false when a spell has a been multikicked? Is it just a timing issue or are you laughing at me for my complete lack of knowledge?
- Code: Select all
else if (property.startsWith("kicked")) {
int multikicked = this.getMultiKickerMagnitude();
if (!this.isKicked() && (multikicked <= 0)) {
return false;
}
}
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Quick Solution for non-Permanent Kicker spells
by moomarc » 23 Mar 2012, 22:32
Can't remember the name, but its a counterspell that let's you draw a card for each time it was kicked. Used that because I saw the others might be a problem (used one of them for testing as well anyway). But thinking about it, there might be a problem with the other spell too. I never actuall drew cards from its multikicker, but I thought it was because I only had one card in my library and kicked it twice.
The trigger side of the test was with Rumbling Aftershocks and Saproling Infestation (without trying to count the times kicked)
Either way, this method obviously won't work on those creatures anyway. I guess it'll just have to wait until the additional cost class eventually gets coded.
The trigger side of the test was with Rumbling Aftershocks and Saproling Infestation (without trying to count the times kicked)
Either way, this method obviously won't work on those creatures anyway. I guess it'll just have to wait until the additional cost class eventually gets coded.
-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: Quick Solution for non-Permanent Kicker spells
by Sloth » 24 Mar 2012, 10:09
The fault is definitely not on your side marc. I won't mind you submitting your code if it works with normal kicker abilities.
Multikicker has a ton of issues and needs to be rewritten anyway, so don't let it hold you back.
Multikicker has a ton of issues and needs to be rewritten anyway, so don't let it hold you back.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Quick Solution for non-Permanent Kicker spells
by moomarc » 24 Mar 2012, 11:44
Thanks Sloth. At this stage the only card really affected by the change would be Ertai's Trickery. It will finally be able to counter sorcery and instant spells that have been scripted in the form of two A:SP lines, one with the kicker cost included. I don't think I should add Rumbling Aftershocks or Saproling Infestation until the multikickers can be handled properly though, because they lose too much functionality.
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 28 guests