- little spelling fix

This commit is contained in:
Jeff 2019-03-12 11:43:16 -05:00
parent c4c217848d
commit 678f77c2a3

View file

@ -94,21 +94,26 @@ public class ManaPool implements Serializable {
* @return
*/
public boolean pay(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay, Mana usedManaToPay) {
if (!isAutoPayment() && manaType != unlockedManaType) {
if (!isAutoPayment()
&& manaType != unlockedManaType) {
// if manual payment and the needed mana type was not unlocked, nothing will be paid
return false;
}
ManaType possibleAsThoughtPoolManaType = null;
if (isAutoPayment() && isAutoPaymentRestricted() && !wasManaAddedBeyondStock() && manaType != unlockedManaType) {
ManaType possibleAsThoughPoolManaType = null;
if (isAutoPayment()
&& isAutoPaymentRestricted()
&& !wasManaAddedBeyondStock()
&& manaType != unlockedManaType) {
// if automatic restricted payment and there is already mana in the pool
// and the needed mana type was not unlocked, nothing will be paid
if (unlockedManaType != null) {
ManaPoolItem checkItem = new ManaPoolItem();
checkItem.add(unlockedManaType, 1);
possibleAsThoughtPoolManaType = game.getContinuousEffects().asThoughMana(manaType, checkItem, ability.getSourceId(), ability, ability.getControllerId(), game);
possibleAsThoughPoolManaType = game.getContinuousEffects().asThoughMana(manaType, checkItem, ability.getSourceId(), ability, ability.getControllerId(), game);
}
// Check if it's possible to use mana as thought for the unlocked manatype in the mana pool for this ability
if (possibleAsThoughtPoolManaType == null || possibleAsThoughtPoolManaType != unlockedManaType) {
if (possibleAsThoughPoolManaType == null
|| possibleAsThoughPoolManaType != unlockedManaType) {
return false; // if it's not possible return
}
}
@ -123,12 +128,17 @@ public class ManaPool implements Serializable {
if (filter != null) {
if (!filter.match(mana.getSourceObject(), game)) {
// Prevent that cost reduction by convoke is filtered out
if (!(mana.getSourceObject() instanceof Spell) || ability.getSourceId().equals(mana.getSourceId())) {
if (!(mana.getSourceObject() instanceof Spell)
|| ability.getSourceId().equals(mana.getSourceId())) {
continue;
}
}
}
if (possibleAsThoughtPoolManaType == null && manaType != unlockedManaType && isAutoPayment() && isAutoPaymentRestricted() && mana.count() == mana.getStock()) {
if (possibleAsThoughPoolManaType == null
&& manaType != unlockedManaType
&& isAutoPayment()
&& isAutoPaymentRestricted()
&& mana.count() == mana.getStock()) {
// no mana added beyond the stock so don't auto pay this
continue;
}
@ -164,7 +174,8 @@ public class ManaPool implements Serializable {
if (mana.isConditional()
&& mana.getConditionalMana().get(manaType) > 0
&& mana.getConditionalMana().apply(ability, game, mana.getSourceId(), costToPay)) {
if (filter == null || filter.match(mana.getSourceObject(), game)) {
if (filter == null
|| filter.match(mana.getSourceObject(), game)) {
return mana.getConditionalMana().get(manaType);
}
}
@ -173,7 +184,8 @@ public class ManaPool implements Serializable {
}
public int getConditionalCount(Ability ability, Game game, FilterMana filter, Cost costToPay) {
if (ability == null || getConditionalMana().isEmpty()) {
if (ability == null
|| getConditionalMana().isEmpty()) {
return 0;
}
int count = 0;
@ -210,7 +222,8 @@ public class ManaPool implements Serializable {
for (ManaType manaType : ManaType.values()) {
if (!doNotEmptyManaTypes.contains(manaType)) {
if (item.get(manaType) > 0) {
if (item.getDuration() != Duration.EndOfTurn || game.getPhase().getType() == TurnPhase.END) {
if (item.getDuration() != Duration.EndOfTurn
|| game.getPhase().getType() == TurnPhase.END) {
if (game.replaceEvent(new GameEvent(GameEvent.EventType.EMPTY_MANA_POOL, playerId, null, playerId))) {
int amount = item.get(manaType);
item.clear(manaType);
@ -223,7 +236,8 @@ public class ManaPool implements Serializable {
}
if (conditionalItem != null) {
if (conditionalItem.get(manaType) > 0) {
if (item.getDuration() != Duration.EndOfTurn || game.getPhase().getType() == TurnPhase.END) {
if (item.getDuration() != Duration.EndOfTurn
|| game.getPhase().getType() == TurnPhase.END) {
if (game.replaceEvent(new GameEvent(GameEvent.EventType.EMPTY_MANA_POOL, playerId, null, playerId))) {
int amount = conditionalItem.get(manaType);
conditionalItem.clear(manaType);
@ -378,7 +392,8 @@ public class ManaPool implements Serializable {
if (!game.replaceEvent(new ManaEvent(EventType.ADD_MANA, source.getId(), source.getSourceId(), playerId, mana))) {
if (mana instanceof ConditionalMana) {
ManaPoolItem item = new ManaPoolItem((ConditionalMana) mana, source.getSourceObject(game),
((ConditionalMana) mana).getManaProducerOriginalId() != null ? ((ConditionalMana) mana).getManaProducerOriginalId() : source.getOriginalId());
((ConditionalMana) mana).getManaProducerOriginalId() != null
? ((ConditionalMana) mana).getManaProducerOriginalId() : source.getOriginalId());
if (emptyOnTurnsEnd) {
item.setDuration(Duration.EndOfTurn);
}