mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
[BLB] Implement forage mechanic (#12569)
* [BLB] Implement Corpseberry Cultivator * [BLB] Implement Thornvault Forager * fix verify failure
This commit is contained in:
parent
39e254c914
commit
43e95fd0cf
6 changed files with 208 additions and 0 deletions
|
|
@ -0,0 +1,41 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class ForageTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public ForageTriggeredAbility(Effect effect) {
|
||||
this(Zone.BATTLEFIELD, effect, false);
|
||||
}
|
||||
|
||||
public ForageTriggeredAbility(Zone zone, Effect effect, boolean optional) {
|
||||
super(zone, effect, optional);
|
||||
setTriggerPhrase("Whenever you forage, ");
|
||||
}
|
||||
|
||||
private ForageTriggeredAbility(final ForageTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForageTriggeredAbility copy() {
|
||||
return new ForageTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.FORAGED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return isControlledBy(event.getPlayerId());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package mage.abilities.costs.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.OrCost;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class ForageCost extends OrCost {
|
||||
|
||||
public ForageCost() {
|
||||
super(
|
||||
"forage",
|
||||
new ExileFromGraveCost(new TargetCardInYourGraveyard(3)),
|
||||
new SacrificeTargetCost(StaticFilters.FILTER_CONTROLLED_FOOD)
|
||||
);
|
||||
}
|
||||
|
||||
private ForageCost(final ForageCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForageCost copy() {
|
||||
return new ForageCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
if (!super.pay(ability, game, source, controllerId, noMana, costToPay)) {
|
||||
return false;
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FORAGED, source.getSourceId(), source, controllerId));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -662,6 +662,12 @@ public class GameEvent implements Serializable {
|
|||
playerId owner of the plotted card (the one able to cast the card)
|
||||
*/
|
||||
BECOME_PLOTTED,
|
||||
/* the player foraged
|
||||
targetId same as sourceId
|
||||
sourceId of the ability
|
||||
playerId player who foraged
|
||||
*/
|
||||
FORAGED,
|
||||
//custom events
|
||||
CUSTOM_EVENT
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue