Code cleanup: protect all copy constructors (#10750)

* apply regex to change public copy constructors to protected
* cleanup code using now protected constructors
* fix manaBuilder weird casting of Mana into ConditionalMana
This commit is contained in:
Susucre 2023-08-05 01:34:58 +02:00 committed by GitHub
parent b04b13d530
commit f75b1c9f0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1565 changed files with 2412 additions and 2731 deletions

View file

@ -17,19 +17,18 @@ import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
*
* 702.45. Soulshift
* 702.45a Soulshift is a triggered ability. Soulshift N means When this permanent is put into a graveyard from play,
* you may return target Spirit card with converted mana cost N or less from your graveyard to your hand.
* 702.45b If a permanent has multiple instances of soulshift, each triggers separately.
*
* The soulshift number tells you the maximum converted mana cost of the Spirit card you can target.
* You choose whether or not to return the targeted creature card when the ability resolves.
* 702.45. Soulshift
* 702.45a Soulshift is a triggered ability. Soulshift N means When this permanent is put into a graveyard from play,
* you may return target Spirit card with converted mana cost N or less from your graveyard to your hand.
* 702.45b If a permanent has multiple instances of soulshift, each triggers separately.
* <p>
* The soulshift number tells you the maximum converted mana cost of the Spirit card you can target.
* You choose whether or not to return the targeted creature card when the ability resolves.
*
* @author Loki, LevelX2
*/
public class SoulshiftAbility extends DiesSourceTriggeredAbility {
private final DynamicValue amount;
public SoulshiftAbility(int amount) {
@ -38,10 +37,10 @@ public class SoulshiftAbility extends DiesSourceTriggeredAbility {
public SoulshiftAbility(DynamicValue amount) {
super(new ReturnToHandTargetEffect());
this.amount = amount;
this.amount = amount;
}
public SoulshiftAbility(final SoulshiftAbility ability) {
protected SoulshiftAbility(final SoulshiftAbility ability) {
super(ability);
this.amount = ability.amount;
}
@ -51,7 +50,7 @@ public class SoulshiftAbility extends DiesSourceTriggeredAbility {
this.getTargets().clear();
int intValue = amount.calculate(game, this, null);
FilterCard filter = new FilterCard("Spirit card with mana value " + intValue + " or less from your graveyard");
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, intValue + 1));
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, intValue + 1));
filter.add(SubType.SPIRIT.getPredicate());
this.addTarget(new TargetCardInYourGraveyard(filter));
super.trigger(game, controllerId, triggeringEvent); //To change body of generated methods, choose Tools | Templates.
@ -68,8 +67,8 @@ public class SoulshiftAbility extends DiesSourceTriggeredAbility {
return "Soulshift " + amount.toString() + " <i>(When this creature dies, you may return target Spirit card with mana value " + amount.toString() + " or less from your graveyard to your hand.)</i>";
} else {
return "{this} has soulshift X, where X is the number of " + amount.getMessage() +
". <i>(When this creature dies, you may return target Spirit card with mana value X or less from your graveyard to your hand.)</i>";
". <i>(When this creature dies, you may return target Spirit card with mana value X or less from your graveyard to your hand.)</i>";
}
}
}