Compare commits
13 Commits
3bb1616d7e
...
5531e8aa7a
Author | SHA1 | Date | |
---|---|---|---|
|
5531e8aa7a | ||
|
cd1249a5fe | ||
00692c18df | |||
46deb678df | |||
|
7d0ed36699 | ||
1d9c848525 | |||
aa28df24b3 | |||
261a2e89c9 | |||
16ed2a8cae | |||
0d2fd4b451 | |||
9438245d84 | |||
|
7f93abc07d | ||
|
a687f18918 |
@ -63,7 +63,6 @@ pub fn process_part1(input: &str) -> i32 {
|
|||||||
|
|
||||||
highest_happiness
|
highest_happiness
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_part2(input: &str) -> i32 {
|
pub fn process_part2(input: &str) -> i32 {
|
||||||
let mut happiness_table = HashMap::new();
|
let mut happiness_table = HashMap::new();
|
||||||
let mut people = Vec::new();
|
let mut people = Vec::new();
|
||||||
|
@ -36,6 +36,36 @@ pub fn process_part1(input: &str) -> u32 {
|
|||||||
if leaf.state == State::Playing {
|
if leaf.state == State::Playing {
|
||||||
//println!("try for leaf");
|
//println!("try for leaf");
|
||||||
for spell in Spell::get_all() {
|
for spell in Spell::get_all() {
|
||||||
|
match spell.name {
|
||||||
|
SpellID::MagicMissile | SpellID::Drain => {}
|
||||||
|
SpellID::Shield => {
|
||||||
|
if !leaf
|
||||||
|
.player
|
||||||
|
.status_effects
|
||||||
|
.iter()
|
||||||
|
.any(|effect| effect.name == SpellID::Shield && effect.duration > 1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SpellID::Poison => {
|
||||||
|
if !leaf
|
||||||
|
.player
|
||||||
|
.status_effects
|
||||||
|
.iter()
|
||||||
|
.any(|effect| effect.name == SpellID::Poison && effect.duration > 1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SpellID::Recharge => {
|
||||||
|
if !leaf.player.status_effects.iter().any(|effect| {
|
||||||
|
effect.name == SpellID::Recharge && effect.duration > 1
|
||||||
|
}) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
leafs.push(leaf.use_spell(spell));
|
leafs.push(leaf.use_spell(spell));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user