mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
*Added Radiance parameter to AF_PreventDamage & AF_Protection.
*Added StackDescription handling of Radiance for all affected AFs (DealDamage,Destroy,PreventDamage,Protection & Pump) *Added Bathe in Light Wojek Apothecary
This commit is contained in:
@@ -182,6 +182,16 @@ public class AbilityFactory_DealDamage {
|
||||
if (o instanceof Card || o instanceof Player)
|
||||
sb.append(o.toString());
|
||||
}
|
||||
|
||||
if(af.getMapParams().containsKey("Radiance")) {
|
||||
sb.append(" and each other ").append(af.getMapParams().get("ValidTgts")).append(" that shares a color with ");
|
||||
if(tgts.size() > 1) {
|
||||
sb.append("them");
|
||||
}
|
||||
else {
|
||||
sb.append("it");
|
||||
}
|
||||
}
|
||||
|
||||
sb.append(". ");
|
||||
|
||||
|
||||
@@ -357,6 +357,16 @@ public class AbilityFactory_Destroy {
|
||||
|
||||
if (it.hasNext()) sb.append(", ");
|
||||
}
|
||||
|
||||
if(af.getMapParams().containsKey("Radiance")) {
|
||||
sb.append(" and each other ").append(af.getMapParams().get("ValidTgts")).append(" that shares a color with ");
|
||||
if(tgtCards.size() > 1) {
|
||||
sb.append("them");
|
||||
}
|
||||
else {
|
||||
sb.append("it");
|
||||
}
|
||||
}
|
||||
|
||||
if (noRegen) {
|
||||
sb.append(". ");
|
||||
|
||||
@@ -159,6 +159,16 @@ public class AbilityFactory_PreventDamage {
|
||||
else sb.append(tgtC);
|
||||
} else sb.append(o.toString());
|
||||
}
|
||||
|
||||
if(af.getMapParams().containsKey("Radiance") && sa.getTarget() != null) {
|
||||
sb.append(" and each other ").append(af.getMapParams().get("ValidTgts")).append(" that shares a color with ");
|
||||
if(tgts.size() > 1) {
|
||||
sb.append("them");
|
||||
}
|
||||
else {
|
||||
sb.append("it");
|
||||
}
|
||||
}
|
||||
sb.append(" this turn.");
|
||||
|
||||
Ability_Sub abSub = sa.getSubAbility();
|
||||
@@ -373,10 +383,28 @@ public class AbilityFactory_PreventDamage {
|
||||
int numDam = AbilityFactory.calculateAmount(af.getHostCard(), params.get("Amount"), sa);
|
||||
|
||||
ArrayList<Object> tgts;
|
||||
ArrayList<Card> untargetedCards = new ArrayList<Card>();
|
||||
if (sa.getTarget() == null)
|
||||
tgts = AbilityFactory.getDefinedObjects(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
else
|
||||
tgts = sa.getTarget().getTargets();
|
||||
|
||||
if(params.containsKey("Radiance") && sa.getTarget() != null) {
|
||||
Card origin = null;
|
||||
for(int i = 0; i< tgts.size();i++)
|
||||
{
|
||||
if(tgts.get(i) instanceof Card) {
|
||||
origin = (Card)tgts.get(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(origin != null) //Can't radiate from a player
|
||||
{
|
||||
for(Card c : CardUtil.getRadiance(af.getHostCard(), origin, params.get("ValidTgts").split(","))) {
|
||||
untargetedCards.add(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean targeted = (af.getAbTgt() != null);
|
||||
|
||||
@@ -394,5 +422,11 @@ public class AbilityFactory_PreventDamage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(Card c : untargetedCards) {
|
||||
if(AllZoneUtil.isCardInPlay(c)) {
|
||||
c.addPreventNextDamage(numDam);
|
||||
}
|
||||
}
|
||||
}//doResolve
|
||||
}
|
||||
|
||||
@@ -552,6 +552,16 @@ public final class AbilityFactory_Protection {
|
||||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
if(af.getMapParams().containsKey("Radiance") && sa.getTarget() != null) {
|
||||
sb.append(" and each other ").append(af.getMapParams().get("ValidTgts")).append(" that shares a color with ");
|
||||
if(tgtCards.size() > 1) {
|
||||
sb.append("them");
|
||||
}
|
||||
else {
|
||||
sb.append("it");
|
||||
}
|
||||
}
|
||||
|
||||
sb.append(" gain");
|
||||
if (tgtCards.size() == 1) {
|
||||
@@ -624,6 +634,7 @@ public final class AbilityFactory_Protection {
|
||||
}
|
||||
|
||||
ArrayList<Card> tgtCards;
|
||||
ArrayList<Card> untargetedCards = new ArrayList<Card>();
|
||||
Target tgt = af.getAbTgt();
|
||||
if (tgt != null) {
|
||||
tgtCards = tgt.getTargetCards();
|
||||
@@ -631,6 +642,12 @@ public final class AbilityFactory_Protection {
|
||||
else {
|
||||
tgtCards = AbilityFactory.getDefinedCards(host, params.get("Defined"), sa);
|
||||
}
|
||||
|
||||
if(params.containsKey("Radiance") && tgt != null) {
|
||||
for(Card c : CardUtil.getRadiance(af.getHostCard(), tgtCards.get(0), params.get("ValidTgts").split(","))) {
|
||||
untargetedCards.add(c);
|
||||
}
|
||||
}
|
||||
|
||||
int size = tgtCards.size();
|
||||
for (int j = 0; j < size; j++) {
|
||||
@@ -670,6 +687,37 @@ public final class AbilityFactory_Protection {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(final Card unTgtC : untargetedCards) {
|
||||
// only pump things in play
|
||||
if (!AllZoneUtil.isCardInPlay(unTgtC)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (String gain : gains) {
|
||||
unTgtC.addExtrinsicKeyword("Protection from " + gain);
|
||||
}
|
||||
|
||||
if (!params.containsKey("Permanent")) {
|
||||
// If not Permanent, remove protection at EOT
|
||||
final Command untilEOT = new Command() {
|
||||
private static final long serialVersionUID = 7682700789217703789L;
|
||||
|
||||
public void execute() {
|
||||
if (AllZoneUtil.isCardInPlay(unTgtC)) {
|
||||
for (String gain : gains) {
|
||||
unTgtC.removeExtrinsicKeyword("Protection from " + gain);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (params.containsKey("UntilEndOfCombat")) {
|
||||
AllZone.getEndOfCombat().addUntil(untilEOT);
|
||||
} else {
|
||||
AllZone.getEndOfTurn().addUntil(untilEOT);
|
||||
}
|
||||
}
|
||||
}
|
||||
} //protectResolve()
|
||||
|
||||
private static ArrayList<String> getProtectionList(final Card host, final HashMap<String, String> params) {
|
||||
|
||||
@@ -657,6 +657,16 @@ public class AbilityFactory_Pump {
|
||||
|
||||
for (Card c : tgtCards)
|
||||
sb.append(c.getName()).append(" ");
|
||||
|
||||
if(af.getMapParams().containsKey("Radiance")) {
|
||||
sb.append(" and each other ").append(af.getMapParams().get("ValidTgts")).append(" that shares a color with ");
|
||||
if(tgtCards.size() > 1) {
|
||||
sb.append("them ");
|
||||
}
|
||||
else {
|
||||
sb.append("it ");
|
||||
}
|
||||
}
|
||||
|
||||
final int atk = getNumAttack(sa);
|
||||
final int def = getNumDefense(sa);
|
||||
|
||||
Reference in New Issue
Block a user