mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
[DOM] Added Warcry Phoenix.
This commit is contained in:
parent
c8c0caf704
commit
de53977941
6 changed files with 440 additions and 334 deletions
|
|
@ -9,9 +9,11 @@ import java.util.UUID;
|
|||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -23,11 +25,15 @@ public class AttacksWithCreaturesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
private int minAttackers;
|
||||
|
||||
public AttacksWithCreaturesTriggeredAbility(Effect effect, int minAttackers) {
|
||||
this(effect, minAttackers, new FilterCreaturePermanent("creatures"));
|
||||
this(effect, minAttackers, StaticFilters.FILTER_PERMANENT_CREATURES);
|
||||
}
|
||||
|
||||
public AttacksWithCreaturesTriggeredAbility(Effect effect, int minAttackers, FilterCreaturePermanent filter) {
|
||||
super(Zone.BATTLEFIELD, effect);
|
||||
this(Zone.BATTLEFIELD, effect, minAttackers, filter);
|
||||
}
|
||||
|
||||
public AttacksWithCreaturesTriggeredAbility(Zone zone, Effect effect, int minAttackers, FilterCreaturePermanent filter) {
|
||||
super(zone, effect);
|
||||
this.filter = filter;
|
||||
this.minAttackers = minAttackers;
|
||||
}
|
||||
|
|
@ -50,13 +56,17 @@ public class AttacksWithCreaturesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
int attackerCount = 0;
|
||||
for (UUID attacker : game.getCombat().getAttackers()) {
|
||||
if (filter.match(game.getPermanent(attacker), game)) {
|
||||
attackerCount++;
|
||||
if (game.getCombat().getAttackingPlayerId().equals(getControllerId())) {
|
||||
int attackerCount = 0;
|
||||
for (UUID attackerId : game.getCombat().getAttackers()) {
|
||||
Permanent permanent = game.getPermanent(attackerId);
|
||||
if (permanent != null && filter.match(game.getPermanent(attackerId), game)) {
|
||||
attackerCount++;
|
||||
}
|
||||
}
|
||||
return attackerCount >= minAttackers;
|
||||
}
|
||||
return attackerCount >= minAttackers && game.getCombat().getAttackingPlayerId().equals(getControllerId());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import mage.game.Game;
|
|||
public class ReturnToBattlefieldUnderOwnerControlSourceEffect extends OneShotEffect {
|
||||
|
||||
private boolean tapped;
|
||||
private boolean attacking;
|
||||
private int zoneChangeCounter;
|
||||
|
||||
public ReturnToBattlefieldUnderOwnerControlSourceEffect() {
|
||||
|
|
@ -52,16 +53,25 @@ public class ReturnToBattlefieldUnderOwnerControlSourceEffect extends OneShotEff
|
|||
}
|
||||
|
||||
public ReturnToBattlefieldUnderOwnerControlSourceEffect(boolean tapped, int zoneChangeCounter) {
|
||||
this(tapped, false, zoneChangeCounter);
|
||||
}
|
||||
|
||||
public ReturnToBattlefieldUnderOwnerControlSourceEffect(boolean tapped, boolean attacking, int zoneChangeCounter) {
|
||||
super(Outcome.Benefit);
|
||||
this.tapped = tapped;
|
||||
this.attacking = attacking;
|
||||
this.zoneChangeCounter = zoneChangeCounter;
|
||||
staticText = new StringBuilder("return that card to the battlefield").append(tapped ? " tapped" : "").append(" under its owner's control").toString();
|
||||
staticText = "return that card to the battlefield"
|
||||
+ (tapped ? " tapped" : "")
|
||||
+ (attacking ? " attacking" : "")
|
||||
+ " under its owner's control";
|
||||
}
|
||||
|
||||
public ReturnToBattlefieldUnderOwnerControlSourceEffect(final ReturnToBattlefieldUnderOwnerControlSourceEffect effect) {
|
||||
super(effect);
|
||||
this.tapped = effect.tapped;
|
||||
this.zoneChangeCounter = effect.zoneChangeCounter;
|
||||
this.attacking = effect.attacking;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -80,7 +90,11 @@ public class ReturnToBattlefieldUnderOwnerControlSourceEffect extends OneShotEff
|
|||
case GRAVEYARD:
|
||||
if (zoneChangeCounter < 0 || game.getState().getZoneChangeCounter(card.getId()) == zoneChangeCounter) {
|
||||
Zone currentZone = game.getState().getZone(card.getId());
|
||||
card.putOntoBattlefield(game, currentZone, source.getSourceId(), card.getOwnerId(), tapped);
|
||||
if (card.putOntoBattlefield(game, currentZone, source.getSourceId(), card.getOwnerId(), tapped)) {
|
||||
if (attacking) {
|
||||
game.getCombat().addAttackingCreature(card.getId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue