forked from External/mage
Ability refactor: new code to search abilities in cards and permanents;
This commit is contained in:
parent
978118148b
commit
8af43dc13a
31 changed files with 85 additions and 47 deletions
|
|
@ -524,8 +524,8 @@ public class Spell extends StackObjImpl implements Card {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAbility(UUID abilityId, Game game) {
|
||||
return card.hasAbility(abilityId, game);
|
||||
public boolean hasAbility(Ability ability, Game game) {
|
||||
return card.hasAbility(ability, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ public class StackAbility extends StackObjImpl implements Ability {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAbility(UUID abilityId, Game game) {
|
||||
public boolean hasAbility(Ability ability, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -672,4 +672,17 @@ public class StackAbility extends StackObjImpl implements Ability {
|
|||
public Outcome getCustomOutcome() {
|
||||
return this.ability.getCustomOutcome();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameInstance(Ability ability) {
|
||||
// same instance (by mtg rules) = same object, ID or class+text (you can't check class only cause it can be different by params/text)
|
||||
if (ability == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (this == ability)
|
||||
|| (this.getId().equals(ability.getId()))
|
||||
|| (this.getOriginalId().equals(ability.getOriginalId()))
|
||||
|| (this.getClass() == ability.getClass() && this.getRule().equals(ability.getRule()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue