mirror of
https://github.com/correl/mage.git
synced 2025-01-14 03:00:10 +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;
|
package mage.cards.r;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import mage.MageObject;
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -54,6 +52,11 @@ import mage.target.Target;
|
||||||
import mage.target.common.TargetControlledCreaturePermanent;
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
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
|
* @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
|
// 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(": ");
|
StringBuilder sb = new StringBuilder("Left pile of ").append(defender.getLogName()).append(": ");
|
||||||
int i = 0;
|
sb.append(leftLog.stream().map(MageObject::getLogName).collect(Collectors.joining(", ")));
|
||||||
for (Permanent permanent : leftLog) {
|
|
||||||
i++;
|
|
||||||
sb.append(permanent.getLogName());
|
|
||||||
if (i < leftLog.size()) {
|
|
||||||
sb.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
game.informPlayers(sb.toString());
|
game.informPlayers(sb.toString());
|
||||||
|
|
||||||
sb = new StringBuilder("Right pile of ").append(defender.getLogName()).append(": ");
|
sb = new StringBuilder("Right pile of ").append(defender.getLogName()).append(": ");
|
||||||
i = 0;
|
sb.append(rightLog.stream().map(MageObject::getLogName).collect(Collectors.joining(", ")));
|
||||||
for (Permanent permanent : rightLog) {
|
|
||||||
i++;
|
|
||||||
sb.append(permanent.getLogName());
|
|
||||||
if (i < rightLog.size()) {
|
|
||||||
sb.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
game.informPlayers(sb.toString());
|
game.informPlayers(sb.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,19 +151,13 @@ class RagingRiverEffect extends OneShotEffect {
|
||||||
// shortcut in case of no labeled blockers available
|
// shortcut in case of no labeled blockers available
|
||||||
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
|
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
|
||||||
} else {
|
} else {
|
||||||
List<Permanent> leftLog = new ArrayList<>();
|
List<Permanent> leftLog = left.stream()
|
||||||
List<Permanent> rightLog = new ArrayList<>();
|
.filter(permanent -> permanent.getControllerId().equals(defender.getId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
for (Permanent permanent : left) {
|
List<Permanent> rightLog = right.stream()
|
||||||
if (permanent.getControllerId() == defender.getId()) {
|
.filter(permanent -> permanent.getControllerId().equals(defender.getId()))
|
||||||
leftLog.add(permanent);
|
.collect(Collectors.toList());
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Permanent permanent : right) {
|
|
||||||
if (permanent.getControllerId() == defender.getId()) {
|
|
||||||
rightLog.add(permanent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (controller.choosePile(outcome, attacker.getName() + ": attacking " + defender.getName(), leftLog, rightLog, game)) {
|
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))));
|
filter.add(Predicates.not(Predicates.or(new AbilityPredicate(FlyingAbility.class), new PermanentInListPredicate(left))));
|
||||||
|
|
Loading…
Reference in a new issue