//
//  PercentileRollOdds.hpp
//  eagle0_tests
//
//  Created by Dan Crosby on 3/25/18.
//  Copyright © 2018 none. All rights reserved.
//

#ifndef EAGLE0_SHARDOK_LIBRARY_PERCENTILE_ROLL_ODDS_HPP
#define EAGLE0_SHARDOK_LIBRARY_PERCENTILE_ROLL_ODDS_HPP

#include <span>
#include <string>
#include <vector>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
#include "src/main/protobuf/net/eagle0/shardok/storage/odds.pb.h"
#pragma GCC diagnostic pop

namespace shardok {
using PercentileRollOdds = net::eagle0::shardok::storage::Odds;
using OtherFactor = net::eagle0::shardok::storage::Odds_OtherFactor;

[[nodiscard]] double BonusFromStat(double stat);

[[nodiscard]] int16_t AverageBonusFromStats(const std::vector<double> &stats);

[[nodiscard]] OtherFactor MakeOtherFactor(int value, const std::string &id);

[[nodiscard]] PercentileRollOdds MakeOdds(
        int base = 0,
        int terr = 0,
        int weath = 0,
        int wind = 0,
        int statF = 0,
        std::span<const OtherFactor> others = {});

[[nodiscard]] PercentileRollOdds MakeOdds(
        int base,
        int terr,
        int weath,
        int wind,
        const std::vector<double> &stats,
        std::span<const OtherFactor> others = {});

[[nodiscard]] int16_t GetTotalOdds(const PercentileRollOdds &odds);

[[nodiscard]] bool PercentileRollSucceeds(const PercentileRollOdds &odds, double roll);

[[nodiscard]] int16_t GetSuccessChance(const PercentileRollOdds &odds);
}  // namespace shardok

#endif  // EAGLE0_SHARDOK_LIBRARY_PERCENTILE_ROLL_ODDS_HPP
