Fix copying subabilities to no longer duplicate them (#11399)

* Fix Subability copy bug (fix #10526 )

* Cards which copy abilities of other cards should not copy subabilities.

* Enable previously-failing tests

* Find more addAbility that should be done without subabilities

* Add documentation to addAbility function

* Add warning about not using basic addAbility when copying from a source

* Invert withSubabilities to fromExistingObject
This commit is contained in:
ssk97 2023-11-12 16:57:39 -08:00 committed by GitHub
parent 3972e80860
commit ec4c79e0e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 83 additions and 40 deletions

View file

@ -140,8 +140,8 @@ public class CopyTokenFunction {
// otherwise there are problems to check for created continuous effects to check if
// the source (the Token) has still this ability
ability.newOriginalId();
target.addAbility(ability);
//Don't re-add subabilities since they've already in sourceObj's abilities list
target.addAbility(ability, true);
}
target.setPower(sourceObj.getPower().getBaseValue());
@ -152,7 +152,6 @@ public class CopyTokenFunction {
private Token from(Card source, Game game, Spell spell) {
apply(source, game);
// token's ZCC must be synced with original card to keep abilities settings
// Example: kicker ability and kicked status
if (spell != null) {