mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
* Some minor changes.
This commit is contained in:
parent
1694daa4ab
commit
6244046330
9 changed files with 24 additions and 29 deletions
|
@ -613,7 +613,7 @@ public class GameController implements GameCallback {
|
||||||
if (viewLimitedDeckPlayer != null) {
|
if (viewLimitedDeckPlayer != null) {
|
||||||
if (viewLimitedDeckPlayer.isHuman()) {
|
if (viewLimitedDeckPlayer.isHuman()) {
|
||||||
for (MatchPlayer p : TableManager.instance.getTable(tableId).getMatch().getPlayers()) {
|
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);
|
Optional<User> u = UserManager.instance.getUser(origId);
|
||||||
if (u != null && u.isPresent() && p.getDeck() != null) {
|
if (u != null && u.isPresent() && p.getDeck() != null) {
|
||||||
u.get().ccViewLimitedDeck(p.getDeck(), tableId, requestsOpen, true);
|
u.get().ccViewLimitedDeck(p.getDeck(), tableId, requestsOpen, true);
|
||||||
|
|
|
@ -181,7 +181,7 @@ class AbandonedSarcophagusReplacementEffect extends ReplacementEffectImpl {
|
||||||
Card card = game.getCard(event.getTargetId());
|
Card card = game.getCard(event.getTargetId());
|
||||||
if (card != null
|
if (card != null
|
||||||
&& watcher != null
|
&& watcher != null
|
||||||
&& card.getOwnerId() == controller.getId()) {
|
&& card.getOwnerId().equals(controller.getId())) {
|
||||||
for (Ability ability : card.getAbilities()) {
|
for (Ability ability : card.getAbilities()) {
|
||||||
if (ability instanceof CyclingAbility) {
|
if (ability instanceof CyclingAbility) {
|
||||||
cardHasCycling = true;
|
cardHasCycling = true;
|
||||||
|
@ -224,8 +224,8 @@ class AbandonedSarcophagusWatcher extends Watcher {
|
||||||
Card card = game.getCard(event.getSourceId());
|
Card card = game.getCard(event.getSourceId());
|
||||||
Player controller = game.getPlayer(event.getPlayerId());
|
Player controller = game.getPlayer(event.getPlayerId());
|
||||||
if (card != null
|
if (card != null
|
||||||
&& controller != null
|
&& controller != null
|
||||||
&& card.getOwnerId() == controller.getId()) {
|
&& card.getOwnerId().equals(controller.getId())) {
|
||||||
Cards c = getCardsCycledThisTurn(event.getPlayerId());
|
Cards c = getCardsCycledThisTurn(event.getPlayerId());
|
||||||
c.add(card);
|
c.add(card);
|
||||||
cycledCardsThisTurn.put(event.getPlayerId(), c);
|
cycledCardsThisTurn.put(event.getPlayerId(), c);
|
||||||
|
|
|
@ -115,7 +115,7 @@ class AzoriusAEthermageAbility extends TriggeredAbilityImpl {
|
||||||
}
|
}
|
||||||
if (permanentThatMoved != null
|
if (permanentThatMoved != null
|
||||||
&& filter.match(permanentThatMoved, sourceId, controllerId, game)
|
&& 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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
@ -42,10 +45,6 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
|
@ -123,7 +122,7 @@ class MenacingOgreEffect extends OneShotEffect {
|
||||||
game.informPlayers(player.getLogName() + " chose number " + numberChosen.get(player));
|
game.informPlayers(player.getLogName() + " chose number " + numberChosen.get(player));
|
||||||
if (numberChosen.get(player) >= highestNumber) {
|
if (numberChosen.get(player) >= highestNumber) {
|
||||||
player.loseLife(highestNumber, game, false);
|
player.loseLife(highestNumber, game, false);
|
||||||
if (player.getId() == source.getControllerId()
|
if (player.getId().equals(source.getControllerId())
|
||||||
&& menacingOgre != null) {
|
&& menacingOgre != null) {
|
||||||
menacingOgre.addCounters(CounterType.P1P1.createInstance(2), source, game);
|
menacingOgre.addCounters(CounterType.P1P1.createInstance(2), source, game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ class SpellWasNotCastCondition implements Condition {
|
||||||
List<Spell> spells = watcher.getSpellsCastThisTurn(source.getControllerId());
|
List<Spell> spells = watcher.getSpellsCastThisTurn(source.getControllerId());
|
||||||
if (spells != null) {
|
if (spells != null) {
|
||||||
for (Spell spell : spells) {
|
for (Spell spell : spells) {
|
||||||
if (spell.getSourceId() == cardId) {
|
if (spell.getSourceId().equals(cardId)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ public class Reparations extends CardImpl {
|
||||||
public Reparations(UUID ownerId, CardSetInfo setInfo) {
|
public Reparations(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{U}");
|
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.
|
// Whenever an opponent casts a spell that targets you or a creature you control, you may draw a card.
|
||||||
this.addAbility(new ReparationsTriggeredAbility());
|
this.addAbility(new ReparationsTriggeredAbility());
|
||||||
|
|
||||||
|
@ -96,12 +95,12 @@ class ReparationsTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
Player targetPlayer = game.getPlayer(stackObject.getStackAbility().getFirstTarget());
|
Player targetPlayer = game.getPlayer(stackObject.getStackAbility().getFirstTarget());
|
||||||
Permanent targetPermanent = game.getPermanent(stackObject.getStackAbility().getFirstTarget());
|
Permanent targetPermanent = game.getPermanent(stackObject.getStackAbility().getFirstTarget());
|
||||||
if (targetPlayer != null
|
if (targetPlayer != null
|
||||||
&& targetPlayer.getId() == controllerId) {
|
&& targetPlayer.getId().equals(controllerId)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (targetPermanent != null
|
if (targetPermanent != null
|
||||||
&& targetPermanent.isCreature()
|
&& targetPermanent.isCreature()
|
||||||
&& targetPermanent.getControllerId() == controllerId) {
|
&& targetPermanent.getControllerId().equals(controllerId)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class PlayerDiedStackTargetHandlingTest extends CardTestMultiPlayerBase {
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertGraveyardCount(playerA, "Lightning Helix", 2);
|
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);
|
assertLife(playerA, 6);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class PlayerDiedStackTargetHandlingTest extends CardTestMultiPlayerBase {
|
||||||
|
|
||||||
assertPermanentCount(playerA, "Silvercoat Lion", 2);
|
assertPermanentCount(playerA, "Silvercoat Lion", 2);
|
||||||
assertGraveyardCount(playerA, "Tendrils of Agony", 1);
|
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);
|
assertLife(playerA, 7);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.common;
|
package mage.abilities.common;
|
||||||
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -33,14 +32,14 @@ import mage.abilities.effects.Effect;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.combat.CombatGroup;
|
import mage.game.combat.CombatGroup;
|
||||||
import mage.game.events.GameEvent.EventType;
|
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
public class AttacksAndIsNotBlockedTriggeredAbility extends TriggeredAbilityImpl {
|
public class AttacksAndIsNotBlockedTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
private boolean setTargetPointer;
|
private final boolean setTargetPointer;
|
||||||
|
|
||||||
public AttacksAndIsNotBlockedTriggeredAbility(Effect effect) {
|
public AttacksAndIsNotBlockedTriggeredAbility(Effect effect) {
|
||||||
this(effect, false, false);
|
this(effect, false, false);
|
||||||
|
@ -72,14 +71,12 @@ public class AttacksAndIsNotBlockedTriggeredAbility extends TriggeredAbilityImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent sourcePermanent = game.getPermanent(getSourceId());
|
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getSourceId());
|
||||||
if(sourcePermanent.isAttacking()) {
|
if (sourcePermanent != null && sourcePermanent.isAttacking()) {
|
||||||
for(CombatGroup combatGroup: game.getCombat().getGroups()) {
|
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||||
if(combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) {
|
if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) {
|
||||||
if(setTargetPointer) {
|
if (setTargetPointer) {
|
||||||
for(Effect effect : this.getEffects()) {
|
this.getEffects().setTargetPointer(new FixedTarget(game.getCombat().getDefendingPlayerId(getSourceId(), game)));
|
||||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getDefendingPlayerId(getSourceId(), game)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ class AftermathExileAsResolvesFromGraveyard extends ReplacementEffectImpl {
|
||||||
sourceId = sourceCard.getId();
|
sourceId = sourceCard.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getTargetId() == sourceId) {
|
if (event.getTargetId().equals(sourceId)) {
|
||||||
// Moving this spell from stack to yard
|
// Moving this spell from stack to yard
|
||||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||||
if (spell != null && spell.getFromZone() == Zone.GRAVEYARD) {
|
if (spell != null && spell.getFromZone() == Zone.GRAVEYARD) {
|
||||||
|
|
Loading…
Reference in a new issue