use of mage.game.events.DamagedPermanentBatchEvent in project mage by magefree.
the class FiendlashEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent equipment = game.getPermanent(this.getSourceId());
if (equipment == null) {
return false;
}
UUID attachedCreature = equipment.getAttachedTo();
if (attachedCreature == null) {
return false;
}
game.getState().setValue("Fiendlash" + equipment.getId(), attachedCreature);
DamagedPermanentBatchEvent dEvent = (DamagedPermanentBatchEvent) event;
for (DamagedEvent damagedEvent : dEvent.getEvents()) {
UUID targetID = damagedEvent.getTargetId();
if (targetID == null) {
continue;
}
if (targetID == attachedCreature) {
return true;
}
}
return false;
}
use of mage.game.events.DamagedPermanentBatchEvent in project mage by magefree.
the class DealtDamageToSourceTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPermanentBatchEvent dEvent = (DamagedPermanentBatchEvent) event;
int damage = dEvent.getEvents().stream().filter(damagedEvent -> getSourceId().equals(damagedEvent.getTargetId())).mapToInt(GameEvent::getAmount).sum();
if (damage < 1) {
return false;
}
this.getEffects().setValue("damage", damage);
return true;
}
use of mage.game.events.DamagedPermanentBatchEvent in project mage by magefree.
the class HowlpackAvengerTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPermanentBatchEvent dEvent = (DamagedPermanentBatchEvent) event;
int damage = dEvent.getEvents().stream().filter(damagedEvent -> isControlledBy(game.getControllerId(damagedEvent.getTargetId()))).mapToInt(GameEvent::getAmount).sum();
if (damage < 1) {
return false;
}
this.getEffects().setValue("damage", damage);
return false;
}
use of mage.game.events.DamagedPermanentBatchEvent in project mage by magefree.
the class BlazingSunsteelEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent equipment = game.getPermanent(this.getSourceId());
if (equipment == null) {
return false;
}
UUID attachedCreature = equipment.getAttachedTo();
if (attachedCreature == null) {
return false;
}
int damage = 0;
DamagedPermanentBatchEvent dEvent = (DamagedPermanentBatchEvent) event;
for (DamagedEvent damagedEvent : dEvent.getEvents()) {
UUID targetID = damagedEvent.getTargetId();
if (targetID == null) {
continue;
}
if (targetID == attachedCreature) {
damage += damagedEvent.getAmount();
}
}
if (damage > 0) {
this.getEffects().setValue("equipped", attachedCreature);
this.getEffects().setValue("damage", damage);
return true;
}
return false;
}
Aggregations