Fixed ClassCastException for Baron Von Count

This commit is contained in:
Zzooouhh 2018-01-08 17:00:08 +00:00 committed by GitHub
parent 9258621bf1
commit 6769630308
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -196,8 +196,9 @@ class BaronVonCountMoveDoomCounterEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
MageObject mageObject = game.getObject(source.getSourceId());
if (controller != null && mageObject != null) {
if (controller != null && sourcePermanent != null && mageObject != null) {
if (game.getState().getValue(mageObject.getId() + "_doom") == null) {
return false;
}
@ -272,8 +273,9 @@ class BaronVonCountDestroyPlayerEffect extends OneShotEffect {
game.informPlayers(targetPlayer.getLogName() + " was destroyed");
targetPlayer.lost(game); // double checks canLose, but seems more future-proof than lostForced
}
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
MageObject mageObject = game.getObject(source.getSourceId());
if (mageObject != null) {
if (sourcePermanent != null && mageObject != null) {
if (game.getState().getValue(mageObject.getId() + "_doom") == null) {
return false;
}