mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
- little spelling fix
This commit is contained in:
parent
c4c217848d
commit
678f77c2a3
1 changed files with 27 additions and 12 deletions
|
|
@ -94,21 +94,26 @@ public class ManaPool implements Serializable {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean pay(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay, Mana usedManaToPay) {
|
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
|
// if manual payment and the needed mana type was not unlocked, nothing will be paid
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ManaType possibleAsThoughtPoolManaType = null;
|
ManaType possibleAsThoughPoolManaType = null;
|
||||||
if (isAutoPayment() && isAutoPaymentRestricted() && !wasManaAddedBeyondStock() && manaType != unlockedManaType) {
|
if (isAutoPayment()
|
||||||
|
&& isAutoPaymentRestricted()
|
||||||
|
&& !wasManaAddedBeyondStock()
|
||||||
|
&& manaType != unlockedManaType) {
|
||||||
// if automatic restricted payment and there is already mana in the pool
|
// if automatic restricted payment and there is already mana in the pool
|
||||||
// and the needed mana type was not unlocked, nothing will be paid
|
// and the needed mana type was not unlocked, nothing will be paid
|
||||||
if (unlockedManaType != null) {
|
if (unlockedManaType != null) {
|
||||||
ManaPoolItem checkItem = new ManaPoolItem();
|
ManaPoolItem checkItem = new ManaPoolItem();
|
||||||
checkItem.add(unlockedManaType, 1);
|
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
|
// 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
|
return false; // if it's not possible return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -123,12 +128,17 @@ public class ManaPool implements Serializable {
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
if (!filter.match(mana.getSourceObject(), game)) {
|
if (!filter.match(mana.getSourceObject(), game)) {
|
||||||
// Prevent that cost reduction by convoke is filtered out
|
// 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;
|
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
|
// no mana added beyond the stock so don't auto pay this
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +174,8 @@ public class ManaPool implements Serializable {
|
||||||
if (mana.isConditional()
|
if (mana.isConditional()
|
||||||
&& mana.getConditionalMana().get(manaType) > 0
|
&& mana.getConditionalMana().get(manaType) > 0
|
||||||
&& mana.getConditionalMana().apply(ability, game, mana.getSourceId(), costToPay)) {
|
&& 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);
|
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) {
|
public int getConditionalCount(Ability ability, Game game, FilterMana filter, Cost costToPay) {
|
||||||
if (ability == null || getConditionalMana().isEmpty()) {
|
if (ability == null
|
||||||
|
|| getConditionalMana().isEmpty()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
@ -210,7 +222,8 @@ public class ManaPool implements Serializable {
|
||||||
for (ManaType manaType : ManaType.values()) {
|
for (ManaType manaType : ManaType.values()) {
|
||||||
if (!doNotEmptyManaTypes.contains(manaType)) {
|
if (!doNotEmptyManaTypes.contains(manaType)) {
|
||||||
if (item.get(manaType) > 0) {
|
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))) {
|
if (game.replaceEvent(new GameEvent(GameEvent.EventType.EMPTY_MANA_POOL, playerId, null, playerId))) {
|
||||||
int amount = item.get(manaType);
|
int amount = item.get(manaType);
|
||||||
item.clear(manaType);
|
item.clear(manaType);
|
||||||
|
|
@ -223,7 +236,8 @@ public class ManaPool implements Serializable {
|
||||||
}
|
}
|
||||||
if (conditionalItem != null) {
|
if (conditionalItem != null) {
|
||||||
if (conditionalItem.get(manaType) > 0) {
|
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))) {
|
if (game.replaceEvent(new GameEvent(GameEvent.EventType.EMPTY_MANA_POOL, playerId, null, playerId))) {
|
||||||
int amount = conditionalItem.get(manaType);
|
int amount = conditionalItem.get(manaType);
|
||||||
conditionalItem.clear(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 (!game.replaceEvent(new ManaEvent(EventType.ADD_MANA, source.getId(), source.getSourceId(), playerId, mana))) {
|
||||||
if (mana instanceof ConditionalMana) {
|
if (mana instanceof ConditionalMana) {
|
||||||
ManaPoolItem item = new ManaPoolItem((ConditionalMana) mana, source.getSourceObject(game),
|
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) {
|
if (emptyOnTurnsEnd) {
|
||||||
item.setDuration(Duration.EndOfTurn);
|
item.setDuration(Duration.EndOfTurn);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue