mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[SPM] Implement Selfless Police Captain
This commit is contained in:
parent
1251c6046f
commit
1a0f3b68fc
3 changed files with 67 additions and 1 deletions
51
Mage.Sets/src/mage/cards/s/SelflessPoliceCaptain.java
Normal file
51
Mage.Sets/src/mage/cards/s/SelflessPoliceCaptain.java
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.common.PutSourceCountersOnTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SelflessPoliceCaptain extends CardImpl {
|
||||
|
||||
public SelflessPoliceCaptain(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.DETECTIVE);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// This creature enters with a +1/+1 counter on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
|
||||
"with a +1/+1 counter on it"
|
||||
));
|
||||
|
||||
// When this creature leaves the battlefield, put its +1/+1 counters on target creature you control.
|
||||
Ability ability = new DiesSourceTriggeredAbility(new PutSourceCountersOnTargetEffect(CounterType.P1P1));
|
||||
ability.addTarget(new TargetControlledCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private SelflessPoliceCaptain(final SelflessPoliceCaptain card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SelflessPoliceCaptain copy() {
|
||||
return new SelflessPoliceCaptain(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ public final class MarvelsSpiderMan extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Mountain", 197, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Origin of Spider-Man", 9, Rarity.RARE, mage.cards.o.OriginOfSpiderMan.class));
|
||||
cards.add(new SetCardInfo("Plains", 194, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Selfless Police Captain", 12, Rarity.COMMON, mage.cards.s.SelflessPoliceCaptain.class));
|
||||
cards.add(new SetCardInfo("Shock", 88, Rarity.COMMON, mage.cards.s.Shock.class));
|
||||
cards.add(new SetCardInfo("Swamp", 196, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
|
@ -12,12 +13,20 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class PutSourceCountersOnTargetEffect extends OneShotEffect {
|
||||
|
||||
private final CounterType counterType;
|
||||
|
||||
public PutSourceCountersOnTargetEffect() {
|
||||
this((CounterType) null);
|
||||
}
|
||||
|
||||
public PutSourceCountersOnTargetEffect(CounterType counterType) {
|
||||
super(Outcome.Benefit);
|
||||
this.counterType = counterType;
|
||||
}
|
||||
|
||||
private PutSourceCountersOnTargetEffect(final PutSourceCountersOnTargetEffect effect) {
|
||||
super(effect);
|
||||
this.counterType = effect.counterType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -32,6 +41,10 @@ public class PutSourceCountersOnTargetEffect extends OneShotEffect {
|
|||
if (sourcePermanent == null || permanent == null) {
|
||||
return false;
|
||||
}
|
||||
if (counterType != null) {
|
||||
int count = sourcePermanent.getCounters(game).getCount(counterType);
|
||||
return count > 0 && permanent.addCounters(counterType.createInstance(count), source, game);
|
||||
}
|
||||
sourcePermanent
|
||||
.getCounters(game)
|
||||
.values()
|
||||
|
|
@ -45,6 +58,7 @@ public class PutSourceCountersOnTargetEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "put its counters on " + getTargetPointer().describeTargets(mode.getTargets(), "that creature");
|
||||
return "put its" + (counterType != null ? " " + counterType : "") + " counters on " +
|
||||
getTargetPointer().describeTargets(mode.getTargets(), "that creature");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue