mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00:13 +00:00
rewrite raging river with streams
This commit is contained in:
parent
f10bbdf6a0
commit
b3d1454055
1 changed files with 17 additions and 32 deletions
|
@ -27,9 +27,7 @@
|
|||
*/
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -54,6 +52,11 @@ import mage.target.Target;
|
|||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
|
@ -124,25 +127,13 @@ class RagingRiverEffect extends OneShotEffect {
|
|||
|
||||
// it could be nice to invoke some graphic indicator of which creature is Left or Right in this spot
|
||||
StringBuilder sb = new StringBuilder("Left pile of ").append(defender.getLogName()).append(": ");
|
||||
int i = 0;
|
||||
for (Permanent permanent : leftLog) {
|
||||
i++;
|
||||
sb.append(permanent.getLogName());
|
||||
if (i < leftLog.size()) {
|
||||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
sb.append(leftLog.stream().map(MageObject::getLogName).collect(Collectors.joining(", ")));
|
||||
|
||||
game.informPlayers(sb.toString());
|
||||
|
||||
sb = new StringBuilder("Right pile of ").append(defender.getLogName()).append(": ");
|
||||
i = 0;
|
||||
for (Permanent permanent : rightLog) {
|
||||
i++;
|
||||
sb.append(permanent.getLogName());
|
||||
if (i < rightLog.size()) {
|
||||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
sb.append(rightLog.stream().map(MageObject::getLogName).collect(Collectors.joining(", ")));
|
||||
|
||||
game.informPlayers(sb.toString());
|
||||
}
|
||||
}
|
||||
|
@ -160,19 +151,13 @@ class RagingRiverEffect extends OneShotEffect {
|
|||
// shortcut in case of no labeled blockers available
|
||||
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
|
||||
} else {
|
||||
List<Permanent> leftLog = new ArrayList<>();
|
||||
List<Permanent> rightLog = new ArrayList<>();
|
||||
List<Permanent> leftLog = left.stream()
|
||||
.filter(permanent -> permanent.getControllerId().equals(defender.getId()))
|
||||
.collect(Collectors.toList());
|
||||
List<Permanent> rightLog = right.stream()
|
||||
.filter(permanent -> permanent.getControllerId().equals(defender.getId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (Permanent permanent : left) {
|
||||
if (permanent.getControllerId() == defender.getId()) {
|
||||
leftLog.add(permanent);
|
||||
}
|
||||
}
|
||||
for (Permanent permanent : right) {
|
||||
if (permanent.getControllerId() == defender.getId()) {
|
||||
rightLog.add(permanent);
|
||||
}
|
||||
}
|
||||
|
||||
if (controller.choosePile(outcome, attacker.getName() + ": attacking " + defender.getName(), leftLog, rightLog, game)) {
|
||||
filter.add(Predicates.not(Predicates.or(new AbilityPredicate(FlyingAbility.class), new PermanentInListPredicate(left))));
|
||||
|
|
Loading…
Reference in a new issue