mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 20:29:19 -08:00
Redesigned handling of attack allowed check related to the complete attack.
This commit is contained in:
parent
359dc3f537
commit
4d01eb143a
15 changed files with 267 additions and 176 deletions
|
|
@ -53,7 +53,7 @@ public class LoyalPegasus extends CardImpl {
|
|||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
// Loyal Pegasus can't attack or block alone.
|
||||
this.addAbility(CantAttackAloneAbility.getInstance());
|
||||
this.addAbility(new CantAttackAloneAbility());
|
||||
this.addAbility(CantBlockAloneAbility.getInstance());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class MasterOfCruelties extends CardImpl {
|
|||
// Deathtouch
|
||||
this.addAbility(DeathtouchAbility.getInstance());
|
||||
// Master of Cruelties can only attack alone.
|
||||
this.addAbility(CanAttackOnlyAloneAbility.getInstance());
|
||||
this.addAbility(new CanAttackOnlyAloneAbility());
|
||||
|
||||
// Whenever Master of Cruelties attacks a player and isn't blocked, that player's life total becomes 1. Master of Cruelties assigns no combat damage this combat.
|
||||
this.addAbility(new MasterOfCrueltiesTriggeredAbility());
|
||||
|
|
@ -111,7 +111,7 @@ class MasterOfCrueltiesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanent(getSourceId());
|
||||
if (sourcePermanent.isAttacking()) {
|
||||
for (CombatGroup combatGroup: game.getCombat().getGroups()) {
|
||||
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) {
|
||||
// check if a player is attacked (instead of a planeswalker)
|
||||
Player defendingPlayer = game.getPlayer(combatGroup.getDefenderId());
|
||||
|
|
@ -184,11 +184,11 @@ class MasterOfCrueltiesNoDamageEffect extends ContinuousRuleModifyingEffectImpl
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
DamageEvent damageEvent = (DamageEvent) event;
|
||||
return event.getSourceId().equals(source.getSourceId()) && damageEvent.isCombatDamage();
|
||||
|
||||
return event.getSourceId().equals(source.getSourceId()) && damageEvent.isCombatDamage();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@
|
|||
package mage.sets.gatecrash;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.CantAttackAloneAbility;
|
||||
import mage.abilities.keyword.CantBlockAloneAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -50,7 +50,7 @@ public class EmberBeast extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Ember Beast can't attack or block alone.
|
||||
this.addAbility(CantAttackAloneAbility.getInstance());
|
||||
this.addAbility(new CantAttackAloneAbility());
|
||||
this.addAbility(CantBlockAloneAbility.getInstance());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,12 +32,11 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.combat.CanAttackOnlyAloneEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.BestowAbility;
|
||||
import mage.abilities.keyword.CantAttackAloneAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.AttachmentType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
|
|
@ -61,16 +60,16 @@ public class SightlessBrawler extends CardImpl {
|
|||
// Bestow 4W (If you cast this card for its bestow cost, it's an Aura spell with enchant creature. It becomes a creature again if it's not attached to a creature.)
|
||||
this.addAbility(new BestowAbility(this, "{4}{W}"));
|
||||
// Sightless Brawler can't attack alone.
|
||||
this.addAbility(CantAttackAloneAbility.getInstance());
|
||||
this.addAbility(new CantAttackAloneAbility());
|
||||
// Enchanted creature gets +3/+2 and can't attack alone.
|
||||
Effect effect = new BoostEnchantedEffect(3,2, Duration.WhileOnBattlefield);
|
||||
Effect effect = new BoostEnchantedEffect(3, 2, Duration.WhileOnBattlefield);
|
||||
effect.setText("Enchanted creature gets +3/+2");
|
||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
|
||||
effect = new GainAbilityAttachedEffect(CantAttackAloneAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield);
|
||||
effect = new CanAttackOnlyAloneEffect();
|
||||
effect.setText("and can't attack alone");
|
||||
ability.addEffect(effect);
|
||||
this.addAbility(ability);
|
||||
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
public SightlessBrawler(final SightlessBrawler card) {
|
||||
|
|
|
|||
|
|
@ -27,14 +27,13 @@
|
|||
*/
|
||||
package mage.sets.magic2010;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.CantAttackAloneAbility;
|
||||
import mage.abilities.keyword.CantBlockAloneAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
|
||||
/**
|
||||
* @author magenoxx_at_gmail.com
|
||||
|
|
@ -50,7 +49,7 @@ public class JackalFamiliar extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Jackal Familiar can't attack or block alone.
|
||||
this.addAbility(CantAttackAloneAbility.getInstance());
|
||||
this.addAbility(new CantAttackAloneAbility());
|
||||
this.addAbility(CantBlockAloneAbility.getInstance());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,14 +27,13 @@
|
|||
*/
|
||||
package mage.sets.magic2013;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.CantAttackAloneAbility;
|
||||
import mage.abilities.keyword.CantBlockAloneAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
|
||||
/**
|
||||
* @author magenoxx_at_gmail.com
|
||||
|
|
@ -50,7 +49,7 @@ public class MoggFlunkies extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Mogg Flunkies can't attack or block alone.
|
||||
this.addAbility(CantAttackAloneAbility.getInstance());
|
||||
this.addAbility(new CantAttackAloneAbility());
|
||||
this.addAbility(CantBlockAloneAbility.getInstance());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class BondedConstruct extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Bonded Construct can't attack alone.
|
||||
this.addAbility(CantAttackAloneAbility.getInstance());
|
||||
this.addAbility(new CantAttackAloneAbility());
|
||||
}
|
||||
|
||||
public BondedConstruct(final BondedConstruct card) {
|
||||
|
|
|
|||
|
|
@ -32,12 +32,10 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.combat.CanAttackOnlyAloneEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.CanAttackOnlyAloneAbility;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.AttachmentType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
|
|
@ -49,7 +47,7 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
||||
*
|
||||
*/
|
||||
public class Errantry extends CardImpl {
|
||||
|
||||
|
|
@ -66,8 +64,8 @@ public class Errantry extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
// Enchanted creature gets +3/+0 and can only attack alone.
|
||||
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 0, Duration.WhileOnBattlefield));
|
||||
Effect effect = new GainAbilityAttachedEffect(CanAttackOnlyAloneAbility.getInstance(), AttachmentType.AURA);
|
||||
effect.setText("and can only attack alone.");
|
||||
Effect effect = new CanAttackOnlyAloneEffect();
|
||||
effect.setText("and can only attack alone");
|
||||
ability.addEffect(effect);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue