mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Convert Painter's Servant to Script
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
Name:Painter's Servant
|
Name:Painter's Servant
|
||||||
ManaCost:2
|
ManaCost:2
|
||||||
Types:Artifact Creature Scarecrow
|
Types:Artifact Creature Scarecrow
|
||||||
Text:As Painter's Servant enters the battlefield, choose a color.\r\nAll cards that aren't on the battlefield, spells, and permanents are the chosen color in addition to their other colors.
|
Text:no text
|
||||||
PT:1/3
|
PT:1/3
|
||||||
|
K:ETBReplacement:Other:ChooseColor
|
||||||
|
SVar:ChooseColor:DB$ ChooseColor | Defined$ You | SpellDescription$ As CARDNAME enters the battlefield, choose a color. | AILogic$ MostProminentKeywordInComputerDeck
|
||||||
|
S:Mode$ Continuous| Affected$ Card | AddColor$ ChosenColor | AffectedZone$ Battlefield,Hand,Library,Graveyard,Exile,Stack | Description$ All cards that aren't on the battlefield, spells, and permanents are the chosen color in addition to their other colors.
|
||||||
SVar:Rarity:Rare
|
SVar:Rarity:Rare
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/painters_servant.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/painters_servant.jpg
|
||||||
SetInfo:SHM|Rare|http://magiccards.info/scans/en/shm/257.jpg
|
SetInfo:SHM|Rare|http://magiccards.info/scans/en/shm/257.jpg
|
||||||
|
|||||||
@@ -101,6 +101,20 @@ public class ChooseColorEffect extends SpellEffect {
|
|||||||
chosen.add(CardFactoryUtil.getMostProminentColor(Singletons.getModel().getGame().getCombat()
|
chosen.add(CardFactoryUtil.getMostProminentColor(Singletons.getModel().getGame().getCombat()
|
||||||
.getAttackerList()));
|
.getAttackerList()));
|
||||||
}
|
}
|
||||||
|
else if (logic.equals("MostProminentKeywordInComputerDeck")) {
|
||||||
|
List<Card> list = ai.getAllCards();
|
||||||
|
int max = 0;
|
||||||
|
String chosenColor = Constant.Color.WHITE;
|
||||||
|
|
||||||
|
for (final String c : Constant.Color.ONLY_COLORS) {
|
||||||
|
final int cmp = CardLists.filter(list, CardPredicates.containsKeyword(c)).size();
|
||||||
|
if (cmp > max) {
|
||||||
|
max = cmp;
|
||||||
|
chosenColor = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
chosen.add(chosenColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (chosen.size() == 0) {
|
if (chosen.size() == 0) {
|
||||||
chosen.add(Constant.Color.GREEN);
|
chosen.add(Constant.Color.GREEN);
|
||||||
|
|||||||
@@ -68,60 +68,6 @@ import forge.util.Aggregates;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class CardFactoryCreatures {
|
public class CardFactoryCreatures {
|
||||||
private static void getCard_PainterServant(final Card card) {
|
|
||||||
final long[] timeStamp = new long[1];
|
|
||||||
final String[] color = new String[1];
|
|
||||||
|
|
||||||
final Command comesIntoPlay = new Command() {
|
|
||||||
private static final long serialVersionUID = 333134223161L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
if (card.getController().isHuman()) {
|
|
||||||
color[0] = GuiChoose.one("Choose color", Constant.Color.ONLY_COLORS);
|
|
||||||
} else {
|
|
||||||
// AI chooses the color that appears in the keywords of
|
|
||||||
// the most cards in its deck, hand and on battlefield
|
|
||||||
final List<Card> list = new ArrayList<Card>();
|
|
||||||
list.addAll(card.getController().getCardsIn(ZoneType.Library));
|
|
||||||
list.addAll(card.getController().getCardsIn(ZoneType.Hand));
|
|
||||||
list.addAll(card.getController().getCardsIn(ZoneType.Battlefield));
|
|
||||||
|
|
||||||
color[0] = Constant.Color.WHITE;
|
|
||||||
int max = 0;
|
|
||||||
CardLists.filter(list, CardPredicates.containsKeyword(color[0])).size();
|
|
||||||
|
|
||||||
for (final String c : Constant.Color.ONLY_COLORS) {
|
|
||||||
final int cmp = CardLists.filter(list, CardPredicates.containsKeyword(c)).size();
|
|
||||||
if (cmp > max) {
|
|
||||||
max = cmp;
|
|
||||||
color[0] = c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final ArrayList<String> colors = new ArrayList<String>();
|
|
||||||
colors.add(color[0]);
|
|
||||||
card.setChosenColor(colors);
|
|
||||||
final String s = CardUtil.getShortColor(color[0]);
|
|
||||||
|
|
||||||
timeStamp[0] = Singletons.getModel().getGame().getColorChanger().addColorChanges(s, card, true, true);
|
|
||||||
}
|
|
||||||
}; // Command
|
|
||||||
|
|
||||||
final Command leavesBattlefield = new Command() {
|
|
||||||
private static final long serialVersionUID = 2559212590399132459L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
final String s = CardUtil.getShortColor(color[0]);
|
|
||||||
Singletons.getModel().getGame().getColorChanger().removeColorChanges(s, card, true, timeStamp[0]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
card.addComesIntoPlayCommand(comesIntoPlay);
|
|
||||||
card.addLeavesPlayCommand(leavesBattlefield);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void getCard_Stangg(final Card card) {
|
private static void getCard_Stangg(final Card card) {
|
||||||
|
|
||||||
final Ability ability = new Ability(card, SpellManaCost.ZERO) {
|
final Ability ability = new Ability(card, SpellManaCost.ZERO) {
|
||||||
@@ -803,9 +749,7 @@ public class CardFactoryCreatures {
|
|||||||
|
|
||||||
public static void buildCard(final Card card, final String cardName) {
|
public static void buildCard(final Card card, final String cardName) {
|
||||||
|
|
||||||
if (cardName.equals("Painter's Servant")) {
|
if (cardName.equals("Stangg")) {
|
||||||
getCard_PainterServant(card);
|
|
||||||
} else if (cardName.equals("Stangg")) {
|
|
||||||
getCard_Stangg(card);
|
getCard_Stangg(card);
|
||||||
} else if (cardName.equals("Sphinx of Jwar Isle")) {
|
} else if (cardName.equals("Sphinx of Jwar Isle")) {
|
||||||
getCard_SphinxJwar(card);
|
getCard_SphinxJwar(card);
|
||||||
|
|||||||
@@ -223,8 +223,13 @@ public class StaticAbilityContinuous {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (params.containsKey("AddColor")) {
|
if (params.containsKey("AddColor")) {
|
||||||
addColors = CardUtil.getShortColorsString(new ArrayList<String>(Arrays.asList(params.get("AddColor").split(
|
final String colors = params.get("AddColor");
|
||||||
|
if (colors.equals("ChosenColor")) {
|
||||||
|
addColors = CardUtil.getShortColorsString(hostCard.getChosenColor());
|
||||||
|
} else {
|
||||||
|
addColors = CardUtil.getShortColorsString(new ArrayList<String>(Arrays.asList(colors.split(
|
||||||
" & "))));
|
" & "))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.containsKey("SetColor")) {
|
if (params.containsKey("SetColor")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user