mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
game: improved cost tags to support card hints on stack (example: evidence, fixes #12522);
This commit is contained in:
parent
74b3d26a41
commit
8a4a23bb8f
4 changed files with 75 additions and 5 deletions
|
|
@ -21,6 +21,7 @@ public enum CollectedEvidenceCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Evidence was collected";
|
||||
// must use "used" instead "collected" because it can be visible as card hint on stack before real collect
|
||||
return "Evidence was used";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class EvidenceHint extends ConditionHint {
|
|||
private final int needAmount;
|
||||
|
||||
public EvidenceHint(int needAmount) {
|
||||
super(CollectedEvidenceCondition.instance, "evidence was collected");
|
||||
super(CollectedEvidenceCondition.instance);
|
||||
this.needAmount = needAmount;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1732,11 +1732,27 @@ public final class CardUtil {
|
|||
*/
|
||||
public static Map<String, Object> getSourceCostsTagsMap(Game game, Ability source) {
|
||||
Map<String, Object> costTags;
|
||||
|
||||
// from spell ability - direct access
|
||||
costTags = source.getCostsTagMap();
|
||||
if (costTags == null && source.getSourcePermanentOrLKI(game) != null) {
|
||||
costTags = game.getPermanentCostsTags().get(CardUtil.getSourceStackMomentReference(game, source));
|
||||
if (costTags != null) {
|
||||
return costTags;
|
||||
}
|
||||
return costTags;
|
||||
|
||||
// from any ability after resolve - access by permanent
|
||||
Permanent permanent = source.getSourcePermanentOrLKI(game);
|
||||
if (permanent != null) {
|
||||
costTags = game.getPermanentCostsTags().get(CardUtil.getSourceStackMomentReference(game, source));
|
||||
return costTags;
|
||||
}
|
||||
|
||||
// from any ability before resolve (on stack) - access by spell ability
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (sourceObject instanceof Spell) {
|
||||
return ((Spell) sourceObject).getSpellAbility().getCostsTagMap();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue