gpt4 book ai didi

mage.game.events.ZoneChangeEvent.getTargetId()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 10:15:51 27 4
gpt4 key购买 nike

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

ZoneChangeEvent.getTargetId介绍

暂无

代码示例

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

@Override
  public boolean applies(GameEvent event, Ability source, Game game) {
    ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
    return zEvent.getToZone() == Zone.GRAVEYARD
        && zEvent.getTargetId().equals(this.cardId);
  }
}

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

@Override
  public boolean applies(GameEvent event, Ability source, Game game) {
    ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
    return zEvent.getToZone() == Zone.GRAVEYARD
        && zEvent.getTargetId().equals(this.cardId);
  }
}

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

@Override
  public boolean applies(GameEvent event, Ability source, Game game) {
    ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
    return zEvent.getToZone() == Zone.GRAVEYARD
        && zEvent.getTargetId().equals(this.cardId);
  }
}

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

@Override
  public boolean applies(GameEvent event, Ability source, Game game) {
    ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
    return zEvent.getToZone() == Zone.GRAVEYARD
        && zEvent.getTargetId().equals(this.cardId);
  }
}

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

@Override
  public boolean applies(GameEvent event, Ability source, Game game) {
    ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
    return zEvent.getToZone() == Zone.GRAVEYARD
        && zEvent.getTargetId().equals(this.cardId);
  }
}

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

@Override
  public boolean applies(GameEvent event, Ability source, Game game) {
    ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
    if (zEvent.getToZone() == Zone.BATTLEFIELD) {
      Card card = game.getCard(zEvent.getTargetId());
      if (card != null && card.isLand()) {
        return true;
      }
    }
    return false;
  }
}

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

@Override
public void watch(GameEvent event, Game game) {
  if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
    ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
    if (zEvent.isDiesEvent()
        && zEvent.getTarget() != null
        && zEvent.getTarget().isCreature()) {
      diedThisTurn.add(zEvent.getTargetId());
    }
  }
}

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

@Override
public boolean checkTrigger(GameEvent event, Game game) {
  ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
  if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getTarget() != null && zEvent.getTargetId().equals(getTargets().getFirstTarget())) {
    this.getTargets().clear(); // else spell fizzles because target creature died
    return true;
  }
  return false;
}

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

@Override
public boolean applies(GameEvent event, Ability source, Game game) {
  ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
  if (zEvent.getToZone() == Zone.BATTLEFIELD && (zEvent.getFromZone() == Zone.GRAVEYARD || zEvent.getFromZone() == Zone.LIBRARY)) {
    Card card = game.getCard(zEvent.getTargetId());
    if (card != null && card.isCreature()) {
      return true;
    }
  }
  return false;
}

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

@Override
public boolean checkTrigger(GameEvent event, Game game) {
  if (event.getTargetId().equals(getSourceId())) {
    ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
    Permanent permanent = zEvent.getTarget();
    if (permanent != null
        && zEvent.getToZone() == Zone.GRAVEYARD
        && zEvent.getFromZone() == Zone.BATTLEFIELD) {
      return !onlyToControllerGraveyard || this.isControlledBy(game.getOwnerId(zEvent.getTargetId()));
    }
  }
  return false;
}

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

public static boolean cast(ZoneChangeInfo info, Game game) {
  if (maybeRemoveFromSourceZone(info, game)) {
    placeInDestinationZone(info, game);
    // create a group zone change event if a card is moved to stack for casting (it's always only one card, but some effects check for group events (one or more xxx))
    Set<Card> cards = new HashSet<>();
    Card targetCard = getTargetCard(game, info.event.getTargetId());
    cards.add(targetCard);
    game.fireEvent(new ZoneChangeGroupEvent(cards, info.event.getSourceId(), info.event.getPlayerId(), info.event.getFromZone(), info.event.getToZone()));
    // normal movement
    game.fireEvent(info.event);
    return true;
  }
  return false;
}

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

@Override
public void watch(GameEvent event, Game game) {
  if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
    ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
    if (zEvent.isDiesEvent() && zEvent.getTarget() != null
        && zEvent.getTarget().isCreature()
        && !(zEvent.getTarget() instanceof PermanentToken)) {
      int count = getAmountOfNontokenCreatureDiedThisTurn(zEvent.getTargetId());
      amountOfCreaturesThatDied.put(zEvent.getTarget().getControllerId(), ++count);
    }
  }
}

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

@Override
public boolean checkTrigger(GameEvent event, Game game) {
  ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
  if (zEvent.isDiesEvent()) {
    Permanent permanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId());
    if (permanent != null && game.getOpponents(controllerId).contains(permanent.getOwnerId())) {
      this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getOwnerId()));
      return true;
    }
  }
  return false;
}

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

@Override
public boolean checkTrigger(GameEvent event, Game game) {
  ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
  if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
    Permanent permanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId());
    if (permanent != null
        && permanent.isCreature()
        && permanent.getCounters(game).containsKey(CounterType.M1M1)) {
      return true;
    }
  }
  return false;
}

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

@Override
public boolean checkTrigger(GameEvent event, Game game) {
  ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
  if (zEvent.getFromZone() == Zone.GRAVEYARD) {
    Card card = game.getCard(zEvent.getTargetId());
    Player controller = game.getPlayer(getControllerId());
    return card != null
        && card.isCreature()
        && controller != null
        && controller.hasOpponent(card.getOwnerId(), game);
  }
  return false;
}

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

@Override
public boolean checkTrigger(GameEvent event, Game game) {
  ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
  if (zEvent.getToZone() == Zone.GRAVEYARD && zEvent.getFromZone() == Zone.BATTLEFIELD) {
    Card card = game.getCard(zEvent.getTargetId());
    Player controller = game.getPlayer(getControllerId());
    return card != null && controller != null && controller.hasOpponent(card.getOwnerId(), game);
  }
  return false;
}

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

@Override
public boolean checkTrigger(GameEvent event, Game game) {
  ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
  if (zEvent.isDiesEvent() && zEvent.getTarget() != null && zEvent.getTargetId().equals(getTargets().getFirstTarget())) {
    this.getTargets().clear(); // else spell fizzles because target creature died
    Target target = new TargetPlayer();
    target.add(zEvent.getTarget().getControllerId(), game);
    this.addTarget(target);
    return true;
  }
  return false;
}

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

@Override
public boolean checkTrigger(GameEvent event, Game game) {
  ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
  if (zEvent.getToZone() == Zone.GRAVEYARD
      && zEvent.getFromZone() == Zone.BATTLEFIELD
      && zEvent.getTarget().isArtifact()
      && zEvent.getTarget().isOwnedBy(this.controllerId)) {
    this.getEffects().setTargetPointer(new FixedTarget(zEvent.getTargetId()));
    return true;
  }
  return false;
}

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

private static Card takeAttributesFromSpell(Card card, ZoneChangeEvent event, Game game) {
  card = card.copy();
  if (Zone.STACK == event.getFromZone()) {
    Spell spell = game.getStack().getSpell(event.getTargetId());
    if (spell != null && !spell.isFaceDown(game)) {
      if (!card.getColor(game).equals(spell.getColor(game))) {
        // the card that is referenced to in the permanent is copied and the spell attributes are set to this copied card
        card.getColor(game).setColor(spell.getColor(game));
      }
    }
  }
  return card;
}

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

@Override
public boolean checkTrigger(GameEvent event, Game game) {
  ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
  if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
    Permanent permanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId());
    if (permanent != null
        && permanent.isCreature()
        && permanent.getCounters(game).containsKey(CounterType.FUNGUS)) {
      Effect effect = this.getEffects().get(0);
      effect.setTargetPointer(new FixedTarget(event.getTargetId()));
      return true;
    }
  }
  return false;
}

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