mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
[OGW] Added Reflector Mage and Vile Redeemer.
This commit is contained in:
parent
00ab4165d2
commit
9883eff7b9
6 changed files with 387 additions and 67 deletions
|
|
@ -1,31 +1,30 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -47,8 +46,6 @@ import mage.util.CardUtil;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// 701.26. Detain
|
||||
//
|
||||
|
|
@ -56,7 +53,6 @@ import mage.util.CardUtil;
|
|||
// turn of the controller of that spell or ability, that permanent can’t attack
|
||||
// or block and its activated abilities can’t be activated.
|
||||
//
|
||||
|
||||
public class DetainTargetEffect extends OneShotEffect {
|
||||
|
||||
public DetainTargetEffect() {
|
||||
|
|
@ -80,7 +76,7 @@ public class DetainTargetEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (!game.isSimulation()) {
|
||||
for (UUID target: this.getTargetPointer().getTargets(game, source)) {
|
||||
for (UUID target : this.getTargetPointer().getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(target);
|
||||
if (permanent != null) {
|
||||
game.informPlayers("Detained permanent: " + permanent.getName());
|
||||
|
|
@ -99,40 +95,37 @@ public class DetainTargetEffect extends OneShotEffect {
|
|||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Target target = mode.getTargets().get(0);
|
||||
|
||||
|
||||
if (target.getMaxNumberOfTargets() == target.getNumberOfTargets()) {
|
||||
if (target.getMaxNumberOfTargets() == 1) {
|
||||
sb.append("detain target ").append(target.getTargetName());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sb.append("detain ").append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName());
|
||||
}
|
||||
} else {
|
||||
sb.append("detain up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName());
|
||||
sb.append("detain up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName());
|
||||
}
|
||||
sb.append(". <i>(Until your next turn, ");
|
||||
|
||||
|
||||
if (target instanceof TargetCreaturePermanent) {
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "that creature": "those creatures");
|
||||
}
|
||||
else {
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "that permanent": "those permanents");
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "that creature" : "those creatures");
|
||||
} else {
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "that permanent" : "those permanents");
|
||||
}
|
||||
sb.append(" can't attack or block and ");
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "its": "their");
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "its" : "their");
|
||||
sb.append(" activated abilities can't be activated)</i>");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DetainRestrictionEffect extends RestrictionEffect {
|
||||
|
||||
|
||||
public DetainRestrictionEffect() {
|
||||
super(Duration.Custom);
|
||||
staticText = "";
|
||||
}
|
||||
|
||||
|
||||
public DetainRestrictionEffect(final DetainRestrictionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
|
@ -140,23 +133,22 @@ class DetainRestrictionEffect extends RestrictionEffect {
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
for(UUID targetId :this.getTargetPointer().getTargets(game, source)) {
|
||||
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"[Detained]", game);
|
||||
permanent.addInfo(new StringBuilder("detain").append(getId()).toString(), "[Detained]", game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE)
|
||||
{
|
||||
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE) {
|
||||
if (game.getActivePlayerId().equals(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
|
||||
for(UUID targetId :this.getTargetPointer().getTargets(game, source)) {
|
||||
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"", game);
|
||||
permanent.addInfo("detain" + getId(), "", game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -164,7 +156,7 @@ class DetainRestrictionEffect extends RestrictionEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (this.targetPointer.getTargets(game, source).contains(permanent.getId())) {
|
||||
|
|
@ -172,12 +164,12 @@ class DetainRestrictionEffect extends RestrictionEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canAttack(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||
return false;
|
||||
|
|
@ -192,5 +184,5 @@ class DetainRestrictionEffect extends RestrictionEffect {
|
|||
public DetainRestrictionEffect copy() {
|
||||
return new DetainRestrictionEffect(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import java.util.UUID;
|
|||
import mage.MageObjectReference;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
|
|
@ -19,11 +18,10 @@ import mage.watchers.Watcher;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class DamageDoneWatcher extends Watcher {
|
||||
|
||||
|
||||
// which object did how much damage during the turn
|
||||
public Map<MageObjectReference, Integer> damagingObjects = new HashMap<>();
|
||||
public Map<MageObjectReference, Integer> damagingObjects = new HashMap<>();
|
||||
|
||||
public DamageDoneWatcher() {
|
||||
super("DamageDone", WatcherScope.GAME);
|
||||
|
|
@ -41,15 +39,14 @@ public class DamageDoneWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
switch(event.getType()) {
|
||||
switch (event.getType()) {
|
||||
case DAMAGED_CREATURE:
|
||||
case DAMAGED_PLANESWALKER:
|
||||
case DAMAGED_PLAYER:
|
||||
{
|
||||
case DAMAGED_PLAYER: {
|
||||
MageObjectReference mor = new MageObjectReference(event.getSourceId(), game);
|
||||
int count = damagingObjects.containsKey(mor) ? damagingObjects.get(mor) : 0;
|
||||
damagingObjects.put(mor, count + event.getAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue