Fix Slayer's cleaver implementation to check if attached permanent can be blocked instead of the equipment (#10327)

Co-authored-by: Ethan Ward <ethanandrewward@gmail.com>
This commit is contained in:
bobwoco 2023-05-12 02:53:08 -05:00 committed by GitHub
parent c45a546526
commit 09892bf1f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,7 +60,13 @@ class SlayersCleaverEffect extends RequirementEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
return permanent.canBlock(source.getSourceId(), game) && permanent.hasSubtype(SubType.ELDRAZI, game);
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment == null || equipment.getAttachedTo() == null) {
return false;
}
Permanent attachedCreature = game.getPermanent(equipment.getAttachedTo());
return attachedCreature != null && attachedCreature.isAttacking()
&& permanent.canBlock(equipment.getAttachedTo(), game) && permanent.hasSubtype(SubType.ELDRAZI, game);
}
@Override