It is currently 09 Sep 2025, 10:06
   
Text Size

Optional additional costs

Post MTG Forge Related Programming Questions Here

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

Re: Optional additional costs

Postby Sloth » 16 Sep 2012, 18:00

moomarc wrote:Do optional additional costs paid get added to the paid costs hash? I'm trying to add Dralnu's Pet but no counters are being added.
Script for Dralnu's Pet | Open
Name:Dralnu's Pet
ManaCost:1 U U
Types:Creature Shapeshifter
Text:no text
PT:2/2
K:Kicker 2 B Discard<1/Creature>
T:Mode$ ChangesZone | ValidCard$ Card.Self+kicked | Origin$ Any | Destination$ Battlefield | Execute$ PetLaunch | Static$ True | TriggerDescription$ If CARDNAME was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost.
SVar:PetLaunch:AB$ Pump | Cost$ 0 | Defined$ Self | KW$ Flying | Permanent$ True | SubAbility$ PetStrength
SVar:PetStrength:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ KickedPet | References$ KickedPet
SVar:KickedPet:Discarded$CardManaCost
SVar:RemRandomDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/dralnus_pet.jpg
SetInfo:PLS|Rare|http://magiccards.info/scans/en/ps/23.jpg
Oracle:Kicker-{2}{B}, Discard a creature card. (You may pay {2}{B} and discard a creature card in addition to any other costs as you cast this spell.)\nIf Dralnu's Pet was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost.
End

So I added this check in AbilityFactory.calculateAmount in the "Discarded" method and the output is null when the kicker is paid (obviously no output if kicker not paid)
Code: Select all
if (card.getOptionalAdditionalCostsPaid() != null) {
    System.out.println(list);
}
This is a different problem. AbilityFactory.calculateAmount looks at the paid information of the triggered ability (which has no cost), but it should look for the paid info of the SpellPermanent.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Optional additional costs

Postby Sloth » 16 Sep 2012, 18:47

moomarc wrote:
702.30e - If part of a spell's ability has its effect only if that spell was kicked, and that part of the ability includes any targets, the spell's controller chooses those targets only if that spell was kicked. Otherwise, the spell is cast as if it did not have those targets. See Rule 601.2c. [CompRules 2009/10/01]
Would it take more effort than it's worth to get this ruling working for cards like Dwarven Landslide? I imaging the functional part of the script would look like this:
Code: Select all
K:Kicker 2 R Sac<1/Land>
A:SP$ Destroy | Cost$ 3 R | ValidTgts$ Land | TargetMin$ X | TargetMax$ X | References$ X | TgtPrompt$ Select target land | SubAbility$ DBKicker | SpellDescription$ Destroy target land. If CARDNAME was kicked, destroy another target land.
SVar:X:Count$KickerSelected:2:1
I've solved the problem. See r16888.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 53 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 53 users online :: 0 registered, 0 hidden and 53 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 53 guests

Login Form