Fix Soulhunter Rakshasa (#7925)

* Fix Soulhunter Rakshasa

* Remove Soulhunter Rakshasa imports
This commit is contained in:
ciaccona007 2021-06-20 11:27:11 -06:00 committed by GitHub
parent 6ebfe78090
commit 124eaf936c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,12 +4,20 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetOpponent;
import mage.watchers.common.CastFromHandWatcher;
import java.util.UUID;
@ -28,10 +36,13 @@ public final class SoulhunterRakshasa extends CardImpl {
// Soulhunter Rakshasa cant block.
this.addAbility(new CantBlockAbility());
// When Soulhunter Rakshasa enters the battlefield, it deals 5 damage to target opponent.
Ability ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(5, "it"), false);
// When Soulhunter Rakshasa enters the battlefield, if you cast it from your hand, it deals 1 damage to target opponent for each Swamp you control.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new SoulhunterRakshasaEffect()),
CastFromEverywhereSourceCondition.instance,
"When {this} enters the battlefield, if you cast it from your hand, it deals 1 damage to target opponent for each Swamp you control.");
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
this.addAbility(ability, new CastFromHandWatcher());
}
private SoulhunterRakshasa(final SoulhunterRakshasa card) {
@ -43,3 +54,35 @@ public final class SoulhunterRakshasa extends CardImpl {
return new SoulhunterRakshasa(this);
}
}
class SoulhunterRakshasaEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterControlledPermanent(SubType.SWAMP);
public SoulhunterRakshasaEffect() {
super(Outcome.Damage);
this.staticText = "{this} deals 1 damage to target opponent for each Swamp you control.";
}
public SoulhunterRakshasaEffect(final SoulhunterRakshasaEffect effect) {
super(effect);
}
@Override
public SoulhunterRakshasaEffect copy() {
return new SoulhunterRakshasaEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
if (amount > 0) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
player.damage(amount, source.getSourceId(), source, game);
return true;
}
}
return false;
}
}