[LCI] Implement Intrepid Paleontologist (#11508)

* Improve some "mana spent -> give effect to permanent spell" cards
make effect source be the SpellAbility itself

* Implement Intrepid Paleontologist and tests

* Use a common class for the "specific MOR ETBs with counter" effect

* Prevent casting non-owned dinosuars

* Rename AddCounterEnteringMOR to AddCounterEnteringCreature

* fixes from review
This commit is contained in:
ssk97 2023-12-05 17:27:49 -08:00 committed by GitHub
parent 0995524f35
commit 898952515e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 349 additions and 129 deletions

View file

@ -24,6 +24,7 @@ public enum MageIdentifier {
GisaAndGeralfWatcher,
DanithaNewBenaliasLightWatcher,
HaukensInsightWatcher,
IntrepidPaleontologistWatcher,
KaradorGhostChieftainWatcher,
KessDissidentMageWatcher,
MuldrothaTheGravetideWatcher,

View file

@ -0,0 +1,70 @@
package mage.abilities.effects.common.counter;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
* @author notgreat
*/
public class AddCounterEnteringCreatureEffect extends ReplacementEffectImpl {
private final MageObjectReference mor;
private final Counter counters;
public AddCounterEnteringCreatureEffect(MageObjectReference mor, Counter counters, Outcome outcome, String text) {
super(Duration.EndOfTurn, outcome);
this.staticText = "That creature enters the battlefield with " + text + " on it";
this.mor = mor;
this.counters = counters;
}
public AddCounterEnteringCreatureEffect(MageObjectReference mor, Counter counters, Outcome outcome){
this(mor, counters, outcome, counters.getDescription());
}
/**
* defaults to a single +1/+1 counter
*/
public AddCounterEnteringCreatureEffect(MageObjectReference mor){
this(mor, CounterType.P1P1.createInstance(), Outcome.BoostCreature, "an additional +1/+1 counter");
}
private AddCounterEnteringCreatureEffect(final AddCounterEnteringCreatureEffect effect) {
super(effect);
this.mor = effect.mor;
this.counters = effect.counters;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
return permanent != null && mor.refersTo(permanent, game);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.addCounters(counters, source.getControllerId(), source, game, event.getAppliedEffects());
}
return false;
}
@Override
public AddCounterEnteringCreatureEffect copy() {
return new AddCounterEnteringCreatureEffect(this);
}
}