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

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

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

Ability.getControllerId介绍

[英]Gets the id of the player in control of this ability.
[中]获取控制此技能的玩家的id。

代码示例

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

@Override
public Abilities<ActivatedManaAbilityImpl> getAvailableActivatedManaAbilities(Zone zone, Game game) {
  return stream()
      .filter(ability -> ability instanceof ActivatedManaAbilityImpl)
      .filter(ability -> ability.getZone().match(zone))
      .filter(ability -> (((ActivatedManaAbilityImpl) ability).canActivate(ability.getControllerId(), game).canActivate()))
      .map(ability -> (ActivatedManaAbilityImpl) ability)
      .collect(Collectors.toCollection(AbilitiesImpl::new));
}

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

@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
  int count = 0;
  for (CombatGroup combatGroup : game.getCombat().getGroups()) {
    if (combatGroup.getDefenderId().equals(sourceAbility.getControllerId())) {
      count += combatGroup.getAttackers().size();
    }
  }
  return count * 3;
}

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

@Override
public boolean apply(Game game, Ability source) {
  int damage = 0;
  for (UUID opponentId: game.getOpponents(source.getControllerId())) {
    damage += game.getPlayer(opponentId).damage(3, source.getSourceId(), game, false, true);
  }
  game.getPlayer(source.getControllerId()).gainLife(damage, game, source);
  return true;
}

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

@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
  if (abilityToModify instanceof SpellAbility) {
    if (abilityToModify.isControlledBy(source.getControllerId())) {
      return SpellAbilityCastMode.FLASHBACK.equals(((SpellAbility) abilityToModify).getSpellAbilityCastMode());
    }
  }
  return false;
}

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

@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
  int value = game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game);
  if (multiplier != null) {
    value *= multiplier;
  }
  return value;
}

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

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(source.getControllerId());
  if (player != null) {
    player.gainLife(player.getLife(), game, source);
    return true;
  }
  return false;
}

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

@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
  if (sourceAbility != null) {
    Player controller = game.getPlayer(sourceAbility.getControllerId());
    if (controller != null) {
      return controller.getHand().size();
    }
  }
  return 0;
}

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

@Override
public boolean apply(Game game, Ability source) {
  PlayerAttackedStepWatcher watcher = game.getState().getWatcher(PlayerAttackedStepWatcher.class);
  return watcher != null
      && watcher.getNumberAttackingCurrentStep(source.getControllerId()) > 0;
}

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

@Override
public boolean applies(GameEvent event, Ability source, Game game) {
  if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
    Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
    if (permanent != null && (permanent.isCreature() || permanent.isArtifact())) {
      return true;
    }
  }
  return false;
}

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

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(source.getControllerId());
  if (player != null) {
    player.getManaPool().addMana(getMana(game, source), game, source);
  }
  return true;
}

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

@Override
public boolean apply(Game game, Ability source) {
  int sumPower = 0;
  for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
    sumPower += permanent.getPower().getValue();
  }
  return sumPower >= 8;
}

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

@Override
  public boolean apply(Game game, Ability source) {
    for (UUID opponentId : game.getOpponents(source.getControllerId())) {
      Token token = new SoldierToken();
      token.putOntoBattlefield(1, game, source.getSourceId(), opponentId);
    }
    return true;
  }
}

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

@Override
public boolean applies(GameEvent event, Ability source, Game game) {
  Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
  return creature != null && creature.isControlledBy(source.getControllerId())
      && creature.isCreature()
      && creature.hasSubtype(SubType.WARRIOR, game)
      && !event.getTargetId().equals(source.getSourceId());
}

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

@Override
  public boolean apply(Game game, Ability source) {
    Permanent target = game.getBattlefield().getPermanent(source.getFirstTarget());
    if (target != null) {
      if (filter.match(target, source.getSourceId(), source.getControllerId(), game)) {
        return true;
      }
    }
    return false;
  }
}

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

@Override
  public boolean apply(Game game, Ability source) {
    FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Eldrazi Spawn");
    filter.add(new SubtypePredicate(SubType.ELDRAZI));
    filter.add(new SubtypePredicate(SubType.SPAWN));

    EldraziSpawnToken token = new EldraziSpawnToken();
    int count = game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0 ? 3 : 1;
    token.putOntoBattlefield(count, game, source.getSourceId(), source.getControllerId());
    return true;
  }
}

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

@Override
public boolean apply(Game game, Ability source) {
  for (UUID opponentId : game.getOpponents(source.getControllerId())) {
    Player opponent = game.getPlayer(opponentId);
    if (opponent != null) {
      opponent.moveCards(opponent.getLibrary().getTopCards(game, 7), Zone.GRAVEYARD, source, game);
    }
  }
  return true;
}

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

@Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      CreateTokenEffect effect = new CreateTokenEffect(new ElementalToken("OGW", 1, true), 2);
      effect.apply(game, source);
      effect.exileTokensCreatedAtNextEndStep(game, source);
      return true;
    }

    return false;
  }
}

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

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
  Player controller = game.getPlayer(source.getControllerId());
  Player opponent = game.getPlayer(event.getPlayerId());
  if (controller != null && opponent != null) {
    controller.drawCards(1, game, event.getAppliedEffects());
    opponent.drawCards(1, game, event.getAppliedEffects());
    return true;
  }
  return false;
}

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

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  if (controller != null) {
    int result = controller.rollDice(game, 6);
    if (result == 6) {
      new SacrificeSourceEffect().apply(game, source);
      return (new CreateTokenEffect(new GiantChickenToken(), 1)).apply(game, source);
    }
  }
  return false;
}

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

@Override
public boolean apply(Game game, Ability source) {
  SpecialAction newAction = (SpecialAction) action.copy();
  newAction.setSourceId(source.getSourceId());
  newAction.setControllerId(source.getControllerId());
  newAction.getTargets().addAll(source.getTargets());
  game.getState().getSpecialActions().add(newAction);
  return true;
}

相关文章