mage.abilities.Ability.getSourcePermanentIfItStillExists()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(57)

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

Ability.getSourcePermanentIfItStillExists介绍

[英]Returns the permanent that actually existed while the ability triggerd or an ability was activated only if it has not changed zone meanwhile. If not set yet, the current permanent if one exists will be retrieved from the game and returned.
[中]返回在触发异能或激活异能时实际存在的永久物,前提是该异能未同时更改。如果尚未设置,将从游戏中检索并返回当前永久值(如果存在)。

代码示例

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

@Override
public Permanent getSourcePermanentIfItStillExists(Game game) {
  return this.ability.getSourcePermanentIfItStillExists(game);
}

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

@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
  return permanent.equals(source.getSourcePermanentIfItStillExists(game));
}

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

@Override
  public boolean apply(Game game, Ability source) {
    Permanent permanent = source.getSourcePermanentIfItStillExists(game);
    if (permanent != null) {
      return permanent.phaseOut(game);
    }
    return false;
  }
}

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

@Override
  public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
    Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
    return sourcePermanent != null && sourceId.equals(sourcePermanent.getAttachedTo());
  }
}

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

@Override
  public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
    Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
    return sourcePermanent != null && sourceId.equals(sourcePermanent.getAttachedTo());
  }
}

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

@Override
public boolean apply(Game game, Ability source) {
  Permanent permanent = source.getSourcePermanentIfItStillExists(game);
  if (permanent != null) {
    permanent.destroy(source.getSourceId(), game, noRegen);
    return true;
  }
  return false;
}

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

@Override
public boolean apply(Game game, Ability source) {
  Permanent permanent = source.getSourcePermanentIfItStillExists(game);
  if (permanent != null) {
    return permanent.changeControllerId(source.getFirstTarget(), game);
  } else {
    discard();
  }
  return false;
}

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

@Override
public void init(Ability source, Game game) {
  super.init(source, game); //To change body of generated methods, choose Tools | Templates.
  if (duration.isOnlyValidIfNoZoneChange()) {
    // If source permanent is no longer onto battlefield discard the effect
    if (source.getSourcePermanentIfItStillExists(game) == null) {
      discard();
    }
  }
}

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

@Override
public void init(Ability source, Game game) {
  super.init(source, game); //To change body of generated methods, choose Tools | Templates.
  if (duration.isOnlyValidIfNoZoneChange()) {
    // If source permanent is no longer onto battlefield discard the effect
    if (source.getSourcePermanentIfItStillExists(game) == null) {
      discard();
    }
  }
}

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

@Override
public void init(Ability source, Game game) {
  super.init(source, game); //To change body of generated methods, choose Tools | Templates.
  if (duration.isOnlyValidIfNoZoneChange()) {
    // If source permanent is no longer onto battlefield discard the effect
    if (source.getSourcePermanentIfItStillExists(game) == null) {
      discard();
    }
  }
}

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

@Override
public void init(Ability source, Game game) {
  super.init(source, game); //To change body of generated methods, choose Tools | Templates.
  if (duration.isOnlyValidIfNoZoneChange()) {
    // If source permanent is no longer onto battlefield discard the effect
    if (source.getSourcePermanentIfItStillExists(game) == null) {
      discard();
    }
  }
}

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

@Override
public void init(Ability source, Game game) {
  super.init(source, game); //To change body of generated methods, choose Tools | Templates.
  if (duration.isOnlyValidIfNoZoneChange()) {
    // If source permanent is no longer onto battlefield discard the effect
    if (source.getSourcePermanentIfItStillExists(game) == null) {
      discard();
    }
  }
}

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

@Override
public void init(Ability source, Game game) {
  super.init(source, game); //To change body of generated methods, choose Tools | Templates.
  if (duration.isOnlyValidIfNoZoneChange()) {
    // If source permanent is no longer onto battlefield discard the effect
    if (source.getSourcePermanentIfItStillExists(game) == null) {
      discard();
    }
  }
}

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

@Override
public boolean apply(Game game, Ability source) {
  Permanent permanent = source.getSourcePermanentIfItStillExists(game);
  if (permanent != null) {
    Permanent attach = game.getPermanent(permanent.getAttachedTo());
    if (attach != null) {
      attach.tap(game);
      return true;
    }
  }
  return false;
}

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

@Override
public boolean apply(Game game, Ability source) {
  Permanent permanent = source.getSourcePermanentIfItStillExists(game);
  if (permanent != null) {
    int count = permanent.getCounters(game).getCount(counterType);
    permanent.removeCounters(counterType.getName(), count, game);
    return true;
  }
  return false;
}

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

@Override
public boolean apply(Game game, Ability source) {
  Permanent permanent = source.getSourcePermanentIfItStillExists(game);
  Player player = null;
  if (permanent != null) {
    player = game.getPlayer(permanent.getControllerId());
  }
  if (player != null) {
    player.loseLife(amount.calculate(game, source, this), game, false);
    return true;
  }
  return false;
}

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

@Override
protected PreventionEffectData preventDamageAction(GameEvent event, Ability source, Game game) {
  Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
  if (sourcePermanent != null) {
    return game.preventDamage(event, source, game, sourcePermanent.getCounters(game).getCount(CounterType.AGE));
  } else {
    this.discard();
    return game.preventDamage(event, source, game, 0);
  }
}

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

@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
  Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
  if (sourcePermanent != null && sourcePermanent.isAttacking()){
    Player controller = game.getPlayer(source.getControllerId());
    Permanent otherCreature = game.getPermanent(sourceId);
    if (controller != null && otherCreature != null && otherCreature.isControlledBy(controller.getId())){
      return controller.chooseUse(Outcome.Damage, "Do you wish to assign damage for "
          + otherCreature.getLogName() + " as though it weren't blocked?", source, game);
    }
  }
  return false;
}

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

@Override
  public boolean apply(Game game, Ability source) {
    Permanent targetPermanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
    if (targetPermanent != null && new ExileTargetEffect().apply(game, source)) {
      Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
      if (sourcePermanent != null) {
        ContinuousEffect effect = new ActOfAuthorityGainControlEffect(Duration.Custom, targetPermanent.getControllerId());
        effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
        game.addEffect(effect, source);
      }
      return true;
    }
    return false;
  }
}

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

@Override
public boolean apply(Game game, Ability source) {
  StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
  if (stackObject != null && game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game)) {
    Permanent sourcePermanent = stackObject.getStackAbility().getSourcePermanentIfItStillExists(game);
    if (sourcePermanent != null) {
      InterdictCantActivateEffect effect = new InterdictCantActivateEffect();
      effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
      game.getContinuousEffects().addEffect(effect, source);
    }
    return true;
  }
  return false;
}

相关文章