rewrote enum comparisons, iterator to removeIf, added some stream and filters

This commit is contained in:
ingmargoudt 2017-02-11 22:37:00 +01:00
parent 05e5ca3c78
commit 3a152ab3d6
41 changed files with 178 additions and 239 deletions

View file

@ -27,22 +27,18 @@
*/
package mage.abilities;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.keyword.FlashAbility;
import mage.cards.SplitCard;
import mage.constants.AbilityType;
import mage.constants.AsThoughEffectType;
import mage.constants.SpellAbilityType;
import mage.constants.TimingRule;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class SpellAbility extends ActivatedAbilityImpl {
@ -90,7 +86,7 @@ public class SpellAbility extends ActivatedAbilityImpl {
public boolean canActivate(UUID playerId, Game game) {
if (game.getContinuousEffects().asThough(sourceId, AsThoughEffectType.CAST_AS_INSTANT, this, playerId, game) // check this first to allow Offering in main phase
|| this.spellCanBeActivatedRegularlyNow(playerId, game)) {
if (spellAbilityType.equals(SpellAbilityType.SPLIT)) {
if (spellAbilityType == SpellAbilityType.SPLIT) {
return false;
}
// fix for Gitaxian Probe and casting opponent's spells
@ -106,7 +102,7 @@ public class SpellAbility extends ActivatedAbilityImpl {
}
}
// Alternate spell abilities (Flashback, Overload) can't be cast with no mana to pay option
if (getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) {
if (getSpellAbilityType()== SpellAbilityType.BASE_ALTERNATE) {
Player player = game.getPlayer(playerId);
if (player != null && getSourceId().equals(player.getCastSourceIdWithAlternateMana())) {
return false;