mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Fixed implementation of team-controlled effects
This commit is contained in:
parent
21578709bc
commit
c7f57d8c68
15 changed files with 116 additions and 84 deletions
|
|
@ -185,13 +185,16 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
|
|||
switch (mayActivate) {
|
||||
case ANY:
|
||||
break;
|
||||
|
||||
case NOT_YOU:
|
||||
if (controlsAbility(playerId, game)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case TEAM:
|
||||
if (game.getPlayer(controllerId).hasOpponent(playerId, game)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case OPPONENT:
|
||||
if (!game.getPlayer(controllerId).hasOpponent(playerId, game)) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ package mage.constants;
|
|||
*/
|
||||
public enum TargetController {
|
||||
|
||||
ACTIVE, ANY, YOU, NOT_YOU, OPPONENT, OWNER, CONTROLLER_ATTACHED_TO, NEXT
|
||||
ACTIVE, ANY, YOU, NOT_YOU, OPPONENT, TEAM, OWNER, CONTROLLER_ATTACHED_TO, NEXT
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
package mage.filter.common;
|
||||
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class FilterTeamCreaturePermanent extends FilterCreaturePermanent {
|
||||
|
||||
public FilterTeamCreaturePermanent() {
|
||||
this("creature your team controls");
|
||||
}
|
||||
|
||||
public FilterTeamCreaturePermanent(String name) {
|
||||
super(name);
|
||||
this.add(new ControllerPredicate(TargetController.TEAM));
|
||||
|
||||
}
|
||||
|
||||
public FilterTeamCreaturePermanent(SubType subtype, String name) {
|
||||
super(subtype, name);
|
||||
this.add(new ControllerPredicate(TargetController.TEAM));
|
||||
}
|
||||
|
||||
public FilterTeamCreaturePermanent(final FilterTeamCreaturePermanent filter) {
|
||||
super(filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilterTeamCreaturePermanent copy() {
|
||||
return new FilterTeamCreaturePermanent(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package mage.filter.common;
|
||||
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class FilterTeamPermanent extends FilterPermanent {
|
||||
|
||||
public FilterTeamPermanent() {
|
||||
this("permanent your team controls");
|
||||
}
|
||||
|
||||
public FilterTeamPermanent(String name) {
|
||||
super(name);
|
||||
this.add(new ControllerPredicate(TargetController.TEAM));
|
||||
|
||||
}
|
||||
|
||||
public FilterTeamPermanent(SubType subtype, String name) {
|
||||
super(subtype, name);
|
||||
this.add(new ControllerPredicate(TargetController.TEAM));
|
||||
}
|
||||
|
||||
public FilterTeamPermanent(final FilterTeamPermanent filter) {
|
||||
super(filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilterTeamPermanent copy() {
|
||||
return new FilterTeamPermanent(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -58,9 +58,14 @@ public class ControllerPredicate implements ObjectPlayerPredicate<ObjectPlayer<C
|
|||
return true;
|
||||
}
|
||||
break;
|
||||
case TEAM:
|
||||
if (!game.getPlayer(playerId).hasOpponent(object.getControllerId(), game)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case OPPONENT:
|
||||
if (!object.getControllerId().equals(playerId) &&
|
||||
game.getPlayer(playerId).hasOpponent(object.getControllerId(), game)) {
|
||||
if (!object.getControllerId().equals(playerId)
|
||||
&& game.getPlayer(playerId).hasOpponent(object.getControllerId(), game)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue