* AI: improved support of "as though mana" abilities (now computer can choose correct mana ability to pay, example: Draugr Necromancer);

* Dev: added card's LKI support of multi part cards (mdf/split/adventure);
* Dev: improved support of adding/removing counters from mdf cards;
* Draugr Necromancer - fixed support of mdf/split/adventure cards (#7620);
This commit is contained in:
Oleg Agafonov 2021-02-27 20:14:12 +04:00
parent adc945748b
commit dda69cd009
12 changed files with 227 additions and 65 deletions

View file

@ -1,27 +1,30 @@
package mage.abilities.effects;
import java.util.UUID;
import mage.abilities.Ability;
import mage.constants.ManaType;
import mage.game.Game;
import mage.players.ManaPoolItem;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public interface AsThoughManaEffect extends AsThoughEffect {
// return a mana type that can be used to pay a mana cost instead of the normally needed mana type
/**
* Return a mana type that can be used to pay a mana cost instead of the normally needed mana type
* <p>
* Usage instructions:
* - on non applied effect: must return null (example: basic object applied, by you need to check a mana source too, see Draugr Necromancer);
* - on applied effect: must return compatible manaType with ManaPoolItem (e.g. return mana.getFirstAvailable)
*
* @param manaType type of mana with which the player wants to pay the cost
* @param mana mana pool item to pay from the cost
* @param manaType type of mana with which the player wants to pay the cost
* @param mana mana pool item to pay from the cost
* @param affectedControllerId
* @param source
* @param game
* @return
* @return null on non applied effect
*/
ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game);

View file

@ -612,6 +612,23 @@ public class ContinuousEffects implements Serializable {
return null;
}
/**
* Fit paying mana type with current mana pool (if asThoughMana affected)
* <p>
* Example:
* - you need to pay {R} as cost
* - asThoughMana effect allows to use {G} as any color;
* - asThoughMana effect must change/fit paying mana type from {R} to {G}
* - after that you can pay {G} as cost
*
* @param manaType paying mana type
* @param mana checking pool item
* @param objectId paying ability's source object
* @param affectedAbility paying ability
* @param controllerId controller who pay
* @param game
* @return corrected paying mana type (same if no asThough effects and different on applied asThough effect)
*/
public ManaType asThoughMana(ManaType manaType, ManaPoolItem mana, UUID objectId, Ability affectedAbility, UUID controllerId, Game game) {
// First check existing only effects
List<AsThoughEffect> asThoughEffectsList = getApplicableAsThoughEffects(AsThoughEffectType.SPEND_ONLY_MANA, game);