mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Dynamic mana effects - Fixed that dynamic mana effects (e.g. Cabal Coffers, Elvish Archdruid) did not benefit from mana manipulation effects like Mana Reflection.
This commit is contained in:
parent
07a6c8154a
commit
c0689ec675
3 changed files with 9 additions and 7 deletions
|
@ -90,22 +90,22 @@ class ManaReflectionReplacementEffect extends ReplacementEffectImpl {
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Mana mana = ((ManaEvent) event).getMana();
|
Mana mana = ((ManaEvent) event).getMana();
|
||||||
if (mana.getBlack() > 0) {
|
if (mana.getBlack() > 0) {
|
||||||
((ManaEvent) event).getMana().set(ManaType.BLACK, mana.getBlack()* 2);
|
mana.set(ManaType.BLACK, mana.getBlack()* 2);
|
||||||
}
|
}
|
||||||
if (mana.getBlue() > 0) {
|
if (mana.getBlue() > 0) {
|
||||||
((ManaEvent) event).getMana().set(ManaType.BLUE, mana.getBlue() * 2);
|
mana.set(ManaType.BLUE, mana.getBlue() * 2);
|
||||||
}
|
}
|
||||||
if (mana.getWhite() > 0) {
|
if (mana.getWhite() > 0) {
|
||||||
((ManaEvent) event).getMana().set(ManaType.WHITE, mana.getWhite() * 2);
|
mana.set(ManaType.WHITE, mana.getWhite() * 2);
|
||||||
}
|
}
|
||||||
if (mana.getGreen() > 0) {
|
if (mana.getGreen() > 0) {
|
||||||
((ManaEvent) event).getMana().set(ManaType.GREEN, mana.getGreen() * 2);
|
mana.set(ManaType.GREEN, mana.getGreen() * 2);
|
||||||
}
|
}
|
||||||
if (mana.getRed() > 0) {
|
if (mana.getRed() > 0) {
|
||||||
((ManaEvent) event).getMana().set(ManaType.RED, mana.getRed() * 2);
|
mana.set(ManaType.RED, mana.getRed() * 2);
|
||||||
}
|
}
|
||||||
if (mana.getColorless() > 0) {
|
if (mana.getColorless() > 0) {
|
||||||
((ManaEvent) event).getMana().set(ManaType.COLORLESS, mana.getColorless() * 2);
|
mana.set(ManaType.COLORLESS, mana.getColorless() * 2);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ public class DynamicManaEffect extends BasicManaEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
computeMana(false, game, source);
|
computeMana(false, game, source);
|
||||||
|
checkToFirePossibleEvents(computedMana, game, source);
|
||||||
game.getPlayer(source.getControllerId()).getManaPool().addMana(computedMana, game, source);
|
game.getPlayer(source.getControllerId()).getManaPool().addMana(computedMana, game, source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +89,7 @@ public class DynamicManaEffect extends BasicManaEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mana getMana(Game game, Ability source) {
|
public Mana getMana(Game game, Ability source) {
|
||||||
return computeMana(false, game, source);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mana computeMana(boolean netMana ,Game game, Ability source){
|
public Mana computeMana(boolean netMana ,Game game, Ability source){
|
||||||
|
|
|
@ -89,6 +89,7 @@ public class DynamicManaAbility extends ManaAbility {
|
||||||
public List<Mana> getNetMana(Game game) {
|
public List<Mana> getNetMana(Game game) {
|
||||||
List<Mana> newNetMana = new ArrayList<>();
|
List<Mana> newNetMana = new ArrayList<>();
|
||||||
if (game != null) {
|
if (game != null) {
|
||||||
|
// TODO: effects from replacement effects like Mana Refelection are not considered yet
|
||||||
newNetMana.add(manaEffect.computeMana(true, game, this));
|
newNetMana.add(manaEffect.computeMana(true, game, this));
|
||||||
}
|
}
|
||||||
return newNetMana;
|
return newNetMana;
|
||||||
|
|
Loading…
Reference in a new issue