Codota Logo
Player.rollDice
Code IndexAdd Codota to your IDE (free)

How to use
rollDice
method
in
mage.players.Player

Best Java code snippets using mage.players.Player.rollDice (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      int firstRoll = controller.rollDice(game, 6);
      int secondRoll = controller.rollDice(game, 6);
      game.addEffect(new SetPowerToughnessSourceEffect(firstRoll, secondRoll, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source);
      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 thisRoll = controller.rollDice(game, 6);
      int thatRoll = controller.rollDice(game, 6);

      Token token = new GoblinToken();
      return token.putOntoBattlefield(Math.abs(thatRoll - thisRoll), game, source.getSourceId(), source.getControllerId());
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      int count = 1;
      int amount = controller.rollDice(game, 20);

      while (amount == 20) {
        count += 1;
        amount = controller.rollDice(game, 20);
      }
      return new CreateTokenEffect(new DragonTokenGold(), count).apply(game, source);
    }
    return false;
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  MageObject mageObject = game.getObject(source.getSourceId());
  if (controller != null && mageObject != null) {
    controller.rollDice(game, numSides);                
    return true;
  }
  return false;
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      return new AddCountersSourceEffect(CounterType.FUNK.createInstance(controller.rollDice(game, 6))).apply(game, source);
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (controller != null && permanent != null) {
      int amount = controller.rollDice(game, 6);
      game.addEffect(new BoostSourceEffect(amount, amount, Duration.EndOfTurn), source);
      return true;
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (controller != null && permanent != null) {
      int amount = controller.rollDice(game, 6);
      permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
      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 amount = controller.rollDice(game, 6);
      CreateTokenEffect effect = new CreateTokenEffect(new GoblinToken(), amount);
      effect.apply(game, source);
      return true;
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (controller != null && permanent != null) {
      int amount = controller.rollDice(game, 6);
      permanent.removeCounters(CounterType.P1P1.createInstance(amount), game);
      return true;
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (controller != null && permanent != null) {
      int amount = controller.rollDice(game, 6);
      game.addEffect(new BoostSourceEffect(amount, 0, Duration.EndOfTurn), source);
      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 == 1) {
      new SacrificeSourceEffect().apply(game, source);
      return new DamageEverythingEffect(3).apply(game, source);
    }
  }
  return false;
}
origin: magefree/mage

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
  Player player = game.getPlayer(event.getPlayerId());
  if (player != null) {
    String data = event.getData();
    int numSides = Integer.parseInt(data);
    if (numSides == 6 && event.getAmount() == 3) {
      if (player.chooseUse(outcome, "Reroll the die?", source, game)) {
        game.informPlayers(player.getLogName() + " chose to reroll the die.");
        event.setAmount(player.rollDice(game, 6));
      }
    }
  }
  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) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (controller != null && permanent != null) {
      int amount = controller.rollDice(game, 6);
      return new CreateTokenEffect(new BrainiacToken(), amount).apply(game, source);
    }
    return false;
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  Permanent permanent = game.getPermanentEntering(source.getSourceId());
  if (controller != null && permanent != null) {
    int amount = controller.rollDice(game, 6);
    ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
    permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game, appliedEffects);
    return super.apply(game, source);
  }
  return false;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  Permanent permanent = game.getPermanentEntering(source.getSourceId());
  if (controller != null && permanent != null) {
    int amount = controller.rollDice(game, 6);
    ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
    permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game, appliedEffects);
    return super.apply(game, source);
  }
  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);
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent != null) {
      ContinuousEffect effect = new BoostTargetEffect(result, result, Duration.EndOfTurn);
      effect.setTargetPointer(new FixedTarget(permanent, game));
      game.addEffect(effect, source);
    }
  }
  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);
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (permanent != null) {
      if (result == 1) {
        return permanent.sacrifice(source.getSourceId(), game);
      } else {
        return new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source);
      }
    }
  }
  return false;
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent equipment = game.getPermanent(source.getSourceId());
    Player player = game.getPlayer(source.getFirstTarget());

    if (controller != null && equipment != null && player != null) {
      player.damage(1, source.getSourceId(), game, false, true);        
      int amount = controller.rollDice(game, 6);
      if (amount >= 5) {
        new UntapSourceEffect().apply(game, source);
      }
      return true;
    }

    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent targetCreature = game.getPermanent(source.getFirstTarget());
    if (controller != null && targetCreature != null) {
      source.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId()));
      game.addEffect(new GainControlTargetEffect(Duration.EndOfTurn), source);
      targetCreature.untap(game);
      int amount = controller.rollDice(game, 6);
      game.addEffect(new BoostTargetEffect(amount, 0, Duration.EndOfTurn), source);
      game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn), source);
      return true;
    }
    return false;
  }
}
mage.playersPlayerrollDice

Popular methods of Player

  • getId
  • getHand
  • getName
  • getLife
  • getLibrary
  • hasLeft
  • hasWon
  • getCounters
  • hasLost
  • copy
  • damage
  • declareAttacker
  • damage,
  • declareAttacker,
  • getGraveyard,
  • getPlayersUnderYourControl,
  • activateAbility,
  • canLose,
  • choose,
  • declareBlocker,
  • gainLife,
  • getAttachments

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getContentResolver (Context)
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now