mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Merge pull request #2901 from ingmargoudt/master
change enum equals to ==
This commit is contained in:
commit
a32a02b688
40 changed files with 57 additions and 57 deletions
|
@ -109,7 +109,7 @@ public class SpellAbility extends ActivatedAbilityImpl {
|
|||
}
|
||||
}
|
||||
if (costs.canPay(this, sourceId, controllerId, game)) {
|
||||
if (getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
|
||||
if (getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) {
|
||||
SplitCard splitCard = (SplitCard) game.getCard(getSourceId());
|
||||
if (splitCard != null) {
|
||||
return (splitCard.getLeftHalfCard().getSpellAbility().canChooseTarget(game)
|
||||
|
|
|
@ -95,7 +95,7 @@ public class TriggeredAbilities extends ConcurrentHashMap<String, TriggeredAbili
|
|||
if (event == null || !game.getContinuousEffects().preventedByRuleModification(event, ability, game, false)) {
|
||||
if (object != null) {
|
||||
boolean controllerSet = false;
|
||||
if (!ability.getZone().equals(Zone.COMMAND) && event != null
|
||||
if (ability.getZone() != Zone.COMMAND && event != null
|
||||
&& event.getTargetId() != null // && event.getTargetId().equals(ability.getSourceId())
|
||||
&& ability.isLeavesTheBattlefieldTrigger()
|
||||
// && ((event.getType().equals(EventType.ZONE_CHANGE)
|
||||
|
|
|
@ -69,7 +69,7 @@ public class EntersBattlefieldOrDiesSourceTriggeredAbility extends TriggeredAbil
|
|||
}
|
||||
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId())) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
||||
if (zEvent.getFromZone().equals(Zone.BATTLEFIELD) && zEvent.getToZone().equals(Zone.GRAVEYARD)) {
|
||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
|
|||
|
||||
@Override
|
||||
public boolean askToActivateAlternativeCosts(Ability ability, Game game) {
|
||||
if (ability != null && AbilityType.SPELL.equals(ability.getAbilityType())) {
|
||||
if (ability != null && AbilityType.SPELL == ability.getAbilityType()) {
|
||||
if (filter != null) {
|
||||
Card card = game.getCard(ability.getSourceId());
|
||||
if (!filter.match(card, ability.getSourceId(), ability.getControllerId(), game)) {
|
||||
|
|
|
@ -90,7 +90,7 @@ public class ExileFromGraveCost extends CostImpl {
|
|||
if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) {
|
||||
for (UUID targetId : targets.get(0).getTargets()) {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card == null || !game.getState().getZone(targetId).equals(Zone.GRAVEYARD)) {
|
||||
if (card == null || game.getState().getZone(targetId) != Zone.GRAVEYARD) {
|
||||
return false;
|
||||
}
|
||||
exiledCards.add(card);
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ExileSourceFromGraveCost extends CostImpl {
|
|||
Player controller = game.getPlayer(controllerId);
|
||||
if (controller != null) {
|
||||
Card card = game.getCard(sourceId);
|
||||
if (card != null && game.getState().getZone(sourceId).equals(Zone.GRAVEYARD)) {
|
||||
if (card != null && game.getState().getZone(sourceId) == Zone.GRAVEYARD) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", sourceId, game, Zone.GRAVEYARD, true);
|
||||
// 117.11. The actions performed when paying a cost may be modified by effects.
|
||||
// Even if they are, meaning the actions that are performed don't match the actions
|
||||
|
@ -70,7 +70,7 @@ public class ExileSourceFromGraveCost extends CostImpl {
|
|||
@Override
|
||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||
Card card = game.getCard(sourceId);
|
||||
if (card != null && game.getState().getZone(sourceId).equals(Zone.GRAVEYARD)) {
|
||||
if (card != null && game.getState().getZone(sourceId) == Zone.GRAVEYARD) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -71,7 +71,7 @@ public class RevealSourceFromYourHandCost extends CostImpl {
|
|||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||
return game.getState().getZone(sourceId).equals(Zone.HAND);
|
||||
return game.getState().getZone(sourceId) == Zone.HAND;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -67,14 +67,13 @@ public class SacrificeAllCost extends CostImpl {
|
|||
permanents.add(permanent.copy());
|
||||
permanent.sacrifice(sourceId, game);
|
||||
}
|
||||
paid = true;
|
||||
return paid;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||
UUID activator = controllerId;
|
||||
if (ability.getAbilityType().equals(AbilityType.ACTIVATED) || ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) {
|
||||
if (ability.getAbilityType() == AbilityType.ACTIVATED || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
||||
if (((ActivatedAbilityImpl) ability).getActivatorId() != null) {
|
||||
activator = ((ActivatedAbilityImpl) ability).getActivatorId();
|
||||
} else {
|
||||
|
|
|
@ -71,7 +71,7 @@ public class SacrificeTargetCost extends CostImpl {
|
|||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
UUID activator = controllerId;
|
||||
if (ability.getAbilityType().equals(AbilityType.ACTIVATED) || ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) {
|
||||
if (ability.getAbilityType() == AbilityType.ACTIVATED || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
||||
activator = ((ActivatedAbilityImpl) ability).getActivatorId();
|
||||
}
|
||||
if (targets.choose(Outcome.Sacrifice, activator, sourceId, game)) {
|
||||
|
@ -93,7 +93,7 @@ public class SacrificeTargetCost extends CostImpl {
|
|||
@Override
|
||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||
UUID activator = controllerId;
|
||||
if (ability.getAbilityType().equals(AbilityType.ACTIVATED) || ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) {
|
||||
if (ability.getAbilityType() == AbilityType.ACTIVATED || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
||||
if (((ActivatedAbilityImpl) ability).getActivatorId() != null) {
|
||||
activator = ((ActivatedAbilityImpl) ability).getActivatorId();
|
||||
} else {
|
||||
|
|
|
@ -130,7 +130,7 @@ public class HybridManaCost extends ManaCostImpl {
|
|||
|
||||
@Override
|
||||
public boolean containsColor(ColoredManaSymbol coloredManaSymbol) {
|
||||
return mana1.equals(coloredManaSymbol) || mana2.equals(coloredManaSymbol);
|
||||
return mana1 == coloredManaSymbol || mana2 == coloredManaSymbol;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -81,7 +81,7 @@ public class CantBeRegeneratedSourceEffect extends ContinuousRuleModifyingEffect
|
|||
sb.append(" {this} can't be regenerated");
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append(" this turn");
|
||||
} else {
|
||||
sb.append(' ').append(duration.toString());
|
||||
|
|
|
@ -82,7 +82,7 @@ public class CantBeRegeneratedTargetEffect extends ContinuousRuleModifyingEffect
|
|||
sb.append(" can't be regenerated");
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append(" this turn");
|
||||
} else {
|
||||
sb.append(' ').append(duration.toString());
|
||||
|
|
|
@ -85,7 +85,7 @@ public class CantBeTargetedAttachedEffect extends ContinuousRuleModifyingEffectI
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent attachment = game.getPermanent(source.getSourceId());
|
||||
if (attachment != null && event.getTargetId().equals(attachment.getAttachedTo())) {
|
||||
if (targetController.equals(TargetController.OPPONENT)
|
||||
if (targetController == TargetController.OPPONENT
|
||||
&& !game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class DontUntapInControllersUntapStepAllEffect extends ContinuousRuleModi
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (PhaseStep.UNTAP.equals(game.getTurn().getStepType())) {
|
||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null) {
|
||||
switch(targetController) {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class EntersBattlefieldWithXCountersEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null) {
|
||||
if (permanent == null && source.getAbilityType().equals(AbilityType.STATIC)) {
|
||||
if (permanent == null && source.getAbilityType() == AbilityType.STATIC) {
|
||||
permanent = game.getPermanentEntering(source.getSourceId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
|||
if (revealPickedCards) {
|
||||
sb.append(". You may reveal ");
|
||||
sb.append(filter.getMessage()).append(" from among them and put it into your ");
|
||||
} else if (targetPickedCards.equals(Zone.BATTLEFIELD)) {
|
||||
} else if (targetPickedCards == Zone.BATTLEFIELD) {
|
||||
sb.append(". You ");
|
||||
if (optional) {
|
||||
sb.append("may ");
|
||||
|
|
|
@ -75,7 +75,7 @@ public class PreventAllDamageByAllObjectsEffect extends PreventionEffectImpl {
|
|||
sb.append("combat ");
|
||||
}
|
||||
sb.append("damage that would be dealt");
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append(" this turn");
|
||||
}
|
||||
if (filter != null) {
|
||||
|
|
|
@ -95,7 +95,7 @@ public class PreventAllDamageFromChosenSourceToYouEffect extends PreventionEffec
|
|||
sb.append("combat ");
|
||||
}
|
||||
sb.append("damage that would be dealt to you ");
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append("this turn ");
|
||||
}
|
||||
sb.append("by a ").append(targetSource.getFilter().getMessage());
|
||||
|
|
|
@ -90,7 +90,7 @@ public class PreventDamageToTargetEffect extends PreventionEffectImpl {
|
|||
sb.append(mode.getTargets().get(0).getTargetName());
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append("this turn");
|
||||
} else {
|
||||
sb.append(duration.toString());
|
||||
|
|
|
@ -89,7 +89,7 @@ public class PutOnLibraryTargetEffect extends OneShotEffect {
|
|||
break;
|
||||
case GRAVEYARD:
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null && game.getState().getZone(targetId).equals(Zone.GRAVEYARD)) {
|
||||
if (card != null && game.getState().getZone(targetId) == Zone.GRAVEYARD) {
|
||||
cards.add(card);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId())
|
||||
&& game.getState().getZone(source.getSourceId()).equals(Zone.BATTLEFIELD)) {
|
||||
&& game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) {
|
||||
sourcePermanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -59,7 +59,7 @@ public class TapSourceUnlessPaysEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null && source.getAbilityType().equals(AbilityType.STATIC)) {
|
||||
if (permanent == null && source.getAbilityType() == AbilityType.STATIC) {
|
||||
permanent = game.getPermanentEntering(source.getSourceId());
|
||||
}
|
||||
if (player != null && permanent != null) {
|
||||
|
|
|
@ -80,7 +80,7 @@ public class AddCardTypeSourceEffect extends ContinuousEffectImpl {
|
|||
permanent.getCardType().add(addedCardType);
|
||||
}
|
||||
return true;
|
||||
} else if (this.getDuration().equals(Duration.Custom)) {
|
||||
} else if (this.getDuration() == Duration.Custom) {
|
||||
this.discard();
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -163,7 +163,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
String gainedAbility = ability.getRule();
|
||||
sb.append(filter.getMessage()).append(" you control ");
|
||||
if (duration.equals(Duration.WhileOnBattlefield) || duration.equals(Duration.EndOfGame)) {
|
||||
if (duration == Duration.WhileOnBattlefield || duration == Duration.EndOfGame) {
|
||||
sb.append("have ");
|
||||
if (gainedAbility.startsWith("Whenever ") || gainedAbility.startsWith("{T}")) {
|
||||
gainedAbility = '"' + gainedAbility + '"';
|
||||
|
@ -173,7 +173,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
|
|||
sb.append("gain ");
|
||||
}
|
||||
sb.append(gainedAbility);
|
||||
if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) {
|
||||
if (!duration.toString().isEmpty() && duration != Duration.EndOfGame) {
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
staticText = sb.toString();
|
||||
|
|
|
@ -111,7 +111,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
|||
if (super.isInactive(source, game)) {
|
||||
return true;
|
||||
}
|
||||
if (durationPhaseStep != null && durationPhaseStep.equals(game.getPhase().getStep().getType())) {
|
||||
if (durationPhaseStep != null && durationPhaseStep == game.getPhase().getStep().getType()) {
|
||||
if (!sameStep && game.getActivePlayerId().equals(durationPlayerId) || game.getPlayer(durationPlayerId).hasReachedNextTurnAfterLeaving()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
|||
affectedTargets++;
|
||||
}
|
||||
}
|
||||
if (duration.equals(Duration.OneUse)) {
|
||||
if (duration == Duration.OneUse) {
|
||||
discard();
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class CastOnlyDuringPhaseStepSourceEffect extends ContinuousRuleModifying
|
|||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return GameEvent.EventType.CAST_SPELL.equals(event.getType());
|
||||
return event.getType() == GameEvent.EventType.CAST_SPELL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,7 +75,7 @@ public class RecoverAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getFromZone().equals(Zone.BATTLEFIELD) && zEvent.getToZone().equals(Zone.GRAVEYARD)) {
|
||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
|
||||
if (zEvent.getTarget().getOwnerId().equals(getControllerId())
|
||||
&& zEvent.getTarget().getCardType().contains(CardType.CREATURE)
|
||||
&& !zEvent.getTarget().getId().equals(getSourceId())) {
|
||||
|
@ -116,7 +116,7 @@ class RecoverEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (controller != null && sourceCard != null
|
||||
&& game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) {
|
||||
&& game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
|
||||
if (controller.chooseUse(Outcome.Damage, "Pay " + cost.getText() + " to recover " + sourceCard.getLogName() + "? (Otherwise the card will be exiled)", source, game)) {
|
||||
cost.clearPaid();
|
||||
if (cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) {
|
||||
|
|
|
@ -308,7 +308,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
if (spellAbility == null) {
|
||||
for (Ability ability : abilities.getActivatedAbilities(Zone.HAND)) {
|
||||
if (ability instanceof SpellAbility
|
||||
&& !((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) {
|
||||
&& ((SpellAbility) ability).getSpellAbilityType() != SpellAbilityType.BASE_ALTERNATE) {
|
||||
return spellAbility = (SpellAbility) ability;
|
||||
}
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
break;
|
||||
}
|
||||
if (removed) {
|
||||
if (!fromZone.equals(Zone.OUTSIDE)) {
|
||||
if (fromZone != Zone.OUTSIDE) {
|
||||
game.rememberLKI(lkiObject != null ? lkiObject.getId() : objectId, fromZone, lkiObject != null ? lkiObject : this);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -387,7 +387,7 @@ public abstract class ExpansionSet implements Serializable {
|
|||
List<CardInfo> savedCardsInfos = savedCards.get(rarity);
|
||||
if (savedCardsInfos == null) {
|
||||
CardCriteria criteria = new CardCriteria();
|
||||
if (rarity.equals(Rarity.LAND)) {
|
||||
if (rarity == Rarity.LAND) {
|
||||
criteria.setCodes(!hasBasicLands && parentSet != null ? parentSet.code : this.code);
|
||||
} else {
|
||||
criteria.setCodes(this.code);
|
||||
|
|
|
@ -130,7 +130,7 @@ public abstract class SplitCard extends CardImpl {
|
|||
public Abilities<Ability> getAbilities() {
|
||||
Abilities<Ability> allAbilites = new AbilitiesImpl<>();
|
||||
for (Ability ability : super.getAbilities()) {
|
||||
if (ability instanceof SpellAbility && !((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT)) {
|
||||
if (ability instanceof SpellAbility && ((SpellAbility) ability).getSpellAbilityType() != SpellAbilityType.SPLIT) {
|
||||
allAbilites.add(ability);
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public abstract class SplitCard extends CardImpl {
|
|||
public Abilities<Ability> getAbilities(Game game) {
|
||||
Abilities<Ability> allAbilites = new AbilitiesImpl<>();
|
||||
for (Ability ability : super.getAbilities(game)) {
|
||||
if (ability instanceof SpellAbility && !((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT)) {
|
||||
if (ability instanceof SpellAbility && ((SpellAbility) ability).getSpellAbilityType() != SpellAbilityType.SPLIT) {
|
||||
allAbilites.add(ability);
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public abstract class SplitCard extends CardImpl {
|
|||
@Override
|
||||
public List<String> getRules() {
|
||||
List<String> rules = new ArrayList<>();
|
||||
if (getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
|
||||
if (getSpellAbility().getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) {
|
||||
rules.add("--------------------------------------------------------------------------\nFuse (You may cast one or both halves of this card from your hand.)");
|
||||
}
|
||||
return rules;
|
||||
|
|
|
@ -384,7 +384,7 @@ public enum CardRepository {
|
|||
for (CardInfo cardinfo : cards) {
|
||||
ExpansionInfo set = ExpansionRepository.instance.getSetByCode(cardinfo.getSetCode());
|
||||
if (set != null) {
|
||||
if ((set.getType().equals(SetType.EXPANSION) || set.getType().equals(SetType.CORE))
|
||||
if ((set.getType() == SetType.EXPANSION || set.getType() == SetType.CORE)
|
||||
&& (lastExpansionDate == null || set.getReleaseDate().after(lastExpansionDate))) {
|
||||
cardToUse = cardinfo;
|
||||
lastExpansionDate = set.getReleaseDate();
|
||||
|
|
|
@ -41,7 +41,7 @@ public enum Zone {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this.equals(EXILED)) {
|
||||
if (this == EXILED) {
|
||||
return "exile zone";
|
||||
}
|
||||
return super.toString();
|
||||
|
|
|
@ -1465,12 +1465,12 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
newEffect.init(newAbility, this);
|
||||
|
||||
// If there are already copy effects with dration = Custom to the same object, remove the existing effects because they no longer have any effect
|
||||
if (Duration.Custom.equals(duration)) {
|
||||
if (duration == Duration.Custom) {
|
||||
for (Effect effect : getState().getContinuousEffects().getLayeredEffects(this)) {
|
||||
if (effect instanceof CopyEffect) {
|
||||
CopyEffect copyEffect = (CopyEffect) effect;
|
||||
// there is another copy effect that copies to the same permanent
|
||||
if (copyEffect.getSourceId().equals(copyToPermanentId) && copyEffect.getDuration().equals(Duration.Custom)) {
|
||||
if (copyEffect.getSourceId().equals(copyToPermanentId) && copyEffect.getDuration() == Duration.Custom) {
|
||||
copyEffect.discard();
|
||||
}
|
||||
}
|
||||
|
@ -1750,7 +1750,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
if (spellAbility.getTargets().isEmpty()) {
|
||||
for (Ability ability : perm.getAbilities(this)) {
|
||||
if ((ability instanceof SpellAbility)
|
||||
&& SpellAbilityType.BASE_ALTERNATE.equals(((SpellAbility) ability).getSpellAbilityType())
|
||||
&& SpellAbilityType.BASE_ALTERNATE == ((SpellAbility) ability).getSpellAbilityType()
|
||||
&& !ability.getTargets().isEmpty()) {
|
||||
spellAbility = (SpellAbility) ability;
|
||||
break;
|
||||
|
@ -2337,6 +2337,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
}
|
||||
|
||||
Iterator it = gameCards.entrySet().iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
Entry<UUID, Card> entry = (Entry<UUID, Card>) it.next();
|
||||
Card card = entry.getValue();
|
||||
|
@ -2507,7 +2508,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
|
||||
@Override
|
||||
public MageObject getLastKnownInformation(UUID objectId, Zone zone, int zoneChangeCounter) {
|
||||
if (zone.equals(Zone.BATTLEFIELD)) {
|
||||
if (zone == Zone.BATTLEFIELD) {
|
||||
Map<Integer, MageObject> lkiMapExtended = lkiExtended.get(objectId);
|
||||
|
||||
if (lkiMapExtended != null) {
|
||||
|
|
|
@ -218,7 +218,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
for (UUID modeId : spellAbility.getModes().getSelectedModes()) {
|
||||
spellAbility.getModes().setActiveMode(modeId);
|
||||
if (spellAbility.getTargets().stillLegal(spellAbility, game)) {
|
||||
if (!spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE)) {
|
||||
if (spellAbility.getSpellAbilityType() != SpellAbilityType.SPLICE) {
|
||||
updateOptionalCosts(index);
|
||||
}
|
||||
result |= spellAbility.resolve(game);
|
||||
|
|
|
@ -283,14 +283,14 @@ public abstract class TournamentImpl implements Tournament {
|
|||
// set player state if he finished the round
|
||||
if (round.getRoundNumber() == rounds.size()) { // for elimination getRoundNumber = 0 so never true here
|
||||
match.setTournamentRound(round.getRoundNumber());
|
||||
if (tp1.getState().equals(TournamentPlayerState.DUELING)) {
|
||||
if (tp1.getState() == TournamentPlayerState.DUELING) {
|
||||
if (round.getRoundNumber() == getNumberRounds()) {
|
||||
tp1.setState(TournamentPlayerState.FINISHED);
|
||||
} else {
|
||||
tp1.setState(TournamentPlayerState.WAITING);
|
||||
}
|
||||
}
|
||||
if (tp2.getState().equals(TournamentPlayerState.DUELING)) {
|
||||
if (tp2.getState() == TournamentPlayerState.DUELING) {
|
||||
if (round.getRoundNumber() == getNumberRounds()) {
|
||||
tp2.setState(TournamentPlayerState.FINISHED);
|
||||
} else {
|
||||
|
|
|
@ -145,7 +145,7 @@ public class Turn implements Serializable {
|
|||
if (game.isPaused() || game.gameOver(null)) {
|
||||
return false;
|
||||
}
|
||||
if (!isEndTurnRequested() || phase.getType().equals(TurnPhase.END)) {
|
||||
if (!isEndTurnRequested() || phase.getType() == TurnPhase.END) {
|
||||
currentPhase = phase;
|
||||
game.fireEvent(new GameEvent(GameEvent.EventType.PHASE_CHANGED, activePlayer.getId(), null, activePlayer.getId()));
|
||||
if (!game.getState().getTurnMods().skipPhase(activePlayer.getId(), currentPhase.getType())) {
|
||||
|
|
|
@ -214,7 +214,7 @@ public class ManaPool implements Serializable {
|
|||
for (ManaType manaType : ManaType.values()) {
|
||||
if (!doNotEmptyManaTypes.contains(manaType)) {
|
||||
if (item.get(manaType) > 0) {
|
||||
if (!item.getDuration().equals(Duration.EndOfTurn) || game.getPhase().getType().equals(TurnPhase.END)) {
|
||||
if (item.getDuration() != Duration.EndOfTurn || game.getPhase().getType() == TurnPhase.END) {
|
||||
if (game.replaceEvent(new GameEvent(GameEvent.EventType.EMPTY_MANA_POOL, playerId, null, playerId))) {
|
||||
int amount = item.get(manaType);
|
||||
item.clear(manaType);
|
||||
|
@ -227,7 +227,7 @@ public class ManaPool implements Serializable {
|
|||
}
|
||||
if (conditionalItem != null) {
|
||||
if (conditionalItem.get(manaType) > 0) {
|
||||
if (!item.getDuration().equals(Duration.EndOfTurn) || game.getPhase().getType().equals(TurnPhase.END)) {
|
||||
if (item.getDuration() != Duration.EndOfTurn || game.getPhase().getType() == TurnPhase.END) {
|
||||
if (game.replaceEvent(new GameEvent(GameEvent.EventType.EMPTY_MANA_POOL, playerId, null, playerId))) {
|
||||
int amount = conditionalItem.get(manaType);
|
||||
conditionalItem.clear(manaType);
|
||||
|
|
|
@ -2795,8 +2795,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return true;
|
||||
}
|
||||
for (Entry<PhaseStep, Step.StepPart> phaseStep : silentPhaseSteps.entrySet()) {
|
||||
if (game.getPhase() != null && game.getPhase().getStep() != null && phaseStep.getKey().equals(game.getPhase().getStep().getType())) {
|
||||
if (phaseStep.getValue() == null || phaseStep.getValue().equals(game.getPhase().getStep().getStepPart())) {
|
||||
if (game.getPhase() != null && game.getPhase().getStep() != null && phaseStep.getKey() == game.getPhase().getStep().getType()) {
|
||||
if (phaseStep.getValue() == null || phaseStep.getValue() == game.getPhase().getStep().getStepPart()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class TargetActivatedAbility extends TargetObject {
|
|||
public boolean canChoose(UUID sourceControllerId, Game game) {
|
||||
for (StackObject stackObject : game.getStack()) {
|
||||
if (stackObject.getStackAbility() != null
|
||||
&& stackObject.getStackAbility().getAbilityType().equals(AbilityType.ACTIVATED)
|
||||
&& stackObject.getStackAbility().getAbilityType() == AbilityType.ACTIVATED
|
||||
&& game.getState().getPlayersInRange(sourceControllerId, game).contains(stackObject.getStackAbility().getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@ public class TargetActivatedOrTriggeredAbility extends TargetObject {
|
|||
}
|
||||
if (stackObject instanceof Ability) {
|
||||
Ability ability = (Ability)stackObject;
|
||||
return ability.getAbilityType().equals(AbilityType.TRIGGERED)
|
||||
|| ability.getAbilityType().equals(AbilityType.ACTIVATED);
|
||||
return ability.getAbilityType() == AbilityType.TRIGGERED
|
||||
|| ability.getAbilityType() == AbilityType.ACTIVATED;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue