| 66 | } |
| 67 | |
| 68 | Json jsonFromStatModifier(StatModifier const& modifier) { |
| 69 | if (auto baseMultiplier = modifier.ptr<StatBaseMultiplier>()) { |
| 70 | return JsonObject{{"stat", baseMultiplier->statName}, {"baseMultiplier", baseMultiplier->baseMultiplier}}; |
| 71 | } else if (auto valueModifier = modifier.ptr<StatValueModifier>()) { |
| 72 | return JsonObject{{"stat", valueModifier->statName}, {"amount", valueModifier->value}}; |
| 73 | } else if (auto effectiveMultiplier = modifier.ptr<StatEffectiveMultiplier>()) { |
| 74 | return JsonObject{{"stat", effectiveMultiplier->statName}, {"effectiveMultiplier", effectiveMultiplier->effectiveMultiplier}}; |
| 75 | } else { |
| 76 | throw JsonException("No 'baseMultiplier', 'amount', or 'effectiveMultiplier' member found in json"); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | PersistentStatusEffect jsonToPersistentStatusEffect(Json const& config) { |
| 81 | if (config.isType(Json::Type::String)) { |
no outgoing calls
no test coverage detected