mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Added the cost "OppGainLife".
- Added Reverent Silence.
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -6151,6 +6151,7 @@ res/cardsfolder/r/reverberate.txt svneol=native#text/plain
|
||||
res/cardsfolder/r/revered_dead.txt svneol=native#text/plain
|
||||
res/cardsfolder/r/revered_elder.txt svneol=native#text/plain
|
||||
res/cardsfolder/r/reverence.txt svneol=native#text/plain
|
||||
res/cardsfolder/r/reverent_silence.txt -text
|
||||
res/cardsfolder/r/revive.txt svneol=native#text/plain
|
||||
res/cardsfolder/r/revive_the_fallen.txt svneol=native#text/plain
|
||||
res/cardsfolder/r/reviving_dose.txt svneol=native#text/plain
|
||||
@@ -9657,6 +9658,7 @@ src/main/java/forge/card/cardFactory/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/card/cost/Cost.java svneol=native#text/plain
|
||||
src/main/java/forge/card/cost/CostDiscard.java -text
|
||||
src/main/java/forge/card/cost/CostExile.java -text
|
||||
src/main/java/forge/card/cost/CostGainLife.java -text
|
||||
src/main/java/forge/card/cost/CostMana.java -text
|
||||
src/main/java/forge/card/cost/CostMill.java -text
|
||||
src/main/java/forge/card/cost/CostPart.java -text
|
||||
|
||||
9
res/cardsfolder/r/reverent_silence.txt
Normal file
9
res/cardsfolder/r/reverent_silence.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Name:Reverent Silence
|
||||
ManaCost:3 G
|
||||
Types:Sorcery
|
||||
Text:no text
|
||||
A:SP$ DestroyAll | Cost$ 3 G | ValidCards$ Enchantment | SpellDescription$ Destroy all enchantments.
|
||||
A:SP$ DestroyAll | Cost$ OppGainLife<6> | ValidCards$ Enchantment | IsPresent$ Forest.YouCtrl | PrecostDesc$ If you control a Forest, rather than pay CARDNAME's mana cost, | CostDesc$ you may have each other player gain 6 life | SpellDescription$ .
|
||||
SVar:Rarity:Common
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/reverent_silence.jpg
|
||||
End
|
||||
@@ -91,6 +91,7 @@ public class Cost {
|
||||
private final static String subStr = "SubCounter<";
|
||||
private final static String addStr = "AddCounter<";
|
||||
private final static String lifeStr = "PayLife<";
|
||||
private final static String lifeGainStr = "OppGainLife<";
|
||||
private final static String millStr = "Mill<";
|
||||
private final static String discStr = "Discard<";
|
||||
private final static String sacStr = "Sac<";
|
||||
@@ -149,6 +150,14 @@ public class Cost {
|
||||
|
||||
costParts.add(new CostPayLife(splitStr[0]));
|
||||
}
|
||||
|
||||
while (parse.contains(lifeGainStr)) {
|
||||
// PayLife<LifeCost>
|
||||
String[] splitStr = abCostParse(parse, lifeGainStr, 1);
|
||||
parse = abUpdateParse(parse, lifeGainStr);
|
||||
|
||||
costParts.add(new CostGainLife(splitStr[0]));
|
||||
}
|
||||
|
||||
while (parse.contains(millStr)) {
|
||||
// PayLife<LifeCost>
|
||||
|
||||
106
src/main/java/forge/card/cost/CostGainLife.java
Normal file
106
src/main/java/forge/card/cost/CostGainLife.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package forge.card.cost;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.GameActionUtil;
|
||||
import forge.Player;
|
||||
import forge.card.abilityFactory.AbilityFactory;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
public class CostGainLife extends CostPart {
|
||||
private int lastPaidAmount = 0;
|
||||
|
||||
public int getLastPaidAmount(){
|
||||
return lastPaidAmount;
|
||||
}
|
||||
|
||||
public void setLastPaidAmount(int paidAmount){
|
||||
lastPaidAmount = paidAmount;
|
||||
}
|
||||
|
||||
public CostGainLife(String amount){
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Have each other player gain ").append(amount).append(" Life");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refund(Card source) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(SpellAbility ability, Card source, Player activator, Cost cost) {
|
||||
Integer amount = convertAmount();
|
||||
if (amount != null && !activator.getOpponent().canGainLife()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void payAI(SpellAbility ability, Card source, Cost_Payment payment) {
|
||||
AllZone.getHumanPlayer().gainLife(getLastPaidAmount(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean payHuman(SpellAbility ability, Card source, Cost_Payment payment) {
|
||||
String amount = getAmount();
|
||||
Player activator = ability.getActivatingPlayer();
|
||||
int life = activator.getLife();
|
||||
|
||||
Integer c = convertAmount();
|
||||
if (c == null){
|
||||
String sVar = source.getSVar(amount);
|
||||
// Generalize this
|
||||
if (sVar.equals("XChoice")){
|
||||
c = CostUtil.chooseXValue(source, life);
|
||||
}
|
||||
else{
|
||||
c = AbilityFactory.calculateAmount(source, amount, ability);
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(source.getName()).append(" - Have each other player gain ").append(c).append(" Life?");
|
||||
|
||||
if (GameActionUtil.showYesNoDialog(source, sb.toString()) && activator.getOpponent().canGainLife()) {
|
||||
activator.getOpponent().gainLife(c, null);
|
||||
setLastPaidAmount(c);
|
||||
payment.setPaidManaPart(this, true);
|
||||
} else {
|
||||
payment.setCancel(true);
|
||||
payment.getRequirements().finishPaying();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean decideAIPayment(SpellAbility ability, Card source, Cost_Payment payment) {
|
||||
Player activator = ability.getActivatingPlayer();
|
||||
|
||||
Integer c = convertAmount();
|
||||
if (c == null){
|
||||
String sVar = source.getSVar(amount);
|
||||
// Generalize this
|
||||
if (sVar.equals("XChoice")){
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
c = AbilityFactory.calculateAmount(source, amount, ability);
|
||||
}
|
||||
}
|
||||
if (!activator.getOpponent().canGainLife()){
|
||||
return false;
|
||||
}
|
||||
setLastPaidAmount(c);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user