Can't be activated effects - fixed that some restricted effects show abilities as playable (example: Sharkey, Tyrant of the Shire and Karakas, fixed #10642)

This commit is contained in:
Oleg Agafonov 2024-07-27 15:38:13 +04:00
parent 21ad11dbdc
commit 393dbc4047
9 changed files with 136 additions and 44 deletions

View file

@ -55,11 +55,11 @@ public class PlayableObjectStats implements Serializable, Copyable<PlayableObjec
// 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();
shortInfo = shortInfo.replace("<br>", " ");
shortInfo = shortInfo.replace("\n", " ");
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));
}
}
@ -91,7 +91,7 @@ public class PlayableObjectStats implements Serializable, Copyable<PlayableObjec
+ this.other.size();
}
public List<String> getPlayableAbilities() {
public List<String> getPlayableAbilityNames() {
List<String> all = new ArrayList<>();
all.addAll(this.basicManaAbilities.stream().map(PlayableObjectRecord::getValue).sorted().collect(Collectors.toList()));
all.addAll(this.basicPlayAbilities.stream().map(PlayableObjectRecord::getValue).sorted().collect(Collectors.toList()));
@ -100,6 +100,15 @@ public class PlayableObjectStats implements Serializable, Copyable<PlayableObjec
return all;
}
public List<UUID> getPlayableAbilityIds() {
List<UUID> all = new ArrayList<>();
all.addAll(this.basicManaAbilities.stream().map(PlayableObjectRecord::getId).collect(Collectors.toList()));
all.addAll(this.basicPlayAbilities.stream().map(PlayableObjectRecord::getId).collect(Collectors.toList()));
all.addAll(this.basicCastAbilities.stream().map(PlayableObjectRecord::getId).collect(Collectors.toList()));
all.addAll(this.other.stream().map(PlayableObjectRecord::getId).collect(Collectors.toList()));
return all;
}
public int getPlayableImportantAmount() {
// return only important abilities (e.g. show it as card icons)
return this.other.size();