@Override public DealsDamageToACreatureAttachedTriggeredAbility copy() { return new DealsDamageToACreatureAttachedTriggeredAbility(this); }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (!combatOnly || ((DamagedCreatureEvent) event).isCombatDamage()) { Permanent attachment = game.getPermanent(this.getSourceId()); if (attachment != null && attachment.isAttachedTo(event.getSourceId())) { if (setTargetPointer) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); effect.setValue("damage", event.getAmount()); } } return true; } } return false; }
public VenomousFangs(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); this.subtype.add(SubType.AURA); // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Whenever enchanted creature deals damage to a creature, destroy the other creature. this.addAbility(new DealsDamageToACreatureAttachedTriggeredAbility(new DestroyTargetEffect(), false, "enchanted creature", false, true)); }
public Charisma(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}{U}"); this.subtype.add(SubType.AURA); // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Whenever enchanted creature deals damage to a creature, gain control of the other creature for as long as Charisma remains on the battlefield. Condition condition = SourceOnBattlefieldCondition.instance; ConditionalContinuousEffect conditionalEffect = new ConditionalContinuousEffect(new GainControlTargetEffect(Duration.Custom), condition, rule); this.addAbility(new DealsDamageToACreatureAttachedTriggeredAbility(conditionalEffect, false, "enchanted creature", false, true)); }
public NekoTe(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); this.subtype.add(SubType.EQUIPMENT); // Whenever equipped creature deals damage to a creature, tap that creature. That creature doesn't untap during its controller's untap step for as long as Neko-Te remains on the battlefield. ContinuousRuleModifyingEffect skipUntapEffect = new DontUntapInControllersUntapStepTargetEffect(Duration.WhileOnBattlefield); skipUntapEffect.setText("That creature doesn't untap during its controller's untap step for as long as {this} remains on the battlefield"); ConditionalContinuousRuleModifyingEffect effect = new ConditionalContinuousRuleModifyingEffect(skipUntapEffect, SourceOnBattlefieldCondition.instance); Ability ability = new DealsDamageToACreatureAttachedTriggeredAbility(new TapTargetEffect("that creature"), false, "equipped creature", false, true); ability.addEffect(effect); this.addAbility(ability); // Whenever equipped creature deals damage to a player, that player loses 1 life. this.addAbility(new DealsDamageToAPlayerAttachedTriggeredAbility(new LoseLifeTargetEffect(1), "equipped creature", false, true, false)); // Equip {2} this.addAbility(new EquipAbility(Outcome.Benefit, new GenericManaCost(2))); }