mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Fixed type cast
This commit is contained in:
parent
bef45a829c
commit
f166724562
2 changed files with 7 additions and 8 deletions
|
@ -17,8 +17,8 @@ import mage.constants.SubType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetAnyTarget;
|
import mage.target.common.TargetAnyTarget;
|
||||||
|
import mage.util.SubTypeList;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,7 +67,7 @@ class TwiceDevouredGoblins implements DynamicValue {
|
||||||
if (abilityEffect instanceof DevourEffect) {
|
if (abilityEffect instanceof DevourEffect) {
|
||||||
DevourEffect devourEffect = (DevourEffect) abilityEffect;
|
DevourEffect devourEffect = (DevourEffect) abilityEffect;
|
||||||
int amountGoblins = 0;
|
int amountGoblins = 0;
|
||||||
for (List<String> subtypesItem : devourEffect.getSubtypes(game, sourcePermanent.getId())) {
|
for (SubTypeList subtypesItem : devourEffect.getSubtypes(game, sourcePermanent.getId())) {
|
||||||
if (subtypesItem.contains(SubType.GOBLIN)) {
|
if (subtypesItem.contains(SubType.GOBLIN)) {
|
||||||
++amountGoblins;
|
++amountGoblins;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -25,7 +24,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Effect for the DevourAbility
|
* Effect for the DevourAbility
|
||||||
*
|
* <p>
|
||||||
* 702.81. Devour 702.81a Devour is a static ability. "Devour N" means "As this
|
* 702.81. Devour 702.81a Devour is a static ability. "Devour N" means "As this
|
||||||
* object enters the battlefield, you may sacrifice any number of creatures.
|
* object enters the battlefield, you may sacrifice any number of creatures.
|
||||||
* This permanent enters the battlefield with N +1/+1 counters on it for each
|
* This permanent enters the battlefield with N +1/+1 counters on it for each
|
||||||
|
@ -33,7 +32,6 @@ import java.util.UUID;
|
||||||
* to the number of creatures the permanent devoured. "It devoured" means
|
* to the number of creatures the permanent devoured. "It devoured" means
|
||||||
* "sacrificed as a result of its devour ability as it entered the battlefield."
|
* "sacrificed as a result of its devour ability as it entered the battlefield."
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class DevourEffect extends ReplacementEffectImpl {
|
public class DevourEffect extends ReplacementEffectImpl {
|
||||||
|
@ -43,6 +41,7 @@ public class DevourEffect extends ReplacementEffectImpl {
|
||||||
static {
|
static {
|
||||||
filter.add(AnotherPredicate.instance);
|
filter.add(AnotherPredicate.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final DevourFactor devourFactor;
|
private final DevourFactor devourFactor;
|
||||||
|
|
||||||
public DevourEffect(DevourFactor devourFactor) {
|
public DevourEffect(DevourFactor devourFactor) {
|
||||||
|
@ -125,10 +124,10 @@ public class DevourEffect extends ReplacementEffectImpl {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ArrayList<String>> getSubtypes(Game game, UUID permanentId) {
|
public List<SubTypeList> getSubtypes(Game game, UUID permanentId) {
|
||||||
Object object = game.getState().getValue(permanentId.toString() + "devoured");
|
Object object = game.getState().getValue(permanentId.toString() + "devoured");
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
return (List<ArrayList<String>>) object;
|
return (List<SubTypeList>) object;
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
@ -136,7 +135,7 @@ public class DevourEffect extends ReplacementEffectImpl {
|
||||||
public int getDevouredCreaturesAmount(Game game, UUID permanentId) {
|
public int getDevouredCreaturesAmount(Game game, UUID permanentId) {
|
||||||
Object object = game.getState().getValue(permanentId.toString() + "devoured");
|
Object object = game.getState().getValue(permanentId.toString() + "devoured");
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
return ((List<ArrayList<String>>) object).size();
|
return ((List<SubTypeList>) object).size();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue