If I have a Ghalta, Primal Hunger in hand and I imprint it under Soul Foundry, what is the cost to cast Ghalta? I'm thinking the power deduction still applies but I just want to verify.
Additionally, if I have an X spell is that considered an optional cost?
If Ghalta is exiled with Soul Foundry, you generally have to pay "12, T" to activate Soul Foundry's second ability to create a token that's a copy of Ghalta (because Ghalta's converted mana cost is 12). Note that Ghalta has no X in its mana cost, and Ghalta's cost reduction applies only while Ghalta is being cast (C.R. 601.2f), which is not happening here. (If the card is Walking Ballista rather than Ghalta, the Xs in Walking Ballista's mana cost would be 0 in the same situation [C.R. 107.3f], making the mana cost 00 so that the converted mana cost is 0.)
Ghalta's converted mana cost is always 12, since it is based on the mana cost, which doesn't change. The cost reduction only applies to casting Ghalta, which Soul Foundry doesn't let you do, that artifact directly creates a token copy via an activated ability.
When casting a spell with X in its cost or activating an ablity with X in its cost, you first choose the value of X, and then calculate and pay the cost based on that value for X. X in the mana cost of an object is part of that mana cost, and if you are not getting to pay the mana cost (like when casting a spell "without paying the mana cost", or simply look at the mana cost to calculate the CMC for example), you don't get to set a value for X, so X is treated as 0 for any subsequent calculations.
Additionally, if I have an X spell is that considered an optional cost?
When casting a spell with X in its cost or activating an ablity with X in its cost, you first choose the value of X, and then calculate and pay the cost based on that value for X. X in the mana cost of an object is part of that mana cost, and if you are not getting to pay the mana cost (like when casting a spell "without paying the mana cost", or simply look at the mana cost to calculate the CMC for example), you don't get to set a value for X, so X is treated as 0 for any subsequent calculations.
Former Rules Advisor
"Everything's better with pirates." - Lodge
(The Gamers: Dorkness Rising)
"Any sufficiently analyzed magic is indistinguishable from science."
(Girl Genius - Fairy Tale Theater Break - Cinderella, end of volume 8)