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

@ -19,11 +19,10 @@ import mage.game.stack.Spell;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class PutIntoGraveFromAnywhereSourceAbility extends SimpleStaticAbility {
public PutIntoGraveFromAnywhereSourceAbility(Effect baseEffect) {
this(baseEffect, null, "", true, false);
}
@ -32,7 +31,7 @@ public class PutIntoGraveFromAnywhereSourceAbility extends SimpleStaticAbility {
super(Zone.ALL, new PutIntoGraveFromAnywhereEffect(baseEffect, condition, text, selfScope, optional));
}
public PutIntoGraveFromAnywhereSourceAbility(final PutIntoGraveFromAnywhereSourceAbility ability) {
protected PutIntoGraveFromAnywhereSourceAbility(final PutIntoGraveFromAnywhereSourceAbility ability) {
super(ability);
}
@ -45,7 +44,7 @@ public class PutIntoGraveFromAnywhereSourceAbility extends SimpleStaticAbility {
public String getRule() {
return "If {this} would be put into a graveyard from anywhere, " + super.getRule();
}
}
class PutIntoGraveFromAnywhereEffect extends ReplacementEffectImpl {
@ -100,7 +99,7 @@ class PutIntoGraveFromAnywhereEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD
if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD
&& event.getTargetId().equals(source.getSourceId())) {
if (condition == null || condition.apply(game, source)) {
return true;
@ -127,11 +126,10 @@ class PutIntoGraveFromAnywhereEffect extends ReplacementEffectImpl {
}
}
Spell spell = game.getStack().getSpell(event.getSourceId());
for (Effect effect: baseEffects) {
for (Effect effect : baseEffects) {
if (effect instanceof ContinuousEffect) {
game.addEffect((ContinuousEffect) effect, source);
}
else {
} else {
if (spell != null) {
effect.setValue(SOURCE_CAST_SPELL_ABILITY, spell.getSpellAbility());
}