mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 04:09:54 -08:00
[DFT] Add Guidelight Matrix artifact
add static method from SaddleAbility to saddle a permanent add common saddle effect refactor Alacrian Armory with new saddle effect
This commit is contained in:
parent
37fc173701
commit
a472ff9f18
5 changed files with 130 additions and 16 deletions
|
|
@ -0,0 +1,44 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.SaddleAbility;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author Jmlundeen
|
||||
*/
|
||||
public class SaddleTargetMountEffect extends OneShotEffect {
|
||||
|
||||
public SaddleTargetMountEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Target Mount you control becomes saddled until end of turn";
|
||||
}
|
||||
|
||||
public SaddleTargetMountEffect(String rule) {
|
||||
super(Outcome.Benefit);
|
||||
staticText = rule;
|
||||
}
|
||||
|
||||
protected SaddleTargetMountEffect(final SaddleTargetMountEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaddleTargetMountEffect copy() {
|
||||
return new SaddleTargetMountEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent targetMount = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (targetMount == null || !targetMount.hasSubtype(SubType.MOUNT, game)) {
|
||||
return false;
|
||||
}
|
||||
return SaddleAbility.applySaddle(targetMount, game);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -48,6 +48,23 @@ public class SaddleAbility extends SimpleActivatedAbility {
|
|||
this.value = ability.value;
|
||||
}
|
||||
|
||||
public static boolean applySaddle(Permanent permanent, Game game) {
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
SaddleAbility saddleAbility = permanent.getAbilities().stream()
|
||||
.filter(a -> a instanceof SaddleAbility)
|
||||
.map(a -> (SaddleAbility) a)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (saddleAbility != null) {
|
||||
SaddleEventEffect effect = new SaddleEventEffect();
|
||||
effect.apply(game, saddleAbility);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaddleAbility copy() {
|
||||
return new SaddleAbility(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue