add isOwned and isControlled methods. remove some null-checks, remove some unnecessary casts

This commit is contained in:
igoudt 2018-07-04 14:24:11 +02:00
parent e46ad02918
commit 9f06046f22
464 changed files with 567 additions and 562 deletions

View file

@ -209,7 +209,7 @@ public class Combat implements Serializable, Copyable<Combat> {
possibleDefenders = new HashSet<>();
for (UUID objectId : defenders) {
Permanent planeswalker = game.getPermanent(objectId);
if (planeswalker != null && planeswalker.getControllerId().equals(playerToAttack)) {
if (planeswalker != null && planeswalker.isControlledBy(playerToAttack)) {
possibleDefenders.add(objectId);
} else if (playerToAttack.equals(objectId)) {
possibleDefenders.add(objectId);
@ -964,7 +964,7 @@ public class Combat implements Serializable, Copyable<Combat> {
if (creatureForcedToBlock == null) {
break;
}
if (!creatureForcedToBlock.getControllerId().equals(player.getId())) {
if (!creatureForcedToBlock.isControlledBy(player.getId())) {
// ignore creatures controlled by other players
continue;
}
@ -1473,7 +1473,7 @@ public class Combat implements Serializable, Copyable<Combat> {
}
if (group.defenderIsPlaneswalker) {
Permanent permanent = game.getPermanent(group.getDefenderId());
if (permanent.getControllerId().equals(defenderId)) {
if (permanent.isControlledBy(defenderId)) {
return true;
}
}