mirror of
https://github.com/correl/mage.git
synced 2025-03-20 09:19:21 -09:00
Add Flanking ability
This commit is contained in:
parent
3d4467e071
commit
bfe6261acc
2 changed files with 113 additions and 45 deletions
67
Mage/src/mage/abilities/keyword/FlankingAbility.java
Normal file
67
Mage/src/mage/abilities/keyword/FlankingAbility.java
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
|
||||||
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
|
import mage.Constants;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.common.continious.BoostTargetEffect;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Plopman
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class FlankingAbility extends TriggeredAbilityImpl<FlankingAbility> {
|
||||||
|
|
||||||
|
public FlankingAbility() {
|
||||||
|
super(Constants.Zone.BATTLEFIELD, new BoostTargetEffect(-1, -1, Constants.Duration.EndOfTurn), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FlankingAbility(final FlankingAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED && event.getTargetId().equals(this.getSourceId())) {
|
||||||
|
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||||
|
if(permanent != null)
|
||||||
|
{
|
||||||
|
boolean hasFlankingAbility = false;
|
||||||
|
for(Ability ability : permanent.getAbilities()){
|
||||||
|
if(ability instanceof FlankingAbility){
|
||||||
|
hasFlankingAbility = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!hasFlankingAbility){
|
||||||
|
for (Effect effect : this.getEffects()) {
|
||||||
|
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRule() {
|
||||||
|
return "Flanking";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FlankingAbility copy() {
|
||||||
|
return new FlankingAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,46 +1,47 @@
|
||||||
Annihilator|number|
|
Annihilator|number|
|
||||||
Bloodthirst|number|
|
Bloodthirst|number|
|
||||||
Bushido|number|
|
Bushido|number|
|
||||||
Dredge|number|
|
Dredge|number|
|
||||||
Soulshift|number|
|
Soulshift|number|
|
||||||
Basic landcycling|cost|
|
Basic landcycling|cost|
|
||||||
Cycling|cost|
|
Cycling|cost|
|
||||||
Level up|cost|
|
Level up|cost|
|
||||||
Miracle|cost|
|
Miracle|cost|
|
||||||
Unearth|cost|
|
Unearth|cost|
|
||||||
Battle cry|new|
|
Battle cry|new|
|
||||||
Cascade|new|
|
Cascade|new|
|
||||||
Exalted|new|
|
Exalted|new|
|
||||||
Forestwalk|new|
|
Flanking|new|
|
||||||
Indestructible|new|
|
Forestwalk|new|
|
||||||
Islandwalk|new|
|
Indestructible|new|
|
||||||
Living weapon|new|
|
Islandwalk|new|
|
||||||
Mountainwalk|new|
|
Living weapon|new|
|
||||||
Persist|new|
|
Mountainwalk|new|
|
||||||
Plainswalk|new|
|
Persist|new|
|
||||||
Rebound|new|
|
Plainswalk|new|
|
||||||
Storm|new|
|
Rebound|new|
|
||||||
Swampwalk|new|
|
Storm|new|
|
||||||
Totem armor|new|
|
Swampwalk|new|
|
||||||
Unblockable|new|
|
Totem armor|new|
|
||||||
Undying|new|
|
Unblockable|new|
|
||||||
Deathtouch|instance|
|
Undying|new|
|
||||||
Defender|instance|
|
Deathtouch|instance|
|
||||||
Double Strike|instance|
|
Defender|instance|
|
||||||
Fear|instance|
|
Double Strike|instance|
|
||||||
First strike|instance|
|
Fear|instance|
|
||||||
Flash|instance|
|
First strike|instance|
|
||||||
Flying|instance|
|
Flash|instance|
|
||||||
Haste|instance|
|
Flying|instance|
|
||||||
Hexproof|instance|
|
Haste|instance|
|
||||||
Infect|instance|
|
Hexproof|instance|
|
||||||
Intimidate|instance|
|
Infect|instance|
|
||||||
Lifelink|instance|
|
Intimidate|instance|
|
||||||
Phasing|instance|
|
Lifelink|instance|
|
||||||
Reach|instance|
|
Phasing|instance|
|
||||||
Scavenge|cost|
|
Reach|instance|
|
||||||
Shroud|instance|
|
Scavenge|cost|
|
||||||
Soulbond|instance|
|
Shroud|instance|
|
||||||
Trample|instance|
|
Soulbond|instance|
|
||||||
Vigilance|instance|
|
Trample|instance|
|
||||||
|
Vigilance|instance|
|
||||||
Wither|instance|
|
Wither|instance|
|
Loading…
Add table
Reference in a new issue