* Some minor changes.

This commit is contained in:
LevelX2 2017-08-14 16:48:48 +02:00
parent 1694daa4ab
commit 6244046330
9 changed files with 24 additions and 29 deletions

View file

@ -613,7 +613,7 @@ public class GameController implements GameCallback {
if (viewLimitedDeckPlayer != null) {
if (viewLimitedDeckPlayer.isHuman()) {
for (MatchPlayer p : TableManager.instance.getTable(tableId).getMatch().getPlayers()) {
if (p.getPlayer().getId() == userIdRequester) {
if (p.getPlayer().getId().equals(userIdRequester)) {
Optional<User> u = UserManager.instance.getUser(origId);
if (u != null && u.isPresent() && p.getDeck() != null) {
u.get().ccViewLimitedDeck(p.getDeck(), tableId, requestsOpen, true);

View file

@ -181,7 +181,7 @@ class AbandonedSarcophagusReplacementEffect extends ReplacementEffectImpl {
Card card = game.getCard(event.getTargetId());
if (card != null
&& watcher != null
&& card.getOwnerId() == controller.getId()) {
&& card.getOwnerId().equals(controller.getId())) {
for (Ability ability : card.getAbilities()) {
if (ability instanceof CyclingAbility) {
cardHasCycling = true;
@ -224,8 +224,8 @@ class AbandonedSarcophagusWatcher extends Watcher {
Card card = game.getCard(event.getSourceId());
Player controller = game.getPlayer(event.getPlayerId());
if (card != null
&& controller != null
&& card.getOwnerId() == controller.getId()) {
&& controller != null
&& card.getOwnerId().equals(controller.getId())) {
Cards c = getCardsCycledThisTurn(event.getPlayerId());
c.add(card);
cycledCardsThisTurn.put(event.getPlayerId(), c);

View file

@ -115,7 +115,7 @@ class AzoriusAEthermageAbility extends TriggeredAbilityImpl {
}
if (permanentThatMoved != null
&& filter.match(permanentThatMoved, sourceId, controllerId, game)
&& zEvent.getPlayerId() == controllerId) { //The controller's hand is where the permanent moved to.
&& zEvent.getPlayerId().equals(controllerId)) { //The controller's hand is where the permanent moved to.
return true;
}
}

View file

@ -27,6 +27,9 @@
*/
package mage.cards.m;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -42,10 +45,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -123,7 +122,7 @@ class MenacingOgreEffect extends OneShotEffect {
game.informPlayers(player.getLogName() + " chose number " + numberChosen.get(player));
if (numberChosen.get(player) >= highestNumber) {
player.loseLife(highestNumber, game, false);
if (player.getId() == source.getControllerId()
if (player.getId().equals(source.getControllerId())
&& menacingOgre != null) {
menacingOgre.addCounters(CounterType.P1P1.createInstance(2), source, game);
}

View file

@ -183,7 +183,7 @@ class SpellWasNotCastCondition implements Condition {
List<Spell> spells = watcher.getSpellsCastThisTurn(source.getControllerId());
if (spells != null) {
for (Spell spell : spells) {
if (spell.getSourceId() == cardId) {
if (spell.getSourceId().equals(cardId)) {
return false;
}
}

View file

@ -49,11 +49,10 @@ public class Reparations extends CardImpl {
public Reparations(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{U}");
// Whenever an opponent casts a spell that targets you or a creature you control, you may draw a card.
this.addAbility(new ReparationsTriggeredAbility());
}
public Reparations(final Reparations card) {
@ -96,12 +95,12 @@ class ReparationsTriggeredAbility extends TriggeredAbilityImpl {
Player targetPlayer = game.getPlayer(stackObject.getStackAbility().getFirstTarget());
Permanent targetPermanent = game.getPermanent(stackObject.getStackAbility().getFirstTarget());
if (targetPlayer != null
&& targetPlayer.getId() == controllerId) {
&& targetPlayer.getId().equals(controllerId)) {
return true;
}
if (targetPermanent != null
&& targetPermanent.isCreature()
&& targetPermanent.getControllerId() == controllerId) {
&& targetPermanent.getControllerId().equals(controllerId)) {
return true;
}
}

View file

@ -58,7 +58,7 @@ public class PlayerDiedStackTargetHandlingTest extends CardTestMultiPlayerBase {
execute();
assertGraveyardCount(playerA, "Lightning Helix", 2);
Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId() == playerC.getId());
Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId().equals(playerC.getId()));
assertLife(playerA, 6);
@ -93,7 +93,7 @@ public class PlayerDiedStackTargetHandlingTest extends CardTestMultiPlayerBase {
assertPermanentCount(playerA, "Silvercoat Lion", 2);
assertGraveyardCount(playerA, "Tendrils of Agony", 1);
Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId() == playerC.getId());
Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId().equals(playerC.getId()));
assertLife(playerA, 7);

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
@ -33,14 +32,14 @@ import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.game.events.GameEvent.EventType;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
public class AttacksAndIsNotBlockedTriggeredAbility extends TriggeredAbilityImpl {
private boolean setTargetPointer;
private final boolean setTargetPointer;
public AttacksAndIsNotBlockedTriggeredAbility(Effect effect) {
this(effect, false, false);
@ -72,14 +71,12 @@ public class AttacksAndIsNotBlockedTriggeredAbility extends TriggeredAbilityImpl
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent sourcePermanent = game.getPermanent(getSourceId());
if(sourcePermanent.isAttacking()) {
for(CombatGroup combatGroup: game.getCombat().getGroups()) {
if(combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) {
if(setTargetPointer) {
for(Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getDefendingPlayerId(getSourceId(), game)));
}
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getSourceId());
if (sourcePermanent != null && sourcePermanent.isAttacking()) {
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) {
if (setTargetPointer) {
this.getEffects().setTargetPointer(new FixedTarget(game.getCombat().getDefendingPlayerId(getSourceId(), game)));
}
return true;
}

View file

@ -180,7 +180,7 @@ class AftermathExileAsResolvesFromGraveyard extends ReplacementEffectImpl {
sourceId = sourceCard.getId();
}
if (event.getTargetId() == sourceId) {
if (event.getTargetId().equals(sourceId)) {
// Moving this spell from stack to yard
Spell spell = game.getStack().getSpell(source.getSourceId());
if (spell != null && spell.getFromZone() == Zone.GRAVEYARD) {