mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
* Some minor mainly fixed target changes.
This commit is contained in:
parent
b33e863262
commit
dfb9446994
5 changed files with 33 additions and 47 deletions
|
|
@ -24,19 +24,17 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
|
|
@ -48,7 +46,6 @@ import mage.target.targetpointer.FixedTarget;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class DetainAllEffect extends OneShotEffect {
|
||||
|
||||
private FilterPermanent filter = new FilterPermanent();
|
||||
|
|
@ -56,7 +53,7 @@ public class DetainAllEffect extends OneShotEffect {
|
|||
public DetainAllEffect(FilterPermanent filter) {
|
||||
super(Outcome.Benefit);
|
||||
this.filter = filter;
|
||||
this.staticText = new StringBuilder("detain ").append(filter.getMessage()).toString();
|
||||
this.staticText = "detain " + filter.getMessage();
|
||||
}
|
||||
|
||||
public DetainAllEffect(final DetainAllEffect effect) {
|
||||
|
|
@ -73,10 +70,10 @@ public class DetainAllEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
List<FixedTarget> detainedObjects = new ArrayList<>();
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
if (!game.isSimulation())
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("Detained permanent: " + permanent.getName());
|
||||
FixedTarget fixedTarget = new FixedTarget(permanent.getId());
|
||||
fixedTarget.init(game, source);
|
||||
}
|
||||
FixedTarget fixedTarget = new FixedTarget(permanent, game);
|
||||
detainedObjects.add(fixedTarget);
|
||||
}
|
||||
|
||||
|
|
@ -103,23 +100,22 @@ class DetainAllRestrictionEffect extends RestrictionEffect {
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
for(FixedTarget fixedTarget :this.detainedObjects) {
|
||||
for (FixedTarget fixedTarget : this.detainedObjects) {
|
||||
Permanent permanent = game.getPermanent(fixedTarget.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"[Detained]", game);
|
||||
permanent.addInfo(new StringBuilder("detain").append(getId()).toString(), "[Detained]", game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE)
|
||||
{
|
||||
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE) {
|
||||
if (game.getActivePlayerId().equals(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
|
||||
for(FixedTarget fixedTarget :this.detainedObjects) {
|
||||
for (FixedTarget fixedTarget : this.detainedObjects) {
|
||||
Permanent permanent = game.getPermanent(fixedTarget.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"", game);
|
||||
permanent.addInfo(new StringBuilder("detain").append(getId()).toString(), "", game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -130,7 +126,7 @@ class DetainAllRestrictionEffect extends RestrictionEffect {
|
|||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
for(FixedTarget fixedTarget :this.detainedObjects) {
|
||||
for (FixedTarget fixedTarget : this.detainedObjects) {
|
||||
UUID targetId = fixedTarget.getFirst(game, source);
|
||||
if (targetId != null && targetId.equals(permanent.getId())) {
|
||||
return true;
|
||||
|
|
@ -148,7 +144,7 @@ class DetainAllRestrictionEffect extends RestrictionEffect {
|
|||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class RegenerateAllEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
RegenerateTargetEffect regenEffect = new RegenerateTargetEffect();
|
||||
regenEffect.setTargetPointer(new FixedTarget(permanent.getId()));
|
||||
regenEffect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
game.addEffect(regenEffect, source);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
public class PersistAbility extends DiesTriggeredAbility {
|
||||
|
||||
|
|
@ -66,8 +65,6 @@ public class PersistAbility extends DiesTriggeredAbility {
|
|||
if (super.checkTrigger(event, game)) {
|
||||
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
||||
if (permanent.getCounters(game).getCount(CounterType.M1M1) == 0) {
|
||||
FixedTarget fixedTarget = new FixedTarget(permanent.getId());
|
||||
fixedTarget.init(game, this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue