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
use std::str::FromStr;
use crate::ItrKindParseError;
/// Interaction variants.
///
/// See https://lf-empire.de/lf2-empire/data-changing/frame-elements/174-itr-interaction?showall=1
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ItrKind {
/// Hit another object's `bdy`.
Normal = 0,
/// Catch a character that is stunned / "dance of pain" (state 16).
CatchStunned = 1,
/// Picks up a light or heavy weapon.
///
/// Character switches to the `picking_light` frame (`115`) for light
/// weapons, and `picking_heavy` (`116`) for heavy weapons.
WeaponPick = 2,
/// Catch a character.
///
/// `catchingact` and `caughtact` specify the frame numbers for where the
/// catching and caught characters should switch to. They are specified
/// twice because one is for catching from the front and and the other is
/// for catching from the back.
///
/// This is used in Louis' whirlwind throw.
CatchForce = 3,
/// Interaction on a falling character that only hits if he/she was thrown.
Falling = 4,
/// Interaction on a weapon whose damage depends on `weaponact`.
///
/// The strength of a weapon can vary, so you can't note it directly in the
/// frames. The wpoint in the characters using the `attacking` tag to
/// activate an entry in the `weapon_strength_list`. The corresponding `itr`
/// values are then used for the weapon's itr.
WeaponStrength = 5,
/// Interaction that enables characters to do a super punch.
///
/// `vrest:` 1 is normally used because this should affect all characters.
SuperPunch = 6,
/// Picks up a light weapon without switching frame.
///
/// This `itr` allows a character to pick up a light weapon without going to
/// the `picking_light` frames (`115`). It's used in the "rowing"
/// frames. If you roll over a weapon and press the attack-button, you
/// pick it up.
RollWeaponPick = 7,
/// Heals a character, constrained by dark red HP.
///
/// When the healing is activated, you'll see your healthbar flash. Some
/// additional functions of `itr/kind: 8` are:
///
/// * Aligns its centerx and centery to that of any `type: 0` object it
/// touches - independant of `wait` and `next`.
/// * Reacts to both allies and enemies.
/// * Only interacts with `type: 0` objects.
/// * Doesn't have to be used with a special state like `ItrPoint`.
/// * The character that `itr/kind: 8` "sticks" to is not influenced in any
/// way (besides healing).
///
/// The `injury` tag doesn't do damage here. Instead, it sets the amount of
/// life points that the character can regenerate. Normally it is `100`,
/// because `state: 1700` and `hit_Fa: 4` heal `100` points (defined by
/// source code), but you may also use other values -- set the value to `0`
/// for no healing.
///
/// The `dvx` tag is also repurposed -- if the `itr` hits a character, the
/// object switches to the frame noted by `dvx`.
HealBall = 8,
/// John's reflective shield.
///
/// An itr with `kind: 9` permits an object to reflect/destroy any sort of
/// incoming projectiles. Additionally the itr can hit characters (type: 0
/// objects), but doing so will reduce the attacker's health to zero.
///
/// This is utilized in conjunction with `hit_a`/`hit_d` to create John's
/// shield, which will disappear if a character runs into it.
///
/// Using an `itr/kind:9` in a character (type: 0) would cause the character
/// to die instantly once he/she hits another character with the itr.
ReflectiveShield = 9,
/// Henry's Sonata of Death.
///
/// All characters and weapons are lifted up into the air.
SonataOfDeath = 10,
/// Henry's Sonata of Death.
///
/// Similar to [`ItrKind::SonataOfDeath`].
SonataOfDeath2 = 11,
/// Impassable object.
///
/// This kind doesn't do any damage, it just acts as a solid object that
/// other objects cannot pass through. It's used in heavy weapons and
/// Freeze's icicles, so you can't simply walk through these objects.
Wall = 14,
/// Freeze's whirlwind's vacuum.
///
/// Objects are sucked in like a vacuum.
WhirlwindWind = 15,
/// Freeze's whirlwind freeze.
///
/// Turns characters into ice without using the `effect` tag and lifts up
/// only weapons.
WhirlwindIce = 16,
}
impl Default for ItrKind {
fn default() -> Self {
Self::Normal
}
}
impl FromStr for ItrKind {
type Err = ItrKindParseError;
fn from_str(s: &str) -> Result<ItrKind, ItrKindParseError> {
s.parse::<u32>()
.map_err(ItrKindParseError::ParseIntError)
.and_then(|value| match value {
0 => Ok(ItrKind::Normal),
1 => Ok(ItrKind::CatchStunned),
2 => Ok(ItrKind::WeaponPick),
3 => Ok(ItrKind::CatchForce),
4 => Ok(ItrKind::Falling),
5 => Ok(ItrKind::WeaponStrength),
6 => Ok(ItrKind::SuperPunch),
7 => Ok(ItrKind::RollWeaponPick),
8 => Ok(ItrKind::HealBall),
9 => Ok(ItrKind::ReflectiveShield),
10 => Ok(ItrKind::SonataOfDeath),
11 => Ok(ItrKind::SonataOfDeath2),
14 => Ok(ItrKind::Wall),
15 => Ok(ItrKind::WhirlwindWind),
16 => Ok(ItrKind::WhirlwindIce),
value => Err(ItrKindParseError::InvalidValue(value)),
})
}
}