Tabnine Logo
ConditionalMana
Code IndexAdd Tabnine to your IDE (free)

How to use
ConditionalMana
in
mage

Best Java code snippets using mage.ConditionalMana (Showing top 11 results out of 315)

origin: magefree/mage

private void removeConditional(ManaType manaType, Ability ability, Game game, Cost costToPay, Mana usedManaToPay) {
  for (ConditionalMana mana : getConditionalMana()) {
    if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) {
      mana.set(manaType, mana.get(manaType) - 1);
      usedManaToPay.increase(manaType);
      GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAID, ability.getId(), mana.getManaProducerId(), ability.getControllerId(), 0, mana.getFlag());
      event.setData(mana.getManaProducerOriginalId().toString());
      game.fireEvent(event);
      break;
    }
  }
}
origin: magefree/mage

public ManaPoolView(ManaPool pool) {
  this.red = pool.getRed();
  this.green = pool.getGreen();
  this.blue = pool.getBlue();
  this.white = pool.getWhite();
  this.black = pool.getBlack();
  this.colorless = pool.getColorless();
  for (ConditionalMana mana : pool.getConditionalMana()) {
    this.red += mana.getRed();
    this.green += mana.getGreen();
    this.blue += mana.getBlue();
    this.white += mana.getWhite();
    this.black += mana.getBlack();
    this.colorless += mana.getColorless();
  }
}
origin: magefree/mage

@Override
public ConditionalMana copy() {
  return new ConditionalMana(this);
}
origin: magefree/mage

public int getConditionalCount(Ability ability, Game game, FilterMana filter, Cost costToPay) {
  if (ability == null || getConditionalMana().isEmpty()) {
    return 0;
  }
  int count = 0;
  for (ConditionalMana mana : getConditionalMana()) {
    if (mana.apply(ability, game, mana.getManaProducerId(), costToPay)) {
      count += mana.count(filter);
    }
  }
  return count;
}
origin: magefree/mage

if (item.isConditional()) {
  ConditionalMana c = item.getConditionalMana();
  if (c.apply(ability, game, c.getManaProducerId(), null)) {
    int count = c.count(filter);
    if (count > 0) {
      total += count;
      c.removeAll(filter);
      if (c.count() == 0) {
        it.remove();
origin: magefree/mage

private int payX(Ability ability, Game game) {
  int total = 0;
  Iterator<ManaPoolItem> it = manaItems.iterator();
  while (it.hasNext()) {
    ManaPoolItem item = it.next();
    if (item.isConditional()) {
      ConditionalMana cm = item.getConditionalMana();
      if (cm.apply(ability, game, cm.getManaProducerId(), null)) {
        total += item.count();
        it.remove();
      }
    } else {
      total += item.count();
      it.remove();
    }
  }
  return total;
}
origin: magefree/mage

private int getConditional(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay) {
  if (ability == null || getConditionalMana().isEmpty()) {
    return 0;
  }
  for (ManaPoolItem mana : manaItems) {
    if (mana.isConditional()
        && mana.getConditionalMana().get(manaType) > 0
        && mana.getConditionalMana().apply(ability, game, mana.getSourceId(), costToPay)) {
      if (filter == null || filter.match(mana.getSourceObject(), game)) {
        return mana.getConditionalMana().get(manaType);
      }
    }
  }
  return 0;
}
origin: magefree/mage

if (conditionalItem.get(manaType) > 0) {
  if (item.getDuration() != Duration.EndOfTurn || game.getPhase().getType() == TurnPhase.END) {
    if (game.replaceEvent(new GameEvent(GameEvent.EventType.EMPTY_MANA_POOL, playerId, null, playerId))) {
      int amount = conditionalItem.get(manaType);
      conditionalItem.clear(manaType);
      conditionalItem.add(ManaType.COLORLESS, amount);
    } else {
      total += conditionalItem.get(manaType);
      conditionalItem.clear(manaType);
origin: magefree/mage

  mana = new ConditionalMana(manaBuilder.setMana(choice.getMana(value), source, game).build());
  break;
} else {
  if (mana == null) {
    mana = new ConditionalMana(manaBuilder.setMana(choice.getMana(1), source, game).build());
  } else {
    mana.add(choice.getMana(1));
origin: magefree/mage

for (Mana netMana : manaAbility.getNetMana(game)) {
  if (cost.testPay(netMana)) {
    if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
      continue;
for (Mana netMana : manaAbility.getNetMana(game)) {
  if (cost.testPay(netMana) || permittingObject != null) {
    if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
      continue;
for (Mana netMana : manaAbility.getNetMana(game)) {
  if (cost.testPay(netMana) || permittingObject != null) {
    if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
      continue;
for (Mana netMana : manaAbility.getNetMana(game)) {
  if (cost.testPay(netMana) || permittingObject != null) {
    if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
      continue;
for (Mana netMana : manaAbility.getNetMana(game)) {
  if (cost.testPay(netMana) || permittingObject != null) {
    if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
      continue;
for (Mana netMana : manaAbility.getNetMana(game)) {
  if (cost.testPay(netMana) || permittingObject != null) {
    if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
      continue;
origin: magefree/mage

@Override
public Mana produceMana(boolean netMana, Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  if (controller == null) {
    return null;
  }
  ManaPool pool = controller.getManaPool();
  int blackMana = pool.getBlack();
  int whiteMana = pool.getWhite();
  int blueMana = pool.getBlue();
  int greenMana = pool.getGreen();
  int redMana = pool.getRed();
  int colorlessMana = pool.getColorless();
  for (ConditionalMana conditionalMana : pool.getConditionalMana()) {
    blackMana += conditionalMana.getBlack();
    whiteMana += conditionalMana.getWhite();
    blueMana += conditionalMana.getBlue();
    greenMana += conditionalMana.getGreen();
    redMana += conditionalMana.getRed();
    colorlessMana += conditionalMana.getColorless();
  }
  return new Mana(redMana, greenMana, blueMana, whiteMana, blackMana, 0, 0, colorlessMana);
}
mageConditionalMana

Most used methods

  • apply
  • getBlack
  • getBlue
  • getColorless
  • getGreen
  • getRed
  • getWhite
  • <init>
  • add
  • clear
  • copy
  • count
  • copy,
  • count,
  • get,
  • getDescription,
  • getFlag,
  • getManaProducerId,
  • getManaProducerOriginalId,
  • removeAll,
  • set,
  • setManaProducerId

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • notifyDataSetChanged (ArrayAdapter)
  • onCreateOptionsMenu (Activity)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Runner (org.openjdk.jmh.runner)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now