mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[ONE] Implement Rhuk, Hexgold Nabber
This commit is contained in:
parent
5dbbaf8ba0
commit
6a5abf5936
2 changed files with 146 additions and 0 deletions
145
Mage.Sets/src/mage/cards/r/RhukHexgoldNabber.java
Normal file
145
Mage.Sets/src/mage/cards/r/RhukHexgoldNabber.java
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
package mage.cards.r;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.keyword.HasteAbility;
|
||||||
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
|
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||||
|
import mage.filter.predicate.permanent.EquippedPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.ZoneChangeEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class RhukHexgoldNabber extends CardImpl {
|
||||||
|
|
||||||
|
public RhukHexgoldNabber(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
|
||||||
|
|
||||||
|
this.addSuperType(SuperType.LEGENDARY);
|
||||||
|
this.subtype.add(SubType.GOBLIN);
|
||||||
|
this.subtype.add(SubType.REBEL);
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
|
// Trample
|
||||||
|
this.addAbility(TrampleAbility.getInstance());
|
||||||
|
|
||||||
|
// Haste
|
||||||
|
this.addAbility(HasteAbility.getInstance());
|
||||||
|
|
||||||
|
// Whenever an equipped creature you control other than Rhuk, Hexgold Nabber attacks or dies, you may attach all Equipment attached to that creature to Rhuk.
|
||||||
|
this.addAbility(new RhukHexgoldNabberTriggeredAbility());
|
||||||
|
}
|
||||||
|
|
||||||
|
private RhukHexgoldNabber(final RhukHexgoldNabber card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RhukHexgoldNabber copy() {
|
||||||
|
return new RhukHexgoldNabber(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RhukHexgoldNabberTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(AnotherPredicate.instance);
|
||||||
|
filter.add(EquippedPredicate.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
RhukHexgoldNabberTriggeredAbility() {
|
||||||
|
super(Zone.BATTLEFIELD, new RhukHexgoldNabberEffect(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RhukHexgoldNabberTriggeredAbility(final RhukHexgoldNabberTriggeredAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RhukHexgoldNabberTriggeredAbility copy() {
|
||||||
|
return new RhukHexgoldNabberTriggeredAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.ZONE_CHANGE
|
||||||
|
|| event.getType() == GameEvent.EventType.ATTACKER_DECLARED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
Permanent permanent;
|
||||||
|
switch (event.getType()) {
|
||||||
|
case ZONE_CHANGE:
|
||||||
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
|
if (!zEvent.isDiesEvent()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
permanent = zEvent.getTarget();
|
||||||
|
break;
|
||||||
|
case ATTACKER_DECLARED:
|
||||||
|
permanent = game.getPermanent(event.getSourceId());
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (permanent == null || !filter.match(permanent, getControllerId(), this, game)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.getEffects().setValue("equippedPermanent", permanent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRule() {
|
||||||
|
return "Whenever an equipped creature you control other than {this} attacks or dies, " +
|
||||||
|
"you may attach all Equipment attached to that creature to {this}.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RhukHexgoldNabberEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
RhukHexgoldNabberEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RhukHexgoldNabberEffect(final RhukHexgoldNabberEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RhukHexgoldNabberEffect copy() {
|
||||||
|
return new RhukHexgoldNabberEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
||||||
|
Permanent permanent = (Permanent) getValue("equippedPermanent");
|
||||||
|
if (sourcePermanent == null || permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (UUID attachmentId : permanent.getAttachments()) {
|
||||||
|
Permanent attachment = game.getPermanent(attachmentId);
|
||||||
|
if (attachment != null && attachment.hasSubtype(SubType.EQUIPMENT, game)) {
|
||||||
|
sourcePermanent.addAttachment(attachmentId, source, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -198,6 +198,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Reject Imperfection", 67, Rarity.UNCOMMON, mage.cards.r.RejectImperfection.class));
|
cards.add(new SetCardInfo("Reject Imperfection", 67, Rarity.UNCOMMON, mage.cards.r.RejectImperfection.class));
|
||||||
cards.add(new SetCardInfo("Resistance Reunited", 31, Rarity.UNCOMMON, mage.cards.r.ResistanceReunited.class));
|
cards.add(new SetCardInfo("Resistance Reunited", 31, Rarity.UNCOMMON, mage.cards.r.ResistanceReunited.class));
|
||||||
cards.add(new SetCardInfo("Resistance Skywarden", 146, Rarity.UNCOMMON, mage.cards.r.ResistanceSkywarden.class));
|
cards.add(new SetCardInfo("Resistance Skywarden", 146, Rarity.UNCOMMON, mage.cards.r.ResistanceSkywarden.class));
|
||||||
|
cards.add(new SetCardInfo("Rhuk, Hexgold Nabber", 407, Rarity.RARE, mage.cards.r.RhukHexgoldNabber.class));
|
||||||
cards.add(new SetCardInfo("Ribskiff", 240, Rarity.UNCOMMON, mage.cards.r.Ribskiff.class));
|
cards.add(new SetCardInfo("Ribskiff", 240, Rarity.UNCOMMON, mage.cards.r.Ribskiff.class));
|
||||||
cards.add(new SetCardInfo("Rustvine Cultivator", 181, Rarity.COMMON, mage.cards.r.RustvineCultivator.class));
|
cards.add(new SetCardInfo("Rustvine Cultivator", 181, Rarity.COMMON, mage.cards.r.RustvineCultivator.class));
|
||||||
cards.add(new SetCardInfo("Ruthless Predation", 182, Rarity.COMMON, mage.cards.r.RuthlessPredation.class));
|
cards.add(new SetCardInfo("Ruthless Predation", 182, Rarity.COMMON, mage.cards.r.RuthlessPredation.class));
|
||||||
|
|
Loading…
Reference in a new issue