Search in sources :

Example 1 with BasicManaAbility

use of mage.abilities.mana.BasicManaAbility in project mage by magefree.

the class PlayableObjectRecord method load.

public void load(List<ActivatedAbility> activatedAbilities) {
    this.basicManaAbilities.clear();
    this.basicPlayAbilities.clear();
    this.basicCastAbilities.clear();
    this.other.clear();
    // split abilities to types (it allows to enable or disable playable icon)
    for (ActivatedAbility ability : activatedAbilities) {
        List<PlayableObjectRecord> dest;
        if (ability instanceof BasicManaAbility) {
            dest = this.basicManaAbilities;
        } else if (ability instanceof PlayLandAbility) {
            dest = this.basicPlayAbilities;
        } else if (ability instanceof SpellAbility && (((SpellAbility) ability).getSpellAbilityType() == SpellAbilityType.BASE)) {
            dest = this.basicCastAbilities;
        } else {
            dest = this.other;
        }
        // collect info about abilities for card icons popup, must be simple online text (html symbols are possible)
        // some long html tags can be miss (example: ability extra hint) -- that's ok
        String shortInfo = ability.toString();
        if (shortInfo.length() > 50) {
            shortInfo = shortInfo.substring(0, 50 - 1) + "...";
        }
        shortInfo = shortInfo.replace("<br>", " ");
        shortInfo = shortInfo.replace("\n", " ");
        dest.add(new PlayableObjectRecord(ability.getId(), shortInfo));
    }
}
Also used : PlayLandAbility(mage.abilities.PlayLandAbility) BasicManaAbility(mage.abilities.mana.BasicManaAbility) ActivatedAbility(mage.abilities.ActivatedAbility) SpellAbility(mage.abilities.SpellAbility)

Aggregations

ActivatedAbility (mage.abilities.ActivatedAbility)1 PlayLandAbility (mage.abilities.PlayLandAbility)1 SpellAbility (mage.abilities.SpellAbility)1 BasicManaAbility (mage.abilities.mana.BasicManaAbility)1