use isActivePlayer where possible, some minor text fixes

This commit is contained in:
igoudt 2018-06-29 21:18:05 +02:00
parent 013eccb6fa
commit dcb1affb9d
27 changed files with 35 additions and 35 deletions

View file

@ -74,7 +74,7 @@ class AlurenRuleEffect extends ContinuousEffectImpl {
public AlurenRuleEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "Any player may play creature cards with converted mana cost 3 or less without paying their mana cost";
staticText = "Any player may cast creature cards with converted mana cost 3 or less without paying their mana cost";
}
public AlurenRuleEffect(final AlurenRuleEffect effect) {

View file

@ -45,7 +45,7 @@ public final class AvariceAmulet extends CardImpl {
ability.addEffect(effect);
this.addAbility(ability);
// When equipped creature dies, target opponent gains control of Avarice Amulet.
// Whenever equipped creature dies, target opponent gains control of Avarice Amulet.
ability = new DiesAttachedTriggeredAbility(new AvariceAmuletChangeControlEffect(), "equipped creature", false);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);

View file

@ -43,7 +43,7 @@ public final class Fluctuator extends CardImpl {
class FluctuatorEffect extends CostModificationEffectImpl {
private static final String effectText = "Cycling abilities you activate cost you up to {2} less to activate";
private static final String effectText = "Cycling abilities you activate cost up to {2} less to activate";
public FluctuatorEffect() {
super(Duration.Custom, Outcome.Benefit, CostModificationType.REDUCE_COST);

View file

@ -42,8 +42,8 @@ public final class LionsEyeDiamond extends CardImpl {
class LionsEyeDiamondAbility extends ActivatedManaAbilityImpl {
public LionsEyeDiamondAbility() {
super(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(3), new SacrificeSourceCost());
this.addCost(new DiscardHandCost());
super(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(3), new DiscardHandCost());
this.addCost(new SacrificeSourceCost());
this.netMana.add(new Mana(0, 0, 0, 0, 0, 0, 3, 0));
}

View file

@ -37,7 +37,7 @@ public class AttacksAloneTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if(game.getActivePlayerId().equals(this.controllerId) ) {
if(game.isActivePlayer(this.controllerId) ) {
UUID creatureId = this.getSourceId();
if(creatureId != null) {
if(game.getCombat().attacksAlone() && Objects.equals(creatureId, game.getCombat().getAttackers().get(0))) {

View file

@ -43,7 +43,7 @@ public class SacrificeIfCastAtInstantTimeTriggeredAbility extends TriggeredAbili
// CHECK
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getSourceId().equals(getSourceId())) {
return !(game.isMainPhase() && game.getActivePlayerId().equals(event.getPlayerId()) && game.getStack().size() == 1);
return !(game.isMainPhase() && game.isActivePlayer(event.getPlayerId()) && game.getStack().size() == 1);
}
return false;
}

View file

@ -36,7 +36,7 @@ public class PactDelayedTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return game.getActivePlayerId().equals(this.getControllerId());
return game.isActivePlayer(this.getControllerId());
}

View file

@ -26,7 +26,7 @@ public class IsStepCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
return phaseStep == game.getStep().getType() && (!onlyDuringYourSteps || game.getActivePlayerId().equals(source.getControllerId()));
return phaseStep == game.getStep().getType() && (!onlyDuringYourSteps || game.isActivePlayer(source.getControllerId()));
}
@Override

View file

@ -20,7 +20,7 @@ public enum MyMainPhaseCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
return game.getActivePlayerId().equals(source.getControllerId()) &&
return game.isActivePlayer(source.getControllerId()) &&
turnPhases.contains(game.getTurn().getPhase().getType());
}
}

View file

@ -16,7 +16,7 @@ public enum MyTurnBeforeAttackersDeclaredCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
if (game.getActivePlayerId().equals(source.getControllerId())) {
if (game.isActivePlayer(source.getControllerId())) {
TurnPhase turnPhase = game.getTurn().getPhase().getType();
if (turnPhase == TurnPhase.BEGINNING || turnPhase == TurnPhase.PRECOMBAT_MAIN) {
return true;

View file

@ -10,7 +10,7 @@ public enum MyTurnCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
return game.getActivePlayerId().equals(source.getControllerId());
return game.isActivePlayer(source.getControllerId());
}
@Override

View file

@ -180,7 +180,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
Player player = game.getPlayer(startingControllerId);
if (player != null) {
if (player.isInGame()) {
return game.getActivePlayerId().equals(startingControllerId) && game.getTurnNum() != startingTurn;
return game.isActivePlayer(startingControllerId) && game.getTurnNum() != startingTurn;
}
return player.hasReachedNextTurnAfterLeaving();
}

View file

@ -77,7 +77,7 @@ class DetainAllRestrictionEffect extends RestrictionEffect {
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("detain" + getId(), "[Detained]", game);
}
}
}
@ -85,11 +85,11 @@ class DetainAllRestrictionEffect extends RestrictionEffect {
@Override
public boolean isInactive(Ability source, Game game) {
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE) {
if (game.getActivePlayerId().equals(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
if (game.isActivePlayer(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
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("detain" + getId(), "", game);
}
}
return true;

View file

@ -118,7 +118,7 @@ class DetainRestrictionEffect extends RestrictionEffect {
@Override
public boolean isInactive(Ability source, Game game) {
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE) {
if (game.getActivePlayerId().equals(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
if (game.isActivePlayer(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {

View file

@ -60,7 +60,7 @@ public class DontUntapInControllersNextUntapStepSourceEffect extends ContinuousR
}
// remember the turn of the untap step the effect has to be applied
if (event.getType() == GameEvent.EventType.UNTAP_STEP
&& game.getActivePlayerId().equals(source.getControllerId())) {
&& game.isActivePlayer(source.getControllerId())) {
if (validForTurnNum == game.getTurnNum()) { // the turn has a second untap step but the effect is already related to the first untap step
discard();
return false;
@ -70,7 +70,7 @@ public class DontUntapInControllersNextUntapStepSourceEffect extends ContinuousR
// skip untap action
if (game.getTurn().getStepType() == PhaseStep.UNTAP
&& event.getType() == GameEvent.EventType.UNTAP
&& game.getActivePlayerId().equals(source.getControllerId())
&& game.isActivePlayer(source.getControllerId())
&& event.getTargetId().equals(source.getSourceId())) {
discard();
return true;

View file

@ -101,8 +101,8 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR
for (UUID targetId : getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
if (game.getActivePlayerId().equals(permanent.getControllerId())
&& ((onlyIfControlledByPlayer == null) || (game.getActivePlayerId().equals(onlyIfControlledByPlayer)))) { // if effect works only for specific player, all permanents have to be set to handled in that players untap step
if (game.isActivePlayer(permanent.getControllerId())
&& ((onlyIfControlledByPlayer == null) || (game.isActivePlayer(onlyIfControlledByPlayer)))) { // if effect works only for specific player, all permanents have to be set to handled in that players untap step
if (!handledTargetsDuringTurn.containsKey(targetId)) {
// it's the untep step of the current controller and the effect was not handled for this target yet, so do it now
handledTargetsDuringTurn.put(targetId, false);
@ -127,8 +127,8 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR
&& !handledTargetsDuringTurn.get(event.getTargetId())
&& getTargetPointer().getTargets(game, source).contains(event.getTargetId())) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && game.getActivePlayerId().equals(permanent.getControllerId())) {
if ((onlyIfControlledByPlayer == null) || game.getActivePlayerId().equals(onlyIfControlledByPlayer)) { // If onlyIfControlledByPlayer is set, then don't apply unless we're currently controlled by the specified player.
if (permanent != null && game.isActivePlayer(permanent.getControllerId())) {
if ((onlyIfControlledByPlayer == null) || game.isActivePlayer(onlyIfControlledByPlayer)) { // If onlyIfControlledByPlayer is set, then don't apply unless we're currently controlled by the specified player.
handledTargetsDuringTurn.put(event.getTargetId(), !twoSteps);
return true;
}

View file

@ -76,7 +76,7 @@ public class DontUntapInControllersUntapStepAllEffect extends ContinuousRuleModi
default:
throw new RuntimeException("Type of TargetController not supported!");
}
if (game.getActivePlayerId().equals(permanent.getControllerId()) && // controller's untap step
if (game.isActivePlayer(permanent.getControllerId()) && // controller's untap step
filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
return true;
}

View file

@ -59,7 +59,7 @@ public class DontUntapInControllersUntapStepTargetEffect extends ContinuousRuleM
for (UUID targetId : targetPointer.getTargets(game, source)) {
if (event.getTargetId().equals(targetId)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null && game.getActivePlayerId().equals(permanent.getControllerId())) {
if (permanent != null && game.isActivePlayer(permanent.getControllerId())) {
return true;
}
}

View file

@ -81,7 +81,7 @@ public class DontUntapInPlayersNextUntapStepAllEffect extends ContinuousRuleModi
}
// remember the turn of the untap step the effect has to be applied
if (event.getType() == EventType.UNTAP_STEP) {
if (game.getActivePlayerId().equals(getTargetPointer().getFirst(game, source))) {
if (game.isActivePlayer(getTargetPointer().getFirst(game, source))) {
if (validForTurnNum == game.getTurnNum()) { // the turn has a second untap step but the effect is already related to the first untap step
discard();
return false;
@ -100,7 +100,7 @@ public class DontUntapInPlayersNextUntapStepAllEffect extends ContinuousRuleModi
if (controller != null && !game.isOpponent(controller, permanent.getControllerId())) {
return false;
}
if (game.getActivePlayerId().equals(permanent.getControllerId())
if (game.isActivePlayer(permanent.getControllerId())
&& // controller's untap step
filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
return true;

View file

@ -44,7 +44,7 @@ public class PopulateEffect extends OneShotEffect {
public PopulateEffect(String prefixText) {
super(Outcome.Copy);
this.staticText = (!prefixText.isEmpty() ? prefixText + " p" : "P") + "opulate <i>(Put a token onto the battlefield that's a copy of a creature token you control.)</i>";
this.staticText = (!prefixText.isEmpty() ? prefixText + " p" : "P") + "opulate <i>(Create a token that's a copy of a creature token you control.)</i>";
}
public PopulateEffect(final PopulateEffect effect) {

View file

@ -88,7 +88,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
return true;
}
if (durationPhaseStep != null && durationPhaseStep == game.getPhase().getStep().getType()) {
if (!sameStep && game.getActivePlayerId().equals(durationPlayerId) || game.getPlayer(durationPlayerId).hasReachedNextTurnAfterLeaving()) {
if (!sameStep && game.isActivePlayer(durationPlayerId) || game.getPlayer(durationPlayerId).hasReachedNextTurnAfterLeaving()) {
return true;
}
} else {

View file

@ -19,7 +19,7 @@ public class InvestigateEffect extends CreateTokenEffect {
public InvestigateEffect() {
super(new ClueArtifactToken());
this.staticText = "Investigate. <i>(Create a colorless Clue artifact token onto the battlefield with \"{2}, Sacrifice this artifact: Draw a card.\")</i>";
this.staticText = "Investigate. <i>(Create a colorless Clue artifact token with \"{2}, Sacrifice this artifact: Draw a card.\")</i>";
}
public InvestigateEffect(final InvestigateEffect effect) {

View file

@ -35,7 +35,7 @@ public class ExaltedAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.controllerId)) {
if (game.isActivePlayer(this.controllerId)) {
if (game.getCombat().attacksAlone()) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
return true;

View file

@ -45,7 +45,7 @@ public class ForecastAbility extends LimitedTimesPerTurnActivatedAbility {
public ActivationStatus canActivate(UUID playerId, Game game) {
// May be activated only during the upkeep step of the card's owner
// Because it can only be activated from a players hand it should be ok to check here with controllerId instead of card.getOwnerId().
if (!game.getActivePlayerId().equals(controllerId) || PhaseStep.UPKEEP != game.getStep().getType()) {
if (!game.isActivePlayer(controllerId) || PhaseStep.UPKEEP != game.getStep().getType()) {
return ActivationStatus.getFalse();
}
return super.canActivate(playerId, game);

View file

@ -17,7 +17,7 @@ public class ControllerIsActivePlayerPredicate implements Predicate<Permanent> {
if(input.getControllerId() == null){
return false;
}
return game.getActivePlayerId().equals(input.getControllerId());
return game.isActivePlayer(input.getControllerId());
}
@Override

View file

@ -316,7 +316,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public void beginningOfTurn(Game game) {
if (game.getActivePlayerId().equals(this.controllerId)) {
if (game.isActivePlayer(this.controllerId)) {
this.controlledFromStartOfControllerTurn = true;
}
}

View file

@ -1470,7 +1470,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
protected boolean isActivePlayer(Game game) {
return game.getActivePlayerId().equals(this.playerId);
return game.isActivePlayer(this.playerId);
}
@Override