mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Merge branch 'deathtouch' into 'master'
Fix getLethalDamage See merge request core-developers/forge!6019
This commit is contained in:
@@ -2216,7 +2216,7 @@ public class GameAction {
|
||||
// publicize the decision
|
||||
game.fireEvent(new GameEventScry(p, numToTop, numToBottom));
|
||||
}
|
||||
// do the moves after all the decisions (maybe not necesssary, but let's
|
||||
// do the moves after all the decisions (maybe not necessary, but let's
|
||||
// do it the official way)
|
||||
for (Map.Entry<Player, ImmutablePair<CardCollection, CardCollection>> e : decisions.entrySet()) {
|
||||
// no good iterate simultaneously in Java
|
||||
|
||||
@@ -5199,6 +5199,12 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
|
||||
// this is the minimal damage a trampling creature has to assign to a blocker
|
||||
public final int getLethalDamage() {
|
||||
// CR 702.2c
|
||||
for (Card c : getAssignedDamageMap().keySet()) {
|
||||
if (c.hasKeyword(Keyword.DEATHTOUCH)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return getLethal() - getDamage() - getTotalAssignedDamage();
|
||||
}
|
||||
|
||||
@@ -5224,8 +5230,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
}
|
||||
|
||||
public final void addAssignedDamage(int assignedDamage0, final Card sourceCard) {
|
||||
if (assignedDamage0 < 0) {
|
||||
assignedDamage0 = 0;
|
||||
// 510.1a Creatures that would assign 0 or less damage don’t assign combat damage at all.
|
||||
if (assignedDamage0 <= 0) {
|
||||
return;
|
||||
}
|
||||
Log.debug(this + " - was assigned " + assignedDamage0 + " damage, by " + sourceCard);
|
||||
if (!assignedDamageMap.containsKey(sourceCard)) {
|
||||
|
||||
@@ -1056,7 +1056,6 @@ public final class CMatchUI
|
||||
return result.get();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void openView(final TrackableCollection<PlayerView> myPlayers) {
|
||||
final GameView gameView = getGameView();
|
||||
|
||||
@@ -283,7 +283,7 @@ public class VAssignCombatDamage {
|
||||
* @param isLMB
|
||||
*/
|
||||
private void assignDamageTo(CardView source, final boolean meta, final boolean isAdding) {
|
||||
if ( !damage.containsKey(source) )
|
||||
if (!damage.containsKey(source))
|
||||
source = null;
|
||||
|
||||
// If trying to assign to the defender, follow the normal assignment rules
|
||||
@@ -391,7 +391,6 @@ public class VAssignCombatDamage {
|
||||
dt.damage = Math.max(0, addedDamage + dt.damage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this method.
|
||||
* @return
|
||||
@@ -410,8 +409,7 @@ public class VAssignCombatDamage {
|
||||
int damageLeft = totalDamageToAssign;
|
||||
boolean allHaveLethal = true;
|
||||
|
||||
for (DamageTarget dt : defenders)
|
||||
{
|
||||
for (DamageTarget dt : defenders) {
|
||||
int dmg = dt.damage;
|
||||
damageLeft -= dmg;
|
||||
int lethal = getDamageToKill(dt.card);
|
||||
|
||||
@@ -3,7 +3,7 @@ ManaCost:3 R
|
||||
Types:Creature Human Soldier
|
||||
PT:4/3
|
||||
K:Haste
|
||||
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigExile | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME attacks, you may exile another target attacking creature you control. If you do, reveal cards from the top of your library until you reveal a creature card. Put that card onto the battlefield tapped and flying and the rest on the bottom of your library in a random order.
|
||||
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigExile | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME attacks, you may exile another target attacking creature you control. If you do, reveal cards from the top of your library until you reveal a creature card. Put that card onto the battlefield tapped and attacking and the rest on the bottom of your library in a random order.
|
||||
SVar:TrigExile:DB$ ChangeZone | ValidTgts$ Creature.attacking+Other+YouCtrl | TgtPrompt$ Select another target attacking creature you control | Origin$ Battlefield | Destination$ Exile | RememberChanged$ True | SubAbility$ DBDigUntil
|
||||
SVar:DBDigUntil:DB$ DigUntil | Valid$ Creature | ValidDescription$ Creature | FoundDestination$ Battlefield | Tapped$ True | Attacking$ True | GainControl$ True | RevealedDestination$ Library | RevealedLibraryPosition$ -1 | RevealRandomOrder$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE1 | SubAbility$ DBCleanup
|
||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||
|
||||
@@ -2,7 +2,7 @@ Name:Pathway Arrows
|
||||
ManaCost:1
|
||||
Types:Artifact Equipment
|
||||
S:Mode$ Continuous | Affected$ Card.EquippedBy | AddAbility$ Damage | AddSVar$ PathwayTapAll & PathwayCleanup | Description$ Equipped creature has "{2}, {T}: This creature deals 1 damage to target creature. If a colorless creature is dealt damage this way, tap it."
|
||||
SVar:Damage:AB$DealDamage | Cost$ 2 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumDmg$ 1 | RememberDamaged$ True | SubAbility$ PathwayTapAll | SpellDescription$ CARDNAME deals 1 damage to target creature. If a colorless creature is dealt damage this way, tap it.
|
||||
SVar:Damage:AB$ DealDamage | Cost$ 2 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumDmg$ 1 | RememberDamaged$ True | SubAbility$ PathwayTapAll | SpellDescription$ CARDNAME deals 1 damage to target creature. If a colorless creature is dealt damage this way, tap it.
|
||||
SVar:PathwayTapAll:DB$ TapAll | ValidCards$ Creature.IsRemembered+Colorless | SubAbility$ PathwayCleanup
|
||||
SVar:PathwayCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||
K:Equip:2
|
||||
|
||||
Reference in New Issue
Block a user