mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
Implemented Bioessence Hydra
This commit is contained in:
parent
2f137969ab
commit
dad325d3d6
2 changed files with 131 additions and 0 deletions
130
Mage.Sets/src/mage/cards/b/BioessenceHydra.java
Normal file
130
Mage.Sets/src/mage/cards/b/BioessenceHydra.java
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BioessenceHydra extends CardImpl {
|
||||
|
||||
public BioessenceHydra(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{U}");
|
||||
|
||||
this.subtype.add(SubType.HYDRA);
|
||||
this.subtype.add(SubType.MUTANT);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Trample
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
|
||||
// Bioessence Hydra enters the battlefield with a +1/+1 counter on it for each loyalty counter on planeswalkers you control.
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(
|
||||
CounterType.P1P1.createInstance(), BioessenceHydraDynamicValue.instance, true
|
||||
), "with a +1/+1 counter on it for each loyalty counter on planeswalkers you control."
|
||||
));
|
||||
|
||||
// Whenever one or more loyalty counters are put on planeswalkers you control, put that many +1/+1 counters on Bioessence Hydra.
|
||||
this.addAbility(new BioessenceHydraTriggeredAbility());
|
||||
}
|
||||
|
||||
private BioessenceHydra(final BioessenceHydra card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BioessenceHydra copy() {
|
||||
return new BioessenceHydra(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum BioessenceHydraDynamicValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int counter = 0;
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(
|
||||
StaticFilters.FILTER_PERMANENT_PLANESWALKER, sourceAbility.getControllerId(), game
|
||||
)) {
|
||||
if (permanent != null) {
|
||||
counter += permanent.getCounters(game).getCount(CounterType.LOYALTY);
|
||||
}
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicValue copy() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
class BioessenceHydraTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
BioessenceHydraTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false);
|
||||
}
|
||||
|
||||
private BioessenceHydraTriggeredAbility(final BioessenceHydraTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BioessenceHydraTriggeredAbility copy() {
|
||||
return new BioessenceHydraTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.COUNTERS_ADDED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getData().equals(CounterType.LOYALTY.getName()) && event.getAmount() > 0) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
if (permanent == null) {
|
||||
permanent = game.getPermanentEntering(event.getTargetId());
|
||||
}
|
||||
if (permanent != null
|
||||
&& !event.getTargetId().equals(this.getSourceId())
|
||||
&& permanent.isPlaneswalker()
|
||||
&& permanent.isControlledBy(this.getControllerId())) {
|
||||
this.getEffects().clear();
|
||||
this.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(event.getAmount())));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever one or more loyalty counters are put on a planeswalker you control, put that many +1/+1 counters on {this}.";
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@ public final class WarOfTheSpark extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Awakening of Vitu-Ghazi", 152, Rarity.RARE, mage.cards.a.AwakeningOfVituGhazi.class));
|
||||
cards.add(new SetCardInfo("Band Together", 153, Rarity.COMMON, mage.cards.b.BandTogether.class));
|
||||
cards.add(new SetCardInfo("Banehound", 77, Rarity.COMMON, mage.cards.b.Banehound.class));
|
||||
cards.add(new SetCardInfo("Bioessence Hydra", 186, Rarity.RARE, mage.cards.b.BioessenceHydra.class));
|
||||
cards.add(new SetCardInfo("Blast Zone", 244, Rarity.RARE, mage.cards.b.BlastZone.class));
|
||||
cards.add(new SetCardInfo("Blindblast", 114, Rarity.COMMON, mage.cards.b.Blindblast.class));
|
||||
cards.add(new SetCardInfo("Bloom Hulk", 154, Rarity.COMMON, mage.cards.b.BloomHulk.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue