forked from External/mage
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>
This commit is contained in:
parent
53be4f384e
commit
a2162ec3e7
65 changed files with 262 additions and 196 deletions
|
|
@ -102,6 +102,18 @@ public interface Ability extends Controllable, Serializable {
|
|||
*/
|
||||
void setSourceId(UUID sourceID);
|
||||
|
||||
default void clearCosts() {
|
||||
getCosts().clear();
|
||||
}
|
||||
|
||||
default void clearManaCosts() {
|
||||
getManaCosts().clear();
|
||||
}
|
||||
|
||||
default void clearManaCostsToPay() {
|
||||
getManaCostsToPay().clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all {@link Costs} associated with this ability.
|
||||
*
|
||||
|
|
@ -151,6 +163,8 @@ public interface Ability extends Controllable, Serializable {
|
|||
*/
|
||||
void addManaCost(ManaCost cost);
|
||||
|
||||
void addManaCostsToPay(ManaCost manaCost);
|
||||
|
||||
/**
|
||||
* Retrieves the effects that are put into the place by the resolution of
|
||||
* this ability.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue