mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
[FIN] Implement Sahagin
This commit is contained in:
parent
181a3306a6
commit
34c4eebd44
10 changed files with 138 additions and 109 deletions
|
|
@ -1,48 +0,0 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class SpellCastOpponentNoManaSpentTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public SpellCastOpponentNoManaSpentTriggeredAbility(Effect effect) {
|
||||
super(Zone.BATTLEFIELD, effect, false);
|
||||
this.setTriggerPhrase("Whenever an opponent casts a spell, if no mana was spent to cast it, ");
|
||||
}
|
||||
|
||||
protected SpellCastOpponentNoManaSpentTriggeredAbility(final SpellCastOpponentNoManaSpentTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpellCastOpponentNoManaSpentTriggeredAbility copy() {
|
||||
return new SpellCastOpponentNoManaSpentTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.SPELL_CAST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && spell.getStackAbility().getManaCostsToPay().getUsedManaToPay().count() == 0) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
package mage.filter;
|
||||
|
||||
import mage.ObjectColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.*;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
|
@ -1045,6 +1042,21 @@ public final class StaticFilters {
|
|||
FILTER_SPELL_KICKED_A.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterSpell FILTER_SPELL_NO_MANA_SPENT = new FilterSpell("a spell, if no mana was spent to cast it");
|
||||
|
||||
static {
|
||||
FILTER_SPELL_NO_MANA_SPENT.add(new ManaSpentToCastPredicate(ComparisonType.EQUAL_TO, 0));
|
||||
FILTER_SPELL_NO_MANA_SPENT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterSpell FILTER_NONCREATURE_SPELL_FOUR_MANA_SPENT = new FilterSpell("a noncreature spell, if at least four mana was spent to cast it");
|
||||
|
||||
static {
|
||||
FILTER_NONCREATURE_SPELL_FOUR_MANA_SPENT.add(Predicates.not(CardType.CREATURE.getPredicate()));
|
||||
FILTER_NONCREATURE_SPELL_FOUR_MANA_SPENT.add(new ManaSpentToCastPredicate(ComparisonType.MORE_THAN, 3));
|
||||
FILTER_NONCREATURE_SPELL_FOUR_MANA_SPENT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterPermanent FILTER_PERMANENT_TOKEN = new FilterPermanent("token");
|
||||
|
||||
static {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package mage.filter.predicate.mageobject;
|
||||
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.filter.predicate.IntComparePredicate;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class ManaSpentToCastPredicate extends IntComparePredicate<StackObject> {
|
||||
|
||||
public ManaSpentToCastPredicate(ComparisonType type, int value) {
|
||||
super(type, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getInputValue(StackObject input) {
|
||||
return input.getStackAbility().getManaCostsToPay().getUsedManaToPay().count();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ManaSpent" + super.toString();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue