mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
Fixed Investigator's Journal not respecting range of influence.
This commit is contained in:
parent
d09b781673
commit
fb31bd97bb
1 changed files with 12 additions and 16 deletions
|
@ -19,8 +19,10 @@ import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -66,25 +68,19 @@ enum InvestigatorsJournalValue implements DynamicValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
HashMap<UUID, Integer> creatureCounts = new HashMap<>();
|
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(sourceAbility.getControllerId(), game)) {
|
|
||||||
creatureCounts.put(playerId, 0);
|
|
||||||
}
|
|
||||||
for (Permanent permanent : game.getBattlefield().getAllPermanents()) {
|
|
||||||
if (permanent.isPhasedIn() && permanent.isCreature(game)) {
|
|
||||||
UUID controllerId = permanent.getControllerId();
|
|
||||||
Integer count = creatureCounts.get(controllerId);
|
|
||||||
if (count != null) {
|
|
||||||
creatureCounts.put(controllerId, count + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int greatestCreatureCount = 0;
|
int greatestCreatureCount = 0;
|
||||||
for (Integer count : creatureCounts.values()) {
|
|
||||||
if (count > greatestCreatureCount) {
|
for (UUID playerId : game.getState().getPlayersInRange(sourceAbility.getControllerId(), game)) {
|
||||||
greatestCreatureCount = count;
|
Player player = game.getPlayer(playerId);
|
||||||
|
if (player == null) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
greatestCreatureCount = Math.max(
|
||||||
|
greatestCreatureCount,
|
||||||
|
game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, playerId, game));
|
||||||
}
|
}
|
||||||
|
|
||||||
return greatestCreatureCount;
|
return greatestCreatureCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue