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

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

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

Ability.newOriginalId介绍

[英]Assigns a new java.util.UUID
[中]分配一个新的java。util。UUID

代码示例

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

@Override
public void newOriginalId() {
  for (Ability ability : this) {
    ability.newOriginalId();
  }
}

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

@Override
  public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getSourceId());
    Permanent creature = game.getPermanent(source.getTargets().getFirstTarget());

    if (permanent != null && creature != null) {
      for (ActivatedAbility ability : creature.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
        Ability newAbility = ability.copy();
        newAbility.newOriginalId();
        game.addEffect(new GainAbilitySourceEffect(newAbility, Duration.EndOfTurn), source);
      }
      return true;
    }
    return false;
  }
}

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

ability.newOriginalId(); // The token is independant from the copy from object so it need a new original Id, otherwise there are problems to check for created continuous effects to check if the source (the Token) has still this ability

相关文章