Implemented Frenzied Arynx

This commit is contained in:
Evan Kranzler 2018-12-20 18:44:57 -05:00
parent e56e7a6def
commit 2b6f85df23
4 changed files with 149 additions and 0 deletions

View file

@ -0,0 +1,96 @@
package mage.abilities.keyword;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
* @author TheElk801
*/
public class RiotAbility extends SimpleStaticAbility {
public RiotAbility() {
super(Zone.ALL, new RiotReplacementEffect());
}
private RiotAbility(final RiotAbility ability) {
super(ability);
}
@Override
public RiotAbility copy() {
return new RiotAbility(this);
}
@Override
public String getRule() {
return "Riot <i>(This creature enters the battlefield with your choice of a +1/+1 counter or haste.)</i>";
}
}
class RiotReplacementEffect extends ReplacementEffectImpl {
RiotReplacementEffect() {
super(Duration.EndOfGame, Outcome.Detriment);
}
private RiotReplacementEffect(final RiotReplacementEffect effect) {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getTargetId().equals(source.getSourceId());
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
Player controller = game.getPlayer(source.getControllerId());
if (creature != null && controller != null) {
if (controller.chooseUse(outcome, "Have " + creature.getLogName() + " enter the battlefield with a +1/+1 counter on it? (If you don't it has haste)", source, game)) {
if (!game.isSimulation()) {
game.informPlayers(controller.getLogName() + " choose to put a +1/+1 counter on " + creature.getName());
}
creature.addCounters(CounterType.P1P1.createInstance(), source, game, event.getAppliedEffects());
} else {
game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.Custom), source);
}
}
return false;
}
@Override
public String getText(Mode mode) {
return staticText;
}
@Override
public RiotReplacementEffect copy() {
return new RiotReplacementEffect(this);
}
}