mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
Refactor related to #6187
This commit is contained in:
parent
4eacadb9f1
commit
d20a20fb6a
9 changed files with 44 additions and 40 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -12,7 +11,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public class DamageTargetControllerEffect extends OneShotEffect {
|
||||
|
|
@ -51,10 +49,10 @@ public class DamageTargetControllerEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
if(permanent != null) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
Player targetController = game.getPlayer(permanent.getControllerId());
|
||||
if(targetController != null) {
|
||||
if (targetController != null) {
|
||||
targetController.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -68,8 +66,8 @@ public class DamageTargetControllerEffect extends OneShotEffect {
|
|||
return staticText;
|
||||
}
|
||||
String text = "{this} deals " + amount.getMessage() + " damage to target "
|
||||
+ mode.getTargets().get(0).getTargetName() + "'s controller";
|
||||
if(!preventable) {
|
||||
+ mode.getTargets().get(0).getTargetName() + "'s controller";
|
||||
if (!preventable) {
|
||||
text += ". The damage can't be prevented";
|
||||
}
|
||||
return text;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class DamageWithPowerFromOneToAnotherTargetEffect extends OneShotEffect {
|
|||
throw new IllegalStateException("It must have two targets, but found " + source.getTargets().size());
|
||||
}
|
||||
|
||||
Permanent myPermanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
Permanent myPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
Permanent anotherPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
Player anotherPlayer = game.getPlayer(source.getTargets().get(1).getFirstTarget());
|
||||
|
||||
|
|
|
|||
|
|
@ -32,12 +32,13 @@ public final class MomirEmblem extends Emblem {
|
|||
public MomirEmblem() {
|
||||
setName("Emblem Momir Vig, Simic Visionary");
|
||||
setExpansionSetCodeForImage("DIS");
|
||||
// {X}, Discard a card: Put a token into play as a copy of a random creature card with converted mana cost X. Play this ability only any time you could play a sorcery and only once each turn.
|
||||
|
||||
// {X}, Discard a card: Create a token that's a copy of a creature card with converted mana cost X chosen at random.
|
||||
// Activate this ability only any time you could cast a sorcery and only once each turn.
|
||||
LimitedTimesPerTurnActivatedAbility ability = new LimitedTimesPerTurnActivatedAbility(Zone.COMMAND, new MomirEffect(), new VariableManaCost());
|
||||
ability.addCost(new DiscardCardCost());
|
||||
ability.setTiming(TimingRule.SORCERY);
|
||||
this.getAbilities().add(ability);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +50,7 @@ class MomirEffect extends OneShotEffect {
|
|||
|
||||
public MomirEffect(MomirEffect effect) {
|
||||
super(effect);
|
||||
staticText = "Put a token into play as a copy of a random creature card with converted mana cost X";
|
||||
staticText = "Create a token that's a copy of a creature card with converted mana cost X chosen at random";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -60,7 +61,8 @@ class MomirEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int value = source.getManaCostsToPay().getX();
|
||||
// should this be random across card names, or card printings?
|
||||
|
||||
// should this be random across card names
|
||||
CardCriteria criteria = new CardCriteria().types(CardType.CREATURE).convertedManaCost(value);
|
||||
List<CardInfo> options = CardRepository.instance.findCards(criteria);
|
||||
if (options == null || options.isEmpty()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue