mirror of
https://github.com/correl/mage.git
synced 2025-03-27 01:11:43 -09:00
Implemented Mob Mentality
This commit is contained in:
parent
55ddd19be6
commit
9e41122813
2 changed files with 112 additions and 0 deletions
Mage.Sets/src/mage
111
Mage.Sets/src/mage/cards/m/MobMentality.java
Normal file
111
Mage.Sets/src/mage/cards/m/MobMentality.java
Normal file
|
@ -0,0 +1,111 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.AttackingCreatureCount;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class MobMentality extends CardImpl {
|
||||
|
||||
public MobMentality(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant creature
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// Enchanted creature has trample.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.AURA)));
|
||||
|
||||
// Whenever all non-Wall creatures you control attack, enchanted creature gets +X/+0 until end of turn, where X is the number of attacking creatures.
|
||||
this.addAbility(new MobMentalityTriggeredAbility());
|
||||
}
|
||||
|
||||
public MobMentality(final MobMentality card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobMentality copy() {
|
||||
return new MobMentality(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MobMentalityTriggeredAbility extends TriggeredAbilityImpl {
|
||||
MobMentalityTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new BoostTargetEffect(new AttackingCreatureCount(), new StaticValue(0), Duration.EndOfTurn, true));
|
||||
}
|
||||
|
||||
private MobMentalityTriggeredAbility(final MobMentalityTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobMentalityTriggeredAbility copy() {
|
||||
return new MobMentalityTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (!game.getCombat().getAttackingPlayerId().equals(getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
Permanent aura = game.getPermanent(getSourceId());
|
||||
if (aura == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent creature = game.getPermanent(aura.getAttachedTo());
|
||||
if (creature == null) {
|
||||
return false;
|
||||
}
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(creature, game));
|
||||
}
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(getControllerId())) {
|
||||
if (permanent.isCreature()
|
||||
&& !permanent.hasSubtype(SubType.WALL, game)
|
||||
&& !permanent.isAttacking()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever all non-Wall creatures you control attack, " +
|
||||
"enchanted creature gets +X/+0 until end of turn, " +
|
||||
"where X is the number of attacking creatures.";
|
||||
}
|
||||
}
|
|
@ -105,6 +105,7 @@ public final class Visions extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Magma Mine", 149, Rarity.UNCOMMON, mage.cards.m.MagmaMine.class));
|
||||
cards.add(new SetCardInfo("Man-o'-War", 37, Rarity.COMMON, mage.cards.m.ManOWar.class));
|
||||
cards.add(new SetCardInfo("Miraculous Recovery", 13, Rarity.UNCOMMON, mage.cards.m.MiraculousRecovery.class));
|
||||
cards.add(new SetCardInfo("Mob Mentality", 88, Rarity.UNCOMMON, mage.cards.m.MobMentality.class));
|
||||
cards.add(new SetCardInfo("Mortal Wound", 113, Rarity.COMMON, mage.cards.m.MortalWound.class));
|
||||
cards.add(new SetCardInfo("Mundungu", 132, Rarity.UNCOMMON, mage.cards.m.Mundungu.class));
|
||||
cards.add(new SetCardInfo("Mystic Veil", 38, Rarity.COMMON, mage.cards.m.MysticVeil.class));
|
||||
|
|
Loading…
Add table
Reference in a new issue