mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
Implemented Epicenter, Infested Roothold, Brown Ouphe, Rust, Ouphe Vandals, Fatal Attraction, Fighting Chance, Arcbound Fiend, Carry Away, Caverns of Despair, Amulet of Unmaking, Aphetto Exterminator, Balduvian Conjurer, Barrin's Unmaking, Each Mana Battery, Blood Hound, Boa Constrictor, Bola Warrior, Brass Talon Chimera, Briar Patch, Brine Shaman, Call to Arms, Goham Djinn, Halam Djinn, Ruham Djinn, Sulam Djinn, Zanam Djinn, Heroic Defiance and Tsabo's Assassin (#3779)
* Implement Epicenter * Implement Infested Roothold * Implement Brown Ouphe * Implement Rust * Implement Ouphe Vandals * Implement Fatal Attraction * Implement Fighting Chance * Implement Arcbound Fiend * Implement Carry Away * Implement Caverns of Despair * Implement Amulet of Unmaking * Implement Aphetto Exterminator * Implement Balduvian Conjurer, Barrin's Unmaking, Each Mana Battery, Blood Hound and Boa Constrictor * Implement Bola Warrior, Brass Talon Chimera, Briar Patch and Brine Shaman * Implemented Call to Arms, Goham Djinn, Halam Djinn, Ruham Djinn, Sulam Djinn, Zanam Djinn, Heroic Defiance and Tsabo's Assassin, updated Barrin's Unmaking and Epicenter
This commit is contained in:
parent
d7e15cf129
commit
385e462f15
56 changed files with 3535 additions and 133 deletions
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class MostCommonColorCondition implements Condition {
|
||||
|
||||
protected ObjectColor compareColor;
|
||||
protected boolean isMono;
|
||||
protected Predicate predicate;
|
||||
|
||||
public MostCommonColorCondition(ObjectColor color) {
|
||||
this(color, false, null);
|
||||
}
|
||||
|
||||
//Use this one if you don't want a tie for most common and want to restrict to a player (literally only Call to Arms)
|
||||
public MostCommonColorCondition(ObjectColor color, boolean isMono, Predicate predicate) {
|
||||
this.compareColor = color;
|
||||
this.isMono = isMono;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FilterPermanent[] colorFilters = new FilterPermanent[6];
|
||||
int i = 0;
|
||||
for (ObjectColor color : ObjectColor.getAllColors()) {
|
||||
colorFilters[i] = new FilterPermanent();
|
||||
colorFilters[i].add(new ColorPredicate(color));
|
||||
if (predicate != null) {
|
||||
colorFilters[i].add(predicate);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
int[] colorCounts = new int[6];
|
||||
i = 0;
|
||||
for (ObjectColor color : ObjectColor.getAllColors()) {
|
||||
colorFilters[i].add(new ColorPredicate(color));
|
||||
colorCounts[i] = game.getBattlefield().count(colorFilters[i], source.getId(), source.getControllerId(), game);
|
||||
i++;
|
||||
}
|
||||
int max = 0;
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (colorCounts[i] > max) {
|
||||
max = colorCounts[i] * 1;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
ObjectColor commonest = new ObjectColor();
|
||||
for (ObjectColor color : ObjectColor.getAllColors()) {
|
||||
if (colorCounts[i] == max) {
|
||||
commonest.addColor(color);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (compareColor.shares(commonest)) {
|
||||
if (isMono) {
|
||||
return !commonest.isMulticolored();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (!compareColor.isMulticolored()) {
|
||||
return compareColor.getDescription() + " is the most common color among all permanents or is tied for most common";
|
||||
} else {
|
||||
return "it shares a color with the most common color among all permanents or a color tied for most common";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* 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.counter;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class RemoveAllCountersSourceEffect extends OneShotEffect {
|
||||
|
||||
private final CounterType counterType;
|
||||
|
||||
public RemoveAllCountersSourceEffect(CounterType counterType) {
|
||||
super(Outcome.Neutral);
|
||||
this.counterType = counterType;
|
||||
staticText = "remove all " + counterType.getName() + " counters from {this}.";
|
||||
}
|
||||
|
||||
public RemoveAllCountersSourceEffect(RemoveAllCountersSourceEffect effect) {
|
||||
super(effect);
|
||||
this.counterType = effect.counterType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if(permanent != null) {
|
||||
int count = permanent.getCounters(game).getCount(counterType);
|
||||
permanent.removeCounters(counterType.getName(), count, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoveAllCountersSourceEffect copy() {
|
||||
return new RemoveAllCountersSourceEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
/*
|
||||
* 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.filter.common;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class FilterEquipmentPermanent extends FilterPermanent {
|
||||
|
||||
public FilterEquipmentPermanent() {
|
||||
this("equipment");
|
||||
}
|
||||
|
||||
public FilterEquipmentPermanent(String name) {
|
||||
super(name);
|
||||
this.add(new SubtypePredicate(SubType.EQUIPMENT));
|
||||
}
|
||||
|
||||
public FilterEquipmentPermanent(final FilterEquipmentPermanent filter) {
|
||||
super(filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilterEquipmentPermanent copy() {
|
||||
return new FilterEquipmentPermanent(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* 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.target.common;
|
||||
|
||||
import mage.filter.common.FilterEquipmentPermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class TargetEquipmentPermanent extends TargetPermanent {
|
||||
|
||||
public TargetEquipmentPermanent() {
|
||||
this(1, 1, new FilterEquipmentPermanent(), false);
|
||||
}
|
||||
|
||||
public TargetEquipmentPermanent(FilterEquipmentPermanent filter) {
|
||||
this(1, 1, filter, false);
|
||||
}
|
||||
|
||||
public TargetEquipmentPermanent(int numTargets) {
|
||||
this(numTargets, numTargets, new FilterEquipmentPermanent(), false);
|
||||
}
|
||||
|
||||
public TargetEquipmentPermanent(int minNumTargets, int maxNumTargets, FilterEquipmentPermanent filter, boolean notTarget) {
|
||||
super(minNumTargets, maxNumTargets, filter, notTarget);
|
||||
}
|
||||
|
||||
public TargetEquipmentPermanent(final TargetEquipmentPermanent target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetEquipmentPermanent copy() {
|
||||
return new TargetEquipmentPermanent(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue