change enum comparison

This commit is contained in:
igoudt 2018-07-08 13:11:39 +02:00
parent 36c004122a
commit d6450eed94
32 changed files with 41 additions and 40 deletions

View file

@ -910,7 +910,7 @@ public abstract class AbilityImpl implements Ability {
}
MageObject object = game.getObject(this.getSourceId());
// emblem/planes are always actual
if (object != null && (object instanceof Emblem || object instanceof Plane)) {
if (object instanceof Emblem || object instanceof Plane) {
return true;
}
}

View file

@ -44,7 +44,7 @@ public class ExileSourceCost extends CostImpl {
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
MageObject sourceObject = ability.getSourceObject(game);
Player controller = game.getPlayer(controllerId);
if (controller != null && sourceObject != null && (sourceObject instanceof Card)) {
if (controller != null && sourceObject instanceof Card) {
UUID exileZoneId = null;
String exileZoneName = "";
if (toUniqueExileZone) {

View file

@ -88,7 +88,7 @@ public class AddCardTypeTargetEffect extends ContinuousEffectImpl {
sb.append(cardType.toString().toLowerCase(Locale.ENGLISH)).append(" ");
}
sb.append("in addition to its other types");
if (getDuration().equals(Duration.EndOfTurn)) {
if (getDuration() == Duration.EndOfTurn) {
sb.append(" until end of turn");
}
return sb.toString();

View file

@ -29,7 +29,7 @@ public class DiesReplacementEffect extends ReplacementEffectImpl {
public DiesReplacementEffect(MageObjectReference objectRef, Duration duration) {
super(duration, Outcome.Exile);
this.objectRef = objectRef;
staticText = "If that creature would die " + (duration.equals(Duration.EndOfTurn) ? "this turn" : "") + ", exile it instead";
staticText = "If that creature would die " + (duration == Duration.EndOfTurn ? "this turn" : "") + ", exile it instead";
}
public DiesReplacementEffect(final DiesReplacementEffect effect) {

View file

@ -63,7 +63,7 @@ class SpellCastManaCondition extends ManaCondition implements Condition {
public boolean apply(Game game, Ability source) {
if (source instanceof SpellAbility) {
MageObject object = game.getObject(source.getSourceId());
if (object != null && (object instanceof StackObject)) {
if ((object instanceof StackObject)) {
return filter.match((StackObject) object, source.getSourceId(), source.getControllerId(), game);
}
}

View file

@ -84,8 +84,7 @@ class MonarchDealsCombatDamageToAPlayerTriggeredAbility extends TriggeredAbility
public boolean checkTrigger(GameEvent event, Game game) {
if (((DamagedPlayerEvent) event).isCombatDamage()) {
MageObject damagingObject = game.getObject(event.getSourceId());
if (damagingObject != null
&& damagingObject instanceof Permanent
if (damagingObject instanceof Permanent
&& damagingObject.isCreature()
&& event.getTargetId().equals(game.getMonarchId())) {
setControllerId(event.getPlayerId());

View file

@ -353,4 +353,11 @@ public interface Permanent extends Card, Controllable {
void setCreateOrder(int createOrder);
default boolean isAttachedTo(UUID otherId){
if(getAttachedTo() == null){
return false;
}
return getAttachedTo().equals(otherId);
}
}