mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Updated Baki's Curse damage processing
This commit is contained in:
parent
c73cd1527c
commit
0eb6a83c6d
1 changed files with 25 additions and 28 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
|
@ -35,11 +36,10 @@ import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
|
||||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -62,8 +62,9 @@ public class BakisCurse extends CardImpl {
|
||||||
public BakisCurse copy() {
|
public BakisCurse copy() {
|
||||||
return new BakisCurse(this);
|
return new BakisCurse(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class BakisCurseEffect extends OneShotEffect {
|
class BakisCurseEffect extends OneShotEffect {
|
||||||
|
|
||||||
public BakisCurseEffect() {
|
public BakisCurseEffect() {
|
||||||
super(Outcome.Detriment);
|
super(Outcome.Detriment);
|
||||||
|
|
@ -74,28 +75,24 @@ public class BakisCurse extends CardImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
|
|
||||||
FilterPermanent filterEnchantments = new FilterPermanent();
|
|
||||||
filterEnchantments.add(new CardTypePredicate(CardType.ENCHANTMENT));
|
|
||||||
filterEnchantments.add(new SubtypePredicate(SubType.AURA));
|
|
||||||
for (Permanent auraEnchantment : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) {
|
|
||||||
if (auraEnchantment.getAttachedTo() != null) {
|
|
||||||
Permanent attachedToCreature = game.getPermanent(auraEnchantment.getAttachedTo());
|
|
||||||
if (attachedToCreature != null && attachedToCreature.isCreature()) {
|
|
||||||
attachedToCreature.damage(2, source.getId(), game, false, true);
|
|
||||||
game.informPlayers("2 damage assigned to " + attachedToCreature.getName() + " from Baki's Curse due to " + auraEnchantment.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BakisCurseEffect copy() {
|
public BakisCurseEffect copy() {
|
||||||
return new BakisCurseEffect(this);
|
return new BakisCurseEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
|
int count = 0;
|
||||||
|
List<UUID> attachments = creature.getAttachments();
|
||||||
|
for (UUID attachmentId : attachments) {
|
||||||
|
Permanent attached = game.getPermanent(attachmentId);
|
||||||
|
if (attached != null && attached.getSubtype(game).contains(SubType.AURA)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
creature.damage(count * 2, source.getId(), game, false, true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue