mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 12:49:39 -08:00
* Cavern of Souls - Fixed that conditional mana in the mana pool remembers correctly for which creature subtrype its usable.
This commit is contained in:
parent
35d3c14dc6
commit
1f196f0bc7
11 changed files with 133 additions and 36 deletions
|
|
@ -119,8 +119,8 @@ class CavernOfSoulsEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
||||
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice().toString());
|
||||
permanent.addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice().toString()));
|
||||
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
|
||||
permanent.addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -133,10 +133,21 @@ class CavernOfSoulsEffect extends OneShotEffect {
|
|||
|
||||
class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
|
||||
|
||||
String creatuerType;
|
||||
|
||||
@Override
|
||||
public ConditionalManaBuilder setMana(Mana mana, Ability source, Game game) {
|
||||
Object value = game.getState().getValue(source.getSourceId() + "_type");
|
||||
if (value != null && value instanceof String) {
|
||||
creatuerType = (String) value;
|
||||
}
|
||||
return super.setMana(mana, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConditionalMana build(Object... options) {
|
||||
this.mana.setFlag(true); // indicates that the mana is from second ability
|
||||
return new CavernOfSoulsConditionalMana(this.mana);
|
||||
return new CavernOfSoulsConditionalMana(this.mana, creatuerType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -147,26 +158,29 @@ class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
|
|||
|
||||
class CavernOfSoulsConditionalMana extends ConditionalMana {
|
||||
|
||||
public CavernOfSoulsConditionalMana(Mana mana) {
|
||||
public CavernOfSoulsConditionalMana(Mana mana, String creatureType) {
|
||||
super(mana);
|
||||
staticText = "Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered";
|
||||
addCondition(new CavernOfSoulsManaCondition());
|
||||
addCondition(new CavernOfSoulsManaCondition(creatureType));
|
||||
}
|
||||
}
|
||||
|
||||
class CavernOfSoulsManaCondition extends CreatureCastManaCondition {
|
||||
|
||||
String creatureType;
|
||||
|
||||
CavernOfSoulsManaCondition(String creatureType) {
|
||||
this.creatureType = creatureType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, UUID manaProducer) {
|
||||
// check: ... to cast a creature spell
|
||||
if (super.apply(game, source)) {
|
||||
// check: ... of the chosen type
|
||||
Object value = game.getState().getValue(manaProducer + "_type");
|
||||
if (value != null && value instanceof String) {
|
||||
MageObject object = game.getObject(source.getSourceId());
|
||||
if (object.hasSubtype((String) value)) {
|
||||
return true;
|
||||
}
|
||||
MageObject object = game.getObject(source.getSourceId());
|
||||
if (creatureType != null && object.hasSubtype(creatureType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -117,19 +117,19 @@ class FoodChainManaEffect extends ManaEffect {
|
|||
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
|
||||
Mana mana = null;
|
||||
if (choice.getColor().isBlack()) {
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.BlackMana(manaCostExiled + 1)).build();
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.BlackMana(manaCostExiled + 1), source, game).build();
|
||||
}
|
||||
else if (choice.getColor().isBlue()) {
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.BlueMana(manaCostExiled + 1)).build();
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.BlueMana(manaCostExiled + 1), source, game).build();
|
||||
}
|
||||
else if (choice.getColor().isRed()) {
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.RedMana(manaCostExiled + 1)).build();
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.RedMana(manaCostExiled + 1), source, game).build();
|
||||
}
|
||||
else if (choice.getColor().isGreen()) {
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.GreenMana(manaCostExiled + 1)).build();
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.GreenMana(manaCostExiled + 1), source, game).build();
|
||||
}
|
||||
else if (choice.getColor().isWhite()) {
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.WhiteMana(manaCostExiled + 1)).build();
|
||||
mana = new FoodChainManaBuilder().setMana(Mana.WhiteMana(manaCostExiled + 1), source, game).build();
|
||||
}
|
||||
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
|
|
|||
|
|
@ -163,15 +163,15 @@ class VedalkenEngineerEffect extends ManaEffect {
|
|||
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
|
||||
Mana mana = null;
|
||||
if (choice.getColor().isBlack()) {
|
||||
mana = manaBuilder.setMana(Mana.BlackMana(1)).build();
|
||||
mana = manaBuilder.setMana(Mana.BlackMana(1), source, game).build();
|
||||
} else if (choice.getColor().isBlue()) {
|
||||
mana = manaBuilder.setMana(Mana.BlueMana(1)).build();
|
||||
mana = manaBuilder.setMana(Mana.BlueMana(1), source, game).build();
|
||||
} else if (choice.getColor().isRed()) {
|
||||
mana = manaBuilder.setMana(Mana.RedMana(1)).build();
|
||||
mana = manaBuilder.setMana(Mana.RedMana(1), source, game).build();
|
||||
} else if (choice.getColor().isGreen()) {
|
||||
mana = manaBuilder.setMana(Mana.GreenMana(1)).build();
|
||||
mana = manaBuilder.setMana(Mana.GreenMana(1), source, game).build();
|
||||
} else if (choice.getColor().isWhite()) {
|
||||
mana = manaBuilder.setMana(Mana.WhiteMana(1)).build();
|
||||
mana = manaBuilder.setMana(Mana.WhiteMana(1), source, game).build();
|
||||
}
|
||||
if (mana != null) {
|
||||
player.getManaPool().addMana(mana, game, source);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue