more fixes

This commit is contained in:
BetaSteward 2010-11-27 05:23:35 +00:00
parent 25e95b708b
commit 8f45bc1717
49 changed files with 68 additions and 59 deletions

View file

@ -431,6 +431,8 @@ public class GameController implements GameCallback {
gameZone = Zone.BATTLEFIELD; gameZone = Zone.BATTLEFIELD;
} else if ("graveyard".equalsIgnoreCase(zone)) { } else if ("graveyard".equalsIgnoreCase(zone)) {
gameZone = Zone.GRAVEYARD; gameZone = Zone.GRAVEYARD;
} else if ("library".equalsIgnoreCase(zone)) {
gameZone = Zone.LIBRARY;
} else { } else {
continue; // go parse next line continue; // go parse next line
} }

View file

@ -101,7 +101,7 @@ class FinestHourAbility extends TriggeredAbilityImpl<FinestHourAbility> {
if (game.getCombat().attacksAlone()) { if (game.getCombat().attacksAlone()) {
this.addTarget(new TargetCreaturePermanent()); this.addTarget(new TargetCreaturePermanent());
this.targets.get(0).add(game.getCombat().getAttackers().get(0), game); this.targets.get(0).add(game.getCombat().getAttackers().get(0), game);
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -89,7 +89,7 @@ class FontOfMythosAbility extends TriggeredAbilityImpl<FontOfMythosAbility> {
if (event.getType() == EventType.DRAW_STEP_PRE) { if (event.getType() == EventType.DRAW_STEP_PRE) {
this.addTarget(new TargetPlayer()); this.addTarget(new TargetPlayer());
this.targets.get(0).add(event.getPlayerId(),game); this.targets.get(0).add(event.getPlayerId(),game);
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -90,8 +90,8 @@ class MartialCoupEffect extends OneShotEffect<MartialCoupEffect> {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int amount = 0; int amount = 0;
if (source.getCosts().getVariableCosts().size() > 0) { if (source.getManaCosts().getVariableCosts().size() > 0) {
amount = source.getCosts().getVariableCosts().get(0).getAmount(); amount = source.getManaCosts().getVariableCosts().get(0).getAmount();
} }
if (amount > 4) { if (amount > 4) {

View file

@ -141,7 +141,7 @@ class QuenchableFireDelayedTriggeredAbility extends DelayedTriggeredAbility<Quen
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { if (event.getType() == EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
for (SpecialAction action: game.getState().getSpecialActions()) { for (SpecialAction action: game.getState().getSpecialActions()) {
if (action.getId().equals(specialActionId)) { if (action.getId().equals(specialActionId)) {
game.getState().getSpecialActions().remove(action); game.getState().getSpecialActions().remove(action);

View file

@ -92,7 +92,7 @@ class SigilOfTheEmptyThroneAbility extends TriggeredAbilityImpl<SigilOfTheEmptyT
if (event.getType() == EventType.SPELL_CAST) { if (event.getType() == EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getCardType().contains(CardType.ENCHANTMENT) && event.getPlayerId().equals(getControllerId())) { if (spell != null && spell.getCardType().contains(CardType.ENCHANTMENT) && event.getPlayerId().equals(getControllerId())) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -93,7 +93,7 @@ class EarthquakeEffect extends OneShotEffect<EarthquakeEffect> {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int amount = source.getCosts().getVariableCosts().get(0).getAmount(); int amount = source.getManaCosts().getVariableCosts().get(0).getAmount();
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
permanent.damage(amount, source.getId(), game, true); permanent.damage(amount, source.getId(), game, true);

View file

@ -88,7 +88,7 @@ class HowlingMineAbility extends TriggeredAbilityImpl<HowlingMineAbility> {
if (event.getType() == EventType.DRAW_STEP_PRE) { if (event.getType() == EventType.DRAW_STEP_PRE) {
this.addTarget(new TargetPlayer()); this.addTarget(new TargetPlayer());
this.targets.get(0).add(event.getPlayerId(), game); this.targets.get(0).add(event.getPlayerId(), game);
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -151,7 +151,7 @@ class IceCageAbility extends TriggeredAbilityImpl<IceCageAbility> {
Permanent enchantment = game.getPermanent(sourceId); Permanent enchantment = game.getPermanent(sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) { if (enchantment != null && enchantment.getAttachedTo() != null) {
if (event.getTargetId().equals(enchantment.getAttachedTo())) { if (event.getTargetId().equals(enchantment.getAttachedTo())) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -84,7 +84,7 @@ class MindSpringEffect extends OneShotEffect<MindSpringEffect> {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int amount = source.getCosts().getVariableCosts().get(0).getAmount(); int amount = source.getManaCosts().getVariableCosts().get(0).getAmount();
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null) { if (player != null) {
player.drawCards(amount, game); player.drawCards(amount, game);

View file

@ -189,7 +189,7 @@ public class ProteanHydra extends CardImpl<ProteanHydra> {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.COUNTER_REMOVED && event.getData().equals("+1/+1") && event.getTargetId().equals(this.getSourceId())) { if (event.getType() == EventType.COUNTER_REMOVED && event.getData().equals("+1/+1") && event.getTargetId().equals(this.getSourceId())) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;
@ -220,7 +220,7 @@ public class ProteanHydra extends CardImpl<ProteanHydra> {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.END_TURN_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { if (event.getType() == EventType.END_TURN_STEP_PRE && event.getPlayerId().equals(this.controllerId)) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -97,7 +97,7 @@ class WallOfFrostAbility extends TriggeredAbilityImpl<WallOfFrostAbility> {
if (event.getType() == EventType.BLOCKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { if (event.getType() == EventType.BLOCKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
this.addTarget(new TargetCreaturePermanent()); this.addTarget(new TargetCreaturePermanent());
this.getTargets().get(0).add(event.getTargetId(), game); this.getTargets().get(0).add(event.getTargetId(), game);
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -92,7 +92,7 @@ class AjanisPridemateAbility extends TriggeredAbilityImpl<AjanisPridemateAbility
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.GAINED_LIFE && event.getPlayerId().equals(controllerId)) { if (event.getType() == EventType.GAINED_LIFE && event.getPlayerId().equals(controllerId)) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -102,7 +102,7 @@ class FrostTitanAbility1 extends TriggeredAbilityImpl<FrostTitanAbility1> {
TargetStackObject target = new TargetStackObject(); TargetStackObject target = new TargetStackObject();
target.add(event.getSourceId(), game); target.add(event.getSourceId(), game);
this.addTarget(target); this.addTarget(target);
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;
@ -135,13 +135,13 @@ class FrostTitanAbility2 extends TriggeredAbilityImpl<FrostTitanAbility2> {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
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.getToZone() == Zone.BATTLEFIELD) { if (zEvent.getToZone() == Zone.BATTLEFIELD) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -95,13 +95,13 @@ class GraveTitanAbility extends TriggeredAbilityImpl<GraveTitanAbility> {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
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.getToZone() == Zone.BATTLEFIELD) { if (zEvent.getToZone() == Zone.BATTLEFIELD) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -99,13 +99,13 @@ class InfernoTitanAbility extends TriggeredAbilityImpl<InfernoTitanAbility> {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
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.getToZone() == Zone.BATTLEFIELD) { if (zEvent.getToZone() == Zone.BATTLEFIELD) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -89,7 +89,7 @@ class JacesErasureAbility extends TriggeredAbilityImpl<JacesErasureAbility> {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.DREW_CARD && event.getPlayerId().equals(controllerId)) { if (event.getType() == EventType.DREW_CARD && event.getPlayerId().equals(controllerId)) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -89,7 +89,7 @@ class LilianasCaressAbility extends TriggeredAbilityImpl<LilianasCaressAbility>
if (event.getType() == EventType.DISCARDED_CARD && game.getOpponents(controllerId).contains(event.getPlayerId())) { if (event.getType() == EventType.DISCARDED_CARD && game.getOpponents(controllerId).contains(event.getPlayerId())) {
this.addTarget(new TargetPlayer()); this.addTarget(new TargetPlayer());
this.targets.get(0).add(event.getPlayerId(), game); this.targets.get(0).add(event.getPlayerId(), game);
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -142,7 +142,7 @@ class MystifyingMazeDelayedTriggeredAbility extends DelayedTriggeredAbility<Myst
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.END_TURN_STEP_PRE) { if (event.getType() == EventType.END_TURN_STEP_PRE) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -90,7 +90,7 @@ public class PhantomBeast extends CardImpl<PhantomBeast> {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.TARGETED && event.getTargetId().equals(sourceId)) { if (event.getType() == EventType.TARGETED && event.getTargetId().equals(sourceId)) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -134,7 +134,7 @@ class PrimalCocoonAbility2 extends TriggeredAbilityImpl<PrimalCocoonAbility2> {
if (event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.BLOCKER_DECLARED) { if (event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.BLOCKER_DECLARED) {
Permanent enchantment = game.getPermanent(sourceId); Permanent enchantment = game.getPermanent(sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null && event.getSourceId() != null && event.getSourceId().equals(enchantment.getAttachedTo())) { if (enchantment != null && enchantment.getAttachedTo() != null && event.getSourceId() != null && event.getSourceId().equals(enchantment.getAttachedTo())) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -99,13 +99,13 @@ class PrimevalTitanAbility extends TriggeredAbilityImpl<PrimevalTitanAbility> {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
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.getToZone() == Zone.BATTLEFIELD) { if (zEvent.getToZone() == Zone.BATTLEFIELD) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -41,6 +41,7 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -61,6 +62,7 @@ public class SerraAscendant extends CardImpl<SerraAscendant> {
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
this.addAbility(LifelinkAbility.getInstance());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SerraAscendantEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SerraAscendantEffect()));
} }

View file

@ -58,7 +58,7 @@ public class SorcerersStrongbox extends CardImpl<SorcerersStrongbox> {
Costs costs = new CostsImpl(); Costs costs = new CostsImpl();
costs.add(new GenericManaCost(2)); costs.add(new GenericManaCost(2));
costs.add(new TapSourceCost()); costs.add(new TapSourceCost());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScryEffect(2), costs)); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SorcerersStrongboxEffect(), costs));
} }
public SorcerersStrongbox(final SorcerersStrongbox card) { public SorcerersStrongbox(final SorcerersStrongbox card) {

View file

@ -61,7 +61,7 @@ public class SquadronHawk extends CardImpl<SquadronHawk> {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
TargetCardInLibrary target = new TargetCardInLibrary(3, filter); TargetCardInLibrary target = new TargetCardInLibrary(3, filter);
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(target))); this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(target), true));
} }
public SquadronHawk(final SquadronHawk card) { public SquadronHawk(final SquadronHawk card) {

View file

@ -149,8 +149,8 @@ class StormtideLeviathanEffect2 extends ReplacementEffectImpl<StormtideLeviathan
if (permanent != null) { if (permanent != null) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player.getInRange().contains(permanent.getControllerId())) { if (player.getInRange().contains(permanent.getControllerId())) {
if (!permanent.getAbilities().contains(FlyingAbility.getInstance()) && if (!(permanent.getAbilities().containsKey(FlyingAbility.getInstance().getId()) ||
!permanent.getAbilities().contains(IslandwalkAbility.getInstance())) permanent.getAbilities().containsKey(IslandwalkAbility.getInstance().getId())))
return true; return true;
} }
} }

View file

@ -57,7 +57,7 @@ import mage.target.common.TargetCardInYourGraveyard;
public class SunTitan extends CardImpl<SunTitan> { public class SunTitan extends CardImpl<SunTitan> {
public SunTitan(UUID ownerId) { public SunTitan(UUID ownerId) {
super(ownerId, 35, "Sun Titan", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{4}{G}{G}"); super(ownerId, 35, "Sun Titan", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{4}{W}{W}");
this.expansionSetCode = "M11"; this.expansionSetCode = "M11";
this.subtype.add("Giant"); this.subtype.add("Giant");
this.color.setWhite(true); this.color.setWhite(true);
@ -117,13 +117,13 @@ class SunTitanAbility extends TriggeredAbilityImpl<SunTitanAbility> {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
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.getToZone() == Zone.BATTLEFIELD) { if (zEvent.getToZone() == Zone.BATTLEFIELD) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }
@ -132,7 +132,7 @@ class SunTitanAbility extends TriggeredAbilityImpl<SunTitanAbility> {
@Override @Override
public String getRule() { public String getRule() {
return "Whenever Primeval Titan enters the battlefield or attacks, you may search your library for up to two land cards, put them onto the battlefield tapped, then shuffle your library."; return "Whenever Sun Titan enters the battlefield or attacks, you may return target permanent card with converted mana cost 3 or less from your graveyard to the battlefield.";
} }
} }

View file

@ -101,8 +101,8 @@ class VengefulArchonEffect extends PreventionEffectImpl<VengefulArchonEffect> {
@Override @Override
public void init(Ability source, Game game) { public void init(Ability source, Game game) {
if (source.getCosts().getVariableCosts().size() > 0) if (source.getManaCosts().getVariableCosts().size() > 0)
amount = source.getCosts().getVariableCosts().get(0).getAmount(); amount = source.getManaCosts().getVariableCosts().get(0).getAmount();
} }
@Override @Override
@ -142,4 +142,9 @@ class VengefulArchonEffect extends PreventionEffectImpl<VengefulArchonEffect> {
return false; return false;
} }
@Override
public String getText(Ability source) {
return "Prevent the next X damage that would be dealt to you this turn. If damage is prevented this way, Vengeful Archon deals that much damage to target player";
}
} }

View file

@ -95,7 +95,7 @@ class WildEvocationAbility extends TriggeredAbilityImpl<WildEvocationAbility> {
if (event.getType() == EventType.DRAW_STEP_PRE) { if (event.getType() == EventType.DRAW_STEP_PRE) {
this.addTarget(new TargetPlayer()); this.addTarget(new TargetPlayer());
this.targets.get(0).add(event.getPlayerId(), game); this.targets.get(0).add(event.getPlayerId(), game);
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -113,6 +113,7 @@ class SeaGateOracleEffect extends OneShotEffect<SeaGateOracleEffect> {
player.choose(cards, target, game); player.choose(cards, target, game);
card = cards.get(target.getFirstTarget(), game); card = cards.get(target.getFirstTarget(), game);
card.moveToZone(Zone.HAND, source.getId(), game, false); card.moveToZone(Zone.HAND, source.getId(), game, false);
cards.remove(card);
for (Card card1: cards.getCards(game)) { for (Card card1: cards.getCards(game)) {
card1.moveToZone(Zone.LIBRARY, source.getId(), game, false); card1.moveToZone(Zone.LIBRARY, source.getId(), game, false);
} }

View file

@ -99,7 +99,7 @@ class VengevineAbility extends TriggeredAbilityImpl<VengevineAbility> {
if (event.getType() == EventType.SPELL_CAST && event.getPlayerId().equals(controllerId)) { if (event.getType() == EventType.SPELL_CAST && event.getPlayerId().equals(controllerId)) {
Watcher watcher = game.getState().getWatchers().get(controllerId, "CreatureCast"); Watcher watcher = game.getState().getWatchers().get(controllerId, "CreatureCast");
if (watcher != null && watcher.conditionMet()) { if (watcher != null && watcher.conditionMet()) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -102,7 +102,7 @@ class RafiqOfTheManyAbility extends TriggeredAbilityImpl<RafiqOfTheManyAbility>
if (game.getCombat().attacksAlone()) { if (game.getCombat().attacksAlone()) {
this.addTarget(new TargetCreaturePermanent()); this.addTarget(new TargetCreaturePermanent());
this.targets.get(0).add(game.getCombat().getAttackers().get(0), game); this.targets.get(0).add(game.getCombat().getAttackers().get(0), game);
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -88,7 +88,7 @@ class AngelsFeatherAbility extends TriggeredAbilityImpl<AngelsFeatherAbility> {
if (event.getType() == EventType.SPELL_CAST) { if (event.getType() == EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getColor().isWhite()) { if (spell != null && spell.getColor().isWhite()) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -88,7 +88,7 @@ class DemonsHornAbility extends TriggeredAbilityImpl<DemonsHornAbility> {
if (event.getType() == EventType.SPELL_CAST) { if (event.getType() == EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getColor().isBlack()) { if (spell != null && spell.getColor().isBlack()) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -88,7 +88,7 @@ class DragonsClawAbility extends TriggeredAbilityImpl<DragonsClawAbility> {
if (event.getType() == EventType.SPELL_CAST) { if (event.getType() == EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getColor().isRed()) { if (spell != null && spell.getColor().isRed()) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -88,7 +88,7 @@ class KrakensEyeAbility extends TriggeredAbilityImpl<KrakensEyeAbility> {
if (event.getType() == EventType.SPELL_CAST) { if (event.getType() == EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getColor().isBlue()) { if (spell != null && spell.getColor().isBlue()) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -88,7 +88,7 @@ class WurmsToothAbility extends TriggeredAbilityImpl<WurmsToothAbility> {
if (event.getType() == EventType.SPELL_CAST) { if (event.getType() == EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getColor().isGreen()) { if (spell != null && spell.getColor().isGreen()) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -95,7 +95,7 @@ class BeastmasterAscensionAbility extends TriggeredAbilityImpl<BeastmasterAscens
if (event.getType() == EventType.ATTACKER_DECLARED) { if (event.getType() == EventType.ATTACKER_DECLARED) {
Permanent source = game.getPermanent(event.getSourceId()); Permanent source = game.getPermanent(event.getSourceId());
if (source != null && source.getControllerId().equals(controllerId)) { if (source != null && source.getControllerId().equals(controllerId)) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -131,9 +131,7 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
result &= effect.apply(game, this); result &= effect.apply(game, this);
} }
else { else {
ContinuousEffect cEffect = (ContinuousEffect) effect; game.addEffect((ContinuousEffect) effect, this);
cEffect.init(this, game);
game.addEffect(cEffect, this);
} }
} }
} }

View file

@ -60,7 +60,7 @@ public class DealsCombatDamageToAPlayerTriggeredAbility extends TriggeredAbility
if (event.getType() == EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId)) { if (event.getType() == EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId)) {
this.addTarget(new TargetPlayer()); this.addTarget(new TargetPlayer());
this.targets.get(0).add(event.getPlayerId(), game); this.targets.get(0).add(event.getPlayerId(), game);
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -55,7 +55,7 @@ public class PutIntoGraveFromBattlefieldTriggeredAbility extends TriggeredAbilit
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() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -56,7 +56,7 @@ public class SimpleTriggeredAbility extends TriggeredAbilityImpl<SimpleTriggered
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == eventType) { if (event.getType() == eventType) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -58,7 +58,7 @@ public class BoostPowerXSourceEffect extends ContinuousEffectImpl<BoostPowerXSou
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int amount = source.getCosts().getVariableCosts().get(0).getAmount(); int amount = source.getManaCosts().getVariableCosts().get(0).getAmount();
Permanent target = (Permanent) game.getPermanent(source.getSourceId()); Permanent target = (Permanent) game.getPermanent(source.getSourceId());
if (target != null) { if (target != null) {
target.addPower(amount); target.addPower(amount);

View file

@ -56,7 +56,7 @@ public class DamageXTargetEffect extends OneShotEffect<DamageXTargetEffect> {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int amount = source.getCosts().getVariableCosts().get(0).getAmount(); int amount = source.getManaCosts().getVariableCosts().get(0).getAmount();
Permanent permanent = game.getPermanent(source.getFirstTarget()); Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) { if (permanent != null) {
permanent.damage(amount, source.getId(), game, true); permanent.damage(amount, source.getId(), game, true);

View file

@ -63,7 +63,7 @@ public class CascadeAbility extends TriggeredAbilityImpl<CascadeAbility> {
if (event.getType() == EventType.SPELL_CAST) { if (event.getType() == EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getSourceId().equals(this.getSourceId())) { if (spell != null && spell.getSourceId().equals(this.getSourceId())) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
} }

View file

@ -63,7 +63,7 @@ public class ExaltedAbility extends TriggeredAbilityImpl<ExaltedAbility> {
TargetCreaturePermanent target = new TargetCreaturePermanent(); TargetCreaturePermanent target = new TargetCreaturePermanent();
this.addTarget(target); this.addTarget(target);
this.getTargets().get(0).add(game.getCombat().getAttackers().get(0),game); this.getTargets().get(0).add(game.getCombat().getAttackers().get(0),game);
trigger(game, event.getPlayerId()); trigger(game, controllerId);
return true; return true;
} }
} }

View file

@ -101,7 +101,7 @@ class UnearthDelayedTriggeredAbility extends DelayedTriggeredAbility<UnearthDela
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.END_TURN_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { if (event.getType() == EventType.END_TURN_STEP_PRE && event.getPlayerId().equals(this.controllerId)) {
trigger(game, event.getPlayerId()); trigger(game, this.controllerId);
return true; return true;
} }
return false; return false;

View file

@ -60,7 +60,7 @@ public class FilterCreatureOrPlayer extends FilterImpl<Object, FilterCreatureOrP
public FilterCreatureOrPlayer(String name) { public FilterCreatureOrPlayer(String name) {
super(name); super(name);
creatureFilter = FilterCreaturePermanent.getDefault(); creatureFilter = new FilterCreaturePermanent();
playerFilter = new FilterPlayer(); playerFilter = new FilterPlayer();
} }

View file

@ -503,6 +503,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
@Override @Override
public void addEffect(ContinuousEffect continuousEffect, Ability source) { public void addEffect(ContinuousEffect continuousEffect, Ability source) {
continuousEffect.init(source, this);
state.addEffect(continuousEffect, source); state.addEffect(continuousEffect, source);
} }