mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
- added some null checks. #5537
This commit is contained in:
parent
badfd1c59e
commit
1ef5d878c6
2 changed files with 13 additions and 8 deletions
|
@ -80,9 +80,12 @@ class RegalBehemothTriggeredManaAbility extends TriggeredManaAbility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (isControlledBy(game.getMonarchId())) {
|
if (game.getMonarchId() != null
|
||||||
|
&& isControlledBy(game.getMonarchId())) {
|
||||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
|
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
|
||||||
if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
if (permanent != null
|
||||||
|
&& getControllerId() != null
|
||||||
|
&& filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||||
ManaEvent mEvent = (ManaEvent) event;
|
ManaEvent mEvent = (ManaEvent) event;
|
||||||
for (Effect effect : getEffects()) {
|
for (Effect effect : getEffects()) {
|
||||||
effect.setValue("mana", mEvent.getMana());
|
effect.setValue("mana", mEvent.getMana());
|
||||||
|
|
|
@ -70,12 +70,14 @@ public class AddManaOfAnyColorEffect extends BasicManaEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
String mes = String.format("Select color of %d mana to add it", this.amount);
|
String mes = String.format("Select color of %d mana to add it", this.amount);
|
||||||
ChoiceColor choice = new ChoiceColor(true, mes, game.getObject(source.getSourceId()));
|
if (mes != null) {
|
||||||
if (controller.choose(outcome, choice, game)) {
|
ChoiceColor choice = new ChoiceColor(true, mes, game.getObject(source.getSourceId()));
|
||||||
if (choice.getColor() != null) {
|
if (controller.choose(outcome, choice, game)) {
|
||||||
Mana mana = choice.getMana(amount);
|
if (choice.getColor() != null) {
|
||||||
mana.setFlag(setFlag);
|
Mana mana = choice.getMana(amount);
|
||||||
return mana;
|
mana.setFlag(setFlag);
|
||||||
|
return mana;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue