mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Added support for "CombatDamage$" "True" and "False" to the PreventDamage static ability.
- Converted Mark of Asylum to script.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
Name:Mark of Asylum
|
||||
ManaCost:1 W
|
||||
Types:Enchantment
|
||||
Text:Prevent all noncombat damage that would be dealt to creatures you control.
|
||||
Text:no text
|
||||
S:Mode$ PreventDamage | Target$ Creature.YouCtrl | CombatDamage$ False | Description$ Prevent all noncombat damage that would be dealt to creatures you control.
|
||||
SVar:Rarity:Rare
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/mark_of_asylum.jpg
|
||||
SetInfo:CFX|Rare|http://magiccards.info/scans/en/cfx/10.jpg
|
||||
|
||||
@@ -5660,7 +5660,6 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
|
||||
int restDamage = damageIn;
|
||||
Player player = getController();
|
||||
|
||||
if (CardFactoryUtil.hasProtectionFrom(source, this)) {
|
||||
return 0;
|
||||
@@ -5694,14 +5693,12 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Prevent Damage static abilities
|
||||
CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
||||
for (Card ca : allp) {
|
||||
ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
|
||||
for (StaticAbility stAb : staticAbilities) {
|
||||
restDamage = stAb.applyAbility("PreventDamage", source, this, restDamage);
|
||||
restDamage = stAb.applyAbility("PreventDamage", source, this, restDamage, isCombat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5715,10 +5712,6 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((!isCombat && AllZoneUtil.isCardInPlay("Mark of Asylum", player))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (getName().equals("Callous Giant") && restDamage <= 3) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ public abstract class Player extends GameEntity {
|
||||
for (Card ca : allp) {
|
||||
ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
|
||||
for (StaticAbility stAb : staticAbilities) {
|
||||
restDamage = stAb.applyAbility("PreventDamage", source, this, restDamage);
|
||||
restDamage = stAb.applyAbility("PreventDamage", source, this, restDamage, isCombat);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ public class StaticAbility {
|
||||
}
|
||||
|
||||
//apply the ability if it has the right mode
|
||||
public int applyAbility(String mode, Card source, GameEntity target, int in) {
|
||||
public int applyAbility(String mode, Card source, GameEntity target, int in, boolean b) {
|
||||
|
||||
//don't apply the ability if it hasn't got the right mode
|
||||
if (!mapParams.get("Mode").equals(mode))
|
||||
@@ -163,7 +163,7 @@ public class StaticAbility {
|
||||
return in;
|
||||
|
||||
if (mode.equals("PreventDamage"))
|
||||
return StaticAbility_PreventDamage.applyPreventDamageAbility(this, source, target, in);
|
||||
return StaticAbility_PreventDamage.applyPreventDamageAbility(this, source, target, in, b);
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class StaticAbility_PreventDamage {
|
||||
* TODO Write javadoc for this method.
|
||||
* @param stAb a StaticAbility
|
||||
*/
|
||||
public static int applyPreventDamageAbility(final StaticAbility stAb, Card source, GameEntity target, int damage) {
|
||||
public static int applyPreventDamageAbility(final StaticAbility stAb, Card source, GameEntity target, int damage, boolean isCombat) {
|
||||
HashMap<String, String> params = stAb.getMapParams();
|
||||
Card hostCard = stAb.getHostCard();
|
||||
int restDamage = damage;
|
||||
@@ -26,6 +26,15 @@ public class StaticAbility_PreventDamage {
|
||||
return restDamage;
|
||||
}
|
||||
|
||||
if(params.containsKey("CombatDamage") && params.get("CombatDamage").equals("True") && !isCombat) {
|
||||
return restDamage;
|
||||
}
|
||||
|
||||
if(params.containsKey("CombatDamage") && params.get("CombatDamage").equals("False") && isCombat) {
|
||||
return restDamage;
|
||||
}
|
||||
|
||||
// no amount means all
|
||||
if(!params.containsKey("Amount") || params.get("Amount").equals("All")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user