diff --git a/Mage/src/mage/abilities/keyword/FlankingAbility.java b/Mage/src/mage/abilities/keyword/FlankingAbility.java new file mode 100644 index 0000000000..be7787b8ba --- /dev/null +++ b/Mage/src/mage/abilities/keyword/FlankingAbility.java @@ -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 { + + 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); + } + + +} diff --git a/Utils/keywords.txt b/Utils/keywords.txt index 299ec88911..5285cc087a 100644 --- a/Utils/keywords.txt +++ b/Utils/keywords.txt @@ -1,46 +1,47 @@ -Annihilator|number| -Bloodthirst|number| -Bushido|number| -Dredge|number| -Soulshift|number| -Basic landcycling|cost| -Cycling|cost| -Level up|cost| -Miracle|cost| -Unearth|cost| -Battle cry|new| -Cascade|new| -Exalted|new| -Forestwalk|new| -Indestructible|new| -Islandwalk|new| -Living weapon|new| -Mountainwalk|new| -Persist|new| -Plainswalk|new| -Rebound|new| -Storm|new| -Swampwalk|new| -Totem armor|new| -Unblockable|new| -Undying|new| -Deathtouch|instance| -Defender|instance| -Double Strike|instance| -Fear|instance| -First strike|instance| -Flash|instance| -Flying|instance| -Haste|instance| -Hexproof|instance| -Infect|instance| -Intimidate|instance| -Lifelink|instance| -Phasing|instance| -Reach|instance| -Scavenge|cost| -Shroud|instance| -Soulbond|instance| -Trample|instance| -Vigilance|instance| +Annihilator|number| +Bloodthirst|number| +Bushido|number| +Dredge|number| +Soulshift|number| +Basic landcycling|cost| +Cycling|cost| +Level up|cost| +Miracle|cost| +Unearth|cost| +Battle cry|new| +Cascade|new| +Exalted|new| +Flanking|new| +Forestwalk|new| +Indestructible|new| +Islandwalk|new| +Living weapon|new| +Mountainwalk|new| +Persist|new| +Plainswalk|new| +Rebound|new| +Storm|new| +Swampwalk|new| +Totem armor|new| +Unblockable|new| +Undying|new| +Deathtouch|instance| +Defender|instance| +Double Strike|instance| +Fear|instance| +First strike|instance| +Flash|instance| +Flying|instance| +Haste|instance| +Hexproof|instance| +Infect|instance| +Intimidate|instance| +Lifelink|instance| +Phasing|instance| +Reach|instance| +Scavenge|cost| +Shroud|instance| +Soulbond|instance| +Trample|instance| +Vigilance|instance| Wither|instance| \ No newline at end of file