forked from External/mage
Some improvements to split card handling. Better display of tooltip of split cards, also added handling if not cast from hand.
This commit is contained in:
parent
a29dc6cb18
commit
b352217e17
11 changed files with 256 additions and 66 deletions
|
|
@ -80,6 +80,8 @@ import java.io.IOException;
|
|||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import static mage.Constants.SpellAbilityType.SPLIT;
|
||||
import static mage.Constants.SpellAbilityType.SPLIT_FUSED;
|
||||
|
||||
|
||||
|
||||
|
|
@ -1204,6 +1206,26 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpellAbility chooseSpellAbilityForCast(SpellAbility ability, Game game, boolean noMana) {
|
||||
switch(ability.getSpellAbilityType()) {
|
||||
case SPLIT:
|
||||
case SPLIT_FUSED:
|
||||
MageObject object = game.getObject(ability.getSourceId());
|
||||
if (object != null) {
|
||||
LinkedHashMap<UUID, ActivatedAbility> useableAbilities = getSpellAbilities(object, game.getState().getZone(object.getId()), game);
|
||||
if (useableAbilities != null && useableAbilities.size() > 0) {
|
||||
game.fireGetChoiceEvent(playerId, name, new ArrayList<ActivatedAbility>(useableAbilities.values()));
|
||||
// TODO: Improve this
|
||||
return (SpellAbility) useableAbilities.values().iterator().next();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
default:
|
||||
return ability;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mode chooseMode(Modes modes, Ability source, Game game) {
|
||||
log.debug("chooseMode");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue