mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Merge origin/master
This commit is contained in:
commit
60fe45dcf4
2 changed files with 18 additions and 14 deletions
|
@ -95,10 +95,7 @@ class GraveTitanAbility extends TriggeredAbilityImpl {
|
|||
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
|
||||
return true;
|
||||
}
|
||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -149,18 +149,25 @@ public class Token extends MageObjectImpl {
|
|||
|
||||
// moved here from CreateTokenEffect because not all cards that create tokens use CreateTokenEffect
|
||||
// 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"
|
||||
String setCode;
|
||||
String setCode = null;
|
||||
if (this.getOriginalExpansionSetCode() != null && !this.getOriginalExpansionSetCode().isEmpty()) {
|
||||
setCode = this.getOriginalExpansionSetCode();
|
||||
} 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));
|
||||
if (!game.replaceEvent(event)) {
|
||||
amount = event.getAmount();
|
||||
|
@ -258,11 +265,11 @@ public class Token extends MageObjectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean updateExpansionSetCode(Card source) {
|
||||
if (source == null) {
|
||||
public boolean updateExpansionSetCode(String setCode) {
|
||||
if (setCode == null || setCode.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
this.setExpansionSetCodeForImage(source.getExpansionSetCode());
|
||||
this.setExpansionSetCodeForImage(setCode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue