* Adventure cards - added missing adventure card type info into rules (instant or sorcery);

This commit is contained in:
Oleg Agafonov 2020-01-02 05:53:56 +04:00
parent 383ab959d3
commit d860c026bd

View file

@ -15,8 +15,10 @@ import mage.constants.Zone;
import mage.game.ExileZone; import mage.game.ExileZone;
import mage.game.Game; import mage.game.Game;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors;
/** /**
* @author phulin * @author phulin
@ -29,10 +31,7 @@ public class AdventureCardSpellImpl extends CardImpl implements AdventureCardSpe
super(ownerId, setInfo, cardTypes, costs, SpellAbilityType.ADVENTURE_SPELL); super(ownerId, setInfo, cardTypes, costs, SpellAbilityType.ADVENTURE_SPELL);
this.subtype.add(SubType.ADVENTURE); this.subtype.add(SubType.ADVENTURE);
AdventureCardSpellAbility newSpellAbility = new AdventureCardSpellAbility(getSpellAbility()); AdventureCardSpellAbility newSpellAbility = new AdventureCardSpellAbility(getSpellAbility(), adventureName, cardTypes, costs);
newSpellAbility.setName(adventureName, costs);
newSpellAbility.addEffect(ExileAdventureSpellEffect.getInstance());
newSpellAbility.setCardName(adventureName);
this.replaceSpellAbility(newSpellAbility); this.replaceSpellAbility(newSpellAbility);
spellAbility = newSpellAbility; spellAbility = newSpellAbility;
@ -103,8 +102,19 @@ public class AdventureCardSpellImpl extends CardImpl implements AdventureCardSpe
} }
class AdventureCardSpellAbility extends SpellAbility { class AdventureCardSpellAbility extends SpellAbility {
public AdventureCardSpellAbility(final SpellAbility ability) {
String nameFull;
public AdventureCardSpellAbility(final SpellAbility baseSpellAbility, String adventureName, CardType[] cardTypes, String costs) {
super(baseSpellAbility);
this.setName(cardTypes, adventureName, costs);
this.addEffect(ExileAdventureSpellEffect.getInstance());
this.setCardName(adventureName);
}
public AdventureCardSpellAbility(final AdventureCardSpellAbility ability) {
super(ability); super(ability);
this.nameFull = ability.nameFull;
} }
@Override @Override
@ -120,8 +130,9 @@ class AdventureCardSpellAbility extends SpellAbility {
return super.canActivate(playerId, game); return super.canActivate(playerId, game);
} }
public void setName(String name, String costs) { public void setName(CardType[] cardTypes, String name, String costs) {
this.name = "Adventure — " + name + " " + costs; this.nameFull = "Adventure " + Arrays.stream(cardTypes).map(CardType::toString).collect(Collectors.joining(" ")) + " — " + name;
this.name = this.nameFull + " " + costs;
} }
@Override @Override
@ -132,8 +143,7 @@ class AdventureCardSpellAbility extends SpellAbility {
@Override @Override
public String getRule() { public String getRule() {
StringBuilder sbRule = new StringBuilder(); StringBuilder sbRule = new StringBuilder();
sbRule.append("Adventure — "); sbRule.append(this.nameFull);
sbRule.append(this.getCardName());
sbRule.append(" "); sbRule.append(" ");
sbRule.append(manaCosts.getText()); sbRule.append(manaCosts.getText());
sbRule.append(" — "); sbRule.append(" — ");