mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
Merge origin/master
This commit is contained in:
commit
eb537712d6
10 changed files with 75 additions and 77 deletions
|
|
@ -64,7 +64,6 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
private static final Logger LOGGER = Logger.getLogger(FeedbackPanel.class);
|
private static final Logger LOGGER = Logger.getLogger(FeedbackPanel.class);
|
||||||
|
|
||||||
public enum FeedbackMode {
|
public enum FeedbackMode {
|
||||||
|
|
||||||
INFORM, QUESTION, CONFIRM, CANCEL, SELECT, END
|
INFORM, QUESTION, CONFIRM, CANCEL, SELECT, END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,7 @@ public class HelperPanel extends JPanel {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// inform about other players
|
// inform about other players
|
||||||
this.setOpaque(false);
|
this.mainPanel.setOpaque(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttons.size() == 0) {
|
if (buttons.size() == 0) {
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,6 @@ public class ConsolePanel extends javax.swing.JPanel {
|
||||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
ConsoleFrame.getSession().toggleActivation(userName);
|
ConsoleFrame.getSession().toggleActivation(userName);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_btnDeActivateActionPerformed
|
}//GEN-LAST:event_btnDeActivateActionPerformed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,24 +28,22 @@
|
||||||
package mage.cards.e;
|
package mage.cards.e;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageObject;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.effects.Effect;
|
|
||||||
import mage.abilities.effects.OneShotEffect;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.events.DamageEvent;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.TargetSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author MarcoMarin
|
* @author L_J
|
||||||
*/
|
*/
|
||||||
public class EyeForAnEye extends CardImpl {
|
public class EyeForAnEye extends CardImpl {
|
||||||
|
|
||||||
|
|
@ -53,8 +51,7 @@ public class EyeForAnEye extends CardImpl {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{W}{W}");
|
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{W}{W}");
|
||||||
|
|
||||||
// The next time a source of your choice would deal damage to you this turn, instead that source deals that much damage to you and Eye for an Eye deals that much damage to that source's controller.
|
// The next time a source of your choice would deal damage to you this turn, instead that source deals that much damage to you and Eye for an Eye deals that much damage to that source's controller.
|
||||||
this.addAbility(new EyeForAnEyeTriggeredAbility(new EyeForAnEyeEffect()));
|
this.getSpellAbility().addEffect(new EyeForAnEyeEffect());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EyeForAnEye(final EyeForAnEye card) {
|
public EyeForAnEye(final EyeForAnEye card) {
|
||||||
|
|
@ -67,48 +64,19 @@ public class EyeForAnEye extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class EyeForAnEyeTriggeredAbility extends TriggeredAbilityImpl {
|
class EyeForAnEyeEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
public EyeForAnEyeTriggeredAbility(Effect effect) {
|
private final TargetSource damageSource;
|
||||||
super(Zone.BATTLEFIELD, effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
public EyeForAnEyeTriggeredAbility(final EyeForAnEyeTriggeredAbility ability) {
|
|
||||||
super(ability);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EyeForAnEyeTriggeredAbility copy() {
|
|
||||||
return new EyeForAnEyeTriggeredAbility(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
|
||||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
|
||||||
MageObject sourceObject = game.getObject(event.getSourceId());
|
|
||||||
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
|
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getControllerId(sourceObject.getId())));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRule() {
|
|
||||||
return "The next time a source of your choice would deal damage to you this turn, instead that source deals that much damage to you and {this} deals that much damage to that source's controller.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class EyeForAnEyeEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public EyeForAnEyeEffect() {
|
public EyeForAnEyeEffect() {
|
||||||
super(Outcome.Damage);
|
super(Duration.EndOfTurn, Outcome.RedirectDamage);
|
||||||
|
staticText = "The next time a source of your choice would deal damage to you this turn, instead that source deals that much damage to you and {this} deals that much damage to that source's controller";
|
||||||
|
this.damageSource = new TargetSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EyeForAnEyeEffect(final EyeForAnEyeEffect effect) {
|
public EyeForAnEyeEffect(final EyeForAnEyeEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
this.damageSource = effect.damageSource.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -116,15 +84,48 @@ class EyeForAnEyeEffect extends OneShotEffect {
|
||||||
return new EyeForAnEyeEffect(this);
|
return new EyeForAnEyeEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Ability source, Game game) {
|
||||||
|
this.damageSource.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
||||||
|
super.init(source, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Integer damageAmount = (Integer) this.getValue("damageAmount");
|
return true;
|
||||||
UUID targetId = this.targetPointer.getFirst(game, source);
|
}
|
||||||
if (damageAmount != null && targetId != null) {
|
|
||||||
Player player = game.getPlayer(targetId);
|
@Override
|
||||||
if (player != null) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
player.damage(damageAmount, targetId, game, false, true);
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
DamageEvent damageEvent = (DamageEvent) event;
|
||||||
|
if (controller != null) {
|
||||||
|
controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects());
|
||||||
|
UUID sourceControllerId = game.getControllerId(damageEvent.getSourceId());
|
||||||
|
if (sourceControllerId != null) {
|
||||||
|
Player sourceController = game.getPlayer(sourceControllerId);
|
||||||
|
if (sourceController != null) {
|
||||||
|
sourceController.damage(damageEvent.getAmount(), source.getSourceId(), game, false, true);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
DamageEvent damageEvent = (DamageEvent) event;
|
||||||
|
if (controller != null) {
|
||||||
|
if (controller.getId() == damageEvent.getTargetId() && damageEvent.getSourceId().equals(damageSource.getFirstTarget())) {
|
||||||
|
this.discard();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -93,11 +93,6 @@ class ProgenitusProtectionAbility extends ProtectionAbility {
|
||||||
return new ProgenitusProtectionAbility(this);
|
return new ProgenitusProtectionAbility(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRule() {
|
|
||||||
return "Protection from everything";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTarget(MageObject source, Game game) {
|
public boolean canTarget(MageObject source, Game game) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -142,11 +142,6 @@ class TeferisProtectionAbility extends ProtectionAbility {
|
||||||
return new TeferisProtectionAbility(this);
|
return new TeferisProtectionAbility(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRule() {
|
|
||||||
return "Protection from everything";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTarget(MageObject source, Game game) {
|
public boolean canTarget(MageObject source, Game game) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ class TormentOfHailfireEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
int repeat = source.getManaCostsToPay().getX();
|
int repeat = source.getManaCostsToPay().getX();
|
||||||
for (int i = 0; i < repeat; i++) {
|
for (int i = 1; i <= repeat; i++) {
|
||||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||||
Player opponent = game.getPlayer(opponentId);
|
Player opponent = game.getPlayer(opponentId);
|
||||||
if (opponent != null) {
|
if (opponent != null) {
|
||||||
|
|
@ -97,8 +97,9 @@ class TormentOfHailfireEffect extends OneShotEffect {
|
||||||
if (opponent.choose(outcome, target, source.getSourceId(), game)) {
|
if (opponent.choose(outcome, target, source.getSourceId(), game)) {
|
||||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.sacrifice(source.getSourceId(), game);
|
if (permanent.sacrifice(source.getSourceId(), game)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,28 +80,28 @@ public class CairnWandererTest extends CardTestPlayerBase {
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Typhoid Rats");
|
addCard(Zone.GRAVEYARD, playerA, "Typhoid Rats");
|
||||||
|
|
||||||
// Testing HasteAbility.
|
// Testing HasteAbility.
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Raging Goblin");
|
addCard(Zone.GRAVEYARD, playerB, "Raging Goblin");
|
||||||
|
|
||||||
// Testing LandwalkAbility.
|
// Testing LandwalkAbility.
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Zodiac Rooster");
|
addCard(Zone.GRAVEYARD, playerB, "Zodiac Rooster");
|
||||||
|
|
||||||
// Testing LifelinkAbility.
|
// Testing LifelinkAbility.
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Trained Caracal");
|
addCard(Zone.GRAVEYARD, playerB, "Trained Caracal");
|
||||||
|
|
||||||
// Testing ProtectionAbility.
|
// Testing ProtectionAbility.
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Progenitus");
|
addCard(Zone.GRAVEYARD, playerB, "Progenitus");
|
||||||
|
|
||||||
// Testing ReachAbility.
|
// Testing ReachAbility.
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Tree Monkey");
|
addCard(Zone.GRAVEYARD, playerB, "Tree Monkey");
|
||||||
|
|
||||||
// Testing TrampleAbility.
|
// Testing TrampleAbility.
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Defiant Elf");
|
addCard(Zone.GRAVEYARD, playerB, "Defiant Elf");
|
||||||
|
|
||||||
// Testing ShroudAbility.
|
// Testing ShroudAbility.
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Elvish Lookout");
|
addCard(Zone.GRAVEYARD, playerB, "Elvish Lookout");
|
||||||
|
|
||||||
// Testing VigilanceAbility.
|
// Testing VigilanceAbility.
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Veteran Cavalier");
|
addCard(Zone.GRAVEYARD, playerB, "Veteran Cavalier");
|
||||||
|
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,4 +87,13 @@ public class FixedTargets implements TargetPointer {
|
||||||
return new FixedTargets(this);
|
return new FixedTargets(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FixedTarget getFixedTarget(Game game, Ability source) {
|
||||||
|
this.init(game, source);
|
||||||
|
UUID firstId = getFirst(game, source);
|
||||||
|
if (firstId != null) {
|
||||||
|
return new FixedTarget(firstId, game.getState().getZoneChangeCounter(firstId));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,5 @@ public class SecondTargetPointer implements TargetPointer {
|
||||||
return new FixedTarget(firstId, game.getState().getZoneChangeCounter(firstId));
|
return new FixedTarget(firstId, game.getState().getZoneChangeCounter(firstId));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue