- Added an experimental AI property controlling damage chaining.

This commit is contained in:
Agetian
2018-12-10 19:37:26 +03:00
parent 685a0daa71
commit cb29ae319e
3 changed files with 13 additions and 1 deletions

View File

@@ -126,9 +126,10 @@ public enum AiProps { /** */
FLASH_USE_BUFF_AURAS_AS_COMBAT_TRICKS("true"),
FLASH_BUFF_AURA_CHANCE_TO_CAST_EARLY("1"),
FLASH_BUFF_AURA_CHANCE_CAST_AT_EOT("5"),
FLASH_BUFF_AURA_CHANCE_TO_RESPOND_TO_STACK("100"); /** */
FLASH_BUFF_AURA_CHANCE_TO_RESPOND_TO_STACK("100"), /** */
// Experimental features, must be promoted or removed after extensive testing and, ideally, defaulting
// <-- There are no experimental options here -->
CHANCE_TO_CHAIN_TWO_DAMAGE_SPELLS("0"); /** */
private final String strDefaultVal;

View File

@@ -23,6 +23,7 @@ import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import forge.util.MyRandom;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
@@ -190,6 +191,11 @@ public class ComputerUtilAbility {
}
public static Pair<SpellAbility, Integer> getDamageAfterChainingSpells(Player ai, SpellAbility sa, String damage) {
int chance = ((PlayerControllerAi)ai.getController()).getAi().getIntProperty(AiProps.CHANCE_TO_CHAIN_TWO_DAMAGE_SPELLS);
if (!MyRandom.percentTrue(chance)) {
return null;
}
if (sa.getSubAbility() != null || sa.getParent() != null) {
// Doesn't work yet for complex decisions where damage is only a part of the decision process
return null;

View File

@@ -277,3 +277,8 @@ MOJHOSTO_CHANCE_TO_USE_JHOIRA_COPY_INSTANT=20
# -- different name if necessary --
# <-- there are no experimental options here at the moment -->
# The chance that the AI will try to chain two damage spells or a damage spell and a debuffing pump spell to try to
# kill a bigger creature or a planeswalker.
CHANCE_TO_CHAIN_TWO_DAMAGE_SPELLS=100