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