mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Small change to StormAbility
This commit is contained in:
parent
681be2a70c
commit
3dd3cb2b6c
2 changed files with 12 additions and 33 deletions
|
@ -45,13 +45,9 @@ import mage.watchers.common.CastSpellLastTurnWatcher;
|
|||
*
|
||||
* @author Plopman
|
||||
*/
|
||||
public class StormAbility extends TriggeredAbilityImpl<StormAbility> {
|
||||
|
||||
|
||||
public class StormAbility extends TriggeredAbilityImpl<StormAbility>{
|
||||
|
||||
|
||||
public StormAbility()
|
||||
{
|
||||
public StormAbility() {
|
||||
super(Constants.Zone.STACK, new StormEffect());
|
||||
}
|
||||
|
||||
|
@ -65,17 +61,11 @@ public class StormAbility extends TriggeredAbilityImpl<StormAbility>{
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if(event.getType() == GameEvent.EventType.SPELL_CAST && event.getSourceId().equals(this.sourceId))
|
||||
{
|
||||
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getSourceId().equals(this.sourceId)) {
|
||||
StackObject spell = game.getStack().getStackObject(this.sourceId);
|
||||
if(spell instanceof Spell)
|
||||
{
|
||||
for(Effect effect : this.getEffects())
|
||||
{
|
||||
if(effect instanceof StormEffect)
|
||||
{
|
||||
((StormEffect)effect).setSpell((Spell)spell);
|
||||
}
|
||||
if (spell instanceof Spell) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setValue("StormSpell", spell);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -87,11 +77,9 @@ public class StormAbility extends TriggeredAbilityImpl<StormAbility>{
|
|||
public String getRule() {
|
||||
return "Storm";
|
||||
}
|
||||
|
||||
}
|
||||
class StormEffect extends OneShotEffect<StormEffect> {
|
||||
|
||||
private Spell spell;
|
||||
class StormEffect extends OneShotEffect<StormEffect> {
|
||||
|
||||
public StormEffect() {
|
||||
super(Constants.Outcome.Copy);
|
||||
|
@ -99,16 +87,15 @@ class StormEffect extends OneShotEffect<StormEffect> {
|
|||
|
||||
public StormEffect(final StormEffect effect) {
|
||||
super(effect);
|
||||
this.spell = effect.spell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = (Spell) this.getValue("StormSpell");
|
||||
if (spell != null) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");
|
||||
|
||||
for(int i = 0; i < watcher.getSpellOrder(spell) - 1; i++)
|
||||
{
|
||||
for (int i = 0; i < watcher.getSpellOrder(spell) - 1; i++) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
|
@ -124,13 +111,4 @@ class StormEffect extends OneShotEffect<StormEffect> {
|
|||
public StormEffect copy() {
|
||||
return new StormEffect(this);
|
||||
}
|
||||
|
||||
public void setSpell(Spell spell) {
|
||||
this.spell = spell;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ Mountainwalk|new|
|
|||
Persist|new|
|
||||
Plainswalk|new|
|
||||
Rebound|new|
|
||||
Storm|new|
|
||||
Swampwalk|new|
|
||||
Totem armor|new|
|
||||
Unblockable|new|
|
||||
|
|
Loading…
Reference in a new issue