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
2 changes: 1 addition & 1 deletion client/src/adapter/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2447,7 +2447,7 @@ export type GameEvent =
| { type: "TurnStarted"; data: { player_id: PlayerId; turn_number: number } }
| { type: "PhaseChanged"; data: { phase: Phase } }
| { type: "PriorityPassed"; data: { player_id: PlayerId } }
| { type: "SpellCast"; data: { card_id: CardId; controller: PlayerId; object_id: ObjectId } }
| { type: "SpellCast"; data: { card_id: CardId; controller: PlayerId; object_id: ObjectId; cast_mana_value?: number } }
| { type: "XValueChosen"; data: { player: PlayerId; object_id: ObjectId; value: number } }
| { type: "AbilityActivated"; data: { player_id: PlayerId; source_id: ObjectId } }
| { type: "ExhaustAbilityActivated"; data: { player_id: PlayerId; source_id: ObjectId; is_mana_ability: boolean } }
Expand Down
1 change: 1 addition & 0 deletions crates/engine/src/ai_support/payment_continuation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ fn finalized_root_matches(
card_id: event_card_id,
controller: event_controller,
object_id: event_object_id,
..
} if *event_card_id == *card_id
&& *event_controller == *controller
&& *event_object_id == *object_id
Expand Down
1 change: 1 addition & 0 deletions crates/engine/src/analysis/sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ mod tests {
card_id: CardId(5),
controller: PlayerId(0),
object_id: ObjectId(22),
cast_mana_value: None,
},
GameEvent::PhaseChanged {
phase: Phase::BeginCombat,
Expand Down
7 changes: 7 additions & 0 deletions crates/engine/src/game/casting_costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9771,6 +9771,13 @@ fn finalize_cast_with_phyrexian_choices_inner(
card_id,
controller: player,
object_id,
cast_mana_value: Some(
state
.objects
.get(&object_id)
.expect("finalized spell must remain available for cast event")
.spell_mana_value(),
),
});

// CR 608.2c + CR 608.2g + CR 601.2i: A paid during-resolution cast is the
Expand Down
1 change: 1 addition & 0 deletions crates/engine/src/game/effects/cascade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ mod tests {
card_id: CardId(2000),
controller: PlayerId(0),
object_id: spell_id,
cast_mana_value: None,
}];

let ts_before = state.next_timestamp;
Expand Down
7 changes: 7 additions & 0 deletions crates/engine/src/game/effects/cast_copy_of_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ fn cast_one_copy(
card_id,
controller: ability.controller,
object_id: copy_id,
cast_mana_value: Some(
state
.objects
.get(&copy_id)
.expect("cast copy must remain available for SpellCast event")
.spell_mana_value(),
),
});
if let Some(obj) = state.objects.get(&copy_id).cloned() {
crate::game::restrictions::record_spell_cast_from_zone(
Expand Down
1 change: 1 addition & 0 deletions crates/engine/src/game/effects/cast_from_zone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,7 @@ fn cast_stack_spell_copy_during_resolution(
card_id: obj.card_id,
controller: ability.controller,
object_id: copy_id,
cast_mana_value: Some(obj.spell_mana_value()),
});
crate::game::restrictions::record_spell_cast_from_zone(
state,
Expand Down
3 changes: 3 additions & 0 deletions crates/engine/src/game/effects/copy_spell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2043,6 +2043,7 @@ mod tests {
card_id: CardId(1),
object_id: cast_spell_id,
controller: PlayerId(0),
cast_mana_value: None,
});

let copy_ability = ResolvedAbility::new(
Expand Down Expand Up @@ -2144,6 +2145,7 @@ mod tests {
card_id: CardId(1),
object_id: cast_spell_id,
controller: PlayerId(0),
cast_mana_value: None,
}),
);

Expand Down Expand Up @@ -3360,6 +3362,7 @@ mod tests {
card_id: CardId(1),
object_id: ObjectId(10),
controller: PlayerId(0),
cast_mana_value: None,
});
let mut events = Vec::new();
resolve(&mut state, &copy, &mut events).expect("automatic copy must resolve");
Expand Down
2 changes: 2 additions & 0 deletions crates/engine/src/game/effects/deal_damage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3113,6 +3113,7 @@ mod tests {
card_id: CardId(11),
controller: PlayerId(0),
object_id: spell,
cast_mana_value: None,
});

// The exile-until hit — Target, mana value 1.
Expand Down Expand Up @@ -3267,6 +3268,7 @@ mod tests {
card_id: CardId(11),
controller: PlayerId(0),
object_id: spell,
cast_mana_value: None,
});

// Two exile-until hits — both bound as object targets on the parent, so the
Expand Down
1 change: 1 addition & 0 deletions crates/engine/src/game/effects/delayed_trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3097,6 +3097,7 @@ mod tests {
card_id,
controller: PlayerId(0),
object_id: spell,
cast_mana_value: None,
});

// Demonstrative "that spell" ref with NO parent target -> event-context path.
Expand Down
1 change: 1 addition & 0 deletions crates/engine/src/game/effects/discover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ mod tests {
card_id: CardId(4),
controller: PlayerId(0),
object_id: triggering_spell,
cast_mana_value: None,
});

let ability = ResolvedAbility::new(
Expand Down
2 changes: 2 additions & 0 deletions crates/engine/src/game/effects/effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,7 @@ mod tests {
card_id: CardId(2),
controller: PlayerId(0),
object_id: cast_spell,
cast_mana_value: None,
});

let static_def = StaticDefinition::continuous()
Expand Down Expand Up @@ -1538,6 +1539,7 @@ mod tests {
card_id: CardId(11),
controller: PlayerId(0),
object_id: cast_spell,
cast_mana_value: None,
});

let static_def = StaticDefinition::continuous()
Expand Down
4 changes: 4 additions & 0 deletions crates/engine/src/game/effects/flip_coin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,7 @@ mod tests {
controller: PlayerId(0),
object_id: spell_id,
card_id: CardId(2),
cast_mana_value: None,
});

let ability = build_resolved_from_def(execute, krark_id, PlayerId(0));
Expand Down Expand Up @@ -1320,6 +1321,7 @@ mod tests {
controller: PlayerId(0),
object_id: spell_id,
card_id: CardId(2),
cast_mana_value: None,
});

let ability = build_resolved_from_def(execute, krark_id, PlayerId(0));
Expand Down Expand Up @@ -1445,6 +1447,7 @@ mod tests {
controller: PlayerId(1),
object_id: ObjectId(999),
card_id: CardId(2),
cast_mana_value: None,
});

let ability =
Expand Down Expand Up @@ -1484,6 +1487,7 @@ mod tests {
controller: PlayerId(1),
object_id: ObjectId(999),
card_id: CardId(2),
cast_mana_value: None,
});

// Lose branch: "that player loses 3 life" — bound to TriggeringPlayer so
Expand Down
3 changes: 3 additions & 0 deletions crates/engine/src/game/effects/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15362,6 +15362,7 @@ mod tests {
card_id: CardId(99),
controller: PlayerId(1),
object_id: ObjectId(99),
cast_mana_value: None,
});

let mut events = Vec::new();
Expand Down Expand Up @@ -28588,6 +28589,7 @@ mod tests {
card_id: CardId(9000),
controller: PlayerId(1),
object_id: ObjectId(9000),
cast_mana_value: None,
});

assert!(
Expand Down Expand Up @@ -28718,6 +28720,7 @@ mod tests {
card_id: CardId(9000),
controller: PlayerId(0),
object_id: ObjectId(9000),
cast_mana_value: None,
});

// The caster (seat 0) and its teammate (seat 1) are NOT opponents.
Expand Down
1 change: 1 addition & 0 deletions crates/engine/src/game/engine_priority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ fn ensure_terminal_cast_spell_triggers_collected(
card_id: object.card_id,
controller: object.controller,
object_id,
cast_mana_value: Some(object.spell_mana_value()),
};
triggers::collect_triggers_into_deferred(state, &[event]);
}
Expand Down
3 changes: 3 additions & 0 deletions crates/engine/src/game/engine_trigger_target_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ fn triggered_modal_modes_with_targets_wait_for_target_selection() {
controller: PlayerId(0),
object_id: ObjectId(98),
card_id: CardId(98),
cast_mana_value: None,
}),
modal: Some(ModalChoice {
min_choices: 2,
Expand Down Expand Up @@ -584,6 +585,7 @@ fn triggered_modal_modes_without_targets_consume_pending_trigger() {
controller: PlayerId(0),
object_id: ObjectId(99),
card_id: CardId(99),
cast_mana_value: None,
}),
modal: Some(ModalChoice {
min_choices: 1,
Expand Down Expand Up @@ -1077,6 +1079,7 @@ fn triggered_modal_modes_reject_unsatisfiable_target_constraints() {
controller: PlayerId(0),
object_id: ObjectId(97),
card_id: CardId(97),
cast_mana_value: None,
}),
modal: Some(ModalChoice {
min_choices: 2,
Expand Down
1 change: 1 addition & 0 deletions crates/engine/src/game/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,7 @@ mod tests {
card_id: CardId(1),
controller: PlayerId(0),
object_id: id,
cast_mana_value: None,
};
let entries = resolve_log_entries(&[event], &state, &state);
assert_eq!(entries.len(), 1);
Expand Down
Loading
Loading