Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions crates/engine/src/analysis/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7018,7 +7018,8 @@ pub(crate) fn token_growth_is_observed(state: &GameState) -> bool {
/// CR 614.1a: a replacement's BODY (not its `condition`) can read a projected
/// player resource. `QuantityModification` variants are all fixed constants (no
/// read). `DamageModification::LifeFloor` caps against a player's live life total
/// (CR 119, projected); `Plus { value }` carries a `QuantityExpr` that MAY read one
/// (CR 119, projected); `Plus { value }` and `PreventionMinus`'s live `Quantity`
/// formula carry a `QuantityExpr` that MAY read one
/// — treated fail-closed. `execute` is an `AbilityDefinition` with no C0-walker
/// predicate ⇒ fail-closed when present. The un-flagged `DamageModification` /
/// `QuantityModification` variants are safe to omit because their outputs land in
Expand All @@ -7032,7 +7033,13 @@ fn replacement_body_may_read_projected(def: &crate::types::ability::ReplacementD
}
matches!(
def.damage_modification,
Some(DamageModification::LifeFloor { .. } | DamageModification::Plus { .. })
Some(
DamageModification::LifeFloor { .. }
| DamageModification::Plus { .. }
| DamageModification::PreventionMinus {
value: crate::types::ability::PreventionFormula::Quantity { .. },
}
)
)
}

Expand Down
12 changes: 9 additions & 3 deletions crates/engine/src/database/synthesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3864,7 +3864,9 @@ pub(crate) fn entry_replacement_for_grant_static(
fn build_absorb_replacement(n: u32) -> ReplacementDefinition {
ReplacementDefinition::new(ReplacementEvent::DamageDone)
.valid_card(TargetFilter::SelfRef)
.damage_modification(DamageModification::PreventionMinus { value: n })
.damage_modification(DamageModification::PreventionMinus {
value: crate::types::ability::PreventionFormula::fixed(n),
})
.description(format!(
"CR 702.64a: Absorb {n} — if a source would deal damage to this creature, \
prevent {n} of that damage."
Expand All @@ -3880,7 +3882,9 @@ fn is_absorb_replacement(r: &ReplacementDefinition, n: u32) -> bool {
&& matches!(r.valid_card, Some(TargetFilter::SelfRef))
&& matches!(
r.damage_modification,
Some(DamageModification::PreventionMinus { value }) if value == n
Some(DamageModification::PreventionMinus {
value: crate::types::ability::PreventionFormula::Fixed(value),
}) if value == n
)
}

Expand Down Expand Up @@ -26050,7 +26054,9 @@ mod absorb_synthesis_tests {
assert!(
matches!(
r.damage_modification,
Some(DamageModification::PreventionMinus { value: 2 })
Some(DamageModification::PreventionMinus {
value: crate::types::ability::PreventionFormula::Fixed(2),
})
),
"CR 702.64a: prevent N (=2) of the damage (prevention provenance)"
);
Expand Down
6 changes: 6 additions & 0 deletions crates/engine/src/game/elimination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,7 @@ mod tests {
search_found_candidates: Vec::new(),
depth: 0,
is_optional: false,
choice_player: None,
library_placement: None,
exile_controller: None,
exile_duration: None,
Expand Down Expand Up @@ -3103,6 +3104,7 @@ mod tests {
search_found_candidates: Vec::new(),
depth: 0,
is_optional: false,
choice_player: None,
library_placement: None,
exile_controller: None,
exile_duration: None,
Expand Down Expand Up @@ -3243,6 +3245,7 @@ mod tests {
search_found_candidates: Vec::new(),
depth: 0,
is_optional: false,
choice_player: None,
library_placement: None,
exile_controller: None,
exile_duration: None,
Expand Down Expand Up @@ -3296,6 +3299,7 @@ mod tests {
search_found_candidates: Vec::new(),
depth: 0,
is_optional: false,
choice_player: None,
library_placement: None,
exile_controller: None,
exile_duration: None,
Expand Down Expand Up @@ -3340,6 +3344,7 @@ mod tests {
search_found_candidates: Vec::new(),
depth: 0,
is_optional: false,
choice_player: None,
library_placement: None,
exile_controller: None,
exile_duration: None,
Expand Down Expand Up @@ -3414,6 +3419,7 @@ mod tests {
search_found_candidates: Vec::new(),
depth: 0,
is_optional: false,
choice_player: None,
library_placement: None,
exile_controller: None,
exile_duration: None,
Expand Down
2 changes: 2 additions & 0 deletions crates/engine/src/game/engine_replacement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3760,6 +3760,7 @@ mod tests {
search_found_candidates: Vec::new(),
depth: 0,
is_optional: true,
choice_player: Some(PlayerId(0)),
library_placement: None,
exile_controller: None,
exile_duration: None,
Expand Down Expand Up @@ -4435,6 +4436,7 @@ mod tests {
search_found_candidates: Vec::new(),
depth: 0,
is_optional: false,
choice_player: None,
library_placement: None,
exile_controller: None,
exile_duration: None,
Expand Down
1 change: 1 addition & 0 deletions crates/engine/src/game/mana_abilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5258,6 +5258,7 @@ mod tests {
search_found_candidates: Vec::new(),
depth: 0,
is_optional: false,
choice_player: None,
library_placement: None,
exile_controller: None,
exile_duration: None,
Expand Down
Loading
Loading