Skip to content

Commit 2372bed

Browse files
committed
inventory simulation for reach checks
1 parent 59db50f commit 2372bed

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

wotw_seedgen/src/common_item.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,21 @@ impl CommonItem {
6060
operator: ArithmeticOperator::Add,
6161
right: CommandInteger::Constant { value: amount },
6262
} if fetch_identifier == uber_identifier && *amount >= 0 => {
63+
let amount = *amount as usize;
6364
match *uber_identifier {
6465
uber_identifier::SPIRIT_LIGHT => {
65-
vec![CommonItem::SpiritLight(*amount as usize)]
66+
vec![CommonItem::SpiritLight(amount)]
6667
}
67-
uber_identifier::MAX_HEALTH if *amount == 5 => {
68-
vec![CommonItem::HealthFragment]
68+
uber_identifier::MAX_HEALTH => {
69+
vec![CommonItem::HealthFragment; amount / 5]
70+
}
71+
uber_identifier::GORLEK_ORE => {
72+
vec![CommonItem::GorlekOre; amount]
73+
}
74+
uber_identifier::KEYSTONES => vec![CommonItem::Keystone; amount],
75+
uber_identifier::SHARD_SLOTS => {
76+
vec![CommonItem::ShardSlot; amount]
6977
}
70-
uber_identifier::GORLEK_ORE if *amount == 1 => vec![CommonItem::GorlekOre],
71-
uber_identifier::KEYSTONES if *amount == 1 => vec![CommonItem::Keystone],
72-
uber_identifier::SHARD_SLOTS if *amount == 1 => vec![CommonItem::ShardSlot],
7378

7479
_ => vec![],
7580
}
@@ -88,7 +93,7 @@ impl CommonItem {
8893
},
8994
operator: ArithmeticOperator::Add,
9095
right: CommandFloat::Constant { value },
91-
} if *value == 0.5 => vec![CommonItem::EnergyFragment],
96+
} => vec![CommonItem::EnergyFragment; (**value * 2.) as usize],
9297
_ => vec![],
9398
},
9499
_ => vec![],

wotw_seedgen_cli/src/daemon/reach_check.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,11 @@ pub fn reach_check(
166166
.ok_or_else(|| format!("Unknown UberIdentifier {uber_identifier}"))?;
167167
match &data.default_value {
168168
UberStateValue::Boolean(_) => world.set_boolean(uber_identifier, *value > 0.5, &output),
169+
// unlike set, modify is recognized as a common item and updates the player inventory
169170
UberStateValue::Integer(_) => {
170-
world.set_integer(uber_identifier, (*value) as i32, &output)
171+
world.modify_integer(uber_identifier, (*value) as i32, &output)
171172
}
172-
UberStateValue::Float(_) => world.set_float(uber_identifier, value, &output),
173+
UberStateValue::Float(_) => world.modify_float(uber_identifier, value, &output),
173174
}
174175
}
175176

0 commit comments

Comments
 (0)