congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
PermanentToken
Code IndexAdd Tabnine to your IDE (free)

How to use
PermanentToken
in
mage.game.permanent

Best Java code snippets using mage.game.permanent.PermanentToken (Showing top 14 results out of 315)

origin: magefree/mage

@Override
public void adjustCosts(Ability ability, Game game) {
  if (getToken().getCopySourceCard() != null) {
    getToken().getCopySourceCard().adjustCosts(ability, game);
  } else {
    super.adjustCosts(ability, game);
  }
}
origin: magefree/mage

private void addToken(Token token, BigCard bigCard, UUID gameId, Rectangle rectangle) {
  if (cardDimension == null) {
    cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
  }
  PermanentToken newToken = new PermanentToken(token, null, token.getOriginalExpansionSetCode(), null);
  newToken.removeSummoningSickness();
  PermanentView theToken = new PermanentView(newToken, null, null, null);
  theToken.setInViewerOnly(true);
  final MageCard cardImg = Plugins.instance.getMagePermanent(theToken, bigCard, cardDimension, gameId, true);
  cardImg.setBounds(rectangle);
  jLayeredPane.add(cardImg, JLayeredPane.DEFAULT_LAYER, 10);
  cardImg.update(theToken);
  cardImg.setCardBounds(rectangle.x, rectangle.y, cardDimensions.frameWidth, cardDimensions.frameHeight);
}
origin: magefree/mage

@Override
public void reset(Game game) {
  copyFromToken(token, game, true);
  super.reset(game);
  // Because the P/T objects have there own base value for reset we have to take it from there instead of from the basic token object
  this.power.resetToBaseValue();
  this.toughness.resetToBaseValue();
}
origin: magefree/mage

  this.mageObjectType = MageObjectType.TOKEN;
  this.rarity = Rarity.COMMON;
  boolean originalCardNumberIsNull = ((PermanentToken) card).getToken().getOriginalCardNumber() == null;
  if (!originalCardNumberIsNull && !"0".equals(((PermanentToken) card).getToken().getOriginalCardNumber())) {
    this.expansionSetCode = ((PermanentToken) card).getToken().getOriginalExpansionSetCode();
    this.cardNumber = ((PermanentToken) card).getToken().getOriginalCardNumber();
  } else {
    this.expansionSetCode = ((PermanentToken) card).getExpansionSetCode();
    this.tokenDescriptor = ((PermanentToken) card).getTokenDescriptor();
  this.rules = ((PermanentToken) card).getRules(game);
  this.type = ((PermanentToken) card).getToken().getTokenType();
} else {
  this.rarity = card.getRarity();
origin: magefree/mage

MageObject object = game.getObject(sourceId);
if (object instanceof PermanentToken) {
  setCode = ((PermanentToken) object).getExpansionSetCode();
PermanentToken newToken = new PermanentToken(this, event.getPlayerId(), setCode, game); // use event.getPlayerId() because it can be replaced by replacement effect
game.getState().addCard(newToken);
permanents.add(newToken);
game.getPermanentsEntering().put(newToken.getId(), newToken);
newToken.setTapped(tapped);
origin: magefree/mage

  PermanentToken permanentToken = (PermanentToken) object;
  this.rarity = Rarity.COMMON;
  this.expansionSetCode = permanentToken.getExpansionSetCode();
  this.rules = permanentToken.getRules();
  this.type = permanentToken.getToken().getTokenType();
} else if (object instanceof Emblem) {
  this.mageObjectType = MageObjectType.EMBLEM;
origin: magefree/mage

@Override
public PermanentToken copy() {
  return new PermanentToken(this);
}
origin: magefree/mage

private void copyFromToken(Token token, Game game, boolean reset) {
  this.name = token.getName();
  this.abilities.clear();
  if (reset) {
    this.abilities.addAll(token.getAbilities());
  } else {
    // first time -> create ContinuousEffects only once
    for (Ability ability : token.getAbilities()) {
      this.addAbility(ability, game);
    }
  }
  this.abilities.setControllerId(this.controllerId);
  this.manaCost.clear();
  for (ManaCost cost : token.getManaCost()) {
    this.getManaCost().add(cost.copy());
  }
  this.cardType.clear();
  this.cardType.addAll(token.getCardType());
  this.color = token.getColor(game).copy();
  this.frameColor = token.getFrameColor(game);
  this.frameStyle = token.getFrameStyle();
  this.supertype.clear();
  this.supertype.addAll(token.getSuperType());
  this.subtype.clear();
  this.subtype.addAll(token.getSubtype(game));
  this.isAllCreatureTypes = token.isAllCreatureTypes();
  this.tokenDescriptor = token.getTokenDescriptor();
}
origin: magefree/mage

if (object instanceof PermanentToken) {
  PermanentToken token = (PermanentToken) object;
  stack.put(stackObject.getId(), new StackAbilityView(game, (StackAbility) stackObject, token.getName(), new CardView(token)));
  checkPaid(stackObject.getId(), (StackAbility) stackObject);
} else if (object instanceof Emblem) {
origin: magefree/mage

@Override
public void adjustTargets(Ability ability, Game game) {
  if (getToken().getCopySourceCard() != null) {
    getToken().getCopySourceCard().adjustTargets(ability, game);
  } else {
    super.adjustTargets(ability, game);
  }
}
origin: magefree/mage

public PermanentToken(Token token, UUID controllerId, String expansionSetCode, Game game) {
  super(controllerId, controllerId, token.getName());
  this.expansionSetCode = expansionSetCode;
  this.token = token.copy();
  this.token.getAbilities().newOriginalId(); // neccessary if token has ability like DevourAbility()
  this.token.getAbilities().setSourceId(objectId);
  this.power.modifyBaseValue(token.getPower().getBaseValueModified());
  this.toughness.modifyBaseValue(token.getToughness().getBaseValueModified());
  this.copyFromToken(this.token, game, false); // needed to have at this time (e.g. for subtypes for entersTheBattlefield replacement effects)
}
origin: magefree/mage

@Override
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
  for (Permanent entering : game.getPermanentsEntering().values()) {
    if (entering.getId().equals(copyToObjectId) && entering instanceof PermanentToken) {
      UUID originalCardId = ((PermanentToken) entering).getToken().getCopySourceCard().getId();
      EmbalmedThisTurnWatcher watcher = game.getState().getWatcher(EmbalmedThisTurnWatcher.class);
      if (watcher != null) {
        for (MageObjectReference mor : watcher.getEmbalmedThisTurnCards()) {
          if (mor.getSourceId().equals(originalCardId) && game.getState().getZoneChangeCounter(originalCardId) == mor.getZoneChangeCounter()) {
            permanent.getManaCost().clear();
            if (!permanent.hasSubtype(SubType.ZOMBIE, game)) {
              permanent.getSubtype(game).add(SubType.ZOMBIE);
            }
            permanent.getColor(game).setColor(ObjectColor.WHITE);
          }
        }
      }
    }
  }
  return true;
}
origin: magefree/mage

original = new CardView(((PermanentToken) permanent).getToken());
original.expansionSetCode = permanent.getExpansionSetCode();
tokenSetCode = original.getTokenSetCode();
origin: magefree/mage

  sourceObj = ((PermanentToken) source).getToken();
  target.setCopySourceCard(((PermanentToken) source).getToken().getCopySourceCard());
} else if (source instanceof PermanentCard) {
  if (((PermanentCard) source).isMorphed() || ((PermanentCard) source).isManifested()) {
mage.game.permanentPermanentToken

Most used methods

  • getToken
  • <init>
  • getExpansionSetCode
  • addAbility
  • copyFromToken
  • getId
  • getManaCost
  • getName
  • getRules
  • getTokenDescriptor
  • removeSummoningSickness
  • setTapped
  • removeSummoningSickness,
  • setTapped

Popular in Java

  • Making http requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (Timer)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now