Add additional ability icons (#10549)

* Slightly revamped basic card icons

All icon classes which were just static text have been removed, and instead replaced with a static instance.

A new icon for reach has been added

Some icons have been reused for new abilities (hexproof for shroud and ward, infect for toxic)

When a card would have two icons of the same type, the icons are instead combines into one with a combined hover tooltip.

* Fixed missing capitalization on ward, hexproof
This commit is contained in:
Alexander Novotny 2023-07-03 14:22:07 -07:00 committed by GitHub
parent 9e63858db6
commit fae63d9d4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 167 additions and 522 deletions

View file

@ -5,6 +5,8 @@ import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.common.CounterUnlessPaysEffect;
import mage.abilities.icon.CardIconImpl;
import mage.abilities.icon.CardIconType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -34,6 +36,9 @@ public class WardAbility extends TriggeredAbilityImpl {
this.genericMana = null;
this.showAbilityHint = showAbilityHint;
this.whereXIs = null;
this.addIcon(new CardIconImpl(CardIconType.ABILITY_HEXPROOF,
CardUtil.getTextWithFirstCharUpperCase(getRuleWithoutHint())));
}
public WardAbility(DynamicValue genericMana) {
@ -46,6 +51,9 @@ public class WardAbility extends TriggeredAbilityImpl {
this.whereXIs = whereXIs;
this.cost = null;
this.showAbilityHint = false;
this.addIcon(new CardIconImpl(CardIconType.ABILITY_HEXPROOF,
CardUtil.getTextWithFirstCharUpperCase(getRuleWithoutHint())));
}
private WardAbility(final WardAbility ability) {
@ -97,8 +105,7 @@ public class WardAbility extends TriggeredAbilityImpl {
return new WardAbility(this);
}
@Override
public String getRule() {
public String getRuleWithoutHint() {
StringBuilder sb = new StringBuilder("ward");
if (cost != null) {
if (cost instanceof ManaCost) {
@ -113,23 +120,33 @@ public class WardAbility extends TriggeredAbilityImpl {
}
}
if (showAbilityHint) {
sb.append(" <i>(Whenever this creature becomes the target of a spell or ability an opponent controls, " +
"counter it unless that player ");
if (cost != null) {
if (cost instanceof ManaCost) {
sb.append("pays ").append(cost.getText());
} else {
sb.append(cost.getText().replace("pay ", "pays "));
}
sb.append(".)</i>");
return sb.toString();
}
@Override
public String getRule() {
String rule = getRuleWithoutHint();
if (!showAbilityHint) {
return rule;
}
StringBuilder sb = new StringBuilder(rule);
sb.append(" <i>(Whenever this creature becomes the target of a spell or ability an opponent controls, " +
"counter it unless that player ");
if (cost != null) {
if (cost instanceof ManaCost) {
sb.append("pays ").append(cost.getText());
} else {
sb.append("pays {X}");
if (whereXIs != null) {
sb.append(whereXIs);
}
sb.append(".)</i>");
sb.append(cost.getText().replace("pay ", "pays "));
}
sb.append(".)</i>");
} else {
sb.append("pays {X}");
if (whereXIs != null) {
sb.append(whereXIs);
}
sb.append(".)</i>");
}
return sb.toString();