foul-magics/Mage/src/main/java/mage/abilities/keyword/OutlastAbility.java
Alex Vasile a2162ec3e7
Refactor: private fields and performance tweaks (#9625)
1a. Make `costs`, `manaCosts`, and `manaCostsToPay` private in `AbilityImpl` with access through getters/setters 
1b. fix cost adjuster for imprinted cards affected by the above

2a. Lazy instantiation for rarely used `data` field in `TargetPointerImpl`

3a. Pre-allocate certain array sizes in `Modes` and `CostsImpl`

4a. Make `manaTemplate` private in `BasicManaEffect`, copy when passing outside the class 
4b. Don't copy `manaTemplate` in copy constructor since it doesn't change 
4c. Add comments explaining copy usage for `manaTemplate` 
4d. Remove redundant variable assignment and make fields final 

---------

Co-authored-by: xenohedron <xenohedron@users.noreply.github.com>
2023-08-27 17:58:19 -04:00

40 lines
1.2 KiB
Java

package mage.abilities.keyword;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.TimingRule;
import mage.constants.Zone;
import mage.counters.CounterType;
/**
* @author LevelX2
*/
public class OutlastAbility extends ActivatedAbilityImpl {
public OutlastAbility(Cost cost) {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), cost);
this.addCost(new TapSourceCost());
this.timing = TimingRule.SORCERY;
}
protected OutlastAbility(final OutlastAbility ability) {
super(ability);
}
@Override
public OutlastAbility copy() {
return new OutlastAbility(this);
}
@Override
public String getRule() {
StringBuilder sb = new StringBuilder("Outlast ").append(getManaCosts().getText());
sb.append(" <i>(").append(getManaCosts().getText()).append(", ").append(getCosts().getText()).append(": Put a +1/+1 counter on this creature. Outlast only as a sorcery.)</i>");
return sb.toString();
}
}