mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Further optimization of BecomesAllBasicsControlledEffect by making static the basic mana abilities used for checking
This commit is contained in:
parent
ff001cdc5d
commit
4b511775db
1 changed files with 10 additions and 10 deletions
|
@ -15,6 +15,14 @@ import java.util.List;
|
|||
* @author TheElk801
|
||||
*/
|
||||
public class BecomesAllBasicsControlledEffect extends ContinuousEffectImpl {
|
||||
// Used only for Permanent.containsRule() to check if the permanent has a basic mana ability that should be removed
|
||||
private static final Ability[] basicManaAbilities = {
|
||||
new WhiteManaAbility(),
|
||||
new BlueManaAbility(),
|
||||
new BlackManaAbility(),
|
||||
new RedManaAbility(),
|
||||
new GreenManaAbility()
|
||||
};
|
||||
|
||||
public BecomesAllBasicsControlledEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Detriment);
|
||||
|
@ -45,16 +53,8 @@ public class BecomesAllBasicsControlledEffect extends ContinuousEffectImpl {
|
|||
SubType.SWAMP,
|
||||
SubType.MOUNTAIN,
|
||||
SubType.FOREST);
|
||||
// Optimization.
|
||||
// Remove basic mana abilities since they are redundant with AnyColorManaAbility
|
||||
// and keeping them will only produce too many combinations inside ManaOptions
|
||||
Ability[] basicManaAbilities = new Ability[]{
|
||||
new WhiteManaAbility(),
|
||||
new BlueManaAbility(),
|
||||
new BlackManaAbility(),
|
||||
new RedManaAbility(),
|
||||
new GreenManaAbility()
|
||||
};
|
||||
// Optimization: Remove basic mana abilities since they are redundant with AnyColorManaAbility
|
||||
// and keeping them will only produce too many combinations inside ManaOptions
|
||||
for (Ability basicManaAbility : basicManaAbilities) {
|
||||
if (permanent.getAbilities(game).containsRule(basicManaAbility)) {
|
||||
permanent.removeAbility(basicManaAbility, source.getSourceId(), game);
|
||||
|
|
Loading…
Reference in a new issue