- Fixed Fork. It now correctly changes the color of the copied spell to red.

This commit is contained in:
moomarc
2012-09-08 16:36:43 +00:00
parent 784cc0338b
commit 392747bb37
2 changed files with 20 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ Name:Fork
ManaCost:R R
Types:Instant
Text:no text
A:SP$ CopySpell | Cost$ R R | ValidTgts$ Instant,Sorcery | SpellDescription$ Copy target instant or sorcery spell. You may choose new targets for the copy.
A:SP$ CopySpell | Cost$ R R | ValidTgts$ Instant,Sorcery | CopyIsColor$ Red | OverwriteColors$ True | SpellDescription$ Copy target instant or sorcery spell, except that the copy is red. You may choose new targets for the copy.
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/fork.jpg

View File

@@ -19,6 +19,8 @@ package forge.card.cardfactory;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import forge.AllZone;
import forge.Card;
@@ -158,6 +160,23 @@ public class CardFactory implements CardFactoryInterface {
return;
}*/
final Card c = AllZone.getCardFactory().copyCard(original);
// change the color of the copy (eg: Fork)
final SpellAbility sourceSA = source.getFirstSpellAbility();
if (sourceSA.getAbilityFactory().getMapParams().containsKey("CopyIsColor")) {
String tmp = "";
final HashMap<String, String> params = sourceSA.getAbilityFactory().getMapParams();
final String newColor = params.get("CopyIsColor");
if (newColor.equals("ChosenColor")) {
tmp = CardUtil.getShortColorsString(source.getChosenColor());
} else {
tmp = CardUtil.getShortColorsString(new ArrayList<String>(Arrays.asList(newColor.split(","))));
}
final String finalColors = tmp;
c.addColor(finalColors, c, !params.containsKey("OverwriteColors"), true);
}
c.addController(controller);
c.setCopiedSpell(true);