Base class for Triggers,ReplacementEffects and StaticAbilities.
| 37 | * |
| 38 | */ |
| 39 | public abstract class CardTraitBase implements GameObject, IHasCardView, IHasSVars { |
| 40 | |
| 41 | /** The host card. */ |
| 42 | protected Card hostCard; |
| 43 | protected CardState cardState = null; |
| 44 | protected KeywordInterface keyword = null; |
| 45 | |
| 46 | /** The map params. */ |
| 47 | protected Map<String, String> originalMapParams = Maps.newHashMap(), |
| 48 | mapParams = Maps.newHashMap(); |
| 49 | |
| 50 | /** The is intrinsic. */ |
| 51 | protected boolean intrinsic; |
| 52 | |
| 53 | /** The suppressed. */ |
| 54 | protected boolean suppressed = false; |
| 55 | |
| 56 | protected Map<String, String> sVars = Maps.newTreeMap(); |
| 57 | |
| 58 | protected Map<String, String> intrinsicChangedTextColors = Maps.newHashMap(); |
| 59 | protected Map<String, String> intrinsicChangedTextTypes = Maps.newHashMap(); |
| 60 | protected Map<String, String> changedTextColors = Maps.newHashMap(); |
| 61 | protected Map<String, String> changedTextTypes = Maps.newHashMap(); |
| 62 | |
| 63 | /** Keys of descriptive (text) parameters. */ |
| 64 | private static final ImmutableList<String> descriptiveKeys = ImmutableList.<String>builder() |
| 65 | .add("Description", "SpellDescription", "StackDescription", "TriggerDescription") |
| 66 | .add("ChangeTypeDesc", "ValidTgtsDesc") |
| 67 | .build(); |
| 68 | |
| 69 | /** |
| 70 | * Keys that should not changed |
| 71 | */ |
| 72 | private static final ImmutableList<String> noChangeKeys = ImmutableList.<String>builder() |
| 73 | .add("TokenScript", "NewName" , "DefinedName", "ChooseFromList") |
| 74 | .add("AddAbility").build(); |
| 75 | |
| 76 | /** |
| 77 | * <p> |
| 78 | * Getter for the field <code>mapParams</code>. |
| 79 | * </p> |
| 80 | * |
| 81 | * @return a {@link java.util.HashMap} object. |
| 82 | */ |
| 83 | public final Map<String, String> getMapParams() { |
| 84 | return this.mapParams; |
| 85 | } |
| 86 | |
| 87 | public String getParamOrDefault(String key, String defaultValue) { |
| 88 | String param = mapParams.get(key); |
| 89 | return param != null ? param : defaultValue; |
| 90 | } |
| 91 | |
| 92 | public String getParam(String key) { |
| 93 | return mapParams.get(key); |
| 94 | } |
| 95 | |
| 96 | public String getOriginalParam(String key) { |