[KHM] fixed Old-Growth Troll - correct addAbility usage for permanents;

This commit is contained in:
Oleg Agafonov 2021-02-02 01:40:12 +04:00
parent 03979f77bb
commit e941ce108b
3 changed files with 3 additions and 3 deletions

View file

@ -174,7 +174,7 @@ class OldGrowthTrollContinuousEffect extends ContinuousEffectImpl {
TargetPermanent auraTarget = new TargetPermanent(filter);
troll.getSpellAbility().addTarget(auraTarget);
troll.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
troll.addAbility(new EnchantAbility(auraTarget.getTargetName()));
troll.addAbility(new EnchantAbility(auraTarget.getTargetName()), source.getSourceId(), game);
// add the activated ability
troll.addAbility(makeAbility(), source.getSourceId(), game);

View file

@ -40,7 +40,7 @@ public abstract class AsThoughEffectImpl extends ContinuousEffectImpl implements
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
// affectedControllerId = player to check (example: you can activate ability from opponent's card)
// by default it applies to full object
// if you AsThough effect type needs affected ability then override that method
// if your AsThough effect type needs affected ability then override that method
return applies(objectId, source, playerId, game);
}

View file

@ -519,7 +519,7 @@ public class ContinuousEffects implements Serializable {
// P.S. In theory a same AsThough effect can be applied to object or to ability, so if you really, really
// need it then disable that check or add extra param to AsThoughEffectType like needAffectedAbilityOrFullObject
if (!type.needAffectedAbility() && affectedAbility != null) {
throw new IllegalArgumentException("ERROR, you can't call AsThough check to affected ability, call it empty affected ability instead: " + type);
throw new IllegalArgumentException("ERROR, you can't call AsThough check to affected ability, call it with empty affected ability instead: " + type);
}
List<AsThoughEffect> asThoughEffectsList = getApplicableAsThoughEffects(type, game);