* Added game to getSharedAbilities() method of split and adventure cards .

This commit is contained in:
LevelX2 2020-01-10 20:03:32 +01:00
parent f23841ce02
commit 8d8d02b07a
3 changed files with 17 additions and 18 deletions

View file

@ -1,5 +1,7 @@
package mage.cards;
import java.util.List;
import java.util.UUID;
import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
@ -8,9 +10,6 @@ import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import java.util.List;
import java.util.UUID;
/**
* @author TheElk801
*/
@ -92,9 +91,9 @@ public abstract class AdventureCard extends CardImpl {
return allAbilities;
}
public Abilities<Ability> getSharedAbilities() {
public Abilities<Ability> getSharedAbilities(Game game) {
// abilities without spellcard
return super.getAbilities();
return super.getAbilities(game);
}
@Override

View file

@ -1,5 +1,8 @@
package mage.cards;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
@ -10,10 +13,6 @@ import mage.constants.SpellAbilityType;
import mage.constants.Zone;
import mage.game.Game;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* @author LevelX2
*/
@ -128,8 +127,8 @@ public abstract class SplitCard extends CardImpl {
*
* @return
*/
public Abilities<Ability> getSharedAbilities() {
return super.getAbilities();
public Abilities<Ability> getSharedAbilities(Game game) {
return super.getAbilities(game);
}
@Override

View file

@ -1574,7 +1574,8 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
}
@Override
@Override
public LinkedHashMap<UUID, ActivatedAbility> getUseableActivatedAbilities(MageObject object, Zone zone, Game game) {
// TODO: replace with getPlayableFromNonHandCardAll (uses for all tests)
boolean previousState = game.inCheckPlayableState();
@ -1590,16 +1591,16 @@ public abstract class PlayerImpl implements Player, Serializable {
getUseableActivatedAbilitiesHalfImpl(splitCard.getRightHalfCard(),
zone, game, splitCard.getRightHalfCard().getAbilities(game), useable);
getUseableActivatedAbilitiesHalfImpl(splitCard,
zone, game, splitCard.getSharedAbilities(), useable);
} else if (object instanceof Card){
zone, game, splitCard.getSharedAbilities(game), useable);
} else if (object instanceof Card) {
getUseableActivatedAbilitiesHalfImpl(object,
zone, game, ((Card)object).getAbilities(game), useable);
zone, game, ((Card) object).getAbilities(game), useable);
} else if (object != null) {
getUseableActivatedAbilitiesHalfImpl(object,
zone, game, object.getAbilities(), useable);
getOtherUseableActivatedAbilities(object, zone, game, useable);
}
game.setCheckPlayableState(previousState);
return useable;
}
@ -3245,12 +3246,12 @@ public abstract class PlayerImpl implements Player, Serializable {
SplitCard splitCard = (SplitCard) card;
getPlayableFromNonHandCardSingle(game, fromZone, splitCard.getLeftHalfCard(), splitCard.getLeftHalfCard().getAbilities(), availableMana, output);
getPlayableFromNonHandCardSingle(game, fromZone, splitCard.getRightHalfCard(), splitCard.getRightHalfCard().getAbilities(), availableMana, output);
getPlayableFromNonHandCardSingle(game, fromZone, splitCard, splitCard.getSharedAbilities(), availableMana, output);
getPlayableFromNonHandCardSingle(game, fromZone, splitCard, splitCard.getSharedAbilities(game), availableMana, output);
} else if (card instanceof AdventureCard) {
// adventure must use different card characteristics for different spells (main or adventure)
AdventureCard adventureCard = (AdventureCard) card;
getPlayableFromNonHandCardSingle(game, fromZone, adventureCard.getSpellCard(), adventureCard.getSpellCard().getAbilities(), availableMana, output);
getPlayableFromNonHandCardSingle(game, fromZone, adventureCard, adventureCard.getSharedAbilities(), availableMana, output);
getPlayableFromNonHandCardSingle(game, fromZone, adventureCard, adventureCard.getSharedAbilities(game), availableMana, output);
} else {
getPlayableFromNonHandCardSingle(game, fromZone, card, card.getAbilities(), availableMana, output);
}