C19: Fix Cliffside Rescuer

This commit is contained in:
swordshine
2019-08-10 15:47:24 +08:00
parent 278c8b7770
commit 6c6a729dcf
4 changed files with 17 additions and 3 deletions

View File

@@ -255,6 +255,8 @@ public class PumpEffect extends SpellAbilityEffect {
replaced = host.getChosenType(); replaced = host.getChosenType();
} else if (defined.equals("CardUIDSource")) { } else if (defined.equals("CardUIDSource")) {
replaced = "CardUID_" + String.valueOf(host.getId()); replaced = "CardUID_" + String.valueOf(host.getId());
} else if (defined.equals("ActivatorName")) {
replaced = sa.getActivatingPlayer().getName();
} }
for (int i = 0; i < keywords.size(); i++) { for (int i = 0; i < keywords.size(); i++) {
keywords.set(i, TextUtil.fastReplace(keywords.get(i), defined, replaced)); keywords.set(i, TextUtil.fastReplace(keywords.get(i), defined, replaced));

View File

@@ -5333,8 +5333,9 @@ public class Card extends GameEntity implements Comparable<Card> {
if (source.getController().equals(chosenPlayer)) { if (source.getController().equals(chosenPlayer)) {
return true; return true;
} }
} else if (kw.equals("Protection from each opponent")) { } else if (kw.startsWith("Protection from opponent of ")) {
if (source.getController().isOpponentOf(getController())) { final String playerName = kw.substring("Protection from opponent of ".length());
if (source.getController().isOpponentOf(playerName)) {
return true; return true;
} }
} else if (kw.startsWith("Protection from ")) { } else if (kw.startsWith("Protection from ")) {

View File

@@ -353,6 +353,17 @@ public class Player extends GameEntity implements Comparable<Player> {
return other != this && other != null && (other.teamNumber < 0 || other.teamNumber != teamNumber); return other != this && other != null && (other.teamNumber < 0 || other.teamNumber != teamNumber);
} }
public boolean isOpponentOf(String other) {
Player otherPlayer = null;
for (Player p : game.getPlayers()) {
if (p.getName().equals(other)) {
otherPlayer = p;
break;
}
}
return isOpponentOf(otherPlayer);
}
public final boolean setLife(final int newLife, final Card source) { public final boolean setLife(final int newLife, final Card source) {
boolean change = false; boolean change = false;
// rule 118.5 // rule 118.5

View File

@@ -3,5 +3,5 @@ ManaCost:1 W
Types:Creature Kor Soldier Types:Creature Kor Soldier
PT:2/2 PT:2/2
K:Vigilance K:Vigilance
A:AB$ Pump | Cost$ T Sac<1/CARDNAME> | ValidTgts$ Permanent.YouCtrl | TgtPrompt$ Select target permanent you control | KW$ Protection from each opponent | SpellDescription$ Target permanent you control gets protection from each opponent until end of turn. A:AB$ Pump | Cost$ T Sac<1/CARDNAME> | ValidTgts$ Permanent.YouCtrl | TgtPrompt$ Select target permanent you control | KW$ Protection from opponent of ActivatorName | DefinedKW$ ActivatorName | SpellDescription$ Target permanent you control gets protection from each opponent until end of turn.
Oracle:Vigilance\n{T}, Sacrifice Cliffside Rescuer: Target permanent you control gets protection from each opponent until end of turn. Oracle:Vigilance\n{T}, Sacrifice Cliffside Rescuer: Target permanent you control gets protection from each opponent until end of turn.