forked from External/mage
* Reworked some parts of transform handling. Fixes #2396.
This commit is contained in:
parent
e57da7598e
commit
86648c7190
157 changed files with 246 additions and 204 deletions
|
|
@ -459,7 +459,7 @@ public class ContinuousEffects implements Serializable {
|
|||
exists = false;
|
||||
if (object instanceof PermanentCard) {
|
||||
PermanentCard permanent = (PermanentCard) object;
|
||||
if (permanent.canTransform() && event.getType() == GameEvent.EventType.TRANSFORMED) {
|
||||
if (permanent.isTransformable() && event.getType() == GameEvent.EventType.TRANSFORMED) {
|
||||
exists = permanent.getCard().getAbilities().contains(ability);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public abstract class RestrictionEffect extends ContinuousEffectImpl {
|
|||
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called for all attackers after all blocking decisions are made
|
||||
*
|
||||
|
|
@ -106,7 +106,7 @@ public abstract class RestrictionEffect extends ContinuousEffectImpl {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean canTransform(Game game) {
|
||||
public boolean canTransform(Permanent permanent, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author halljared
|
||||
*/
|
||||
public class CantAttackBlockTransformAttachedEffect extends RestrictionEffect{
|
||||
|
||||
public class CantAttackBlockTransformAttachedEffect extends RestrictionEffect {
|
||||
|
||||
public CantAttackBlockTransformAttachedEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "Enchanted creature can't attack, block, or transform.";
|
||||
|
|
@ -36,7 +36,7 @@ public class CantAttackBlockTransformAttachedEffect extends RestrictionEffect{
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canAttack(Game game) {
|
||||
return false;
|
||||
|
|
@ -48,7 +48,7 @@ public class CantAttackBlockTransformAttachedEffect extends RestrictionEffect{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canTransform(Game game) {
|
||||
public boolean canTransform(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -56,5 +56,5 @@ public class CantAttackBlockTransformAttachedEffect extends RestrictionEffect{
|
|||
public CantAttackBlockTransformAttachedEffect copy() {
|
||||
return new CantAttackBlockTransformAttachedEffect(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class TransformSourceEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
if (permanent.canTransform(game)) {
|
||||
if (permanent.canTransform(source, game)) {
|
||||
// check not to transform twice the same side
|
||||
if (permanent.isTransformed() != fromDayToNight) {
|
||||
if (withoutTrigger) {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class TransformTargetEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
if (permanent.canTransform(game)) {
|
||||
if (permanent.canTransform(source, game)) {
|
||||
// check not to transform twice the same side
|
||||
if (withoutTrigger) {
|
||||
permanent.setTransformed(!permanent.isTransformed());
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class BecomesFaceDownCreatureAllEffect extends ContinuousEffectImpl imple
|
|||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
if (!perm.isFaceDown(game) && !perm.canTransform()) {
|
||||
if (!perm.isFaceDown(game) && !perm.isTransformable()) {
|
||||
affectedObjectList.add(new MageObjectReference(perm, game));
|
||||
perm.setFaceDown(true, game);
|
||||
// check for Morph
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue