- HOU: Added Oasis Ritualist

This commit is contained in:
swordshine
2017-06-17 08:19:41 +00:00
parent 39d22d1912
commit 4881224b06
7 changed files with 219 additions and 0 deletions

View File

@@ -436,6 +436,12 @@ public class Cost {
return new CostPutCardToLib(splitStr[0], splitStr[1], splitStr[2], description, ZoneType.Graveyard, true);
}
if (parse.startsWith("Exert<")) {
final String[] splitStr = abCostParse(parse, 3);
final String description = splitStr.length > 2 ? splitStr[2] : null;
return new CostExert(splitStr[0], splitStr[1], description);
}
// These won't show up with multiples
if (parse.equals("Untap") || parse.equals("Q")) {
return new CostUntap();

View File

@@ -0,0 +1,124 @@
/*
* Forge: Play Magic: the Gathering.
* Copyright (C) 2011 Forge Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.game.cost;
import forge.game.card.Card;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
/**
* The Class CostExert.
*/
public class CostExert extends CostPartWithList {
/**
* Instantiates a new cost Exert.
*
* @param amount
* the amount
* @param type
* the type
* @param description
* the description
*/
public CostExert(final String amount, final String type, final String description) {
super(amount, type, description);
}
/*
* (non-Javadoc)
*
* @see forge.card.cost.CostPart#toString()
*/
@Override
public final String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Exert ");
final Integer i = this.convertAmount();
if (this.payCostFromSource()) {
sb.append(this.getType());
} else {
final String desc = this.getTypeDescription() == null ? this.getType() : this.getTypeDescription();
if (i != null) {
sb.append(Cost.convertIntAndTypeToWords(i, desc));
} else {
sb.append(Cost.convertAmountTypeToWords(this.getAmount(), desc));
}
}
return sb.toString();
}
/*
* (non-Javadoc)
*
* @see
* forge.card.cost.CostPart#canPay(forge.card.spellability.SpellAbility,
* forge.Card, forge.Player, forge.card.cost.Cost)
*/
@Override
public final boolean canPay(final SpellAbility ability) {
final Player activator = ability.getActivatingPlayer();
final Card source = ability.getHostCard();
if (!this.payCostFromSource()) {
boolean needsAnnoucement = ability.hasParam("Announce") && this.getType().contains(ability.getParam("Announce"));
CardCollectionView typeList = activator.getCardsIn(ZoneType.Battlefield);
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source, ability);
final Integer amount = this.convertAmount();
if (!needsAnnoucement && (amount != null) && (typeList.size() < amount)) {
return false;
}
}
return true;
}
@Override
protected Card doPayment(SpellAbility ability, Card targetCard) {
targetCard.exert();
return targetCard;
}
/* (non-Javadoc)
* @see forge.card.cost.CostPartWithList#getHashForList()
*/
@Override
public String getHashForLKIList() {
return "Exerted";
}
@Override
public String getHashForCardList() {
return "ExertedCards";
}
// Inputs
public <T> T accept(ICostVisitor<T> visitor) {
return visitor.visit(this);
}
}

View File

@@ -10,6 +10,7 @@ public interface ICostVisitor<T> {
public T visit(CostExile cost);
public T visit(CostExileFromStack cost);
public T visit(CostExiledMoveToGrave cost);
public T visit(CostExert cost);
public T visit(CostFlipCoin cost);
public T visit(CostMill cost);
public T visit(CostAddMana cost);
@@ -72,6 +73,11 @@ public interface ICostVisitor<T> {
return null;
}
@Override
public T visit(CostExert cost) {
return null;
}
@Override
public T visit(CostFlipCoin cost) {
return null;