mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Fix Aegis of the Legion after CR update (#11765)
This commit is contained in:
parent
41dbec4dbd
commit
c3d2494db6
3 changed files with 48 additions and 18 deletions
|
|
@ -1,14 +1,17 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.permanent.AttackingPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -25,7 +28,7 @@ public class MentorAbility extends AttacksTriggeredAbility {
|
|||
}
|
||||
|
||||
public MentorAbility() {
|
||||
super(new AddCountersTargetEffect(CounterType.P1P1.createInstance()), false);
|
||||
super(new MentorEffect(), false);
|
||||
this.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
|
||||
|
|
@ -54,3 +57,37 @@ enum MentorAbilityPredicate implements ObjectSourcePlayerPredicate<Card> {
|
|||
return sourcePermanent != null && input.getObject().getPower().getValue() < sourcePermanent.getPower().getValue();
|
||||
}
|
||||
}
|
||||
|
||||
class MentorEffect extends AddCountersTargetEffect {
|
||||
|
||||
MentorEffect() {
|
||||
super(CounterType.P1P1.createInstance(), Outcome.BoostCreature);
|
||||
}
|
||||
|
||||
private MentorEffect(final MentorEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MentorEffect copy() {
|
||||
return new MentorEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (!super.apply(game, source)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Permanent mentoredPermanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (mentoredPermanent == null) {
|
||||
return false;
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(
|
||||
GameEvent.EventType.MENTORED_CREATURE,
|
||||
mentoredPermanent.getId(),
|
||||
source,
|
||||
source.getControllerId()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -584,6 +584,12 @@ public class GameEvent implements Serializable {
|
|||
playerId the player paying the cost
|
||||
*/
|
||||
EVIDENCE_COLLECTED,
|
||||
/* Mentored Creature
|
||||
targetId creature that was mentored
|
||||
sourceId of the mentor ability
|
||||
playerId controller of the creature mentoring
|
||||
*/
|
||||
MENTORED_CREATURE,
|
||||
//custom events
|
||||
CUSTOM_EVENT
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue