[WOM] Implement (not yet official) Mosswood Dreadknight (#10792)

This commit is contained in:
Susucre 2023-08-29 00:27:28 +02:00 committed by GitHub
parent 557e0a06e1
commit 566f4dc7f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 104 additions and 0 deletions

View file

@ -117,6 +117,11 @@ public class SpellAbility extends ActivatedAbilityImpl {
// play from not own hand
ApprovingObject approvingObject = game.getContinuousEffects().asThough(getSourceId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this, playerId, game);
if (approvingObject == null && getSpellAbilityType().equals(SpellAbilityType.ADVENTURE_SPELL)) {
// allowed to cast adventures from non-hand?
approvingObject = game.getContinuousEffects().asThough(getSourceId(), AsThoughEffectType.CAST_ADVENTURE_FROM_NOT_OWN_HAND_ZONE, this, playerId, game);
}
if (approvingObject == null) {
Card card = game.getCard(sourceId);
if (!(card != null && card.isOwnedBy(playerId))) {

View file

@ -36,6 +36,7 @@ public enum AsThoughEffectType {
// 4. You must implement/override an applies method with "Ability affectedAbility" (e.g. check multiple play/cast abilities from all card's parts)
// TODO: search all PLAY_FROM_NOT_OWN_HAND_ZONE and CAST_AS_INSTANT effects and add support of mainCard and objectId
PLAY_FROM_NOT_OWN_HAND_ZONE(true, true),
CAST_ADVENTURE_FROM_NOT_OWN_HAND_ZONE(true, true),
CAST_AS_INSTANT(true, true),
//
ACTIVATE_AS_INSTANT(true, false),

View file

@ -3848,6 +3848,12 @@ public abstract class PlayerImpl implements Player, Serializable {
// play hand from non hand zone (except battlefield - you can't play already played permanents)
approvingObject = game.getContinuousEffects().asThough(object.getId(),
AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, ability, this.getId(), game);
if (approvingObject == null && isPlaySpell
&& ((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.ADVENTURE_SPELL)) {
approvingObject = game.getContinuousEffects().asThough(object.getId(),
AsThoughEffectType.CAST_ADVENTURE_FROM_NOT_OWN_HAND_ZONE, ability, this.getId(), game);
}
} else {
// other abilities from direct zones
approvingObject = null;