mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
* Malfegor - Fixed the enters the battlefield triggered ability that did not work correctly.
This commit is contained in:
parent
c72b87a446
commit
c352c70e27
1 changed files with 22 additions and 20 deletions
|
@ -93,31 +93,33 @@ class MalfegorEffect extends OneShotEffect<MalfegorEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player you = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (you == null) {
|
if (controller != null) {
|
||||||
return false;
|
int sacrificeNumber = controller.getHand().size();
|
||||||
}
|
if (sacrificeNumber > 0) {
|
||||||
int handSizeBefore = you.getHand().size();
|
controller.discard(sacrificeNumber, source, game);
|
||||||
you.discardToMax(game);
|
for (UUID opponentId : game.getOpponents(controller.getId())) {
|
||||||
int sacrificeNumber = handSizeBefore - you.getHand().size();
|
Player opponent = game.getPlayer(opponentId);
|
||||||
for (UUID opponentId : game.getOpponents(you.getId())) {
|
if (opponent != null) {
|
||||||
Player opponent = game.getPlayer(opponentId);
|
for (int i = 0; i < sacrificeNumber; i++) {
|
||||||
if (opponent != null) {
|
Target target = new TargetControlledPermanent(new FilterControlledCreaturePermanent());
|
||||||
for (int i = 0; i < sacrificeNumber; i++) {
|
target.setRequired(true);
|
||||||
Target target = new TargetControlledPermanent(new FilterControlledCreaturePermanent());
|
if (target.canChoose(opponentId, game)) {
|
||||||
if (target.canChoose(opponentId, game)) {
|
if (opponent.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) {
|
||||||
while (!target.isChosen() && target.canChoose(opponentId, game)) {
|
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||||
opponent.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
if (permanent != null) {
|
||||||
}
|
permanent.sacrifice(source.getSourceId(), game);
|
||||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
}
|
||||||
if (permanent != null) {
|
}
|
||||||
permanent.sacrifice(source.getSourceId(), game);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue