mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 05:09:16 -08:00
2 requested cards
This commit is contained in:
parent
7d68d6e67f
commit
709dc83ae6
7 changed files with 280 additions and 44 deletions
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author magenoxx
|
||||
*/
|
||||
public class AddManaToControllersManaPoolEffect extends OneShotEffect {
|
||||
|
||||
protected Mana mana;
|
||||
|
||||
public AddManaToControllersManaPoolEffect(Mana mana) {
|
||||
super(Outcome.PutManaInPool);
|
||||
this.mana = mana;
|
||||
this.staticText = "Add " + mana.toString() + " to your mana pool";
|
||||
}
|
||||
|
||||
public AddManaToControllersManaPoolEffect(final AddManaToControllersManaPoolEffect effect) {
|
||||
super(effect);
|
||||
this.mana = effect.mana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddManaToControllersManaPoolEffect copy() {
|
||||
return new AddManaToControllersManaPoolEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.getManaPool().addMana(mana, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author magenoxx
|
||||
*/
|
||||
public class LoseHalfLifeEffect extends OneShotEffect {
|
||||
|
||||
public LoseHalfLifeEffect() {
|
||||
super(Outcome.LoseLife);
|
||||
staticText = "You lose half your life, rounded up";
|
||||
}
|
||||
|
||||
public LoseHalfLifeEffect(final LoseHalfLifeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoseHalfLifeEffect copy() {
|
||||
return new LoseHalfLifeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
int amount = (player.getLife() + 1) / 2;
|
||||
if (amount > 0) {
|
||||
player.loseLife(amount, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue