-
-
Notifications
You must be signed in to change notification settings - Fork 151
Add Sovereign Okinec Ahau #7409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -524,6 +524,9 @@ pub(crate) fn quantity_expr_uses_recipient(expr: &QuantityExpr) -> bool { | |||||||||||||||||||||
| | QuantityRef::Power { | ||||||||||||||||||||||
| scope: ObjectScope::Recipient, | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| | QuantityRef::BasePower { | ||||||||||||||||||||||
| scope: ObjectScope::Recipient, | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| | QuantityRef::Toughness { | ||||||||||||||||||||||
| scope: ObjectScope::Recipient, | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
@@ -545,6 +548,9 @@ pub(crate) fn quantity_expr_uses_recipient(expr: &QuantityExpr) -> bool { | |||||||||||||||||||||
| QuantityRef::Power { | ||||||||||||||||||||||
| scope: ObjectScope::CostPaidObject, | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| | QuantityRef::BasePower { | ||||||||||||||||||||||
| scope: ObjectScope::CostPaidObject, | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| | QuantityRef::Toughness { | ||||||||||||||||||||||
| scope: ObjectScope::CostPaidObject, | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
@@ -617,6 +623,7 @@ pub(crate) fn quantity_expr_uses_resolution_only_object_scope(expr: &QuantityExp | |||||||||||||||||||||
| QuantityExpr::Fixed { .. } => false, | ||||||||||||||||||||||
| QuantityExpr::Ref { qty } => match qty { | ||||||||||||||||||||||
| QuantityRef::Power { scope } | ||||||||||||||||||||||
| | QuantityRef::BasePower { scope } | ||||||||||||||||||||||
| | QuantityRef::Toughness { scope } | ||||||||||||||||||||||
| | QuantityRef::ObjectManaValue { scope } | ||||||||||||||||||||||
| | QuantityRef::ObjectColorCount { scope } | ||||||||||||||||||||||
|
|
@@ -657,6 +664,7 @@ pub(crate) fn quantity_expr_contains_scope(expr: &QuantityExpr, scope: ObjectSco | |||||||||||||||||||||
| fn ref_contains_scope(qty: &QuantityRef, scope: ObjectScope) -> bool { | ||||||||||||||||||||||
| match qty { | ||||||||||||||||||||||
| QuantityRef::Power { scope: s } | ||||||||||||||||||||||
| | QuantityRef::BasePower { scope: s } | ||||||||||||||||||||||
| | QuantityRef::Toughness { scope: s } | ||||||||||||||||||||||
| | QuantityRef::ObjectManaValue { scope: s } | ||||||||||||||||||||||
| | QuantityRef::ObjectColorCount { scope: s } | ||||||||||||||||||||||
|
|
@@ -802,6 +810,7 @@ pub(crate) fn quantity_expr_missing_resolution_only_referent( | |||||||||||||||||||||
| QuantityExpr::Fixed { .. } => false, | ||||||||||||||||||||||
| QuantityExpr::Ref { qty } => match qty { | ||||||||||||||||||||||
| QuantityRef::Power { scope } | ||||||||||||||||||||||
| | QuantityRef::BasePower { scope } | ||||||||||||||||||||||
| | QuantityRef::Toughness { scope } | ||||||||||||||||||||||
| | QuantityRef::ObjectManaValue { scope } | ||||||||||||||||||||||
| | QuantityRef::ObjectColorCount { scope } | ||||||||||||||||||||||
|
|
@@ -919,6 +928,7 @@ fn quantity_ref_uses_unspent_mana(qty: &QuantityRef) -> bool { | |||||||||||||||||||||
| | QuantityRef::TargetControllerCounter { .. } | ||||||||||||||||||||||
| | QuantityRef::Variable { .. } | ||||||||||||||||||||||
| | QuantityRef::Power { .. } | ||||||||||||||||||||||
| | QuantityRef::BasePower { .. } | ||||||||||||||||||||||
| | QuantityRef::Intensity { .. } | ||||||||||||||||||||||
| | QuantityRef::Toughness { .. } | ||||||||||||||||||||||
| | QuantityRef::ObjectManaValue { .. } | ||||||||||||||||||||||
|
|
@@ -1254,6 +1264,7 @@ fn quantity_ref_uses_object_count(qty: &QuantityRef) -> bool { | |||||||||||||||||||||
| | QuantityRef::TargetControllerCounter { .. } | ||||||||||||||||||||||
| | QuantityRef::Variable { .. } | ||||||||||||||||||||||
| | QuantityRef::Power { .. } | ||||||||||||||||||||||
| | QuantityRef::BasePower { .. } | ||||||||||||||||||||||
| | QuantityRef::Intensity { .. } | ||||||||||||||||||||||
| | QuantityRef::Toughness { .. } | ||||||||||||||||||||||
| | QuantityRef::ObjectManaValue { .. } | ||||||||||||||||||||||
|
|
@@ -1513,7 +1524,9 @@ fn quantity_ref_characteristic_reads(qty: &QuantityRef, depth: u32) -> Character | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| // ---- Single-object characteristic reads. ---- | ||||||||||||||||||||||
| // CR 208.1 / CR 209.1. | ||||||||||||||||||||||
| QuantityRef::Power { .. } | QuantityRef::Toughness { .. } => { | ||||||||||||||||||||||
| QuantityRef::Power { .. } | ||||||||||||||||||||||
| | QuantityRef::BasePower { .. } | ||||||||||||||||||||||
| | QuantityRef::Toughness { .. } => { | ||||||||||||||||||||||
|
Comment on lines
+1527
to
+1529
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win Correct the CR annotation for Line 1225 adds Replace the inherited citation with a description that explains the Proposed annotation- // CR 208.1 / CR 209.1.
+ // CR 208.1 / CR 208.4b / CR 613.4b:
+ // single-object power/toughness reads; BasePower uses the current
+ // value after characteristic-defining and setting effects, before
+ // modifying effects and counters.As per path instructions: 📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSources: Path instructions, MCP tools |
||||||||||||||||||||||
| CharacteristicKinds::POWER_TOUGHNESS | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| // CR 607.2b: power of a card in exile, read the same way. | ||||||||||||||||||||||
|
|
@@ -1813,6 +1826,7 @@ fn entered_object_perturbs_quantity_ref( | |||||||||||||||||||||
| | QuantityRef::TargetControllerCounter { .. } | ||||||||||||||||||||||
| | QuantityRef::Variable { .. } | ||||||||||||||||||||||
| | QuantityRef::Power { .. } | ||||||||||||||||||||||
| | QuantityRef::BasePower { .. } | ||||||||||||||||||||||
| | QuantityRef::Intensity { .. } | ||||||||||||||||||||||
| | QuantityRef::Toughness { .. } | ||||||||||||||||||||||
| | QuantityRef::ObjectManaValue { .. } | ||||||||||||||||||||||
|
|
@@ -3463,6 +3477,17 @@ fn resolve_ref( | |||||||||||||||||||||
| |obj| obj.power, | ||||||||||||||||||||||
| |lki| lki.power, | ||||||||||||||||||||||
| ), | ||||||||||||||||||||||
| // CR 208.4b + CR 613.4b: base power is the layer-7a/7b value, before | ||||||||||||||||||||||
| // counters and other power-modifying effects in layer 7c. | ||||||||||||||||||||||
| QuantityRef::BasePower { scope } => resolve_object_pt( | ||||||||||||||||||||||
| state, | ||||||||||||||||||||||
| *scope, | ||||||||||||||||||||||
| ctx, | ||||||||||||||||||||||
| targets, | ||||||||||||||||||||||
| ability, | ||||||||||||||||||||||
| |obj| obj.base_power, | ||||||||||||||||||||||
| |lki| lki.base_power, | ||||||||||||||||||||||
| ), | ||||||||||||||||||||||
| // Digital-only Alchemy: read the object's current intensity. The reader | ||||||||||||||||||||||
| // is the source itself (a spell on the stack or a permanent reading its | ||||||||||||||||||||||
| // own intensity), so the live object carries it; LKI does not track | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20241,13 +20241,16 @@ fn rebind_source_ref(qty: &mut QuantityRef, target: ObjectScope, rebind: SourceR | |
| if matches!(rebind, SourceRefRebind::PowerOrToughness) | ||
| && !matches!( | ||
| qty, | ||
| QuantityRef::Power { .. } | QuantityRef::Toughness { .. } | ||
| QuantityRef::Power { .. } | ||
| | QuantityRef::BasePower { .. } | ||
| | QuantityRef::Toughness { .. } | ||
| ) | ||
| { | ||
| return; | ||
| } | ||
| let scope = match qty { | ||
| QuantityRef::Power { scope } | ||
| | QuantityRef::BasePower { scope } | ||
| | QuantityRef::Toughness { scope } | ||
| | QuantityRef::ObjectManaValue { scope } | ||
| | QuantityRef::ObjectColorCount { scope } | ||
|
|
@@ -21940,6 +21943,7 @@ pub(super) fn rebind_target_subject_object_scope(expr: &mut QuantityExpr) { | |
| QuantityExpr::Ref { qty } => { | ||
| let scope = match qty { | ||
| QuantityRef::Power { scope } | ||
| | QuantityRef::BasePower { scope } | ||
| | QuantityRef::Toughness { scope } | ||
| | QuantityRef::ObjectManaValue { scope } | ||
| | QuantityRef::ObjectColorCount { scope } | ||
|
|
@@ -21981,6 +21985,7 @@ pub(super) fn rebind_target_subject_object_scope(expr: &mut QuantityExpr) { | |
| fn rebind_anaphoric_ref(qty: &mut QuantityRef, target: ObjectScope) { | ||
| let scope = match qty { | ||
| QuantityRef::Power { scope } | ||
| | QuantityRef::BasePower { scope } | ||
| | QuantityRef::Toughness { scope } | ||
| | QuantityRef::ObjectManaValue { scope } | ||
| | QuantityRef::ObjectColorCount { scope } | ||
|
|
@@ -28160,6 +28165,50 @@ pub(crate) fn is_difference_anaphor_placeholder(expr: &QuantityExpr) -> bool { | |
| ) | ||
| } | ||
|
|
||
| /// CR 208.4b + CR 608.2c: Bind "equal to the difference" inside a member-driven | ||
| /// `repeat_for` whose population is selected by current power exceeding base | ||
| /// power. The enclosing loop rebinds its `ParentTarget` to each member, so the | ||
| /// two operands must use the same recipient-relative object scope. This keeps | ||
| /// the binding general for every future "for each ... with power greater than | ||
| /// that creature's base power ... equal to the difference" clause. | ||
| fn difference_expr_for_repeat_for(repeat_for: &QuantityExpr) -> Option<QuantityExpr> { | ||
| let QuantityExpr::Ref { | ||
| qty: QuantityRef::ObjectCount { filter }, | ||
| } = repeat_for | ||
| else { | ||
| return None; | ||
| }; | ||
|
|
||
| fn filter_has_power_exceeds_base(filter: &TargetFilter) -> bool { | ||
| match filter { | ||
| TargetFilter::Typed(typed) => typed | ||
| .properties | ||
| .iter() | ||
| .any(|property| matches!(property, FilterProp::PowerExceedsBase)), | ||
| TargetFilter::Or { filters } | TargetFilter::And { filters } => { | ||
| filters.iter().any(filter_has_power_exceeds_base) | ||
| } | ||
| TargetFilter::Not { filter } | TargetFilter::TrackedSetFiltered { filter, .. } => { | ||
| filter_has_power_exceeds_base(filter) | ||
| } | ||
| _ => false, | ||
| } | ||
| } | ||
|
|
||
| filter_has_power_exceeds_base(filter).then(|| QuantityExpr::Difference { | ||
| left: Box::new(QuantityExpr::Ref { | ||
| qty: QuantityRef::Power { | ||
| scope: ObjectScope::Recipient, | ||
| }, | ||
| }), | ||
| right: Box::new(QuantityExpr::Ref { | ||
| qty: QuantityRef::BasePower { | ||
| scope: ObjectScope::Recipient, | ||
| }, | ||
| }), | ||
| }) | ||
| } | ||
|
Comment on lines
+28182
to
+28210
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift Do not bind
Carry an explicit comparison-derived difference binding from the parser. Do not reconstruct it from an arbitrary 🤖 Prompt for AI AgentsSource: Path instructions |
||
|
|
||
| /// CR 608.2c: Resolve every deferred "the difference" count-anaphor placeholder | ||
| /// anywhere in an ability's effect tree — the single authority for both the | ||
| /// trigger seam (`lower_trigger_ir`, Drizzt Do'Urden) and the spell clause | ||
|
|
@@ -33016,7 +33065,12 @@ pub(crate) fn parse_effect_chain_ir( | |
| // before the trigger seam runs, breaking every difference-counter | ||
| // trigger. A spell's difference operands always ride the same clause | ||
| // (Hit the Mother Lode), so `Some(bound)` is the only case to handle. | ||
| if let Some(bound) = effective_condition.and_then(conditions::difference_expr) { | ||
| let repeat_for_difference = | ||
| repeat_for.as_ref().and_then(difference_expr_for_repeat_for); | ||
| if let Some(bound) = effective_condition | ||
| .and_then(conditions::difference_expr) | ||
| .or(repeat_for_difference) | ||
| { | ||
| resolve_difference_anaphor_in_effect(&mut clause.effect, Some(&bound)); | ||
| if let Some(sub) = clause.sub_ability.as_deref_mut() { | ||
| resolve_difference_anaphor_in_ability(sub, Some(&bound)); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.