* Sidisi, Brood Tyrant - Fixed that the second ability did wrongly trigger, if Sidisi left battlefield before first ability did resolve.

This commit is contained in:
LevelX2 2015-04-15 08:16:58 +02:00
parent 4785ebd5f8
commit 9aa02f3d6f
14 changed files with 119 additions and 32 deletions

View file

@ -76,7 +76,8 @@ public class TriggeredAbilities extends ConcurrentHashMap<String, TriggeredAbili
if (!game.getContinuousEffects().preventedByRuleModification(event, ability, game, false)) {
if (object != null) {
boolean controllerSet = false;
if (!ability.getZone().equals(Zone.COMMAND) && (event.getType().equals(EventType.ZONE_CHANGE) || event.getType().equals(EventType.DESTROYED_PERMANENT))) {
if (!ability.getZone().equals(Zone.COMMAND) && event.getTargetId() != null && event.getTargetId().equals(ability.getSourceId())
&& (event.getType().equals(EventType.ZONE_CHANGE) || event.getType().equals(EventType.DESTROYED_PERMANENT))) {
// need to check if object was face down for dies and destroy events because the ability triggers in the new zone, zone counter -1 is used
Permanent permanent = (Permanent) game.getLastKnownInformation(ability.getSourceId(), Zone.BATTLEFIELD, ability.getSourceObjectZoneChangeCounter() - 1);
if (permanent != null) {

View file

@ -173,7 +173,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
* leaves the zone and returns again before the ability resolves.) The most common zone-change
* triggers are enters-the-battlefield triggers and leaves-the-battlefield triggers.
*/
if (event != null) {
if (event != null && event.getTargetId() != null && event.getTargetId().equals(getSourceId())) {
switch (event.getType()) {
case ZONE_CHANGE:
if (source == null && ((ZoneChangeEvent)event).getTarget() != null) {

View file

@ -66,13 +66,7 @@ public class PutTopCardOfLibraryIntoGraveControllerEffect extends OneShotEffect
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int cardsCount = Math.min(numberCards, controller.getLibrary().size());
for (int i = 0; i < cardsCount; i++) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
}
}
controller.moveCardsToGraveyardWithInfo(controller.getLibrary().getTopCards(game, numberCards), source, game, Zone.LIBRARY);
return true;
}
return false;

View file

@ -76,13 +76,7 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
MageObject mageObject;
if (source.getZone() == Zone.BATTLEFIELD) {
mageObject = source.getSourceObjectIfItStillExists(game);
} else {
mageObject = game.getObject(source.getSourceId()); // there are character definig abilities (e.g. P/T Nightmare) that have to work also for P/T of cards
}
MageObject mageObject = game.getObject(source.getSourceId());
if (mageObject == null) {
if (duration.equals(Duration.Custom)) {
discard();

View file

@ -787,7 +787,7 @@ public class GameState implements Serializable, Copyable<GameState> {
}
/**
* Onl used for diagnostic purposes of tests
* Only used for diagnostic purposes of tests
* @return
*/
public TriggeredAbilities getTriggers() {

View file

@ -79,6 +79,13 @@ public class GameEvent {
AT_END_OF_TURN,
//player events
/* ZONE_CHANGE
targetId id of the zone chaning object
sourceId sourceId of the ability with the object moving effect
playerId controller of the moved object
amount not used for this event
flag not used for this event
*/
ZONE_CHANGE,
DRAW_CARD, DREW_CARD,
MIRACLE_CARD_REVEALED,
@ -142,7 +149,17 @@ public class GameEvent {
TURNFACEDOWN, TURNEDFACEDOWN,
DAMAGE_CREATURE, DAMAGED_CREATURE,
DAMAGE_PLANESWALKER, DAMAGED_PLANESWALKER,
DESTROY_PERMANENT, DESTROYED_PERMANENT,
DESTROY_PERMANENT,
/* DESTROYED_PERMANENT
targetId id of the destroyed creature
sourceId sourceId of the ability with the destroy effect
playerId controller of the creature
amount not used for this event
flag true if no regeneration is allowed
*/
DESTROYED_PERMANENT,
SACRIFICE_PERMANENT, SACRIFICED_PERMANENT,
FIGHTED_PERMANENT,
EXPLOITED_CREATURE,