From 14d527b1f32a4ff21f6fc2a71b7e72ca31110fe1 Mon Sep 17 00:00:00 2001 From: xenohedron <12538125+xenohedron@users.noreply.github.com> Date: Sun, 13 Apr 2025 21:57:59 -0400 Subject: [PATCH] implement [ACR] Sokrates, Athenian Teacher --- .../mage/cards/s/SokratesAthenianTeacher.java | 121 ++++++++++++++++++ Mage.Sets/src/mage/sets/AssassinsCreed.java | 8 +- 2 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/s/SokratesAthenianTeacher.java diff --git a/Mage.Sets/src/mage/cards/s/SokratesAthenianTeacher.java b/Mage.Sets/src/mage/cards/s/SokratesAthenianTeacher.java new file mode 100644 index 00000000000..6754abe266c --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SokratesAthenianTeacher.java @@ -0,0 +1,121 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.SourceTappedCondition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.DefenderAbility; +import mage.abilities.keyword.HexproofAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author xenohedron + */ +public final class SokratesAthenianTeacher extends CardImpl { + + public SokratesAthenianTeacher(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{U}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ADVISOR); + this.power = new MageInt(0); + this.toughness = new MageInt(4); + + // Defender + this.addAbility(DefenderAbility.getInstance()); + + // Sokrates, Athenian Teacher has hexproof as long as it's untapped. + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( + new GainAbilitySourceEffect( + HexproofAbility.getInstance(), + Duration.WhileOnBattlefield + ), SourceTappedCondition.UNTAPPED, + "{this} has hexproof as long as it's untapped" + ))); + + // Sokratic Dialogue -- {T}: Until end of turn, target creature gains "If this creature would deal combat damage to a player, prevent that damage. This creature's controller and that player each draw half that many cards, rounded down." + Ability ability = new SimpleActivatedAbility( + new GainAbilityTargetEffect(new SimpleStaticAbility(new SokratesAthenianTeacherEffect()), Duration.EndOfTurn) + .setText("until end of turn, target creature gains \"" + SokratesAthenianTeacherEffect.rule + "\""), + new TapSourceCost() + ); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability.withFlavorWord("Sokratic Dialogue")); + } + + private SokratesAthenianTeacher(final SokratesAthenianTeacher card) { + super(card); + } + + @Override + public SokratesAthenianTeacher copy() { + return new SokratesAthenianTeacher(this); + } +} + +class SokratesAthenianTeacherEffect extends PreventionEffectImpl { + + static final String rule = "If this creature would deal combat damage to a player, prevent that damage. " + + "This creature's controller and that player each draw half that many cards, rounded down."; + + SokratesAthenianTeacherEffect() { + super(Duration.WhileOnBattlefield, Integer.MAX_VALUE, true, false); + staticText = rule; + } + + private SokratesAthenianTeacherEffect(final SokratesAthenianTeacherEffect effect) { + super(effect); + } + + @Override + public SokratesAthenianTeacherEffect copy() { + return new SokratesAthenianTeacherEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DAMAGE_PLAYER; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return super.applies(event, source, game) && event.getSourceId().equals(source.getSourceId()); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + int amount = event.getAmount() / 2; + preventDamageAction(event, source, game); + Permanent creature = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (creature != null) { + Player controller = game.getPlayer(creature.getControllerId()); + if (controller != null) { + controller.drawCards(amount, source, game); + } + } + Player damagedPlayer = game.getPlayer(event.getTargetId()); + if (damagedPlayer != null) { + damagedPlayer.drawCards(amount, source, game); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/AssassinsCreed.java b/Mage.Sets/src/mage/sets/AssassinsCreed.java index 7fb2fcf3838..233facd2f17 100644 --- a/Mage.Sets/src/mage/sets/AssassinsCreed.java +++ b/Mage.Sets/src/mage/sets/AssassinsCreed.java @@ -277,10 +277,10 @@ public final class AssassinsCreed extends ExpansionSet { cards.add(new SetCardInfo("Silent Clearing", 115, Rarity.RARE, mage.cards.s.SilentClearing.class)); cards.add(new SetCardInfo("Smoke Bomb", 259, Rarity.UNCOMMON, mage.cards.s.SmokeBomb.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Smoke Bomb", 75, Rarity.UNCOMMON, mage.cards.s.SmokeBomb.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("Sokrates, Athenian Teacher", 121, Rarity.RARE, mage.cards.s.SokratesAthenianTeacher.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("Sokrates, Athenian Teacher", 250, Rarity.RARE, mage.cards.s.SokratesAthenianTeacher.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("Sokrates, Athenian Teacher", 273, Rarity.RARE, mage.cards.s.SokratesAthenianTeacher.class, NON_FULL_USE_VARIOUS)); - //cards.add(new SetCardInfo("Sokrates, Athenian Teacher", 67, Rarity.RARE, mage.cards.s.SokratesAthenianTeacher.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Sokrates, Athenian Teacher", 121, Rarity.RARE, mage.cards.s.SokratesAthenianTeacher.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Sokrates, Athenian Teacher", 250, Rarity.RARE, mage.cards.s.SokratesAthenianTeacher.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Sokrates, Athenian Teacher", 273, Rarity.RARE, mage.cards.s.SokratesAthenianTeacher.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Sokrates, Athenian Teacher", 67, Rarity.RARE, mage.cards.s.SokratesAthenianTeacher.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Spartan Veteran", 292, Rarity.COMMON, mage.cards.s.SpartanVeteran.class)); cards.add(new SetCardInfo("Staff of Eden, Vault's Key", 123, Rarity.MYTHIC, mage.cards.s.StaffOfEdenVaultsKey.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Staff of Eden, Vault's Key", 260, Rarity.MYTHIC, mage.cards.s.StaffOfEdenVaultsKey.class, NON_FULL_USE_VARIOUS));