mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Merge branch 'aihints' into 'master'
DeckHints: extend Type See merge request core-developers/forge!6263
This commit is contained in:
@@ -275,11 +275,9 @@ public class AiBlockController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mode == TriggerType.DamageDone) {
|
if (mode == TriggerType.DamageDone) {
|
||||||
if ((!trigParams.containsKey("ValidSource")
|
if (trigger.matchesValidParam("ValidSource", attacker)
|
||||||
|| trigger.matchesValid(attacker, trigParams.get("ValidSource").split(",")))
|
|
||||||
&& attacker.getNetCombatDamage() > 0
|
&& attacker.getNetCombatDamage() > 0
|
||||||
&& (!trigParams.containsKey("ValidTarget")
|
&& trigger.matchesValidParam("ValidTarget", combat.getDefenderByAttacker(attacker))) {
|
||||||
|| trigger.matchesValid(combat.getDefenderByAttacker(attacker), trigParams.get("ValidTarget").split(",")))) {
|
|
||||||
value += 50;
|
value += 50;
|
||||||
}
|
}
|
||||||
} else if (mode == TriggerType.AttackerUnblocked) {
|
} else if (mode == TriggerType.AttackerUnblocked) {
|
||||||
|
|||||||
@@ -2664,15 +2664,15 @@ public class ComputerUtil {
|
|||||||
for (Trigger trigger : theTriggers) {
|
for (Trigger trigger : theTriggers) {
|
||||||
final Card source = trigger.getHostCard();
|
final Card source = trigger.getHostCard();
|
||||||
|
|
||||||
|
if (trigger.getMode() != TriggerType.SpellCast) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!trigger.zonesCheck(game.getZoneOf(source))) {
|
if (!trigger.zonesCheck(game.getZoneOf(source))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!trigger.requirementsCheck(game)) {
|
if (!trigger.requirementsCheck(game)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (trigger.getMode() != TriggerType.SpellCast) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (trigger.hasParam("ValidCard")) {
|
if (trigger.hasParam("ValidCard")) {
|
||||||
if (!card.isValid(trigger.getParam("ValidCard").split(","), source.getController(), source, sa)) {
|
if (!card.isValid(trigger.getParam("ValidCard").split(","), source.getController(), source, sa)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -2724,6 +2724,12 @@ public class ComputerUtil {
|
|||||||
for (Trigger trigger : theTriggers) {
|
for (Trigger trigger : theTriggers) {
|
||||||
final Card source = trigger.getHostCard();
|
final Card source = trigger.getHostCard();
|
||||||
|
|
||||||
|
if (trigger.getMode() != TriggerType.ChangesZone) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!"Battlefield".equals(trigger.getParam("Destination"))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!trigger.zonesCheck(game.getZoneOf(source))) {
|
if (!trigger.zonesCheck(game.getZoneOf(source))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2734,12 +2740,6 @@ public class ComputerUtil {
|
|||||||
&& AbilityUtils.getDefinedCards(permanent, source.getSVar(trigger.getParam("CheckOnTriggeredCard").split(" ")[0]), null).isEmpty()) {
|
&& AbilityUtils.getDefinedCards(permanent, source.getSVar(trigger.getParam("CheckOnTriggeredCard").split(" ")[0]), null).isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (trigger.getMode() != TriggerType.ChangesZone) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!"Battlefield".equals(trigger.getParam("Destination"))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (trigger.hasParam("ValidCard")) {
|
if (trigger.hasParam("ValidCard")) {
|
||||||
if (!permanent.isValid(trigger.getParam("ValidCard"), source.getController(), source, null)) {
|
if (!permanent.isValid(trigger.getParam("ValidCard"), source.getController(), source, null)) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -176,7 +176,14 @@ public class DeckHints {
|
|||||||
case TYPE:
|
case TYPE:
|
||||||
String[] types = param.split("\\|");
|
String[] types = param.split("\\|");
|
||||||
for (String t : types) {
|
for (String t : types) {
|
||||||
Iterables.addAll(cards, getMatchingItems(cardList, CardRulesPredicates.subType(t), PaperCard.FN_GET_RULES));
|
Predicate<CardRules> op;
|
||||||
|
if (t.contains(".")) {
|
||||||
|
String[] typeParts = t.split("\\.");
|
||||||
|
op = Predicates.and(CardRulesPredicates.coreType(true, typeParts[0]), CardRulesPredicates.subType(typeParts[1]));
|
||||||
|
} else {
|
||||||
|
op = Predicates.or(CardRulesPredicates.coreType(true, t), CardRulesPredicates.subType(t));
|
||||||
|
}
|
||||||
|
Iterables.addAll(cards, getMatchingItems(cardList, op, PaperCard.FN_GET_RULES));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NONE:
|
case NONE:
|
||||||
|
|||||||
@@ -356,19 +356,19 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView,
|
|||||||
}
|
}
|
||||||
CardCollection list = new CardCollection();
|
CardCollection list = new CardCollection();
|
||||||
if (presentPlayer.equals("You") || presentPlayer.equals("Any")) {
|
if (presentPlayer.equals("You") || presentPlayer.equals("Any")) {
|
||||||
list.addAll(this.getHostCard().getController().getCardsIn(presentZone));
|
list.addAll(hostController.getCardsIn(presentZone));
|
||||||
}
|
}
|
||||||
if (presentPlayer.equals("Opponent") || presentPlayer.equals("Any")) {
|
if (presentPlayer.equals("Opponent") || presentPlayer.equals("Any")) {
|
||||||
for (final Player p : this.getHostCard().getController().getOpponents()) {
|
for (final Player p : hostController.getOpponents()) {
|
||||||
list.addAll(p.getCardsIn(presentZone));
|
list.addAll(p.getCardsIn(presentZone));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (presentPlayer.equals("Any")) {
|
if (presentPlayer.equals("Any")) {
|
||||||
for (final Player p : this.getHostCard().getController().getAllies()) {
|
for (final Player p : hostController.getAllies()) {
|
||||||
list.addAll(p.getCardsIn(presentZone));
|
list.addAll(p.getCardsIn(presentZone));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list = CardLists.getValidCards(list, sIsPresent, this.getHostCard().getController(), this.getHostCard(), this);
|
list = CardLists.getValidCards(list, sIsPresent, hostController, this.getHostCard(), this);
|
||||||
|
|
||||||
final String rightString = presentCompare.substring(2);
|
final String rightString = presentCompare.substring(2);
|
||||||
int right = AbilityUtils.calculateAmount(getHostCard(), rightString, this);
|
int right = AbilityUtils.calculateAmount(getHostCard(), rightString, this);
|
||||||
@@ -389,15 +389,15 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView,
|
|||||||
}
|
}
|
||||||
CardCollection list = new CardCollection();
|
CardCollection list = new CardCollection();
|
||||||
if (presentPlayer.equals("You") || presentPlayer.equals("Any")) {
|
if (presentPlayer.equals("You") || presentPlayer.equals("Any")) {
|
||||||
list.addAll(this.getHostCard().getController().getCardsIn(presentZone));
|
list.addAll(hostController.getCardsIn(presentZone));
|
||||||
}
|
}
|
||||||
if (presentPlayer.equals("Opponent") || presentPlayer.equals("Any")) {
|
if (presentPlayer.equals("Opponent") || presentPlayer.equals("Any")) {
|
||||||
for (final Player p : this.getHostCard().getController().getOpponents()) {
|
for (final Player p : hostController.getOpponents()) {
|
||||||
list.addAll(p.getCardsIn(presentZone));
|
list.addAll(p.getCardsIn(presentZone));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list = CardLists.getValidCards(list, sIsPresent, this.getHostCard().getController(), this.getHostCard(), this);
|
list = CardLists.getValidCards(list, sIsPresent, hostController, this.getHostCard(), this);
|
||||||
|
|
||||||
final String rightString = presentCompare.substring(2);
|
final String rightString = presentCompare.substring(2);
|
||||||
int right = AbilityUtils.calculateAmount(getHostCard(), rightString, this);
|
int right = AbilityUtils.calculateAmount(getHostCard(), rightString, this);
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
|
|||||||
* the run params
|
* the run params
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
public abstract boolean canReplace (final Map<AbilityKey, Object> runParams);
|
public abstract boolean canReplace(final Map<AbilityKey, Object> runParams);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -614,8 +614,8 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
for (final Player p : g.getPlayers()) {
|
for (final Player p : g.getPlayers()) {
|
||||||
for (final Card crd : p.getAllCards()) {
|
for (final Card crd : p.getAllCards()) {
|
||||||
for (final ReplacementEffect replacementEffect : crd.getReplacementEffects()) {
|
for (final ReplacementEffect replacementEffect : crd.getReplacementEffects()) {
|
||||||
if (replacementEffect.requirementsCheck(g)
|
if (replacementEffect.getMode() == ReplacementType.ProduceMana
|
||||||
&& replacementEffect.getMode() == ReplacementType.ProduceMana
|
&& replacementEffect.requirementsCheck(g)
|
||||||
&& replacementEffect.canReplace(repParams)
|
&& replacementEffect.canReplace(repParams)
|
||||||
&& replacementEffect.zonesCheck(g.getZoneOf(crd))) {
|
&& replacementEffect.zonesCheck(g.getZoneOf(crd))) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.subAbility != null ? this.subAbility.canProduce(s) : false;
|
return this.subAbility != null && this.subAbility.canProduce(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isManaAbilityFor(SpellAbility saPaidFor, byte colorNeeded) {
|
public boolean isManaAbilityFor(SpellAbility saPaidFor, byte colorNeeded) {
|
||||||
@@ -290,7 +290,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
|||||||
if (mp != null && metConditions() && mp.meetsManaRestrictions(saPaidFor) && mp.abilityProducesManaColor(this, colorNeeded)) {
|
if (mp != null && metConditions() && mp.meetsManaRestrictions(saPaidFor) && mp.abilityProducesManaColor(this, colorNeeded)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return this.subAbility != null ? this.subAbility.isManaAbilityFor(saPaidFor, colorNeeded) : false;
|
return this.subAbility != null && this.subAbility.isManaAbilityFor(saPaidFor, colorNeeded);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isManaCannotCounter(SpellAbility saPaidFor) {
|
public boolean isManaCannotCounter(SpellAbility saPaidFor) {
|
||||||
@@ -298,7 +298,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
|||||||
if (mp != null && metConditions() && mp.meetsManaRestrictions(saPaidFor) && mp.cannotCounterPaidWith(saPaidFor)) {
|
if (mp != null && metConditions() && mp.meetsManaRestrictions(saPaidFor) && mp.cannotCounterPaidWith(saPaidFor)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return this.subAbility != null ? this.subAbility.isManaCannotCounter(saPaidFor) : false;
|
return this.subAbility != null && this.subAbility.isManaCannotCounter(saPaidFor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int amountOfManaGenerated(boolean multiply) {
|
public int amountOfManaGenerated(boolean multiply) {
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
|
|||||||
if (getPresentDefined() != null) {
|
if (getPresentDefined() != null) {
|
||||||
list = AbilityUtils.getDefinedObjects(host, getPresentDefined(), sa);
|
list = AbilityUtils.getDefinedObjects(host, getPresentDefined(), sa);
|
||||||
} else {
|
} else {
|
||||||
list = new FCollection<GameObject>(game.getCardsIn(getPresentZone()));
|
list = new FCollection<>(game.getCardsIn(getPresentZone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
final int left = Iterables.size(Iterables.filter(list, GameObjectPredicates.restriction(getIsPresent().split(","), sa.getActivatingPlayer(), host, sa)));
|
final int left = Iterables.size(Iterables.filter(list, GameObjectPredicates.restriction(getIsPresent().split(","), sa.getActivatingPlayer(), host, sa)));
|
||||||
|
|||||||
Reference in New Issue
Block a user