add unit specific modifiers

This commit is contained in:
Martin Michelsen
2025-11-05 22:29:18 -08:00
parent 766d4e0c7a
commit 8d2ffba3e1
2 changed files with 17 additions and 6 deletions
+2 -1
View File
@@ -660,7 +660,8 @@ Some commands only work for clients not in proxy sessions. The chat commands are
* `$item ES APHEX ZALURE TWIN +200` (ES weapon must be prefixed with "ES"; name comes before special)
* `$item DF FIELD +10DEF +20EVP +4` (armor with DFP bonus, EVP bonus, and slot count)
* `$item RED MERGE +10DFP +20EVP` (shield; same as armor except without slot count)
* `$item Knight/Power++` (unit)
* `$item Knight/Power +9` (unit with specific modifier)
* `$item Knight/Power++` (unit with normal modifier; ++/-- are +4/-4 and +/- are +2/-2)
* `$item LIMITER K:1000` (sealed unit with kill count)
* `$item Tapas PB:F,G,M&Y 120% 200IQ 5/195/0/0 green` (mag with PBs, synchro, IO, stats, and color)
* `$item Trimate x10` (tool with stack size)
+15 -5
View File
@@ -674,16 +674,26 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
{"+", 0x0002},
{"++", 0x0004},
});
ret.data1w[3] = modifiers.at(desc);
bool kill_count_set = false;
for (auto& token : phosg::split(desc, ' ')) {
if (token.starts_with("k:")) {
for (const auto& token : phosg::split(desc, ' ')) {
if (token == "--") {
ret.data1w[3] = 0xFFFC;
} else if (token == "-") {
ret.data1w[3] = 0xFFFE;
} else if (token == "+") {
ret.data1w[3] = 0x0002;
} else if (token == "++") {
ret.data1w[3] = 0x0004;
} else if (token.starts_with('+')) {
ret.data1w[3] = stoul(token.substr(1), nullptr, 0);
} else if (token.starts_with('-')) {
ret.data1w[3] = static_cast<uint16_t>(stol(token, nullptr, 0));
} else if (token.starts_with("k:")) {
ret.set_kill_count(stoul(token.substr(2), nullptr, 0));
kill_count_set = true;
break;
}
}
if (this->item_parameter_table->is_unsealable_item(ret) && !kill_count_set) {
ret.set_kill_count(0);
}