pf_sandbox_lib 0.3.1

Data structures and helper code for PF Sandbox
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
use treeflection::{Node, NodeRunner, NodeToken, ContextVec};
use strum::IntoEnumIterator;
use num_traits::ToPrimitive;

use crate::json_upgrade::engine_version;

impl Default for Fighter {
    fn default() -> Fighter {
        let action_def = ActionDef {
            frames: ContextVec::from_vec(vec!(ActionFrame::default())),
            iasa:   0,
        };
        let mut actions: ContextVec<ActionDef> = ContextVec::new();
        for action in Action::iter() {
            let mut action_def_new = action_def.clone();
            action_def_new.frames[0].pass_through = match action {
                Action::Damage     | Action::DamageFly |
                Action::DamageFall | Action::AerialDodge |
                Action::Uair       | Action::Dair |
                Action::Fair       | Action::Bair |
                Action::Nair => false,
                _ => true
            };
            action_def_new.frames[0].ledge_cancel = match action {
                Action::Teeter | Action::TeeterIdle |
                Action::RollB  | Action::RollF |
                Action::TechB  | Action::TechF |
                Action::MissedTechGetupB | Action::MissedTechGetupF |
                Action::SpotDodge
                  => false,
                _ => true
            };
            action_def_new.frames[0].use_platform_angle = match action {
                Action::Dsmash | Action::Fsmash |
                Action::Dtilt  | Action::MissedTechIdle
                  => true,
                _ => false
            };
            actions.push(action_def_new);
        }

        Fighter {
            engine_version: engine_version(),

            // css render
            name:       "Base Fighter".to_string(),
            css_action: Action::Idle.to_u64().unwrap(),
            css_scale:  1.0,

            // in game attributes
            air_jumps:                1,
            weight:                   1.0, // weight = old value / 100
            gravity:                  -0.1,
            terminal_vel:             -2.0,
            fastfall_terminal_vel:    -3.0,
            jump_y_init_vel:          3.0,
            jump_y_init_vel_short:    2.0,
            jump_x_init_vel:          1.0,
            jump_x_term_vel:          1.5,
            jump_x_vel_ground_mult:   1.0,
            air_mobility_a:           0.04,
            air_mobility_b:           0.02,
            air_x_term_vel:           1.0,
            air_friction:             0.05,
            air_jump_x_vel:           1.0,
            air_jump_y_vel:           3.0,
            walk_init_vel:            0.2,
            walk_acc:                 0.1,
            walk_max_vel:             1.0,
            slow_walk_max_vel:        1.0,
            dash_init_vel:            2.0,
            dash_run_acc_a:           0.01,
            dash_run_acc_b:           0.2,
            dash_run_term_vel:        2.0,
            friction:                 0.1,
            aerialdodge_mult:         3.0,
            aerialdodge_drift_frame:  20,
            forward_roll:             false,
            backward_roll:            false,
            spot_dodge:               false,
            lcancel:                  None,
            shield:                   None,
            power_shield:             None,
            tech:                     None,
            missed_tech_forced_getup: Some(200),
            run_turn_flip_dir_frame:  30,
            tilt_turn_flip_dir_frame: 5,
            tilt_turn_into_dash_iasa: 5,
            actions:                  actions,
        }
    }
}

#[derive(Clone, Serialize, Deserialize, Node)]
pub struct Fighter {
    pub engine_version: u64,

    // css render
    pub name:       String,
    pub css_action: u64,
    pub css_scale:  f32,

    // in game attributes
    pub air_jumps:                u64,
    pub weight:                   f32,
    pub gravity:                  f32,
    pub terminal_vel:             f32,
    pub fastfall_terminal_vel:    f32,
    pub jump_y_init_vel:          f32,
    pub jump_y_init_vel_short:    f32,
    pub jump_x_init_vel:          f32,
    pub jump_x_term_vel:          f32,
    pub jump_x_vel_ground_mult:   f32,
    pub air_mobility_a:           f32,
    pub air_mobility_b:           f32,
    pub air_x_term_vel:           f32,
    pub air_friction:             f32,
    pub air_jump_x_vel:           f32,
    pub air_jump_y_vel:           f32,
    pub walk_init_vel:            f32,
    pub walk_acc:                 f32,
    pub walk_max_vel:             f32,
    pub slow_walk_max_vel:        f32,
    pub dash_init_vel:            f32,
    pub dash_run_acc_a:           f32,
    pub dash_run_acc_b:           f32,
    pub dash_run_term_vel:        f32,
    pub friction:                 f32,
    pub aerialdodge_mult:         f32,
    pub aerialdodge_drift_frame:  u64,
    pub forward_roll:             bool,
    pub backward_roll:            bool,
    pub spot_dodge:               bool,
    pub lcancel:                  Option<LCancel>,
    pub shield:                   Option<Shield>,
    pub power_shield:             Option<PowerShield>,
    pub tech:                     Option<Tech>,
    pub missed_tech_forced_getup: Option<u64>,
    pub run_turn_flip_dir_frame:  u64,
    pub tilt_turn_flip_dir_frame: u64,
    pub tilt_turn_into_dash_iasa: u64,
    pub actions:                  ContextVec<ActionDef>,
}

#[derive(Clone, Serialize, Deserialize, Node)]
pub struct Tech {
    pub active_window: u64,
    pub locked_window: u64,
}

impl Default for Tech {
    fn default() -> Self {
        Tech {
            active_window: 20,
            locked_window: 20
        }
    }
}

#[derive(Clone, Serialize, Deserialize, Node)]
pub struct LCancel {
    pub active_window: u64,
    pub frame_skip:    u8,
    pub normal_land:   bool,
}

impl Default for LCancel {
    fn default() -> Self {
        LCancel {
            active_window: 7,
            frame_skip:    1,
            normal_land:   false
        }
    }
}

#[derive(Clone, Serialize, Deserialize, Node)]
pub struct Shield {
    pub stick_lock: bool,
    pub stick_mult: f32,
    pub offset_x:   f32,
    pub offset_y:   f32,
    pub break_vel:  f32,
    pub scaling:    f32,
    pub hp_scaling: f32,
    pub hp_max:     f32,
    pub hp_regen:   f32,
    pub hp_cost:    f32,
}

impl Default for Shield {
    fn default() -> Self {
        Shield {
            stick_lock: false,
            stick_mult: 3.0,
            offset_x:   0.0,
            offset_y:   10.0,
            break_vel:  3.0,
            scaling:    10.0,
            hp_scaling: 1.0,
            hp_max:     60.0,
            hp_regen:   0.1,
            hp_cost:    0.3,
        }
    }
}

#[derive(Clone, Default, Serialize, Deserialize, Node)]
pub struct PowerShield {
    pub reflect_window: Option<u64>,
    pub parry:          Option<PowerShieldEffect>,
    pub enemy_stun:     Option<PowerShieldEffect>,
}

#[derive(Clone, Default, Serialize, Deserialize, Node)]
pub struct PowerShieldEffect {
    pub window:   u64,
    pub duration: u64
}

#[derive(Clone, Default, Serialize, Deserialize, Node)]
pub struct ActionDef {
    pub frames: ContextVec<ActionFrame>,
    pub iasa:   i64,
}

#[derive(Clone, Serialize, Deserialize, Node)]
pub enum VelModify {
    Set (f32),
    Add (f32),
    None,
}

impl Default for VelModify {
    fn default() -> Self {
        VelModify::None
    }
}

#[derive(Clone, Serialize, Deserialize, Node)]
pub struct ActionFrame {
    pub ecb:                 ECB,
    pub colboxes:            ContextVec<CollisionBox>,
    pub colbox_links:        Vec<CollisionBoxLink>,
    pub render_order:        Vec<RenderOrder>,
    pub item_hold_x:         f32,
    pub item_hold_y:         f32,
    pub grab_hold_x:         f32,
    pub grab_hold_y:         f32,
    pub pass_through:        bool, // only used on aerial actions
    pub ledge_cancel:        bool, // only used on ground actions
    pub use_platform_angle:  bool, // only used on ground actions
    // TODO: pub land_cancel: bool // only used on aerial attacks
    pub ledge_grab_box:      Option<LedgeGrabBox>,
    pub force_hitlist_reset: bool,
    /// Affects the next frames velocity
    pub x_vel_modify: VelModify,
    /// Affects the next frames velocity
    pub y_vel_modify: VelModify,
    /// Does not affect the next frames velocity
    pub x_vel_temp: f32,
    /// Does not affect the next frames velocity
    pub y_vel_temp: f32,
}

impl Default for ActionFrame {
    fn default() -> ActionFrame {
        ActionFrame {
            colboxes:            ContextVec::new(),
            colbox_links:        vec!(),
            render_order:        vec!(),
            ecb:                 ECB::default(),
            item_hold_x:         4.0,
            item_hold_y:         11.0,
            grab_hold_x:         4.0,
            grab_hold_y:         11.0,
            x_vel_modify:        VelModify::None,
            y_vel_modify:        VelModify::None,
            x_vel_temp:           0.0,
            y_vel_temp:           0.0,
            pass_through:        true,
            ledge_cancel:        true,
            use_platform_angle:  false,
            ledge_grab_box:      None,
            force_hitlist_reset: false,
        }
    }
}

impl ActionFrame {
    pub fn get_hitboxes(&self) -> Vec<&CollisionBox> {
        let mut result = self.get_colboxes();
        result.retain(|x| matches!(x.role, CollisionBoxRole::Hit(_)));
        result
    }

    pub fn get_hurtboxes(&self) -> Vec<&CollisionBox> {
        let mut result = self.get_colboxes();
        result.retain(|x| matches!(x.role, CollisionBoxRole::Hurt(_)));
        result
    }

    pub fn get_colboxes(&self) -> Vec<&CollisionBox> {
        let mut result: Vec<&CollisionBox> = vec!();
        for (i, colbox) in self.colboxes.iter().enumerate() {
            if self.is_unordered(&RenderOrder::Colbox(i)) {
                result.push(colbox);
            }
        }

        for order in &self.render_order {
            if let &RenderOrder::Colbox (index) = order {
                result.push(&self.colboxes[index]);
            }
        }

        result
    }

    pub fn get_links(&self) -> Vec<&CollisionBoxLink> {
        let mut result: Vec<&CollisionBoxLink> = vec!();
        for (i, link) in self.colbox_links.iter().enumerate() {
            if self.is_unordered(&RenderOrder::Link(i)) {
                result.push(link);
            }
        }

        for order in &self.render_order {
            if let &RenderOrder::Link (index) = order {
                result.push(&self.colbox_links[index]);
            }
        }

        result
    }

    /// Returns all collisionboxes and linked collisionboxes
    /// collisionboxes referenced by a link are not included individually
    pub fn get_colboxes_and_links(&self) -> Vec<ColboxOrLink> {
        let mut result: Vec<ColboxOrLink> = vec!();
        for (i, colbox) in self.colboxes.iter().enumerate() {
            if self.is_unordered(&RenderOrder::Colbox(i)) && self.is_unlinked(i) {
                result.push(ColboxOrLink::Colbox(colbox));
            }
        }
        for (i, link) in self.colbox_links.iter().enumerate() {
            if self.is_unordered(&RenderOrder::Link(i)) {
                result.push(ColboxOrLink::Link(link));
            }
        }

        for order in &self.render_order {
            match order {
                &RenderOrder::Colbox (index) => {
                    result.push(ColboxOrLink::Colbox(&self.colboxes[index]));
                }
                &RenderOrder::Link (index) => {
                    result.push(ColboxOrLink::Link(&self.colbox_links[index]));
                }
            }
        }

        result
    }

    fn is_unordered(&self, check_order: &RenderOrder) -> bool {
        for order in &self.render_order {
            if check_order == order {
                return false;
            }
        }
        true
    }

    fn is_unlinked(&self, i: usize) -> bool {
        for link in &self.colbox_links {
            if link.one == i || link.two == i {
                return false;
            }
        }
        true
    }

    pub fn get_links_containing_colbox(&self, colbox_i: usize) -> Vec<usize> {
        let mut result: Vec<usize> = vec!();
        for (link_i, link) in self.colbox_links.iter().enumerate() {
            if link.one == colbox_i || link.two == colbox_i {
                result.push(link_i);
            }
        }
        result
    }
}

#[derive(Clone, Serialize, Deserialize, Node)]
pub struct LedgeGrabBox {
    pub x1: f32,
    pub y1: f32,
    pub x2: f32,
    pub y2: f32,
}

impl Default for LedgeGrabBox {
    fn default() -> LedgeGrabBox {
        LedgeGrabBox {
            x1: 0.0,
            y1: 12.0,
            x2: 14.0,
            y2: 22.0,
        }
    }
}

pub enum ColboxOrLink <'a> {
    Colbox (&'a CollisionBox),
    Link   (&'a CollisionBoxLink)
}

#[derive(PartialEq, Clone, Serialize, Deserialize, Node)]
pub enum RenderOrder {
    Colbox (usize),
    Link   (usize)
}

impl Default for RenderOrder {
    fn default() -> RenderOrder {
        RenderOrder::Colbox (0)
    }
}

impl RenderOrder {
    pub fn dec_greater_than(&self, check: usize) -> RenderOrder {
        match self {
            &RenderOrder::Colbox (i) => {
                if i > check {
                    RenderOrder::Colbox (i-1)
                }
                else {
                    RenderOrder::Colbox (i)
                }
            }
            &RenderOrder::Link (i) => {
                if i > check {
                    RenderOrder::Link (i-1)
                }
                else {
                    RenderOrder::Link (i)
                }
            }
        }
    }
}

#[derive(Clone, Serialize, Deserialize, Node)]
pub struct ECB {
    pub left:   f32,
    pub right:  f32,
    pub top:    f32,
    pub bottom: f32,
}

impl Default for ECB {
    fn default() -> ECB {
        ECB {
            top:    16.0,
            left:   -4.0,
            right:  4.0,
            bottom: 0.0,
        }
    }
}

#[derive(Clone, Default, Serialize, Deserialize, Node)]
pub struct CollisionBoxLink {
    pub one:       usize,
    pub two:       usize,
    pub link_type: LinkType,
}

impl CollisionBoxLink {
    pub fn equals (&self, one: usize, two: usize) -> bool {
        self.one == one && self.two == two ||
        self.one == two && self.two == one
    }

    pub fn contains (&self, check: usize) -> bool {
        self.one == check || self.two == check
    }

    pub fn dec_greater_than(&self, check: usize) -> CollisionBoxLink {
        let mut one = self.one;
        let mut two = self.two;

        if self.one > check {
            one -= 1;
        }
        if self.two > check {
            two -= 1;
        }

        CollisionBoxLink {
            one: one,
            two: two,
            link_type: self.link_type.clone(),
        }
    }
}

#[derive(Clone, Serialize, Deserialize, Node)]
pub enum LinkType {
    MeldFirst,
    MeldSecond,
    Simple,
}

impl Default for LinkType {
    fn default() -> LinkType {
        LinkType::MeldFirst
    }
}

#[repr(u64)]
#[derive(Clone, PartialEq, Debug, ToPrimitive, FromPrimitive, EnumIter, Serialize, Deserialize, Node)]
pub enum Action {
    // Idle
    Spawn,
    ReSpawn,
    ReSpawnIdle,
    Idle,
    Crouch,
    LedgeIdle,
    Teeter,
    TeeterIdle,
    MissedTechIdle,

    // Movement
    Fall,
    AerialFall,
    Land,
    JumpSquat,
    JumpF,
    JumpB,
    JumpAerialF,
    JumpAerialB,
    TiltTurn,
    RunTurn,
    SmashTurn,
    Dash,
    Run,
    RunEnd,
    Walk,
    PassPlatform,
    Damage,
    DamageFly,
    DamageFall,
    LedgeGrab,
    LedgeJump,
    LedgeJumpSlow,
    LedgeGetup,
    LedgeGetupSlow,

    // Defense
    PowerShield,
    ShieldOn,
    Shield,
    ShieldOff,
    RollF,
    RollB,
    SpotDodge,
    AerialDodge,
    SpecialFall,
    SpecialLand,
    TechF,
    TechN,
    TechB,
    MissedTechGetupF,
    MissedTechGetupN,
    MissedTechGetupB,
    Rebound, // State after clang
    LedgeRoll,
    LedgeRollSlow,

    // Vulnerable
    ShieldBreakFall,
    ShieldBreakGetup,
    Stun,
    MissedTechStart,

    // Attacks
    Jab,
    Jab2,
    Jab3,
    Utilt,
    Dtilt,
    Ftilt,
    DashAttack,
    Usmash,
    Dsmash,
    Fsmash,
    Grab,
    DashGrab,
    LedgeAttack,
    LedgeAttackSlow,
    MissedTechAttack,

    // Aerials
    Uair,
    Dair,
    Fair,
    Bair,
    Nair,
    UairLand,
    DairLand,
    FairLand,
    BairLand,
    NairLand,

    // Taunts
    TauntUp,
    TauntDown,
    TauntLeft,
    TauntRight,

    // Crouch
    CrouchStart,
    CrouchEnd,

    Eliminated,
    DummyFramePreStart,
}

impl Default for Action {
    fn default() -> Action {
        Action::Spawn
    }
}

impl Action {
    pub fn is_air_attack(&self) -> bool {
        match self {
            &Action::Fair | &Action::Bair |
            &Action::Uair | &Action::Dair |
            &Action::Nair
              => true,
            _ => false
        }
    }

    pub fn is_attack_land(&self) -> bool {
        match self {
            &Action::FairLand | &Action::BairLand |
            &Action::UairLand | &Action::DairLand |
            &Action::NairLand
              => true,
            _ => false
        }
    }

    pub fn is_land(&self) -> bool {
        match self {
            &Action::FairLand | &Action::BairLand |
            &Action::UairLand | &Action::DairLand |
            &Action::NairLand | &Action::SpecialLand |
            &Action::Land
              => true,
            _ => false
        }
    }
}

#[derive(Clone, Serialize, Deserialize, Node)]
pub struct CollisionBox {
    pub point:  (f32, f32),
    pub radius: f32,
    pub role:   CollisionBoxRole,
}

impl CollisionBox {
    pub fn new(point: (f32, f32)) -> CollisionBox {
        CollisionBox {
            point:  point,
            radius: 1.0,
            role:   CollisionBoxRole::default()
        }
    }

    /// Warning: panics when not a hitbox
    pub fn hitbox_ref(&self) -> &HitBox {
        match &self.role {
            &CollisionBoxRole::Hit (ref hitbox) => hitbox,
            _ => panic!("Called hitbox_ref on a CollisionBox that is not a HitBox")
        }
    }
}

impl Default for CollisionBox {
    fn default() -> CollisionBox {
        CollisionBox {
            point:  (0.0, 0.0),
            radius: 3.0,
            role:   CollisionBoxRole::default()
        }
    }
}

#[derive(Clone, Serialize, Deserialize, Node)]
pub enum CollisionBoxRole {
    Hurt (HurtBox), // a target
    Hit  (HitBox),  // a launching attack
    Grab,           // a grabbing attack
    Intangible,     // cannot be interacted with rendered transparent with normal outline
    IntangibleItem, // cannot be interacted with rendered as a grey surface with no outline
    Invincible,     // cannot receive damage or knockback.
    Reflect,        // reflects projectiles
    Absorb,         // absorb projectiles
}

impl Default for CollisionBoxRole {
    fn default() -> CollisionBoxRole {
        CollisionBoxRole::Hurt ( HurtBox::default())
    }
}

#[derive(Debug, Clone, Serialize, Deserialize, Node)]
pub struct HurtBox {
    pub bkb_add:     f32,
    pub kbg_add:     f32,
    pub damage_mult: f32,
}

impl Default for HurtBox {
    fn default() -> HurtBox {
        HurtBox {
            bkb_add:     0.0,
            kbg_add:     0.0,
            damage_mult: 1.0,
        }
    }
}

#[derive(Debug, Clone, Serialize, Deserialize, Node)]
pub struct HitBox {
    pub shield_damage:      f32,
    pub damage:             f32,
    pub bkb:                f32, // base knockback
    pub kbg:                f32, // knockback growth = old value / 100
    pub angle:              f32,
    pub hitstun:            HitStun,
    pub enable_clang:       bool,
    pub enable_rebound:     bool,
    pub effect:             HitboxEffect,
    pub enable_reverse_hit: bool, // if the defender is behind the attacker the direction is reversed.
    //pub team_funnel_angle: Option<f32>, // degrees to +- towards nearest teammate
}

impl Default for HitBox {
    fn default() -> HitBox {
        HitBox {
            shield_damage:      0.0,
            damage:             6.0,
            bkb:                40.0,
            kbg:                1.0,
            angle:              45.0,
            enable_clang:       true,
            enable_rebound:     true,
            enable_reverse_hit: true,
            hitstun:            HitStun::default(),
            effect:             HitboxEffect::default(),
        }
    }
}

#[derive(Debug, Clone, Serialize, Deserialize, Node)]
pub enum HitStun {
    FramesTimesKnockback (f32),
    Frames (u64)
}

impl Default for HitStun {
    fn default() -> HitStun {
        HitStun::FramesTimesKnockback(0.5)
    }
}

#[derive(Debug, Clone, Serialize, Deserialize, Node)]
pub enum HitboxEffect {
    Fire,
    Electric,
    Sleep,
    Reverse,
    Stun,
    Freeze,
    None,
}

impl Default for HitboxEffect {
    fn default() -> HitboxEffect {
        HitboxEffect::None
    }
}