Cantrips

This is mainly for Chris, as he has been the unofficial updater for "Draw a card." additions in cards.txt for Cantrip spells.
While testing new spPumpTgt functionality, I ran into a few cantrip cards, which previously used the card text instead of the spell description.
The new approach to including the spell description in the keyword line, would leave only "Draw a card." in the card text. But it was appearing before the spell description.
So, I went to the horse's mouth and did what we should have done from the beginning - I modified Card.getText().
If the Instant or Sorcery includes "Draw a card." as a keyword, "Draw a card." is appended after the spell description.
cards.txt will need to be gone over to change "Cantrip" to "Draw a card." and the text changed accordingly. After I merge the new spPumpTgt code, a pump spell cantrip will look like this:
While testing new spPumpTgt functionality, I ran into a few cantrip cards, which previously used the card text instead of the spell description.
The new approach to including the spell description in the keyword line, would leave only "Draw a card." in the card text. But it was appearing before the spell description.
So, I went to the horse's mouth and did what we should have done from the beginning - I modified Card.getText().
If the Instant or Sorcery includes "Draw a card." as a keyword, "Draw a card." is appended after the spell description.
cards.txt will need to be gone over to change "Cantrip" to "Draw a card." and the text changed accordingly. After I merge the new spPumpTgt code, a pump spell cantrip will look like this:
- Code: Select all
Pump Draw Spell
1 G
Instant
no text
spPumpTgt:+3/+3
Draw a card.
- Code: Select all
public String getText()
{
if(isInstant() || isSorcery())
{
String s = getSpellText();
StringBuilder sb = new StringBuilder();
sb.append(s);
SpellAbility[] sa = getSpellAbility();
for(int i = 0; i < sa.length; i++)
sb.append(sa[i].toString() + "\r\n");
// Cantrip -> Draw a card.
if (getKeyword().contains("Draw a card."))
s += "Draw a card.\r\n";
return sb.toString();
}
- Code: Select all
final static public void playStack(SpellAbility sa)
{
if (canPayCost(sa))
{
if (AllZone.GameAction.isCardInZone(sa.getSourceCard(),AllZone.Computer_Hand))
AllZone.Computer_Hand.remove(sa.getSourceCard());
if (sa.getSourceCard().getKeyword().contains("Draw a card."))
AllZone.GameAction.drawCard(sa.getSourceCard().getController());
payManaCost(sa);
AllZone.Stack.add(sa);
}
}
final static public void playNoStack(SpellAbility sa)
{
if(canPayCost(sa))
{
if(sa.isSpell())
{
if (AllZone.GameAction.isCardInZone(sa.getSourceCard(),AllZone.Computer_Hand))
AllZone.Computer_Hand.remove(sa.getSourceCard());
//probably doesn't really matter anyways
//sa.getSourceCard().comesIntoPlay(); - messes things up, maybe for the future fix this
}
if(sa instanceof Ability_Tap)
sa.getSourceCard().tap();
if (sa.getSourceCard().getKeyword().contains("Draw a card."))
AllZone.GameAction.drawCard(sa.getSourceCard().getController());
payManaCost(sa);
sa.resolve();
//destroys creatures if they have lethal damage, etc..
AllZone.GameAction.checkStateEffects();
}
}//play()
- Code: Select all
public void selectButtonOK()
{
updateGUI();
SpellAbility sa = AllZone.Stack.pop();
Card c = sa.getSourceCard();
if (sa.getSourceCard().getKeyword().contains("Draw a card."))
AllZone.GameAction.drawCard(sa.getSourceCard().getController());
final Card crd = c;
if (sa.isBuyBackAbility())
{
c.addReplaceMoveToGraveyardCommand(new Command() {
private static final long serialVersionUID = -2559488318473330418L;
public void execute() {
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, crd.getController());
AllZone.GameAction.moveTo(hand, crd);
}
});
}
sa.resolve();
AllZone.GameAction.checkStateEffects();
//special consideration for "Beacon of Unrest" and other "Beacon" cards
if((c.isInstant() || c.isSorcery()) &&
(! c.getName().startsWith("Beacon")) &&
(! c.getName().startsWith("Pulse")) &&
!AllZone.GameAction.isCardRemovedFromGame(c)) //hack to make flashback work
{
if (c.getReplaceMoveToGraveyard().size() == 0)
AllZone.GameAction.moveToGraveyard(c);
else
c.replaceMoveToGraveyard();
}
//update all zones, something things arent' updated for some reason
AllZone.Human_Hand.updateObservers();
AllZone.Human_Play.updateObservers();
AllZone.Computer_Play.updateObservers();
if(AllZone.InputControl.getInput() == this)
AllZone.InputControl.resetInput();
}