Merge branch 'modalPermSpells' into 'master'

MDFC: fix SpellPerm for Kaldheim

See merge request core-developers/forge!3520
This commit is contained in:
Michael Kamensky
2020-12-20 05:01:09 +00:00
5 changed files with 51 additions and 6 deletions

View File

@@ -13,6 +13,6 @@ public class PermanentNoncreatureEffect extends PermanentEffect {
public String getStackDescription(final SpellAbility sa) {
final Card sourceCard = sa.getHostCard();
//CardView toString return translated name,don't need call CardTranslation.getTranslatedName in this.
return sourceCard.toString();
return sourceCard.getName();
}
}

View File

@@ -6035,6 +6035,17 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
abilities.addAll(GameActionUtil.getAlternativeCosts(sa, player));
}
}
// Add Modal Spells
if (isModal() && hasState(CardStateName.Modal)) {
for (SpellAbility sa : getState(CardStateName.Modal).getSpellAbilities()) {
//add alternative costs as additional spell abilities
// only add Spells there
if (sa.isSpell()) {
abilities.add(sa);
abilities.addAll(GameActionUtil.getAlternativeCosts(sa, player));
}
}
}
final Collection<SpellAbility> toRemove = Lists.newArrayListWithCapacity(abilities.size());
for (final SpellAbility sa : abilities) {
@@ -6050,7 +6061,11 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
}
abilities.removeAll(toRemove);
if (getState(CardStateName.Original).getType().isLand() && !getLastKnownZone().is(ZoneType.Battlefield)) {
// Land Abilities below, move them to CardFactory after MayPlayRefactor
if (getLastKnownZone().is(ZoneType.Battlefield)) {
return abilities;
}
if (getState(CardStateName.Original).getType().isLand()) {
LandAbility la = new LandAbility(this, player, null);
if (la.canPlay()) {
abilities.add(la);
@@ -6092,7 +6107,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
}
if (isModal() && hasState(CardStateName.Modal)) {
if (getState(CardStateName.Modal).getType().isLand() && !getLastKnownZone().is(ZoneType.Battlefield)) {
if (getState(CardStateName.Modal).getType().isLand()) {
LandAbility la = new LandAbility(this, player, null);
la.setCardState(CardStateName.Modal);

View File

@@ -392,11 +392,18 @@ public class CardFactory {
}
// SpellPermanent only for Original State
if (c.getCurrentStateName() == CardStateName.Original) {
if (c.getCurrentStateName() == CardStateName.Original || c.getCurrentStateName() == CardStateName.Modal) {
// this is the "default" spell for permanents like creatures and artifacts
if (c.isPermanent() && !c.isAura() && !c.isLand()) {
c.addSpellAbility(new SpellPermanent(c));
SpellAbility sa = new SpellPermanent(c);
// Currently only for Modal, might react different when state is always set
if (c.getCurrentStateName() == CardStateName.Modal) {
sa.setCardState(c.getCurrentStateName());
}
c.addSpellAbility(sa);
}
// TODO add LandAbility there when refactor MayPlay
}
CardFactoryUtil.addAbilityFactoryAbilities(c, face.getAbilities());

View File

@@ -620,7 +620,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
public String getStackDescription() {
String text = getHostCard().getView().getText();
if (stackDescription.equals(text)) {
if (stackDescription.equals(text) && !text.isEmpty()) {
return getHostCard().getName() + " - " + text;
}
return TextUtil.fastReplace(stackDescription, "CARDNAME", getHostCard().getName());

View File

@@ -0,0 +1,23 @@
Name:Halvar, God of Battle
ManaCost:2 W W
Types:Legendary Creature God
PT:4/4
S:Mode$ Continuous | Affected$ Creature.YouCtrl+enchanted,Creature.YouCtrl+equipped | AddKeyword$ Double Strike | Description$ Creatures you control that are enchanted or equipped gain double strike.
T:Mode$ Phase | Phase$ BeginCombat | TriggerZones$ Battlefield | Execute$ TrigTargetAuraEquip | OptionalDecider$ You | TriggerDescription$ At the beginning of each combat, you may attach target Aura or Equipment attached to a creature you control to target creature you control.
SVar:TrigTargetAuraEquip:DB$ Pump | ValidTgts$ Equipment.AttachedTo Creature.YouCtrl,Aura.AttachedTo Creature.YouCtrl | TgtPrompt$ Select target Aura or Equipment attached to a creature you control | SubAbility$ DBAttach | StackDescription$ None
SVar:DBAttach:DB$ Attach | Object$ ParentTarget | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control
AlternateMode:Modal
DeckHints:Type$Equipment|Aura
Oracle:Creatures you control that are enchanted or equipped have double strike.\nAt the beginning of each combat, you may attach target Aura or Equipment attached to a creature you control to target creature you control.
ALTERNATE
Name:Sword of the Realms
ManaCost:1 W
Types:Legendary Artifact Equipment
K:Equip:1 W
S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddPower$ 2 | AddKeyword$ Vigilance | Description$ Equipped creature gets +2/+0 and has vigilance.
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.AttachedBy | Execute$ TrigReturn | TriggerDescription$ Whenever equipped creature dies, return it to its owner's hand.
SVar:TrigReturn:DB$ ChangeZone | Defined$ TriggeredNewCardLKICopy | Origin$ Graveyard | Destination$ Hand
Oracle:Equipped creature gets +2/+0 and has vigilance.\nWhenever equipped creature dies, return it to its owner's hand.\nEquip {1} {W}