Merge origin/master

This commit is contained in:
fireshoes 2015-12-04 10:13:41 -06:00
commit 60fe45dcf4
2 changed files with 18 additions and 14 deletions

View file

@ -95,10 +95,7 @@ class GraveTitanAbility extends TriggeredAbilityImpl {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
return true; return true;
} }
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId())) { return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId());
return true;
}
return false;
} }
@Override @Override

View file

@ -149,18 +149,25 @@ public class Token extends MageObjectImpl {
// moved here from CreateTokenEffect because not all cards that create tokens use CreateTokenEffect // moved here from CreateTokenEffect because not all cards that create tokens use CreateTokenEffect
// they use putOntoBattlefield directly // they use putOntoBattlefield directly
Card source = game.getCard(sourceId);
if (!expansionSetCodeChecked) {
expansionSetCodeChecked = this.updateExpansionSetCode(source);
}
// TODO: Check this setCode handling because it makes no sense if token put into play with e.g. "Feldon of the third Path" // TODO: Check this setCode handling because it makes no sense if token put into play with e.g. "Feldon of the third Path"
String setCode; String setCode = null;
if (this.getOriginalExpansionSetCode() != null && !this.getOriginalExpansionSetCode().isEmpty()) { if (this.getOriginalExpansionSetCode() != null && !this.getOriginalExpansionSetCode().isEmpty()) {
setCode = this.getOriginalExpansionSetCode(); setCode = this.getOriginalExpansionSetCode();
} else { } else {
setCode = source != null ? source.getExpansionSetCode() : null; Card source = game.getCard(sourceId);
if (source != null) {
setCode = source.getExpansionSetCode();
} else {
MageObject object = game.getObject(sourceId);
if (object instanceof PermanentToken) {
((PermanentToken) object).getExpansionSetCode();
}
}
} }
if (!expansionSetCodeChecked) {
expansionSetCodeChecked = this.updateExpansionSetCode(setCode);
}
GameEvent event = new GameEvent(EventType.CREATE_TOKEN, null, sourceId, controllerId, amount, this.getCardType().contains(CardType.CREATURE)); GameEvent event = new GameEvent(EventType.CREATE_TOKEN, null, sourceId, controllerId, amount, this.getCardType().contains(CardType.CREATURE));
if (!game.replaceEvent(event)) { if (!game.replaceEvent(event)) {
amount = event.getAmount(); amount = event.getAmount();
@ -258,11 +265,11 @@ public class Token extends MageObjectImpl {
} }
} }
public boolean updateExpansionSetCode(Card source) { public boolean updateExpansionSetCode(String setCode) {
if (source == null) { if (setCode == null || setCode.isEmpty()) {
return false; return false;
} }
this.setExpansionSetCodeForImage(source.getExpansionSetCode()); this.setExpansionSetCodeForImage(setCode);
return true; return true;
} }
} }