mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
[CLB] Implemented Popular Entertainer
This commit is contained in:
parent
47974d2c32
commit
eb9fe4dd44
2 changed files with 107 additions and 0 deletions
106
Mage.Sets/src/mage/cards/p/PopularEntertainer.java
Normal file
106
Mage.Sets/src/mage/cards/p/PopularEntertainer.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.combat.GoadTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PopularEntertainer extends CardImpl {
|
||||
|
||||
public PopularEntertainer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.BACKGROUND);
|
||||
|
||||
// Commander creatures you own have "Whenever one or more creatures you control deal combat damage to a player, goad target creature that player controls."
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityAllEffect(
|
||||
new PopularEntertainerAbility(), Duration.WhileOnBattlefield,
|
||||
StaticFilters.FILTER_CREATURES_OWNED_COMMANDER
|
||||
)));
|
||||
}
|
||||
|
||||
private PopularEntertainer(final PopularEntertainer card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PopularEntertainer copy() {
|
||||
return new PopularEntertainer(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PopularEntertainerAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final List<UUID> damagedPlayerIds = new ArrayList<>();
|
||||
|
||||
PopularEntertainerAbility() {
|
||||
super(Zone.BATTLEFIELD, new GoadTargetEffect(), false);
|
||||
}
|
||||
|
||||
private PopularEntertainerAbility(final PopularEntertainerAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PopularEntertainerAbility copy() {
|
||||
return new PopularEntertainerAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|
||||
|| event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST) {
|
||||
damagedPlayerIds.clear();
|
||||
return false;
|
||||
}
|
||||
if (event.getType() != GameEvent.EventType.DAMAGED_PLAYER
|
||||
|| !((DamagedPlayerEvent) event).isCombatDamage()) {
|
||||
return false;
|
||||
}
|
||||
Permanent creature = game.getPermanent(event.getSourceId());
|
||||
if (creature == null
|
||||
|| !creature.isControlledBy(getControllerId())
|
||||
|| damagedPlayerIds.contains(event.getTargetId())) {
|
||||
return false;
|
||||
}
|
||||
damagedPlayerIds.add(event.getTargetId());
|
||||
FilterPermanent filter = new FilterCreaturePermanent(
|
||||
"creature controlled by " + game.getPlayer(event.getTargetId()).getName()
|
||||
);
|
||||
filter.add(new ControllerIdPredicate(event.getTargetId()));
|
||||
this.getTargets().clear();
|
||||
this.addTarget(new TargetPermanent(filter));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever one or more creatures you control deal combat damage " +
|
||||
"to a player, goad target creature that player controls.";
|
||||
}
|
||||
}
|
|
@ -426,6 +426,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Plains", 451, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Poison the Blade", 248, Rarity.COMMON, mage.cards.p.PoisonTheBlade.class));
|
||||
cards.add(new SetCardInfo("Pontiff of Blight", 768, Rarity.RARE, mage.cards.p.PontiffOfBlight.class));
|
||||
cards.add(new SetCardInfo("Popular Entertainer", 192, Rarity.RARE, mage.cards.p.PopularEntertainer.class));
|
||||
cards.add(new SetCardInfo("Port of Karfell", 908, Rarity.UNCOMMON, mage.cards.p.PortOfKarfell.class));
|
||||
cards.add(new SetCardInfo("Predatory Impetus", 249, Rarity.COMMON, mage.cards.p.PredatoryImpetus.class));
|
||||
cards.add(new SetCardInfo("Priest of Ancient Lore", 704, Rarity.COMMON, mage.cards.p.PriestOfAncientLore.class));
|
||||
|
|
Loading…
Reference in a new issue