mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
changed enum equals to ==, removed contains check for set
This commit is contained in:
parent
46ab7daf55
commit
1bc8e2248b
18 changed files with 42 additions and 50 deletions
|
@ -29,12 +29,12 @@
|
||||||
package mage.view;
|
package mage.view;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class RevealedView implements Serializable {
|
public class RevealedView implements Serializable {
|
||||||
|
|
|
@ -31,13 +31,13 @@ package mage.view;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.GameInfo;
|
import mage.game.GameInfo;
|
||||||
import mage.game.tournament.Round;
|
import mage.game.tournament.Round;
|
||||||
import mage.game.tournament.TournamentPairing;
|
import mage.game.tournament.TournamentPairing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class RoundView implements Serializable {
|
public class RoundView implements Serializable {
|
||||||
|
|
|
@ -104,13 +104,13 @@ public class ConditionalMana extends Mana implements Serializable {
|
||||||
if (!applied) {
|
if (!applied) {
|
||||||
// if one condition fails, return false only if All conditions should be met
|
// if one condition fails, return false only if All conditions should be met
|
||||||
// otherwise it may happen that Any other condition will be ok
|
// otherwise it may happen that Any other condition will be ok
|
||||||
if (scope.equals(Filter.ComparisonScope.All)) {
|
if (scope == Filter.ComparisonScope.All) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if one condition succeeded, return true only if Any conditions should be met
|
// if one condition succeeded, return true only if Any conditions should be met
|
||||||
// otherwise it may happen that any other condition will fail
|
// otherwise it may happen that any other condition will fail
|
||||||
if (scope.equals(Filter.ComparisonScope.Any)) {
|
if (scope == Filter.ComparisonScope.Any) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public class ConditionalMana extends Mana implements Serializable {
|
||||||
// we are here
|
// we are here
|
||||||
// if All conditions should be met, then it's Ok (return true)
|
// if All conditions should be met, then it's Ok (return true)
|
||||||
// if Any, then it should have already returned true, so returning false here
|
// if Any, then it should have already returned true, so returning false here
|
||||||
return scope.equals(Filter.ComparisonScope.All);
|
return scope == Filter.ComparisonScope.All;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -131,7 +131,7 @@ class KinshipBaseEffect extends OneShotEffect {
|
||||||
controller.revealCards(sourcePermanent.getName(), cards, game);
|
controller.revealCards(sourcePermanent.getName(), cards, game);
|
||||||
for (Effect effect: kinshipEffects) {
|
for (Effect effect: kinshipEffects) {
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||||
if (effect.getEffectType().equals(EffectType.ONESHOT)) {
|
if (effect.getEffectType() == EffectType.ONESHOT) {
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
} else {
|
} else {
|
||||||
if (effect instanceof ContinuousEffect) {
|
if (effect instanceof ContinuousEffect) {
|
||||||
|
|
|
@ -26,8 +26,9 @@ public class AfterBlockersAreDeclaredCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
return !(game.getStep().getType().equals(PhaseStep.BEGIN_COMBAT)
|
|
||||||
|| game.getStep().getType().equals(PhaseStep.DECLARE_ATTACKERS));
|
return !(game.getStep().getType() == PhaseStep.BEGIN_COMBAT
|
||||||
|
|| game.getStep().getType() == PhaseStep.DECLARE_ATTACKERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,7 +34,6 @@ import mage.constants.TurnPhase;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class IsPhaseCondition implements Condition {
|
public class IsPhaseCondition implements Condition {
|
||||||
|
@ -47,7 +46,7 @@ public class IsPhaseCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
return turnPhase.equals(game.getTurn().getPhaseType());
|
return turnPhase == game.getTurn().getPhaseType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ManaWasSpentCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
if (source.getAbilityType().equals(AbilityType.SPELL)) {
|
if (source.getAbilityType() == AbilityType.SPELL) {
|
||||||
return (source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 0);
|
return (source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 0);
|
||||||
}
|
}
|
||||||
ManaSpentToCastWatcher watcher = (ManaSpentToCastWatcher) game.getState().getWatchers().get("ManaSpentToCast", source.getSourceId());
|
ManaSpentToCastWatcher watcher = (ManaSpentToCastWatcher) game.getState().getWatchers().get("ManaSpentToCast", source.getSourceId());
|
||||||
|
|
|
@ -48,10 +48,10 @@ public class MyTurnBeforeAttackersDeclaredCondition implements Condition {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
if (game.getActivePlayerId().equals(source.getControllerId())) {
|
if (game.getActivePlayerId().equals(source.getControllerId())) {
|
||||||
TurnPhase turnPhase = game.getTurn().getPhase().getType();
|
TurnPhase turnPhase = game.getTurn().getPhase().getType();
|
||||||
if (turnPhase.equals(TurnPhase.BEGINNING) || turnPhase.equals(TurnPhase.PRECOMBAT_MAIN)) {
|
if (turnPhase == TurnPhase.BEGINNING || turnPhase == TurnPhase.PRECOMBAT_MAIN) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (turnPhase.equals(TurnPhase.COMBAT)) {
|
if (turnPhase == TurnPhase.COMBAT) {
|
||||||
return !game.getTurn().isDeclareAttackersStepStarted();
|
return !game.getTurn().isDeclareAttackersStepStarted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,12 +65,12 @@ public class SourceTappedBeforeUntapStepCondition implements Condition {
|
||||||
Permanent permanent = game.getBattlefield().getPermanent(permanentId);
|
Permanent permanent = game.getBattlefield().getPermanent(permanentId);
|
||||||
|
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (lastTurnNum != game.getTurnNum() && turnPhase.equals(TurnPhase.BEGINNING)) {
|
if (lastTurnNum != game.getTurnNum() && turnPhase == TurnPhase.BEGINNING) {
|
||||||
lastTurnNum = game.getTurnNum();
|
lastTurnNum = game.getTurnNum();
|
||||||
permanentWasTappedBeforeUntapStep = permanent.isTapped();
|
permanentWasTappedBeforeUntapStep = permanent.isTapped();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step.getType().equals(PhaseStep.UNTAP)) {
|
if (step.getType() == PhaseStep.UNTAP) {
|
||||||
return permanentWasTappedBeforeUntapStep;
|
return permanentWasTappedBeforeUntapStep;
|
||||||
} else {
|
} else {
|
||||||
return permanent.isTapped();
|
return permanent.isTapped();
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class SurgedCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
if (source.getAbilityType().equals(AbilityType.TRIGGERED)) {
|
if (source.getAbilityType() == AbilityType.TRIGGERED) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
ArrayList<Integer> surgeActivations = (ArrayList) game.getState().getValue(SurgeAbility.SURGE_ACTIVATION_VALUE_KEY + source.getSourceId());
|
ArrayList<Integer> surgeActivations = (ArrayList) game.getState().getValue(SurgeAbility.SURGE_ACTIVATION_VALUE_KEY + source.getSourceId());
|
||||||
if (surgeActivations != null) {
|
if (surgeActivations != null) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class DontUntapInControllersNextUntapStepSourceEffect extends ContinuousR
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// remember the turn of the untap step the effect has to be applied
|
// remember the turn of the untap step the effect has to be applied
|
||||||
if (GameEvent.EventType.UNTAP_STEP.equals(event.getType())
|
if (event.getType() == GameEvent.EventType.UNTAP_STEP
|
||||||
&& game.getActivePlayerId().equals(source.getControllerId())) {
|
&& game.getActivePlayerId().equals(source.getControllerId())) {
|
||||||
if (validForTurnNum == game.getTurnNum()) { // the turn has a second untap step but the effect is already related to the first untap step
|
if (validForTurnNum == game.getTurnNum()) { // the turn has a second untap step but the effect is already related to the first untap step
|
||||||
discard();
|
discard();
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class AddCardTypeSourceEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
if (Duration.Custom.equals(this.duration) || this.duration.toString().startsWith("End")) {
|
if (this.duration == Duration.Custom || this.duration.toString().startsWith("End")) {
|
||||||
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId()), game));
|
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId()), game));
|
||||||
if (affectedObjectList.isEmpty()) {
|
if (affectedObjectList.isEmpty()) {
|
||||||
this.discard();
|
this.discard();
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class BecomesColorTargetEffect extends ContinuousEffectImpl {
|
||||||
targetObject.getColor(game).setColor(setColor);
|
targetObject.getColor(game).setColor(setColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!objectFound && this.getDuration().equals(Duration.Custom)) {
|
if (!objectFound && this.getDuration() == Duration.Custom) {
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -40,7 +40,6 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author jeff
|
* @author jeff
|
||||||
*/
|
*/
|
||||||
public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
||||||
|
@ -86,13 +85,11 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
if (!token.getSupertype().isEmpty()) {
|
|
||||||
for (String t : token.getSupertype()) {
|
for (String t : token.getSupertype()) {
|
||||||
if (!permanent.getSupertype().contains(t)) {
|
if (!permanent.getSupertype().contains(t)) {
|
||||||
permanent.getSupertype().add(t);
|
permanent.getSupertype().add(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// card type
|
// card type
|
||||||
switch (loseType) {
|
switch (loseType) {
|
||||||
case ALL:
|
case ALL:
|
||||||
|
@ -100,13 +97,10 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
||||||
permanent.getCardType().clear();
|
permanent.getCardType().clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!token.getCardType().isEmpty()) {
|
|
||||||
for (CardType t : token.getCardType()) {
|
for (CardType t : token.getCardType()) {
|
||||||
if (!permanent.getCardType().contains(t)) {
|
|
||||||
permanent.getCardType().add(t);
|
permanent.getCardType().add(t);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
// sub type
|
// sub type
|
||||||
switch (loseType) {
|
switch (loseType) {
|
||||||
case ALL:
|
case ALL:
|
||||||
|
@ -115,18 +109,17 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
||||||
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
|
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!token.getSubtype(game).isEmpty()) {
|
|
||||||
for (String t : token.getSubtype(game)) {
|
for (String t : token.getSubtype(game)) {
|
||||||
if (!permanent.getSubtype(game).contains(t)) {
|
if (!permanent.getSubtype(game).contains(t)) {
|
||||||
permanent.getSubtype(game).add(t);
|
permanent.getSubtype(game).add(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ColorChangingEffects_5:
|
case ColorChangingEffects_5:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
if (loseType.equals(LoseType.ALL)) {
|
if (loseType == LoseType.ALL) {
|
||||||
permanent.getColor(game).setBlack(false);
|
permanent.getColor(game).setBlack(false);
|
||||||
permanent.getColor(game).setGreen(false);
|
permanent.getColor(game).setGreen(false);
|
||||||
permanent.getColor(game).setBlue(false);
|
permanent.getColor(game).setBlue(false);
|
||||||
|
@ -148,11 +141,10 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
||||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!token.getAbilities().isEmpty()) {
|
|
||||||
for (Ability ability : token.getAbilities()) {
|
for (Ability ability : token.getAbilities()) {
|
||||||
permanent.addAbility(ability, source.getSourceId(), game);
|
permanent.addAbility(ability, source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PTChangingEffects_7:
|
case PTChangingEffects_7:
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class SetToughnessSourceEffect extends ContinuousEffectImpl {
|
||||||
mageObject.getToughness().setValue(value);
|
mageObject.getToughness().setValue(value);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (Duration.Custom.equals(duration)) {
|
if (duration == Duration.Custom) {
|
||||||
discard();
|
discard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class EchoAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
// reset the echo paid state back, if creature enteres the battlefield
|
// reset the echo paid state back, if creature enteres the battlefield
|
||||||
if (event.getType().equals(GameEvent.EventType.ENTERS_THE_BATTLEFIELD)
|
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|
||||||
&& event.getTargetId().equals(this.getSourceId())) {
|
&& event.getTargetId().equals(this.getSourceId())) {
|
||||||
|
|
||||||
this.echoPaid = false;
|
this.echoPaid = false;
|
||||||
|
|
|
@ -236,7 +236,7 @@ public class SuspendAbility extends SpecialAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canActivate(UUID playerId, Game game) {
|
public boolean canActivate(UUID playerId, Game game) {
|
||||||
if (!game.getState().getZone(getSourceId()).equals(Zone.HAND)) {
|
if (game.getState().getZone(getSourceId()) != Zone.HAND) {
|
||||||
// Supend can only be activated from hand
|
// Supend can only be activated from hand
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class Table implements Serializable {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void closeTable() {
|
public void closeTable() {
|
||||||
if (!getState().equals(TableState.WAITING) && !getState().equals(TableState.READY_TO_START)) {
|
if (getState() != TableState.WAITING && getState() != TableState.READY_TO_START) {
|
||||||
setState(TableState.FINISHED); // otherwise the table can be removed completely
|
setState(TableState.FINISHED); // otherwise the table can be removed completely
|
||||||
}
|
}
|
||||||
this.validator = null;
|
this.validator = null;
|
||||||
|
|
Loading…
Reference in a new issue