mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Merge branch 'companion' into 'master'
Restrictions for companion Closes #1767 See merge request core-developers/forge!4171
This commit is contained in:
@@ -2577,14 +2577,10 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
for (final Card card : game.getCardsIn(ZoneType.Stack)) {
|
||||
if (!card.equals(source)) {
|
||||
onlyThis = false;
|
||||
//System.out.println("StackCard: " + card + " vs SourceCard: " + source);
|
||||
}
|
||||
}
|
||||
|
||||
PhaseHandler now = game.getPhaseHandler();
|
||||
//System.out.println("now.isPlayerTurn(player) - " + now.isPlayerTurn(player));
|
||||
//System.out.println("now.getPhase().isMain() - " + now.getPhase().isMain());
|
||||
//System.out.println("onlyThis - " + onlyThis);
|
||||
return onlyThis && now.isPlayerTurn(this) && now.getPhase().isMain();
|
||||
}
|
||||
|
||||
@@ -3144,11 +3140,10 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
DetachedCardEffect eff = new DetachedCardEffect(companion, name);
|
||||
|
||||
String addToHandAbility = "Mode$ Continuous | EffectZone$ Command | Affected$ Card.YouOwn+EffectSource | AffectedZone$ Command | AddAbility$ MoveToHand";
|
||||
String moveToHand = "ST$ ChangeZone | Cost$ 3 | Defined$ Self | Origin$ Command | Destination$ Hand | ActivationZone$ Command | SpellDescription$ Companion - Put CARDNAME in to your hand";
|
||||
String moveToHand = "ST$ ChangeZone | Cost$ 3 | Defined$ Self | Origin$ Command | Destination$ Hand | SorcerySpeed$ True | ActivationZone$ Command | SpellDescription$ Companion - Put CARDNAME in to your hand";
|
||||
eff.setSVar("MoveToHand", moveToHand);
|
||||
eff.addStaticAbility(addToHandAbility);
|
||||
|
||||
// TODO Probably remove this effect when the moved to hand
|
||||
return eff;
|
||||
}
|
||||
|
||||
|
||||
@@ -2231,6 +2231,11 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
}
|
||||
|
||||
public boolean canCastTiming(Card host, Player activator) {
|
||||
// for companion
|
||||
if (this instanceof AbilityStatic && getRestrictions().isSorcerySpeed() && !activator.canCastSorcery()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// no spell or no activated ability, no check there
|
||||
if (!isSpell() && !isActivatedAbility()) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user