manabrew_engine/ability/effects/day_time_effect.rs
1//! DayTime effect — switch between Day and Night.
2//!
3//! Ported 1:1 from Java's `DayTimeEffect.java`.
4//! Day/Night cycle: set the game to Day, Night, or Switch.
5
6use super::EffectContext;
7use crate::ability::ability_ir::DayTimeValue;
8
9/// Struct form of this effect so it can participate in the
10/// `SpellAbilityEffect` trait hierarchy — mirrors Java's
11/// `DayTimeEffect` class extending `SpellAbilityEffect`.
12#[manabrew_engine_macros::spell_effect(DayTimeEffect)]
13fn resolve(ctx: &mut EffectContext, sa: &crate::spellability::SpellAbility) {
14 match sa.ir.day_time_value {
15 Some(DayTimeValue::Day) => {
16 ctx.game.day_night_started = true;
17 ctx.game.is_night = false;
18 }
19 Some(DayTimeValue::Night) => {
20 ctx.game.day_night_started = true;
21 ctx.game.is_night = true;
22 }
23 Some(DayTimeValue::Switch) => {
24 ctx.game.day_night_started = true;
25 ctx.game.is_night = !ctx.game.is_night;
26 }
27 None => {}
28 }
29
30 // Day/Night changes trigger DFC transformations — handled by the game loop's
31 // state-based actions which check is_night against each DFC card.
32}