(SpellAbility sa, Map<AbilityKey, Object> params)
| 3836 | } |
| 3837 | |
| 3838 | public void learnLesson(SpellAbility sa, Map<AbilityKey, Object> params) { |
| 3839 | if (hasLost()) { |
| 3840 | return; |
| 3841 | } |
| 3842 | |
| 3843 | Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(this); |
| 3844 | repParams.put(AbilityKey.Cause, sa); |
| 3845 | repParams.putAll(params); |
| 3846 | if (game.getReplacementHandler().run(ReplacementType.Learn, repParams) != ReplacementResult.NotReplaced) { |
| 3847 | return; |
| 3848 | } |
| 3849 | |
| 3850 | CardCollection list = new CardCollection(); |
| 3851 | if (!isControlled()) { |
| 3852 | list.addAll(CardLists.getType(getZone(ZoneType.Sideboard), "Lesson")); |
| 3853 | } |
| 3854 | list.addAll(getZone(ZoneType.Hand)); |
| 3855 | if (list.isEmpty()) { |
| 3856 | return; |
| 3857 | } |
| 3858 | |
| 3859 | Card c = getController().chooseSingleCardForZoneChange(ZoneType.Hand, List.of(ZoneType.Sideboard, ZoneType.Hand), |
| 3860 | sa, list, null, Localizer.getInstance().getMessage("lblLearnALesson"), true, this); |
| 3861 | if (c == null) { |
| 3862 | return; |
| 3863 | } |
| 3864 | if (c.isInZone(ZoneType.Sideboard)) { // Sideboard Lesson to Hand |
| 3865 | game.getAction().reveal(new CardCollection(c), c.getOwner(), true); |
| 3866 | game.getAction().moveTo(ZoneType.Hand, c, sa, params); |
| 3867 | } else if (c.isInZone(ZoneType.Hand)) { // Discard and Draw |
| 3868 | List<Card> discardedBefore = Lists.newArrayList(getDiscardedThisTurn()); |
| 3869 | Card moved = discard(c, sa, true, params); |
| 3870 | if (moved != null) { |
| 3871 | // Change this if something would make multiple player learn at the same time |
| 3872 | |
| 3873 | // Discard Trigger outside Effect |
| 3874 | final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(this); |
| 3875 | runParams.put(AbilityKey.Cards, new CardCollection(moved)); |
| 3876 | runParams.put(AbilityKey.Cause, sa); |
| 3877 | runParams.put(AbilityKey.DiscardedBefore, discardedBefore); |
| 3878 | if (params != null) { |
| 3879 | runParams.putAll(params); |
| 3880 | } |
| 3881 | getGame().getTriggerHandler().runTrigger(TriggerType.DiscardedAll, runParams, false); |
| 3882 | |
| 3883 | drawCards(1, sa, params); |
| 3884 | } |
| 3885 | } |
| 3886 | } |
| 3887 | |
| 3888 | public void commitCrime() { |
| 3889 | //boolean firstTime = this.commitedCrimeThisTurn == 0; |
no test coverage detected