gpt4 book ai didi

mage.constants.Zone类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 07:35:31 26 4
gpt4 key购买 nike

本文整理了Java中mage.constants.Zone类的一些代码示例,展示了Zone类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zone类的具体详情如下:
包路径:mage.constants.Zone
类名称:Zone

Zone介绍

暂无

代码示例

代码示例来源:origin: magefree/mage

@Override
  public String toString() {
    return "Zone(" + zone.toString() + ')';
  }
}

代码示例来源:origin: magefree/mage

@Override
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID affectedControllerId) {
  if (affectedAbility != null && affectedAbility.getSourceId().equals(source.getSourceId())
      && affectedControllerId.equals(source.getControllerId())) {
    return game.getState().getZone(objectId).equals(Zone.GRAVEYARD);
  }
  return false;
}

代码示例来源:origin: magefree/mage

@Override
public boolean apply(Ability input, Game game) {
  return input.getZone().match(zone);
}

代码示例来源:origin: magefree/mage

@Override
public boolean checkTrigger(GameEvent event, Game game) {
  ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
  for (Zone z : Zone.values()) {
    if (game.getShortLivingLKI(sourceId, z) && z != Zone.GRAVEYARD) {
      return false;
    }
  }
  if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
    if (filter.match(zEvent.getTarget(), sourceId, controllerId, game)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: magefree/mage

@Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = source.getSourceObject(game);
    if (controller != null && sourceObject != null) {
      Set<Card> toExile = new HashSet<>();
      for (UUID permanentId : targetPointer.getTargets(game, source)) {
        Permanent target = game.getPermanent(permanentId);
        if (target != null) {
          toExile.add(target);
        }
      }
      controller.moveCards(toExile, Zone.EXILED, source, game);
      game.applyEffects();
      Set<Card> toBattlefield = new HashSet<>();
      for (Card card : toExile) {
        Zone currentZone = game.getState().getZone(card.getId());
        if (Zone.BATTLEFIELD != currentZone && currentZone.isPublicZone()) {
          toBattlefield.add(card);
        }
      }
      controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);
      return true;
    }
    return false;
  }
}

代码示例来源:origin: magefree/mage

@Override
public boolean checkTrigger(GameEvent event, Game game) {
  ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
  for (Zone z : Zone.values()) {
    if (game.getShortLivingLKI(sourceId, z) && z != Zone.GRAVEYARD) {
      return false;
    }
  }
  if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {            
    if (zEvent.getTarget() != null &&
        zEvent.getTarget().isOwnedBy(this.getControllerId()) &&
        zEvent.getTarget().isCreature()&&
        !zEvent.getTarget().getId().equals(this.getSourceId())) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: magefree/mage

@Override
  public boolean apply(Game game, Ability source) {
    Card card = game.getCard(source.getSourceId());
    Player controller = game.getPlayer(source.getControllerId());
    if (card != null && controller != null) {
      Zone zone = game.getState().getZone(card.getId());
      // cards needs to be in public non battlefield zone
      if (zone == Zone.BATTLEFIELD || !zone.isPublicZone()) {
        return true;
      }
      game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
      controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, false, null);
    }
    return true;
  }
}

代码示例来源:origin: magefree/mage

private void setText() {
    staticText = "target player exiles " + CardUtil.numberToText(amount, "a") + ' ' + filter.getMessage() + " from their " + zone.toString().toLowerCase(Locale.ENGLISH);
  }
}

代码示例来源:origin: magefree/mage

@Override
public boolean apply(StackObject input, Game game) {
  return input instanceof Spell && ((Spell) input).getFromZone().match(zone);
}

代码示例来源:origin: magefree/mage

@Override
  public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
    Card card = game.getCard(objectId);
    if (card != null) {
      return (affectedControllerId.equals(source.getControllerId())
          && StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY.match(card, game)
          && Zone.GRAVEYARD.equals(game.getState().getZone(card.getId())));
    }
    return false;
  }
}

代码示例来源:origin: magefree/mage

.append(" puts ").append(withName ? card.getLogName() : "a card").append(' ');
if (fromZone != null) {
  sb.append("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(' ');

代码示例来源:origin: magefree/mage

@Override
public Abilities<ActivatedAbility> getPlayableAbilities(Zone zone) {
  return stream()
      .filter(ability -> (ability instanceof ActivatedAbility))
      .filter(ability -> ability.getZone().match(zone))
      .map(ability -> (ActivatedAbility) ability)
      .collect(Collectors.toCollection(AbilitiesImpl::new));
}

代码示例来源:origin: magefree/mage

boolean isCastFromPlayersLibrary(Game game, UUID playerId) {
  if (!game.getStack().isEmpty()) {
    StackObject stackObject = game.getStack().getLast();
    return stackObject instanceof Spell
        && !((Spell) stackObject).isDoneActivatingManaAbilities()
        && Zone.LIBRARY.equals(((Spell) stackObject).getFromZone());
  }
  return false;
}

代码示例来源:origin: magefree/mage

sb.append(targetPickedCards.toString().toLowerCase(Locale.ENGLISH));

代码示例来源:origin: magefree/mage

@Override
public Abilities<ActivatedAbility> getActivatedAbilities(Zone zone) {
  return stream()
      .filter(ability -> ability instanceof ActivatedAbility)
      .filter(ability -> ability.getZone().match(zone))
      .map(ability -> (ActivatedAbility) ability)
      .collect(Collectors.toCollection(AbilitiesImpl::new));
}

代码示例来源:origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  MageObject sourceObject = game.getObject(source.getSourceId());
  if (controller != null && sourceObject != null) {
    Set<Card> cards = new HashSet<>(controller.getLibrary().getTopCards(game, 3));
    if (!cards.isEmpty()) {
      controller.moveCardsToExile(cards, source, game, true, source.getSourceId(), sourceObject.getIdName());
      // remove cards that could not be moved to exile
      for (Card card : cards) {
        if (!Zone.EXILED.equals(game.getState().getZone(card.getId()))) {
          cards.remove(card);
        }
      }
      if (!cards.isEmpty()) {
        ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn);
        effect.setTargetPointer(new FixedTargets(cards, game));
        game.addEffect(effect, source);
      }
    }
    return true;
  }
  return false;
}

代码示例来源:origin: magefree/mage

public void initComponents() {
  hand = new mage.client.cards.Cards(true);
  hand.setMinOffsetY(HAND_MIN_CARDS_OFFSET_Y);
  hand.setCardDimension(GUISizeHelper.handCardDimension);
  jPanel = new JPanel();
  jScrollPane1 = new JScrollPane(jPanel);
  jScrollPane1.getViewport().setBackground(new Color(0, 0, 0, 0));
  jPanel.setLayout(new GridBagLayout()); // centers hand
  jPanel.setBackground(new Color(0, 0, 0, 0));
  jPanel.add(hand);
  setOpaque(false);
  jPanel.setOpaque(false);
  jScrollPane1.setOpaque(false);
  jPanel.setBorder(EMPTY_BORDER);
  jScrollPane1.setBorder(EMPTY_BORDER);
  jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
  jScrollPane1.getHorizontalScrollBar().setUnitIncrement(8);
  jScrollPane1.setViewportBorder(EMPTY_BORDER);
  setLayout(new BorderLayout());
  add(jScrollPane1, BorderLayout.CENTER);
  hand.setHScrollSpeed(8);
  hand.setBackgroundColor(new Color(0, 0, 0, 0));
  hand.setVisibleIfEmpty(false);
  hand.setBorder(EMPTY_BORDER);
  hand.setZone(Zone.HAND.toString());
}

代码示例来源:origin: magefree/mage

@Override
public Abilities<StaticAbility> getStaticAbilities(Zone zone) {
  return stream()
      .filter(ability -> ability instanceof StaticAbility)
      .filter(ability -> ability.getZone().match(zone))
      .map(ability -> (StaticAbility) ability)
      .collect(Collectors.toCollection(AbilitiesImpl::new));
}

代码示例来源:origin: magefree/mage

@Override
  public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
    if (!(source instanceof FlashbackAbility)
        && affectedControllerId.equals(source.getControllerId())
        && game.isActivePlayer(source.getControllerId())) {
      Card card = game.getCard(objectId);
      if (card != null
          && (card.isInstant()
          || card.isSorcery())
          && game.getState().getZone(objectId).equals(Zone.GRAVEYARD)) {
        // check if not already a card was cast this turn with this ability
        KessDissidentMageWatcher watcher = game.getState().getWatcher(KessDissidentMageWatcher.class);
        return watcher != null
            && !watcher.isAbilityUsed(new MageObjectReference(source.getSourceId(), game));
      }
    }
    return false;
  }
}

代码示例来源:origin: magefree/mage

@Override
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId,
    Game game, Zone fromZone
) {
  if (card == null) {
    return false;
  }
  boolean result = false;
  //    Zone fromZone = game.getState().getZone(card.getId());
  if (card.moveToZone(Zone.GRAVEYARD, sourceId, game, fromZone != null && fromZone == Zone.BATTLEFIELD)) {
    if (!game.isSimulation()) {
      if (card instanceof PermanentCard && game.getCard(card.getId()) != null) {
        card = game.getCard(card.getId());
      }
      StringBuilder sb = new StringBuilder(this.getLogName())
          .append(" puts ").append(card.getLogName()).append(' ').append(card.isCopy() ? "(Copy) " : "")
          .append(fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + ' ' : "");
      if (card.isOwnedBy(getId())) {
        sb.append("into their graveyard");
      } else {
        sb.append("it into its owner's graveyard");
      }
      game.informPlayers(sb.toString());
    }
    result = true;
  }
  return result;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com