Fixing the healing to contain source of the heal.

This commit is contained in:
marcins78@gmail.com
2011-10-24 14:21:17 +00:00
parent 33328d76f4
commit ab1f553161
29 changed files with 37 additions and 36 deletions

View File

@@ -51,7 +51,7 @@ public class AbstractAlly extends AbstractPermanent {
PhysicalCard active = Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName()));
if (active != null)
action.appendEffect(new HealCharactersEffect(playerId, active));
action.appendEffect(new HealCharactersEffect(self, active));
return Collections.singletonList(action);
}

View File

@@ -51,7 +51,7 @@ public abstract class AbstractCompanion extends AbstractPermanent {
PhysicalCard active = Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName()));
if (active != null)
action.appendEffect(new HealCharactersEffect(playerId, active));
action.appendEffect(new HealCharactersEffect(self, active));
return Collections.singletonList(action);
}

View File

@@ -41,8 +41,8 @@ public class Card1_010 extends AbstractAttachable {
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (PlayConditions.played(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.sameCard(self))) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(new HealCharactersEffect(self.getOwner(), self.getAttachedTo()));
action.appendEffect(new HealCharactersEffect(self.getOwner(), self.getAttachedTo()));
action.appendEffect(new HealCharactersEffect(self, self.getAttachedTo()));
action.appendEffect(new HealCharactersEffect(self, self.getAttachedTo()));
return Collections.singletonList(action);
} else if (effectResult.getType() == EffectResult.Type.START_OF_TURN) {
RequiredTriggerAction action = new RequiredTriggerAction(self);

View File

@@ -40,7 +40,7 @@ public class Card1_025 extends AbstractResponseOldEvent {
if (self.getZone() == Zone.HAND && PlayConditions.winsSkirmish(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.race(Race.DWARF))) {
SkirmishResult skirmishResult = (SkirmishResult) effectResult;
PlayEventAction action = new PlayEventAction(self);
action.appendEffect(new HealCharactersEffect(playerId, skirmishResult.getWinners().get(0)));
action.appendEffect(new HealCharactersEffect(self, skirmishResult.getWinners().get(0)));
return Collections.singletonList(action);
}
return null;

View File

@@ -57,7 +57,7 @@ public class Card1_040 extends AbstractAlly {
if (effectResult.getType() == EffectResult.Type.START_OF_TURN) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new HealCharactersEffect(self.getOwner(), Filters.and(Filters.type(CardType.ALLY), Filters.isAllyHome(3, Block.FELLOWSHIP))));
new HealCharactersEffect(self, Filters.and(Filters.type(CardType.ALLY), Filters.isAllyHome(3, Block.FELLOWSHIP))));
return Collections.singletonList(action);
}

View File

@@ -53,7 +53,7 @@ public class Card1_045 extends AbstractAlly {
if (effectResult.getType() == EffectResult.Type.START_OF_TURN) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new HealCharactersEffect(self.getOwner(), Filters.and(Filters.type(CardType.ALLY), Filters.isAllyHome(6, Block.FELLOWSHIP))));
new HealCharactersEffect(self, Filters.and(Filters.type(CardType.ALLY), Filters.isAllyHome(6, Block.FELLOWSHIP))));
return Collections.singletonList(action);
}

View File

@@ -40,7 +40,7 @@ public class Card1_290 extends AbstractCompanion {
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.type(CardType.COMPANION), Filters.signet(Signet.FRODO), Filters.not(Filters.sameCard(self))));
action.appendEffect(
new HealCharactersEffect(playerId, self));
new HealCharactersEffect(self, self));
return Collections.singletonList(action);
}

View File

@@ -52,7 +52,7 @@ public class Card1_297 extends AbstractAlly {
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.START_OF_TURN) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(new HealCharactersEffect(self.getOwner(), self));
action.appendEffect(new HealCharactersEffect(self, self));
return Collections.singletonList(action);
}
return null;

View File

@@ -48,7 +48,7 @@ public class Card1_309 extends AbstractAlly {
action.appendCost(new ExertCharactersEffect(self, self));
PhysicalCard sam = Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.name("Sam"));
if (sam != null) {
action.appendEffect(new HealCharactersEffect(playerId, sam));
action.appendEffect(new HealCharactersEffect(self, sam));
}
return Collections.singletonList(action);
}

View File

@@ -39,7 +39,7 @@ public class Card2_014 extends AbstractPermanent {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.setText("Heal " + GameUtils.getCardLink(dwarfCompanion));
action.appendEffect(
new HealCharactersEffect(playerId, dwarfCompanion));
new HealCharactersEffect(self, dwarfCompanion));
actions.add(action);
}
return actions;

View File

@@ -42,7 +42,7 @@ public class Card2_120 extends AbstractSite {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.setText("Heal " + GameUtils.getCardLink(hobbitCompanion));
action.appendEffect(
new HealCharactersEffect(playerId, hobbitCompanion));
new HealCharactersEffect(self, hobbitCompanion));
actions.add(action);
}

View File

@@ -38,7 +38,7 @@ public class Card3_122 extends AbstractCompanion {
action.appendCost(
new AddTwilightEffect(self, 2));
action.appendEffect(
new HealCharactersEffect(playerId, self));
new HealCharactersEffect(self, self));
return Collections.singletonList(action);
}
return null;

View File

@@ -46,7 +46,7 @@ public class Card4_263 extends AbstractAttachableFPPossession {
if (PlayConditions.played(game, effectResult, Filters.sameCard(self))) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new HealCharactersEffect(playerId, self.getAttachedTo()));
new HealCharactersEffect(self, self.getAttachedTo()));
return Collections.singletonList(action);
}
return null;

View File

@@ -95,7 +95,7 @@ public class Card4_365 extends AbstractCompanion {
@Override
protected void doPlayEffect(LotroGame game) {
_action.appendEffect(
new HealCharactersEffect(_action.getActionSource().getOwner(), _attachPermanentAction.getTarget()));
new HealCharactersEffect(_action.getActionSource(), _attachPermanentAction.getTarget()));
}
}
}

View File

@@ -58,7 +58,7 @@ public class Card4_303 extends AbstractAttachableFPPossession {
action.appendEffect(
new RemoveBurdenEffect(self));
action.appendEffect(
new HealCharactersEffect(playerId, self.getAttachedTo()));
new HealCharactersEffect(self, self.getAttachedTo()));
}
return Collections.singletonList(action);
}

View File

@@ -33,7 +33,7 @@ public class Card4_344 extends AbstractSite {
&& game.getGameState().getCurrentSite() == self) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new HealCharactersEffect(game.getGameState().getCurrentPlayerId(),
new HealCharactersEffect(self,
Filters.and(
Filters.or(CardType.COMPANION, CardType.ALLY),
Filters.mounted)));

View File

@@ -41,7 +41,7 @@ public class Card5_012 extends AbstractAttachableFPPossession {
&& PlayConditions.canSpot(game, CardType.MINION, Filters.wounded)) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new HealCharactersEffect(playerId, self.getAttachedTo()));
new HealCharactersEffect(self, self.getAttachedTo()));
return Collections.singletonList(action);
}
return null;

View File

@@ -62,7 +62,7 @@ public class Card5_031 extends AbstractCompanion {
}
});
action.appendEffect(
new HealCharactersEffect(playerId, self));
new HealCharactersEffect(self, self));
return Collections.singletonList(action);
}
return null;

View File

@@ -38,7 +38,7 @@ public class Card5_036 extends AbstractCompanion {
action.appendCost(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Culture.GONDOR, CardType.CONDITION));
action.appendEffect(
new HealCharactersEffect(playerId, self));
new HealCharactersEffect(self, self));
return Collections.singletonList(action);
}
return null;

View File

@@ -40,7 +40,7 @@ public class Card5_068 extends AbstractEvent {
new StrengthModifier(self, Filters.sameCard(card), 2), Phase.SKIRMISH));
if (isMounted)
action.appendEffect(
new HealCharactersEffect(playerId, card));
new HealCharactersEffect(self, card));
}
});
return action;

View File

@@ -35,7 +35,7 @@ public class Card5_084 extends AbstractEvent {
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, 2, Filters.name("Theoden")));
action.appendEffect(
new HealCharactersEffect(playerId, Filters.and(CardType.COMPANION, Filters.not(Filters.name("Theoden")), Signet.THÉODEN)));
new HealCharactersEffect(self, Filters.and(CardType.COMPANION, Filters.not(Filters.name("Theoden")), Signet.THÉODEN)));
return action;
}
}

View File

@@ -49,7 +49,7 @@ public class Card5_091 extends AbstractAttachableFPPossession {
action.appendCost(
new DiscardCardsFromPlayEffect(self, self));
action.appendEffect(
new HealCharactersEffect(playerId, self.getAttachedTo()));
new HealCharactersEffect(self, self.getAttachedTo()));
return Collections.singletonList(action);
}
return null;

View File

@@ -48,7 +48,7 @@ public class Card5_094 extends AbstractPermanent {
new StrengthModifier(self, Filters.sameCard(card), 3), Phase.SKIRMISH));
if (atPlains)
action.appendEffect(
new HealCharactersEffect(playerId, card));
new HealCharactersEffect(self, card));
}
});
return Collections.singletonList(action);

View File

@@ -53,7 +53,7 @@ public class Card5_122 extends AbstractCompanion {
}
});
action.appendEffect(
new HealCharactersEffect(playerId, self));
new HealCharactersEffect(self, self));
return Collections.singletonList(action);
}
return null;

View File

@@ -35,9 +35,9 @@ public class Card5_117 extends AbstractEvent {
action.appendCost(
new ChooseAndPlayCardFromDiscardEffect(playerId, game.getGameState().getDiscard(playerId), Filters.name("Smeagol")));
action.appendEffect(
new HealCharactersEffect(playerId, Filters.and(Race.HOBBIT, Keyword.RING_BOUND)));
new HealCharactersEffect(self, Filters.and(Race.HOBBIT, Keyword.RING_BOUND)));
action.appendEffect(
new HealCharactersEffect(playerId, Filters.and(Race.HOBBIT, Keyword.RING_BOUND)));
new HealCharactersEffect(self, Filters.and(Race.HOBBIT, Keyword.RING_BOUND)));
return action;
}
}

View File

@@ -43,7 +43,7 @@ public class Card6_015 extends AbstractAlly {
if (effectResult.getType() == EffectResult.Type.START_OF_TURN) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new HealCharactersEffect(self.getOwner(), self));
new HealCharactersEffect(self, self));
return Collections.singletonList(action);
}
return null;

View File

@@ -40,7 +40,7 @@ public class Card6_018 extends AbstractAlly {
if (effectResult.getType() == EffectResult.Type.START_OF_TURN) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new HealCharactersEffect(self.getOwner(), self));
new HealCharactersEffect(self, self));
return Collections.singletonList(action);
}
return null;

View File

@@ -53,7 +53,7 @@ public class ChooseAndHealCharactersEffect extends ChooseActiveCardsEffect {
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> cards) {
SubAction subAction = new SubAction(_action);
for (int i = 0; i < _count; i++)
subAction.appendEffect(new HealCharactersEffect(_playerId, Filters.in(cards)));
subAction.appendEffect(new HealCharactersEffect(_action.getActionSource(), Filters.in(cards)));
game.getActionsEnvironment().addActionToStack(subAction);
}
}

View File

@@ -5,6 +5,7 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
@@ -14,16 +15,16 @@ import java.util.Collection;
import java.util.Collections;
public class HealCharactersEffect extends AbstractPreventableCardEffect {
private String _playerId;
private PhysicalCard _source;
public HealCharactersEffect(String playerId, PhysicalCard... cards) {
public HealCharactersEffect(PhysicalCard source, PhysicalCard... cards) {
super(cards);
_playerId = playerId;
_source = source;
}
public HealCharactersEffect(String playerId, Filter filter) {
public HealCharactersEffect(PhysicalCard source, Filter filter) {
super(filter);
_playerId = playerId;
_source = source;
}
@Override
@@ -54,7 +55,7 @@ public class HealCharactersEffect extends AbstractPreventableCardEffect {
Collection<PhysicalCard> cardsToHeal = getAffectedCardsMinusPrevented(game);
if (cardsToHeal.size() > 0) {
game.getGameState().sendMessage(_playerId + " heals " + getAppendedNames(cardsToHeal));
game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " heals " + getAppendedNames(cardsToHeal));
for (PhysicalCard cardToHeal : cardsToHeal) {
game.getGameState().removeWound(cardToHeal);
}