mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Added copyCard method into Game interface
This commit is contained in:
parent
169277dd7b
commit
435798f7d5
3 changed files with 18 additions and 1 deletions
|
@ -177,6 +177,8 @@ public interface Game extends MageItem, Serializable {
|
|||
* @param applier
|
||||
*/
|
||||
public void copyPermanent(Permanent copyFromPermanent, Permanent copyToPermanent, Ability source, ApplyToPermanent applier);
|
||||
|
||||
public Card copyCard(Card cardToCopy, Ability source, UUID newController);
|
||||
|
||||
public void addTriggeredAbility(TriggeredAbility ability);
|
||||
public void addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility);
|
||||
|
|
|
@ -867,6 +867,19 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
state.addEffect(newEffect, newAbility);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Card copyCard(Card cardToCopy, Ability source, UUID newController) {
|
||||
Card copiedCard = cardToCopy.copy();
|
||||
copiedCard.assignNewId();
|
||||
copiedCard.setControllerId(newController);
|
||||
copiedCard.setCopy(true);
|
||||
Set<Card> cards = new HashSet<Card>();
|
||||
cards.add(copiedCard);
|
||||
loadCards(cards, source.getControllerId());
|
||||
|
||||
return copiedCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTriggeredAbility(TriggeredAbility ability) {
|
||||
if (ability instanceof TriggeredManaAbility) {
|
||||
|
|
|
@ -101,7 +101,9 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
return result;
|
||||
}
|
||||
}
|
||||
card.moveToZone(Zone.GRAVEYARD, ability.getId(), game, false);
|
||||
if (!card.isCopy()) {
|
||||
card.moveToZone(Zone.GRAVEYARD, ability.getId(), game, false);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue