mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
*Converted Sculpting Steel and Copy Artifact to new Clone-code.
This commit is contained in:
@@ -340,8 +340,6 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
|
|
||||||
private Card cloneOrigin = null;
|
private Card cloneOrigin = null;
|
||||||
private ArrayList<Card> clones = new ArrayList<Card>();
|
private ArrayList<Card> clones = new ArrayList<Card>();
|
||||||
private Card currentlyCloningCard = null;
|
|
||||||
private Command cloneLeavesPlayCommand = null;
|
|
||||||
private ArrayList<Card> gainControlTargets = new ArrayList<Card>();
|
private ArrayList<Card> gainControlTargets = new ArrayList<Card>();
|
||||||
private ArrayList<Command> gainControlReleaseCommands = new ArrayList<Command>();
|
private ArrayList<Command> gainControlReleaseCommands = new ArrayList<Command>();
|
||||||
|
|
||||||
@@ -1052,52 +1050,6 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
cloneOrigin = name;
|
cloneOrigin = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Getter for the field <code>cloneLeavesPlayCommand</code>.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @return a {@link forge.Command} object.
|
|
||||||
*/
|
|
||||||
public final Command getCloneLeavesPlayCommand() {
|
|
||||||
return cloneLeavesPlayCommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Setter for the field <code>cloneLeavesPlayCommand</code>.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param com
|
|
||||||
* a {@link forge.Command} object.
|
|
||||||
*/
|
|
||||||
public final void setCloneLeavesPlayCommand(final Command com) {
|
|
||||||
cloneLeavesPlayCommand = com;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Getter for the field <code>currentlyCloningCard</code>.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @return a {@link forge.Card} object.
|
|
||||||
*/
|
|
||||||
public final Card getCurrentlyCloningCard() {
|
|
||||||
return currentlyCloningCard;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Setter for the field <code>currentlyCloningCard</code>.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param c
|
|
||||||
* a {@link forge.Card} object.
|
|
||||||
*/
|
|
||||||
public final void setCurrentlyCloningCard(final Card c) {
|
|
||||||
currentlyCloningCard = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Getter for the field <code>sacrificeAtEOT</code>.
|
* Getter for the field <code>sacrificeAtEOT</code>.
|
||||||
@@ -2082,6 +2034,10 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
sb.append(nonAbilityText.replaceAll("CARDNAME", getName()));
|
sb.append(nonAbilityText.replaceAll("CARDNAME", getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(characteristicsMap.get("Cloner") != null) {
|
||||||
|
sb.append("\r\nCloned by:").append(characteristicsMap.get("Cloner").getName()).append(" (").append(getUniqueNumber()).append(")");
|
||||||
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1713,59 +1713,64 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
else if (cardName.equals("Copy Artifact") || cardName.equals("Sculpting Steel")) {
|
else if (cardName.equals("Copy Artifact") || cardName.equals("Sculpting Steel")) {
|
||||||
final CardFactoryInterface cfact = this;
|
final CardFactoryInterface cfact = this;
|
||||||
final Card[] copyTarget = new Card[1];
|
final Card[] copyTarget = new Card[1];
|
||||||
final Card[] cloned = new Card[1];
|
|
||||||
|
|
||||||
final Command leaves = new Command() {
|
|
||||||
private static final long serialVersionUID = 6212378498863558380L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
|
|
||||||
final Card orig = cfact.getCard(card.getName(), card.getController());
|
|
||||||
final PlayerZone dest = AllZone.getZoneOf(card.getCurrentlyCloningCard());
|
|
||||||
AllZone.getGameAction().moveTo(dest, orig);
|
|
||||||
dest.remove(card.getCurrentlyCloningCard());
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
final SpellAbility copy = new Spell(card) {
|
final SpellAbility copy = new Spell(card) {
|
||||||
private static final long serialVersionUID = 4236580139968159802L;
|
private static final long serialVersionUID = 4496978456522751302L;
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlayAI() {
|
|
||||||
final CardList arts = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.ARTIFACTS);
|
|
||||||
return !arts.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
if (card.getController().isComputer()) {
|
if (card.getController().isComputer()) {
|
||||||
final CardList arts = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.ARTIFACTS);
|
final CardList creatures = AllZoneUtil.getCreaturesInPlay();
|
||||||
if (!arts.isEmpty()) {
|
if (!creatures.isEmpty()) {
|
||||||
copyTarget[0] = CardFactoryUtil.getBestArtifactAI(arts);
|
copyTarget[0] = CardFactoryUtil.getBestCreatureAI(creatures);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copyTarget[0] != null) {
|
if (copyTarget[0] != null) {
|
||||||
cloned[0] = CardFactoryUtil.copyStats(copyTarget[0]);
|
Card cloned;
|
||||||
cloned[0].setOwner(card.getController());
|
|
||||||
if (cardName.equals("Copy Artifact")) {
|
|
||||||
cloned[0].addType("Enchantment");
|
|
||||||
}
|
|
||||||
cloned[0].setCloneOrigin(card);
|
|
||||||
cloned[0].addLeavesPlayCommand(leaves);
|
|
||||||
cloned[0].setCloneLeavesPlayCommand(leaves);
|
|
||||||
cloned[0].setCurSetCode(copyTarget[0].getCurSetCode());
|
|
||||||
cloned[0].setImageFilename(copyTarget[0].getImageFilename());
|
|
||||||
|
|
||||||
for (final SpellAbility sa : copyTarget[0].getSpellAbilities()) {
|
cloned = cfact.getCard(copyTarget[0].getState("Original").getName(), card.getOwner());
|
||||||
cloned[0].addSpellAbility(sa);
|
card.addAlternateState("Cloner");
|
||||||
|
card.switchStates("Original", "Cloner");
|
||||||
|
card.setState("Original");
|
||||||
|
|
||||||
|
if(copyTarget[0].getCurState().equals("Transformed") && copyTarget[0].isDoubleFaced()) {
|
||||||
|
cloned.setState("Transformed");
|
||||||
}
|
}
|
||||||
|
|
||||||
AllZone.getGameAction().moveToPlay(cloned[0]);
|
CardFactoryUtil.copyCharacteristics(cloned,card);
|
||||||
card.setCurrentlyCloningCard(cloned[0]);
|
this.grantExtras();
|
||||||
|
|
||||||
|
|
||||||
|
//If target is a flipped card, also copy the flipped state.
|
||||||
|
if(copyTarget[0].isFlip()) {
|
||||||
|
cloned.setState("Flipped");
|
||||||
|
cloned.setImageFilename(CardUtil.buildFilename(cloned));
|
||||||
|
card.addAlternateState("Flipped");
|
||||||
|
card.setState("Flipped");
|
||||||
|
CardFactoryUtil.copyCharacteristics(cloned,card);
|
||||||
|
this.grantExtras();
|
||||||
|
|
||||||
|
card.setFlip(true);
|
||||||
|
|
||||||
|
card.setState("Original");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
card.setFlip(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AllZone.getGameAction().moveToPlay(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void grantExtras() {
|
||||||
|
//Grant stuff from specific cloners
|
||||||
|
if(cardName.equals("Copy Artifact")) {
|
||||||
|
card.addType("Enchantment");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}; // SpellAbility
|
}; // SpellAbility
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user