forked from External/mage
Tyvar Kell and gain ability fixes:
* GainAbilityTargetEffect - reworked to support static/dynamic targets, added support of spells (card + related permanent); * SpellCastControllerTriggeredAbility - now it can setup the target to a card instead a spell; * Added checks/errors on wrong ability adding code (example: if you add permanent's ability by game state instead permanent's method); * Tyvar Kell Emblem now use a standard code; * Test framework: added additional logs for some errors;
This commit is contained in:
parent
f131fd0d12
commit
6dcbcbe962
13 changed files with 291 additions and 140 deletions
|
|
@ -33,8 +33,18 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
protected long order;
|
||||
protected boolean used = false;
|
||||
protected boolean discarded = false; // for manual effect discard
|
||||
|
||||
// 611.2c
|
||||
// Two types of affected objects (targets):
|
||||
// 1. Static targets - setup it on ability resolve or effect creation (effect's init method, only once)
|
||||
// 2. Dynamic targets - can be changed after resolve, so use targetPointer, filters or own lists to find affected objects
|
||||
//
|
||||
// If your ability/effect supports multi use cases (one time use, static, target pointers) then affectedObjectsSet can be useful:
|
||||
// * affectedObjectsSet - true on static objects and false on dynamic objects (see rules from 611.2c)
|
||||
// Full implement example: GainAbilityTargetEffect
|
||||
protected boolean affectedObjectsSet = false;
|
||||
protected List<MageObjectReference> affectedObjectList = new ArrayList<>();
|
||||
|
||||
protected boolean temporary = false;
|
||||
protected EnumSet<DependencyType> dependencyTypes; // this effect has the dependencyTypes defined here
|
||||
protected EnumSet<DependencyType> dependendToTypes; // this effect is dependent to this types
|
||||
|
|
@ -154,10 +164,18 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
@Override
|
||||
public void init(Ability source, Game game, UUID activePlayerId) {
|
||||
targetPointer.init(game, source);
|
||||
//20100716 - 611.2c
|
||||
if (AbilityType.ACTIVATED == source.getAbilityType()
|
||||
|| AbilityType.SPELL == source.getAbilityType()
|
||||
|| AbilityType.TRIGGERED == source.getAbilityType()) {
|
||||
// 20210112 - 611.2c
|
||||
// 611.2c If a continuous effect generated by the resolution of a spell or ability modifies the
|
||||
// characteristics or changes the controller of any objects, the set of objects it affects is
|
||||
// determined when that continuous effect begins. After that point, the set won’t change.
|
||||
// (Note that this works differently than a continuous effect from a static ability.)
|
||||
// A continuous effect generated by the resolution of a spell or ability that doesn’t
|
||||
// modify the characteristics or change the controller of any objects modifies the
|
||||
// rules of the game, so it can affect objects that weren’t affected when that continuous
|
||||
// effect began.If a single continuous effect has parts that modify the characteristics or
|
||||
// changes the controller of any objects and other parts that don’t, the set of objects
|
||||
// each part applies to is determined independently.
|
||||
if (AbilityType.STATIC != source.getAbilityType()) {
|
||||
if (layer != null) {
|
||||
switch (layer) {
|
||||
case CopyEffects_1:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue