Skip to content

Commit

Permalink
Fix ProtectEffect (#4456)
Browse files Browse the repository at this point in the history
  • Loading branch information
tool4ever authored Dec 31, 2023
1 parent 4d02d7b commit 76e9b35
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
import java.util.Iterator;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.google.common.collect.Lists;

import forge.GameCommand;
import forge.card.CardType;
import forge.card.MagicColor;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
Expand Down Expand Up @@ -129,8 +132,12 @@ public void resolve(SpellAbility sa) {
}

List<String> gainsKWList = Lists.newArrayList();
for (String color : gains) {
gainsKWList.add(TextUtil.concatWithSpace("Protection from", color));
for (String type : gains) {
if (isChoice && sa.getParam("Choices").equals("CardType")) {
gainsKWList.add("Protection:" + type);
} else {
gainsKWList.add(TextUtil.concatWithSpace("Protection from", type));
}
}

tgtCards.addAll(CardUtil.getRadiance(sa));
Expand Down Expand Up @@ -176,6 +183,8 @@ public static List<String> getProtectionList(final SpellAbility sa) {
if (choices.contains("AnyColor")) {
gains.addAll(MagicColor.Constant.ONLY_COLORS);
choices = choices.replaceAll("AnyColor,?", "");
} else if (choices.contains("CardType")) {
choices = StringUtils.join(CardType.getAllCardTypes(), ",");
}
// Add any remaining choices
if (choices.length() > 0) {
Expand Down
2 changes: 1 addition & 1 deletion forge-gui/res/cardsfolder/m/magmatic_galleon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Types:Artifact Vehicle
PT:5/5
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDamage | TriggerDescription$ When CARDNAME enters the battlefield, it deals 5 damage to target creature an opponent controls.
SVar:TrigDamage:DB$ DealDamage | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Select target creature an opponent controls | NumDmg$ 5
T:Mode$ ExcessDamageAll | ValidTarget$ Creature.OppCtrl | CombatDamage$ False | Execute$ TrigTreasure | TriggerDescription$ Whenever one or more creatures your opponents control are dealt excess noncombat damage, create a Treasure token.
T:Mode$ ExcessDamageAll | ValidTarget$ Creature.OppCtrl | CombatDamage$ False | TriggerZones$ Battlefield | Execute$ TrigTreasure | TriggerDescription$ Whenever one or more creatures your opponents control are dealt excess noncombat damage, create a Treasure token.
SVar:TrigTreasure:DB$ Token | TokenScript$ c_a_treasure_sac
K:Crew:2
Oracle:When Magmatic Galleon enters the battlefield, it deals 5 damage to target creature an opponent controls.\nWhenever one or more creatures your opponents control are dealt excess noncombat damage, create a Treasure token.\nCrew 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Types:Legendary Creature Halfling Soldier
PT:2/2
K:Vigilance
K:Ward:1
A:AB$ Protection | Cost$ T | ValidTgts$ Creature.YouCtrl+Other | TgtPrompt$ Select another target creature you control | Gains$ Choice | Choices$ artifacts,enchantments,creatures,battles,instants,sorceries,planeswalkers,lands | SpellDescription$ Another target creature you control gains protection from the card type of your choice until end of turn. (It can't be blocked, targeted, dealt damage, enchanted, or equipped by anything of that type.)
A:AB$ Protection | Cost$ T | ValidTgts$ Creature.YouCtrl+Other | TgtPrompt$ Select another target creature you control | Gains$ Choice | Choices$ CardType | SpellDescription$ Another target creature you control gains protection from the card type of your choice until end of turn. (It can't be blocked, targeted, dealt damage, enchanted, or equipped by anything of that type.)
Oracle:Vigilance, ward {1}\n{T}: Another target creature you control gains protection from the card type of your choice until end of turn. (It can't be blocked, targeted, dealt damage, enchanted, or equipped by anything of that type.)

0 comments on commit 76e9b35

Please sign in to comment.