mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
fixes
This commit is contained in:
parent
d71f48c2ce
commit
e8be81cd34
11 changed files with 28 additions and 24 deletions
|
@ -97,7 +97,7 @@ class FrostTitanAbility1 extends TriggeredAbilityImpl<FrostTitanAbility1> {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.TARGET && event.getTargetId().equals(this.getSourceId()) && game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||
if (event.getType() == EventType.TARGETED && event.getTargetId().equals(this.getSourceId()) && game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||
this.getTargets().clear();
|
||||
TargetStackObject target = new TargetStackObject();
|
||||
target.add(event.getSourceId(), game);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class GaeasRevenge extends CardImpl<GaeasRevenge> {
|
|||
}
|
||||
|
||||
public GaeasRevenge(UUID ownerId) {
|
||||
super(ownerId, 174, "GaeasRevenge", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{5}{G}{G}");
|
||||
super(ownerId, 174, "Gaea's Revenge", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{5}{G}{G}");
|
||||
this.expansionSetCode = "M11";
|
||||
this.subtype.add("Elemental");
|
||||
this.color.setGreen(true);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -67,8 +68,11 @@ public class CantCounterSourceEffect extends ReplacementEffectImpl<CantCounterSo
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.COUNTER && event.getTargetId().equals(source.getSourceId()))
|
||||
return true;
|
||||
if (event.getType() == EventType.COUNTER) {
|
||||
UUID spellId = game.getCard(source.getSourceId()).getSpellAbility().getId();
|
||||
if (event.getTargetId().equals(spellId))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,8 +87,6 @@ public class CantTargetControlledEffect extends ReplacementEffectImpl<CantTarget
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.TARGET) {
|
||||
filterTarget.setTargetController(TargetController.YOU);
|
||||
// filterTarget.getControllerId().clear();
|
||||
// filterTarget.getControllerId().add(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && filterTarget.match(permanent, source.getControllerId(), game)) {
|
||||
if (filterSource == null)
|
||||
|
|
|
@ -34,9 +34,11 @@ import mage.MageObject;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.filter.FilterObject;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -44,9 +46,9 @@ import mage.game.events.GameEvent.EventType;
|
|||
*/
|
||||
public class CantTargetControllerEffect extends ReplacementEffectImpl<CantTargetControllerEffect> {
|
||||
|
||||
private FilterObject filterSource;
|
||||
private FilterStackObject filterSource;
|
||||
|
||||
public CantTargetControllerEffect(FilterObject filterSource, Duration duration) {
|
||||
public CantTargetControllerEffect(FilterStackObject filterSource, Duration duration) {
|
||||
super(duration, Outcome.Benefit);
|
||||
this.filterSource = filterSource;
|
||||
}
|
||||
|
@ -74,7 +76,7 @@ public class CantTargetControllerEffect extends ReplacementEffectImpl<CantTarget
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.TARGET && event.getTargetId().equals(source.getControllerId())) {
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
StackObject sourceObject = game.getStack().getStackObject(source.getSourceId());
|
||||
if (sourceObject != null && filterSource.match(sourceObject)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -34,9 +34,11 @@ import mage.MageObject;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.filter.FilterObject;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -44,9 +46,9 @@ import mage.game.events.GameEvent.EventType;
|
|||
*/
|
||||
public class CantTargetSourceEffect extends ReplacementEffectImpl<CantTargetSourceEffect> {
|
||||
|
||||
private FilterObject filterSource;
|
||||
private FilterStackObject filterSource;
|
||||
|
||||
public CantTargetSourceEffect(FilterObject filterSource, Duration duration) {
|
||||
public CantTargetSourceEffect(FilterStackObject filterSource, Duration duration) {
|
||||
super(duration, Outcome.Benefit);
|
||||
this.filterSource = filterSource;
|
||||
}
|
||||
|
@ -74,7 +76,7 @@ public class CantTargetSourceEffect extends ReplacementEffectImpl<CantTargetSour
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.TARGET && event.getTargetId().equals(source.getSourceId())) {
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
StackObject sourceObject = game.getStack().getStackObject(event.getSourceId());
|
||||
if (sourceObject != null && filterSource.match(sourceObject)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class CounterUnlessPaysEffect extends OneShotEffect<CounterUnlessPaysEffe
|
|||
|
||||
public CounterUnlessPaysEffect(final CounterUnlessPaysEffect effect) {
|
||||
super(effect);
|
||||
this.cost = effect.cost;
|
||||
this.cost = effect.cost.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -230,7 +230,7 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
return card.getId();
|
||||
return ability.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -115,7 +115,8 @@ public class SpellStack extends Stack<StackObject> {
|
|||
|
||||
public StackObject getStackObject(UUID id) {
|
||||
for (StackObject stackObject: this) {
|
||||
if (stackObject.getId().equals(id))
|
||||
UUID objectId = stackObject.getId();
|
||||
if (objectId.equals(id))
|
||||
return stackObject;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -70,10 +70,8 @@ public class StackAbility implements StackObject, Ability {
|
|||
|
||||
private Ability ability;
|
||||
private UUID controllerId;
|
||||
private UUID id;
|
||||
|
||||
public StackAbility(Ability ability, UUID controllerId) {
|
||||
this.id = UUID.randomUUID();
|
||||
this.ability = ability;
|
||||
this.controllerId = controllerId;
|
||||
}
|
||||
|
@ -81,7 +79,6 @@ public class StackAbility implements StackObject, Ability {
|
|||
public StackAbility(final StackAbility spell) {
|
||||
this.ability = spell.ability.copy();
|
||||
this.controllerId = spell.controllerId;
|
||||
this.id = spell.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -164,7 +161,7 @@ public class StackAbility implements StackObject, Ability {
|
|||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
return this.id;
|
||||
return this.ability.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -160,10 +160,10 @@ public abstract class TargetImpl<T extends TargetImpl<T>> implements Target {
|
|||
if (maxNumberOfTargets == 0 || targets.size() < maxNumberOfTargets) {
|
||||
if (!targets.containsKey(id)) {
|
||||
if (source != null) {
|
||||
if (!game.replaceEvent(GameEvent.getEvent(EventType.TARGET, id, source.getSourceId(), source.getControllerId()))) {
|
||||
if (!game.replaceEvent(GameEvent.getEvent(EventType.TARGET, id, source.getId(), source.getControllerId()))) {
|
||||
targets.put(id, 0);
|
||||
chosen = targets.size() >= minNumberOfTargets;
|
||||
game.fireEvent(GameEvent.getEvent(EventType.TARGETED, id, source.getSourceId(), source.getControllerId()));
|
||||
game.fireEvent(GameEvent.getEvent(EventType.TARGETED, id, source.getId(), source.getControllerId()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -179,10 +179,10 @@ public abstract class TargetImpl<T extends TargetImpl<T>> implements Target {
|
|||
amount += targets.get(id);
|
||||
}
|
||||
if (source != null) {
|
||||
if (!game.replaceEvent(GameEvent.getEvent(EventType.TARGET, id, source.getSourceId(), source.getControllerId()))) {
|
||||
if (!game.replaceEvent(GameEvent.getEvent(EventType.TARGET, id, source.getId(), source.getControllerId()))) {
|
||||
targets.put(id, amount);
|
||||
chosen = targets.size() >= minNumberOfTargets;
|
||||
game.fireEvent(GameEvent.getEvent(EventType.TARGETED, id, source.getSourceId(), source.getControllerId()));
|
||||
game.fireEvent(GameEvent.getEvent(EventType.TARGETED, id, source.getId(), source.getControllerId()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -229,7 +229,7 @@ public abstract class TargetImpl<T extends TargetImpl<T>> implements Target {
|
|||
@Override
|
||||
public boolean isLegal(Ability source, Game game) {
|
||||
for (UUID targetId: targets.keySet()) {
|
||||
if (game.replaceEvent(GameEvent.getEvent(EventType.TARGET, targetId, source.getSourceId(), source.getControllerId())))
|
||||
if (game.replaceEvent(GameEvent.getEvent(EventType.TARGET, targetId, source.getId(), source.getControllerId())))
|
||||
return false;
|
||||
if (!canTarget(targetId, source, game))
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue