mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Added Power Leak (for now, needs a special exclusion in the AI code to properly determine who the paying player is, otherwise the AI believes that it's the opponent who owns Power Leak in case it's cast by the opponent).
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -12285,6 +12285,7 @@ forge-gui/res/cardsfolder/p/powder_keg.txt svneol=native#text/plain
|
||||
forge-gui/res/cardsfolder/p/power_armor.txt svneol=native#text/plain
|
||||
forge-gui/res/cardsfolder/p/power_artifact.txt svneol=native#text/plain
|
||||
forge-gui/res/cardsfolder/p/power_conduit.txt -text
|
||||
forge-gui/res/cardsfolder/p/power_leak.txt -text
|
||||
forge-gui/res/cardsfolder/p/power_matrix.txt svneol=native#text/plain
|
||||
forge-gui/res/cardsfolder/p/power_of_fire.txt svneol=native#text/plain
|
||||
forge-gui/res/cardsfolder/p/power_play.txt -text
|
||||
|
||||
@@ -115,7 +115,22 @@ public class PlayerControllerAi extends PlayerController {
|
||||
if (ability.getApi() != null) {
|
||||
switch (ability.getApi()) {
|
||||
case ChooseNumber:
|
||||
return ability.getActivatingPlayer().isOpponentOf(player) ? 0 : ComputerUtilMana.determineLeftoverMana(ability, player);
|
||||
Player payingPlayer = ability.getActivatingPlayer();
|
||||
String logic = ability.getParamOrDefault("AILogic", "");
|
||||
|
||||
if (logic.startsWith("PowerLeakMaxMana.") && ability.getHostCard().isEnchantingCard()) {
|
||||
// For cards like Power Leak, the payer will be the owner of the enchanted card
|
||||
// TODO: is there any way to generalize this and avoid a special exclusion?
|
||||
payingPlayer = ability.getHostCard().getEnchantingCard().getController();
|
||||
}
|
||||
|
||||
int number = ComputerUtilMana.determineLeftoverMana(ability, player);
|
||||
|
||||
if (logic.startsWith("MaxMana.") || logic.startsWith("PowerLeakMaxMana.")) {
|
||||
number = Math.min(number, Integer.parseInt(logic.substring(logic.indexOf(".") + 1)));
|
||||
}
|
||||
|
||||
return payingPlayer.isOpponentOf(player) ? 0 : number;
|
||||
case BidLife:
|
||||
return 0;
|
||||
default:
|
||||
|
||||
15
forge-gui/res/cardsfolder/p/power_leak.txt
Normal file
15
forge-gui/res/cardsfolder/p/power_leak.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
Name:Power Leak
|
||||
ManaCost:1 U
|
||||
Types:Enchantment Aura
|
||||
K:Enchant enchantment
|
||||
A:SP$ Attach | Cost$ 1 U | ValidTgts$ Enchantment | AILogic$ Curse
|
||||
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ EnchantedController | Execute$ DBPay | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of the upkeep of enchanted enchantment's controller, that player may pay any amount of mana. CARDNAME deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way.
|
||||
S:Mode$ PreventDamage | Target$ EnchantedController | Source$ Card.Self | Amount$ PaidAmount | References$ PaidAmount | Secondary$ True
|
||||
SVar:DBPay:DB$ ChooseNumber | Defined$ EnchantedController | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | AILogic$ PowerLeakMaxMana.2 | SubAbility$ DBStore
|
||||
SVar:DBStore:DB$ StoreSVar | SVar$ PaidAmount | Type$ CountSVar | Expression$ X | UnlessCost$ X | UnlessPayer$ EnchantedController | UnlessSwitched$ True | References$ X,PaidAmount | SubAbility$ DBDmg
|
||||
SVar:DBDmg:DB$ DealDamage | Defined$ EnchantedController | NumDmg$ 2 | SubAbility$ DBReset | References$ PaidAmount | StackDescription$ None
|
||||
SVar:DBReset:DB$ StoreSVar | SVar$ PaidAmount | Type$ Number | Expression$ 0 | References$ PaidAmount
|
||||
SVar:X:Count$ChosenNumber
|
||||
SVar:PaidAmount:Number$0
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/power_leak.jpg
|
||||
Oracle:Enchant enchantment\nAt the beginning of the upkeep of enchanted enchantment's controller, that player may pay any amount of mana. Power Leak deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way.
|
||||
Reference in New Issue
Block a user