mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +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
|
@ -178,6 +178,8 @@ public interface Game extends MageItem, Serializable {
|
|||
*/
|
||||
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);
|
||||
public void applyEffects();
|
||||
|
|
|
@ -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,8 +101,10 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
return result;
|
||||
}
|
||||
}
|
||||
if (!card.isCopy()) {
|
||||
card.moveToZone(Zone.GRAVEYARD, ability.getId(), game, false);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue