跳到正文

剪贴板

剪贴板 rlk609pj

Hu0_gu0_4u31
原文
剪贴板信息

剪贴板信息

发布
收录
更新

c++ 版本:

C++
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <cctype>
#include <limits>

using namespace std;

// ================= 全局变量 =================
double petalhealth, reload_buff_val, summoner, luck, poison, dup, rot, T, ed, ea, dis, ph_bonus;
int udl, dl, qdl, ugl, gl, qgl, utri, tri;

// ================= 基础函数 =================
// 格式化浮点数,保留至多6位小数,并去掉末尾无用的0
string formatDouble(double val) {
    if (std::abs(val) < 1e-12) return "0";
    std::ostringstream oss;
    oss << std::fixed << std::setprecision(6) << val;
    std::string s = oss.str();
    s.erase(s.find_last_not_of('0') + 1, std::string::npos);
    if (!s.empty() && s.back() == '.') {
        s.pop_back();
    }
    return s;
}
double rnd(double x) {
    return max(x, 0.05);
}

double h(double ph) {
    return ph * (petalhealth + 0.3 * udl + 0.45 * dl + 0.6 * qdl);
}

double mh(double ph) {
    return ph * summoner;
}

double fx(double x) {
    if (x == 0) return 0;
    return 0.0003664 * (x - 13.06);
}

double r(double rel, double ph = 1) {
    double res = rnd(rel * reload_buff_val * pow(0.825, ugl) * pow(0.8, gl) * pow(0.775, qgl) * pow(1.05, udl + dl + qdl));
    res += ((int)ceil(ph / ed) / 10) * 0.04;
    res += fx(dis);
    return res;
}

double mr(double rel, double ph = 1) {
    double res = rnd(rel * reload_buff_val * pow(0.825, ugl) * pow(0.8, gl) * pow(0.775, qgl) * pow(1.05, udl + dl + qdl));
    res += (int)ceil(ph / ed) * 0.04;
    res += fx(dis);
    return res;
}

double hr(double rel, double ph = 1) {
    return mr(rel, ph);
}

double d(double pd, double ph = 1, string typ = "") {
    double res = 0;
    double m = ph;
    if (typ == "ubattery" || typ == "ulightning") return pd * 8;
    if (typ == "battery" || typ == "lightning") return pd * 9;
    if (typ == "qbattery" || typ == "qlightning") return pd * 10;
    if (typ == "ubone") {
        double pa = 7290;
        while (m > 0) {
            res += max(0.0, pd * m / ph - ea);
            m -= max(0.0, ed - pa);
            pa /= 2;
        }
        return res;
    }
    if (typ == "bone") {
        double pa = 21870;
        while (m > 0) {
            res += max(0.0, pd * m / ph - ea);
            m -= max(0.0, ed - pa);
            pa /= 2;
        }
        return res;
    }
    if (typ == "qbone") {
        double pa = 65610;
        while (m > 0) {
            res += max(0.0, pd * m / ph - ea);
            m -= max(0.0, ed - pa);
            pa /= 2;
        }
        return res;
    }
    if (typ == "uclaw") {
        while (m > 0) {
            res += max(0.0, pd * m / ph - ea + 72900);
            m -= ed;
        }
        return res;
    }
    if (typ == "claw") {
        while (m > 0) {
            res += max(0.0, pd * m / ph - ea + 218700);
            m -= ed;
        }
        return res;
    }
    if (typ == "qclaw") {
        while (m > 0) {
            res += max(0.0, pd * m / ph - ea + 656100);
            m -= ed;
        }
        return res;
    }
    if (typ == "ubgg" || typ == "bgg" || typ == "qbgg" ||
        typ == "uagg" || typ == "agg" || typ == "qagg" ||
        typ == "ustick" || typ == "stick" || typ == "qstick") {
        return max(0.0, pd - ea) * ceil(ph / ed);
    }
    if (typ == "qmjolnir") {
        while (m > 0) {
            res += max(0.0, pd * m / ph);
            m -= ed;
        }
        return res;
    }
    while (m > 0) {
        res += max(0.0, pd * m / ph - ea);
        m -= ed;
    }
    return res;
}

// ================= 字符串工具 =================
vector<string> split(const string& s) {
    vector<string> res;
    istringstream iss(s);
    string token;
    while (iss >> token) res.push_back(token);
    return res;
}

int countVec(const vector<string>& v, const string& s) {
    return (int)count(v.begin(), v.end(), s);
}

int suffixInt(const string& s, int pos) {
    return stoi(s.substr(pos));
}

string center(const string& s, int width) {
    if ((int)s.size() >= width) return s;
    int diff = width - (int)s.size();
    int left = diff / 2;
    int right = diff - left;
    return string(left, ' ') + s + string(right, ' ');
}

// ================= g 函数(用于 wheel 模式) =================
double g(double rel) {
    double angle = 138.0 / 360.0;
    double lap = floor(rel / T);
    double denom = rel - lap * T;
    if (denom == 0) {
        return nearbyint(rel / T);
    }
    double c = ceil(T * angle / denom);
    return c / (lap * c + 1);
}

// ================= cal =================
double cal(const string& petal) {
    // basic/clover/salt/talisman/yinyang
    if (petal == "ubasic" || petal == "uclover" || petal == "usalt" || petal == "utalisman" || petal == "uyinyang")
        return d(7290, h(7290)) / r(2.5, h(7290));
    if (petal == "basic" || petal == "clover" || petal == "salt" || petal == "talisman" || petal == "yinyang")
        return d(21870, h(21870)) / r(2.5, h(21870));
    if (petal == "qbasic" || petal == "qclover" || petal == "qsalt" || petal == "qtalisman" || petal == "qyinyang" || petal == "tbasic")
        return d(65610, h(65610)) / r(2.5, h(65610));

    // battery
    if (petal == "ubattery") return d(26244, h(1), "ubattery") / (r(2.5) + 0.1);
    if (petal == "battery") return d(78732, h(1), "battery") / (r(2.5) + 0.1);
    if (petal == "qbattery") return d(236196, h(1), "qbattery") / (r(2.5) + 0.1);

    // bean
    if (petal == "ubean" || petal == "ubean_0") return d(14580, h(8748)) / r(2, h(8748));
    if (petal == "ubean_1") return d(21870, h(8748)) / r(2, h(8748));
    if (petal == "bean" || petal == "bean_0") return d(43740, h(26244)) / r(2, h(26244));
    if (petal == "bean_1") return d(65610, h(26244)) / r(2, h(26244));
    if (petal == "qbean" || petal == "qbean_0") return d(131220, h(78732)) / r(2, h(78732));
    if (petal == "qbean_1") return d(196830, h(78732)) / r(2, h(78732));

    // bone
    if (petal == "ubone") return d(10206, h(7290), "ubone") / r(2.5, h(7290) + 14580);
    if (petal == "bone") return d(30618, h(21870), "bone") / r(2.5, h(21870) + 43740);
    if (petal == "qbone") return d(91854, h(65610), "qbone") / r(2.5, h(65610) + 131220);

    // broccoli
    if (petal == "ubroccoli" || petal == "ubroccoli_0")
        return d(10935, h(7290)) / r(2.8, h(7290));
    if (petal == "ubroccoli_1" || petal == "ubroccoli_2" || petal == "ubroccoli_3")
        return (d(10935, h(7290)) + suffixInt(petal, 10) * d(3645, h(2430))) / r(2.8, h(7290));
    if (petal == "broccoli" || petal == "broccoli_0")
        return d(32805, h(21870)) / r(2.8, h(21870));
    if (petal == "broccoli_1" || petal == "broccoli_2" || petal == "broccoli_3")
        return (d(32805, h(21870)) + suffixInt(petal, 9) * d(10935, h(7290))) / r(2.8, h(21870));
    if (petal == "qbroccoli" || petal == "qbroccoli_0")
        return d(98415, h(65610)) / r(2.8, h(65610));
    if (petal == "qbroccoli_1" || petal == "qbroccoli_2" || petal == "qbroccoli_3")
        return (d(98415, h(65610)) + suffixInt(petal, 10) * d(32805, h(21870))) / r(2.8, h(65610));

    // bur
    if (petal == "ubur") return d(3645, h(3645)) / r(2, h(3645));
    if (petal == "bur") return d(10935, h(10935)) / r(2, h(10935));
    if (petal == "qbur") return d(32805, h(32805)) / r(2, h(32805));

    // cactus
    if (petal == "ucactus" || petal == "ucactus_magic") return d(5103, h(10935)) / r(1, h(10935));
    if (petal == "cactus" || petal == "cactus_magic") return d(15309, h(32805)) / r(1, h(32805));
    if (petal == "qcactus" || petal == "qcactus_magic") return d(45927, h(98415)) / r(1, h(98415));

    // card
    if (petal == "ucard")
        return (d(3645, h(21870)) / r(2.5, h(21870)) +
                d(7290, h(18225)) / r(2.5, h(18225)) +
                d(10935, h(14580)) / r(2.5, h(14580)) +
                d(14580, h(10935)) / r(2.5, h(10935))) / 4;
    if (petal == "card")
        return (d(10935, h(65610)) / r(2.5, h(65610)) +
                d(21870, h(54675)) / r(2.5, h(54675)) +
                d(32805, h(43740)) / r(2.5, h(43740)) +
                d(43740, h(32805)) / r(2.5, h(32805))) / 4;
    if (petal == "qcard")
        return (d(32805, h(196830)) / r(2.5, h(196830)) +
                d(65610, h(164025)) / r(2.5, h(164025)) +
                d(98415, h(131220)) / r(2.5, h(131220)) +
                d(131220, h(98415)) / r(2.5, h(98415))) / 4;

    // carrot
    if (petal == "ucarrot_0") return d(13122.0 / 5, h(13122)) / r(1, h(13122));
    if (petal == "carrot_0") return d(39366.0 / 5, h(39366)) / r(1, h(39366));
    if (petal == "qcarrot_0") return d(118098.0 / 5, h(118098)) / r(1, h(118098));
    if (petal == "ucarrot" || petal == "ucarrot_1") return d(13122, h(13122)) / (r(1, h(13122)) + 0.5);
    if (petal == "carrot" || petal == "carrot_1") return d(39366, h(39366)) / (r(1, h(39366)) + 0.5);
    if (petal == "qcarrot" || petal == "carrot_1") return d(118098, h(118098)) / (r(1, h(118098)) + 0.5);

    // chip
    if (petal == "uchip") return d(5103, h(2187)) * 10 / r(2.5, h(2187) + pow(0.9, 10) / (1 - pow(0.9, 10)) * 0.04);
    if (petal == "chip") return d(15309, h(2187)) * 10 / (r(2.5, h(2187)) + pow(0.9, 10) / (1 - pow(0.9, 10)) * 0.04);
    if (petal == "qchip") return d(45927, h(2187)) * 10 / r(2.5, h(2187) + pow(0.9, 10) / (1 - pow(0.9, 10)) * 0.04);

    // claw
    if (petal == "uclaw_0") return d(3645, h(7290)) / r(3.5, h(7290));
    if (petal == "uclaw" || petal == "uclaw_1") return d(3645, h(7290), "uclaw") / r(3.5, h(7290));
    if (petal == "claw_0") return d(10935, h(21870)) / r(3.5, h(21870));
    if (petal == "claw" || petal == "claw_1") return d(10935, h(21870), "claw") / r(3.5, h(21870));
    if (petal == "qclaw_0") return d(32805, h(65610)) / r(3.5, h(65610));
    if (petal == "qclaw" || petal == "qclaw_1") return d(32805, h(65610), "qclaw") / r(3.5, h(65610));

    // clay
    if (petal == "uclay" || petal == "uclay_0") return d(3645, h(7290)) / r(2, h(7290));
    if (petal == "uclay_1") return d(72900, h(7290)) / r(2, h(7290));
    if (petal == "clay" || petal == "clay_0") return d(10935, h(21870)) / r(2, h(21870));
    if (petal == "clay_1") return d(218700, h(21870)) / r(2, h(21870));
    if (petal == "qclay" || petal == "qclay_0") return d(32805, h(65610)) / r(2, h(65610));
    if (petal == "qclay_1") return d(656100, h(65610)) / r(2, h(65610));

    // cog
    if (petal == "ucog") return d(13851, h(9477)) / r(2.5, h(9477));
    if (petal == "cog") return d(41553, h(28431)) / r(2.5, h(28431));
    if (petal == "qcog") return d(124659, h(85293)) / r(2.5, h(85293));

    // coin
    if (petal == "ucoin") return d(10935, h(7290)) / r(2.5, h(7290));
    if (petal == "coin") return d(32805, h(21870)) / r(2.5, h(21870));
    if (petal == "qcoin") return d(98415, h(65610)) / r(2.5, h(65610));

    // coral
    if (petal == "ucoral") return d(8019.0 * 3 / 7) / (r(1.5) + 0.08) * 7;
    if (petal == "coral") return d(24057.0 * 3 / 7) / (r(1.5) + 0.08) * 7;
    if (petal == "qcoral") return d(72171.0 * 3 / 7) / (r(1.5) + 0.08) * 7;

    // corn
    if (petal == "ucorn") return d(5832, h(145800)) / r(7, h(145800));
    if (petal == "corn") return d(17496, h(437400)) / r(7, h(437400));
    if (petal == "qcorn") return d(52488, h(1312200)) / r(7, h(1312200));

    // dandelion
    if (petal == "udandelion") return d(1944, h(1944)) / r(1, h(1944)) * (3 + dup);
    if (petal == "dandelion") return d(5832, h(5832)) / r(1, h(5832)) * (3 + dup);
    if (petal == "qdandelion") return d(17496, h(17496)) / r(1, h(17496)) * (3 + dup);

    // dice
    if (petal == "udice") return d(7290 * (2.7 + 1.36 * luck), h(7290)) / r(2.5, h(7290));
    if (petal == "dice") return d(21870 * (2.7 + 1.36 * luck), h(21870)) / r(2.5, h(21870));
    if (petal == "qdice") return d(65610 * (2.7 + 1.36 * luck), h(65610)) / r(2.5, h(65610));

    // domino
    if (petal == "udomino")
        return (d(0, h(11664)) * 7 + d(729, h(11664)) + d(729 * 2, h(11664)) + d(729 * 3, h(11664)) + d(729 * 4, h(11664)) * 2 + d(729 * 5, h(11664)) + d(729 * 6, h(11664)) * 2 + d(729 * 8, h(11664)) + d(729 * 9, h(11664)) + d(729 * 10, h(11664)) + d(729 * 12, h(11664)) * 2 + d(729 * 15, h(11664)) + d(729 * 16, h(11664)) + d(729 * 18, h(11664)) + d(729 * 20, h(11664)) + d(729 * 24, h(11664)) + d(729 * 25, h(11664)) + d(729 * 30, h(11664)) + d(729 * 36, h(11664))) / 28 / r(1.0, h(11664));
    if (petal == "domino")
        return (d(0, h(34992)) * 7 + d(2187, h(34992)) + d(2187 * 2, h(34992)) + d(2187 * 3, h(34992)) + d(2187 * 4, h(34992)) * 2 + d(2187 * 5, h(34992)) + d(2187 * 6, h(34992)) * 2 + d(2187 * 8, h(34992)) + d(2187 * 9, h(34992)) + d(2187 * 10, h(34992)) + d(2187 * 12, h(34992)) * 2 + d(2187 * 15, h(34992)) + d(2187 * 16, h(34992)) + d(2187 * 18, h(34992)) + d(2187 * 20, h(34992)) + d(2187 * 24, h(34992)) + d(2187 * 25, h(34992)) + d(2187 * 30, h(34992)) + d(2187 * 36, h(34992))) / 28 / r(1.0, h(34992));
    if (petal == "qdomino")
        return (d(0, h(104976)) * 7 + d(6561, h(104976)) + d(6561 * 2, h(104976)) + d(6561 * 3, h(104976)) + d(6561 * 4, h(104976)) * 2 + d(6561 * 5, h(104976)) + d(6561 * 6, h(104976)) * 2 + d(6561 * 8, h(104976)) + d(6561 * 9, h(104976)) + d(6561 * 10, h(104976)) + d(6561 * 12, h(104976)) * 2 + d(6561 * 15, h(104976)) + d(6561 * 16, h(104976)) + d(6561 * 18, h(104976)) + d(6561 * 20, h(104976)) + d(6561 * 24, h(104976)) + d(6561 * 25, h(104976)) + d(6561 * 30, h(104976)) + d(6561 * 36, h(104976))) / 28 / r(1.0, h(104976));

    // dust
    if (petal == "udust") return d(3159, h(1215)) / r(0.8, h(1215)) * (3 + dup);
    if (petal == "dust") return d(9477, h(3645)) / r(0.8, h(3645)) * (3 + dup);
    if (petal == "qdust") return d(28431, h(10935)) / r(0.8, h(10935)) * (3 + dup);

    // agg
    if (petal == "uagg") return d(4374, mh(182250), "uagg") / mr(60, mh(182250)) * (4 + dup);
    if (petal == "agg") return d(13122, mh(546750), "agg") / mr(60, mh(547650)) * (4 + dup);
    if (petal == "qagg") return d(39366, mh(1640250), "qagg") / mr(60, mh(1640250)) * (4 + dup);

    // bgg
    if (petal == "ubgg") return d(5103, mh(364500), "ubgg") / mr(30, mh(1093500));
    if (petal == "bgg") return d(15309, mh(1093500), "bgg") / mr(30, mh(1093500));
    if (petal == "qbgg") return d(45927, mh(3280500), "qbgg") / mr(30, mh(3280500));

    // fang
    if (petal == "ufang") return d(10935) / r(3.5);
    if (petal == "fang") return d(32805) / r(3.5);
    if (petal == "qfang") return d(98415) / r(3.5);

    // faster
    if (petal == "ufaster") return d(8748, h(3645)) / r(2.5, h(3645));
    if (petal == "faster") return d(26244, h(10935)) / r(2.5, h(10935));
    if (petal == "qfaster") return d(78732, h(32805)) / r(2.5, h(32805));

    // fragment/mjolnir
    if (petal == "ufragment") return d(364.5, h(364.5)) / r(10, h(364.5)) * 2;
    if (petal == "fragment") return d(729, h(729)) / r(10, h(729)) * 3;
    if (petal == "qmjolnir" || petal == "qmj?lnir") return d(328050, h(328050), "qmjolnir") / r(8, h(328050));

    // glass
    if (petal == "uglass") return d(16038);
    if (petal == "glass") return d(48114);
    if (petal == "qglass") return d(144342);

    // grapes
    if (petal == "ugrapes" || petal == "ugrapes_0")
        return d(2187, h(3645)) / r(1.5, h(3645)) + (18225 / 0.7) * poison;
    if (petal == "ugrapes_1" || petal == "ugrapes_2" || petal == "ugrapes_3" || petal == "ugrapes_4" || petal == "ugrapes_5" || petal == "ugrapes_6")
        return (d(2187, h(3645)) / r(1.5, h(3645) + 0.5) + (18225 / 0.7) * poison) * suffixInt(petal, 8);
    if (petal == "grapes" || petal == "grapes_0")
        return d(6561, h(10935)) / r(1.5, h(10935)) + (54675 / 0.7) * poison;
    if (petal == "grapes_1" || petal == "grapes_2" || petal == "grapes_3" || petal == "grapes_4" || petal == "grapes_5" || petal == "grapes_6")
        return (d(6561, h(10935)) / r(1.5, h(10935) + 0.5) + (54675 / 0.7) * poison) * suffixInt(petal, 7);
    if (petal == "qgrapes" || petal == "qgrapes_0")
        return d(19683, h(32805)) / r(1.5, h(32805)) + (164025 / 0.7) * poison;
    if (petal == "qgrapes_1" || petal == "qgrapes_2" || petal == "qgrapes_3" || petal == "qgrapes_4" || petal == "qgrapes_5" || petal == "qgrapes_6")
        return (d(19683, h(32805)) / r(1.5, h(32805) + 0.5) + (164025 / 0.7) * poison) * suffixInt(petal, 8);

    // heavy
    if (petal == "uheavy") return d(9477, h(109350)) / r(10, h(109350));
    if (petal == "heavy") return d(28431, h(328050)) / r(10, h(328050));
    if (petal == "qheavy") return d(85293, h(984150)) / r(10, h(984150));

    // iris
    if (petal == "uiris") return d(3645, h(3645)) / r(4, h(3645)) + 17010 * poison;
    if (petal == "iris") return d(10935, h(10935)) / r(4, h(10935)) + 51030 * poison;
    if (petal == "qiris") return d(32805, h(32805)) / r(4, h(32805)) + 153090 * poison;

    // jelly
    if (petal == "ujelly") return d(7290, h(7290)) / hr(10, h(7290));
    if (petal == "jelly") return d(21870, h(21870)) / hr(10, h(21870));
    if (petal == "qjelly") return d(65610, h(65610)) / hr(10, h(65610));

    // laser
    if (petal == "ulaser_0") return d(3645, h(7290)) / hr(5, h(7290));
    if (petal == "ulaser" || petal == "ulaser_1") return 36450;
    if (petal == "laser_0") return d(10935, h(21870)) / hr(5, h(21870));
    if (petal == "laser" || petal == "laser_1") return 109350;
    if (petal == "qlaser_0") return d(32805, h(65610)) / hr(5, h(65610));
    if (petal == "qlaser" || petal == "laser_1") return 328050;

    // leaf
    if (petal == "uleaf" || petal == "uleaf(magic)") return d(11664, h(8748)) / r(1.8, h(8748));
    if (petal == "leaf" || petal == "leaf(magic)") return d(34992, h(26244)) / r(1.8, h(26244));
    if (petal == "qleaf" || petal == "qleaf(magic)") return d(104976, h(78732)) / r(1.8, h(78732));

    // leaf(dead)
    if (petal == "udl" || petal == "uleaf(dead)")
        return d(11664, h(8748)) / r(1.8 / 1.05, h(8748 / petalhealth * (petalhealth - 0.3)));
    if (petal == "dl" || petal == "leaf(dead)")
        return d(34992, h(26244)) / r(1.8 / 1.05, h(26244 / petalhealth * (petalhealth - 0.45)));
    if (petal == "qdl" || petal == "qleaf(dead)")
        return d(104976, h(78732)) / r(1.8 / 1.05, h(78732 / petalhealth * (petalhealth - 0.6)));

    // leaf(golden)
    if (petal == "ugl" || petal == "uleaf(golden)") return d(11664, h(8748)) / r(2.5 / 0.825, h(8748));
    if (petal == "gl" || petal == "leaf(golden)") return d(34992, h(26244)) / r(2.5 / 0.8, h(26244));
    if (petal == "qgl" || petal == "qleaf(golden)") return d(104976, h(78732)) / r(2.5 / 0.775, h(78732));

    // lentil
    if (petal == "ulentil") return d(9477, h(8748)) / r(2, h(8748));
    if (petal == "lentil") return d(28431, h(26244)) / r(2, h(26244));
    if (petal == "qlentil") return d(85293, h(78732)) / r(2, h(78732));

    // light
    if (petal == "ulight") return d(1895.4, h(729)) / r(0.8, h(729)) * (5 + dup);
    if (petal == "light") return d(5686.2, h(2187)) / r(0.8, h(2187)) * (5 + dup);
    if (petal == "qlight") return d(17058.6, h(6561)) / r(0.8, h(6561)) * (5 + dup);

    // lightning
    if (petal == "ulightning") return d(8748, h(14580), "ulightning") / r(2.5);
    if (petal == "lightning") return d(26244, h(43740), "lightning") / r(2.5);
    if (petal == "qlightning") return d(78732, h(131220), "qlightning") / r(2.5);

    // missile
    if (petal == "umissile_0" || petal == "umissile(mecha)_0")
        return d(25515.0 / 5, h(1458)) / r(1.5, h(1458));
    if (petal == "umissile" || petal == "umissile_1" || petal == "umissile(mecha)" || petal == "umissile(mecha)_1")
        return d(25515, h(1458)) / (r(1.5, h(1458)) + 0.5);
    if (petal == "missile_0" || petal == "missile(mecha)_0")
        return d(76545.0 / 5, h(4374)) / r(1.5, h(4374));
    if (petal == "missile" || petal == "missile_1" || petal == "missile(mecha)" || petal == "missile(mecha)_1")
        return d(76545, h(4374)) / (r(1.5, h(4374)) + 0.5);
    if (petal == "qmissile_0" || petal == "qmissile(mecha)_0")
        return d(229635.0 / 5, h(13122)) / r(1.5, h(13122));
    if (petal == "qmissile" || petal == "qmissile_1" || petal == "qmissile(mecha)" || petal == "qmissile(mecha)_1")
        return d(229635, h(13122)) / (r(1.5, h(13122)) + 0.5);

    // orange
    if (petal == "uorange") return d(5832, h(4860)) / r(3.5, h(4860)) * (3 + dup);
    if (petal == "orange") return d(17496, h(14580)) / r(3.5, h(14580)) * (3 + dup);
    if (petal == "qorange") return d(52488, h(43740)) / r(3.5, h(43740)) * (3 + dup);

    // pearl
    if (petal == "upearl" || petal == "upearl_0") return d(14580, h(36450)) / r(4, h(36450));
    if (petal == "upearl_1") return d(14580, h(36450)) / (r(4, h(36450)) + 0.5);
    if (petal == "pearl" || petal == "pearl_0") return d(43740, h(109350)) / r(4, h(109350));
    if (petal == "pearl_1") return d(43740, h(109350)) / (r(4, h(109350)) + 0.5);
    if (petal == "qpearl" || petal == "qpearl_0") return d(131220, h(328050)) / r(4, h(328050));
    if (petal == "qpearl_1") return d(131220, h(328050)) / (r(4, h(328050)) + 0.5);

    // peas
    if (petal == "upeas" || petal == "upeas_0") return d(10935, h(3645)) / r(1.5, h(3645));
    if (petal == "upeas_1" || petal == "upeas_2" || petal == "upeas_3" || petal == "upeas_4" || petal == "upeas_5" || petal == "upeas_6")
        return d(10935, h(3645)) / (r(1.5, h(3645)) + 0.5) * suffixInt(petal, 6);
    if (petal == "peas" || petal == "peas_0") return d(32805, h(10935)) / r(1.5, h(10935));
    if (petal == "peas_1" || petal == "peas_2" || petal == "peas_3" || petal == "peas_4" || petal == "peas_5" || petal == "peas_6")
        return d(32805, h(10935)) / (r(1.5, h(10935)) + 0.5) * suffixInt(petal, 5);
    if (petal == "qpeas" || petal == "qpeas_0") return d(98415, h(32805)) / r(1.5, h(32805));
    if (petal == "qpeas_1" || petal == "qpeas_2" || petal == "qpeas_3" || petal == "qpeas_4" || petal == "qpeas_5" || petal == "qpeas_6")
        return d(98415, h(32805)) / (r(1.5, h(32805)) + 0.5) * suffixInt(petal, 6);

    // pincer
    if (petal == "upincer") return d(3645, h(3645)) / r(2.5, h(3645)) + 14580 * poison;
    if (petal == "pincer") return d(10935, h(10935)) / r(2.5, h(10935)) + 43740 * poison;
    if (petal == "qpincer") return d(32805, h(32805)) / r(2.5, h(32805)) + 131220 * poison;

    // pollen
    if (petal == "upollen_0") return d(9234, h(1215)) / r(2, h(1215)) * (3 + dup);
    if (petal == "upollen" || petal == "upollen_1") return d(9234, h(1215)) / (r(2, h(1215)) + 0.5) * (3 + dup);
    if (petal == "pollen_0") return d(27702, h(3645)) / r(2, h(3645)) * (3 + dup);
    if (petal == "pollen" || petal == "pollen_1") return d(27702, h(3645)) / (r(2, h(3645)) + 0.5) * (3 + dup);
    if (petal == "qpollen_0") return d(83106, h(10935)) / r(2, h(10935)) * (3 + dup);
    if (petal == "qpollen" || petal == "qpollen_1") return d(83106, h(10935)) / (r(2, h(10935)) + 0.5) * (3 + dup);

    // privet
    if (petal == "uprivet_ug") return (18225 / 0.7) * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "uprivet_ui") return 17010 * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "uprivet_up") return 14580 * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "uprivet_uu") return 36450 * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "privet_ug") return (18225 / 0.7) * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "privet_ui") return 17010 * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "privet_up") return 14580 * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "privet_uu") return 36450 * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "qprivet_ug") return (18225 / 0.7) * poison * 0.2 / r(4 * pow(0.7, 8));
    if (petal == "qprivet_ui") return 17010 * poison * 0.2 / r(4 * pow(0.7, 8));
    if (petal == "qprivet_up") return 14580 * poison * 0.2 / r(4 * pow(0.7, 8));
    if (petal == "qprivet_uu") return 36450 * poison * 0.2 / r(4 * pow(0.7, 8));
    if (petal == "uprivet_g") return (54675 / 0.7) * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "uprivet_i") return 51030 * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "uprivet_p") return 43740 * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "uprivet_u") return 109350 * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "privet_g") return (54675 / 0.7) * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "privet_i") return 51030 * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "privet_p") return 43740 * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "privet_u") return 109350 * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "qprivet_g") return (54675 / 0.7) * poison * 0.2 / r(4 * pow(0.7, 8));
    if (petal == "qprivet_i") return 51030 * poison * 0.2 / r(4 * pow(0.7, 8));
    if (petal == "qprivet_p") return 43740 * poison * 0.2 / r(4 * pow(0.7, 8));
    if (petal == "qprivet_u") return 109350 * poison * 0.2 / r(4 * pow(0.7, 8));
    if (petal == "uprivet_qg") return (164025 / 0.7) * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "uprivet_qi") return 153090 * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "uprivet_qp") return 131220 * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "uprivet_qu") return 328050 * poison * 0.2 / r(4 * pow(0.7, 6));
    if (petal == "privet_qg") return (164025 / 0.7) * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "privet_qi") return 153090 * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "privet_qp") return 131220 * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "privet_qu") return 328050 * poison * 0.2 / r(4 * pow(0.7, 7));
    if (petal == "qprivet_qg") return (164025 / 0.7) * poison * 0.2 / r(4 * pow(0.7, 8));
    if (petal == "qprivet_qi") return 153090 * poison * 0.2 / r(4 * pow(0.7, 8));
    if (petal == "qprivet_qp") return 131220 * poison * 0.2 / r(4 * pow(0.7, 8));
    if (petal == "qprivet_qu") return 328050 * poison * 0.2 / r(4 * pow(0.7, 8));

    // rice
    if (petal == "urice") return d(2916, h(729)) / r(0.05, h(729));
    if (petal == "rice") return d(8748, h(2187)) / r(0.05, h(2187));
    if (petal == "qrice") return d(26244, h(6561)) / r(0.05, h(6561));

    // rock
    if (petal == "urock") return d(16038, h(21870)) / r(3, h(21870));
    if (petal == "rock") return d(48114, h(65610)) / r(3, h(65610));
    if (petal == "qrock") return d(144342, h(196830)) / r(3, h(196830));

    // sand
    if (petal == "usand") return d(3645, h(911.25)) / r(1.5, h(911.25)) * (4 + dup);
    if (petal == "sand") return d(10935, h(2733.75)) / r(1.5, h(2733.75)) * (4 + dup);
    if (petal == "qsand") return d(32805, h(8201.25)) / r(1.5, h(8201.25)) * (4 + dup);

    // sawblade
    if (petal == "usawblade") return d(29160, h(18225)) / r(2.5, h(18225));
    if (petal == "sawblade") return d(87480, h(54675)) / r(2.5, h(54675));
    if (petal == "qsawblade") return d(262440, h(164025)) / r(2.5, h(164025));

    // starfish
    if (petal == "ustarfish") return d(3645, h(5103)) / r(1.5, h(5103));
    if (petal == "starfish") return d(10935, h(15309)) / r(1.5, h(15309));
    if (petal == "qstarfish") return d(32805, h(45927)) / r(1.5, h(45927));

    // stick
    if (petal == "ustick") return d(65610, mh(65610), "ustick") / 5 * 4;
    if (petal == "stick") return d(65610, mh(65610), "stick") / 5 * 4;
    if (petal == "qstick") return d(65610, mh(65610), "qstick") / 5 * 4;

    // stinger
    if (petal == "ustinger") return d(14580) / r(10) * (5 + dup);
    if (petal == "stinger") return d(43740) / r(10) * (5 + dup);
    if (petal == "qstinger") return d(131220) / r(10) * (5 + dup);

    // stinger(blood)
    if (petal == "ustinger(blood)") return d(14580) / r(7.5) * (5 + dup);
    if (petal == "stinger(blood)") return d(43740) / r(7.5) * (5 + dup);
    if (petal == "qstinger(blood)") return d(131220) / r(7.5) * (5 + dup);

    // tomato
    if (petal == "utomato_0") return d(3645, h(7290)) / r(2.5, h(7290));
    if (petal == "utomato" || petal == "utomato_1") return d(51030, h(7290)) / (r(2.5, h(7290)) + 1);
    if (petal == "tomato_0") return d(10935, h(21870)) / r(2.5, h(21870));
    if (petal == "tomato" || petal == "tomato_1") return d(153090, h(21870)) / (r(2.5, h(21870)) + 1);
    if (petal == "qtomato_0") return d(32805, h(65610)) / r(2.5, h(65610));
    if (petal == "qtomato" || petal == "qtomato_1") return d(459270, h(65610)) / (r(2.5, h(65610)) + 1);

    // triangle
    if (petal == "utriangle") return d(3645 + 2916 * (utri - 1), h(7290)) / r(2.0, h(7290));
    if (petal == "triangle") return d(10935 + 8748 * (tri - 1), h(21870)) / r(2.0, h(21870));
    if (petal == "qtriangle") return d(32805 + 26244 * tri, h(65610)) / r(2.0, h(65610));

    // uranium
    if (petal == "uuranium") return 36450 * poison;
    if (petal == "uranium") return 109350 * poison;
    if (petal == "quranium") return 328050 * poison;

    // web(electric)
    if (petal == "uweb(electric)") return 3645;
    if (petal == "web(electric)") return 10935;
    if (petal == "qweb(electric)") return 32805;

    // wing
    if (petal == "uwing") return d(14580, h(7290)) / r(3, h(7290));
    if (petal == "wing") return d(43740, h(21870)) / r(3, h(21870));
    if (petal == "qwing") return d(131220, h(65610)) / r(3, h(65610));

    // yucca
    if (petal == "uyucca") return d(3645, h(7290)) / r(2.5, h(7290));
    if (petal == "yucca") return d(10935, h(21870)) / r(2.5, h(21870));
    if (petal == "qyucca") return d(32805, h(65610)) / r(2.5, h(65610));

    return 0;
}

// ================= calw =================
double calw(const string& petal) {
    // basic/clover/salt/talisman/yinyang
    if (petal == "ubasic" || petal == "uclover" || petal == "usalt" || petal == "utalisman" || petal == "uyinyang")
        return d(7290, h(7290)) / T * g(r(2.5, h(7290)));
    if (petal == "basic" || petal == "clover" || petal == "salt" || petal == "talisman" || petal == "yinyang")
        return d(21870, h(21870)) / T * g(r(2.5, h(21870)));
    if (petal == "qbasic" || petal == "qclover" || petal == "qsalt" || petal == "qtalisman" || petal == "qyinyang" || petal == "tbasic")
        return d(65610, h(65610)) / T * g(r(2.5, h(65610)));

    // battery
    if (petal == "ubattery") return d(26244, h(1), "ubattery") / (r(2.5) + 0.1);
    if (petal == "battery") return d(78732, h(1), "battery") / (r(2.5) + 0.1);
    if (petal == "qbattery") return d(236196, h(1), "qbattery") / (r(2.5) + 0.1);

    // bean
    if (petal == "ubean" || petal == "ubean_0") return d(14580, h(8748)) / T * g(r(2, h(8748)));
    if (petal == "ubean_1") return d(21870, h(8748)) / T * g(r(2, h(8748)));
    if (petal == "bean" || petal == "bean_0") return d(43740, h(26244)) / T * g(r(2, h(26244)));
    if (petal == "bean_1") return d(65610, h(26244)) / T * g(r(2, h(26244)));
    if (petal == "qbean" || petal == "qbean_0") return d(131220, h(78732)) / T * g(r(2, h(78732)));
    if (petal == "qbean_1") return d(196830, h(78732)) / T * g(r(2, h(78732)));

    // bone
    if (petal == "ubone") return d(10206, h(7290), "ubone") / T * g(r(2.5, h(7290) + 14580));
    if (petal == "bone") return d(30618, h(21870), "bone") / T * g(r(2.5, h(21870) + 43740));
    if (petal == "qbone") return d(91854, h(65610), "qbone") / T * g(r(2.5, h(65610) + 131220));

    // broccoli
    if (petal == "ubroccoli" || petal == "ubroccoli_0")
        return d(10935, h(7290)) / T * g(r(2.8, h(7290)));
    if (petal == "ubroccoli_1" || petal == "ubroccoli_2" || petal == "ubroccoli_3")
        return (d(10935, h(7290)) + suffixInt(petal, 10) * d(3645, h(2430))) / T * g(r(2.8, h(7290)));
    if (petal == "broccoli" || petal == "broccoli_0")
        return d(32805, h(21870)) / T * g(r(2.8, h(21870)));
    if (petal == "broccoli_1" || petal == "broccoli_2" || petal == "broccoli_3")
        return (d(32805, h(21870)) + suffixInt(petal, 9) * d(10935, h(7290))) / T * g(r(2.8, h(21870)));
    if (petal == "qbroccoli" || petal == "qbroccoli_0")
        return d(98415, h(65610)) / T * g(r(2.8, h(65610)));
    if (petal == "qbroccoli_1" || petal == "qbroccoli_2" || petal == "qbroccoli_3")
        return (d(98415, h(65610)) + suffixInt(petal, 10) * d(32805, h(21870))) / T * g(r(2.8, h(65610)));

    // bur
    if (petal == "ubur") return d(3645, h(3645)) / T * g(r(2, h(3645)));
    if (petal == "bur") return d(10935, h(10935)) / T * g(r(2, h(10935)));
    if (petal == "qbur") return d(32805, h(32805)) / T * g(r(2, h(32805)));

    // cactus
    if (petal == "ucactus" || petal == "ucactus_magic") return d(5103, h(10935)) / T * g(r(1, h(10935)));
    if (petal == "cactus" || petal == "cactus_magic") return d(15309, h(32805)) / T * g(r(1, h(32805)));
    if (petal == "qcactus" || petal == "qcactus_magic") return d(45927, h(98415)) / T * g(r(1, h(98415)));

    // card
    if (petal == "ucard")
        return (d(3645, h(21870)) / r(2.5, h(21870)) +
                d(7290, h(18225)) / r(2.5, h(18225)) +
                d(10935, h(14580)) / r(2.5, h(14580)) +
                d(14580, h(10935)) / T * g(r(2.5, h(10935)))) / 4;
    if (petal == "card")
        return (d(10935, h(65610)) / r(2.5, h(65610)) +
                d(21870, h(54675)) / r(2.5, h(54675)) +
                d(32805, h(43740)) / r(2.5, h(43740)) +
                d(43740, h(32805)) / T * g(r(2.5, h(32805)))) / 4;
    if (petal == "qcard")
        return (d(32805, h(196830)) / r(2.5, h(196830)) +
                d(65610, h(164025)) / r(2.5, h(164025)) +
                d(98415, h(131220)) / r(2.5, h(131220)) +
                d(131220, h(98415)) / T * g(r(2.5, h(98415)))) / 4;

    // carrot
    if (petal == "ucarrot_0") return d(13122.0 / 5, h(13122)) / T * g(r(1, h(13122)));
    if (petal == "carrot_0") return d(39366.0 / 5, h(39366)) / T * g(r(1, h(39366)));
    if (petal == "qcarrot_0") return d(118098.0 / 5, h(118098)) / T * g(r(1, h(118098)));
    if (petal == "ucarrot" || petal == "ucarrot_1") return d(13122, h(13122)) / T * g(r(1, h(13122)) + 0.5);
    if (petal == "carrot" || petal == "carrot_1") return d(39366, h(39366)) / T * g(r(1, h(39366)) + 0.5);
    if (petal == "qcarrot" || petal == "carrot_1") return d(118098, h(118098)) / T * g(r(1, h(118098)) + 0.5);

    // chip
    if (petal == "uchip") return d(5103, h(2187)) * 10 / T * g(r(2.5, h(2187) + pow(0.9, 10) / (1 - pow(0.9, 10)) * 0.04));
    if (petal == "chip") return d(15309, h(2187)) * 10 / T * g(r(2.5, h(2187)) + pow(0.9, 10) / (1 - pow(0.9, 10)) * 0.04);
    if (petal == "qchip") return d(45927, h(2187)) * 10 / T * g(r(2.5, h(2187) + pow(0.9, 10) / (1 - pow(0.9, 10)) * 0.04));

    // claw
    if (petal == "uclaw_0") return d(3645, h(7290)) / T * g(r(3.5, h(7290)));
    if (petal == "uclaw" || petal == "uclaw_1") return d(3645, h(7290), "uclaw") / T * g(r(3.5, h(7290)));
    if (petal == "claw_0") return d(10935, h(21870)) / T * g(r(3.5, h(21870)));
    if (petal == "claw" || petal == "claw_1") return d(10935, h(21870), "claw") / T * g(r(3.5, h(21870)));
    if (petal == "qclaw_0") return d(32805, h(65610)) / T * g(r(3.5, h(65610)));
    if (petal == "qclaw" || petal == "qclaw_1") return d(32805, h(65610), "qclaw") / T * g(r(3.5, h(65610)));

    // clay
    if (petal == "uclay" || petal == "uclay_0") return d(3645, h(7290)) / T * g(r(2, h(7290)));
    if (petal == "uclay_1") return d(72900, h(7290)) / T * g(r(2, h(7290)));
    if (petal == "clay" || petal == "clay_0") return d(10935, h(21870)) / T * g(r(2, h(21870)));
    if (petal == "clay_1") return d(218700, h(21870)) / T * g(r(2, h(21870)));
    if (petal == "qclay" || petal == "qclay_0") return d(32805, h(65610)) / T * g(r(2, h(65610)));
    if (petal == "qclay_1") return d(656100, h(65610)) / T * g(r(2, h(65610)));

    // cog
    if (petal == "ucog") return d(13851, h(9477)) / T * g(r(2.5, h(9477)));
    if (petal == "cog") return d(41553, h(28431)) / T * g(r(2.5, h(28431)));
    if (petal == "qcog") return d(124659, h(85293)) / T * g(r(2.5, h(85293)));

    // coin
    if (petal == "ucoin") return d(10935, h(7290)) / T * g(r(2.5, h(7290)));
    if (petal == "coin") return d(32805, h(21870)) / T * g(r(2.5, h(21870)));
    if (petal == "qcoin") return d(98415, h(65610)) / T * g(r(2.5, h(65610)));

    // coral
    if (petal == "ucoral") return d(8019.0 * 3 / 7) / T * g(r(1.5) + 0.08) * 7;
    if (petal == "coral") return d(24057.0 * 3 / 7) / T * g(r(1.5) + 0.08) * 7;
    if (petal == "qcoral") return d(72171.0 * 3 / 7) / T * g(r(1.5) + 0.08) * 7;

    // corn
    if (petal == "ucorn") return d(5832, h(145800)) / T * g(r(7, h(145800)));
    if (petal == "corn") return d(17496, h(437400)) / T * g(r(7, h(437400)));
    if (petal == "qcorn") return d(52488, h(1312200)) / T * g(r(7, h(1312200)));

    // dandelion
    if (petal == "udandelion") return d(1944, h(1944)) / T * g(r(1, h(1944))) * (3 + dup);
    if (petal == "dandelion") return d(5832, h(5832)) / T * g(r(1, h(5832))) * (3 + dup);
    if (petal == "qdandelion") return d(17496, h(17496)) / T * g(r(1, h(17496))) * (3 + dup);

    // dice
    if (petal == "udice") return d(7290 * (2.7 + 1.36 * luck), h(7290)) / T * g(r(2.5, h(7290)));
    if (petal == "dice") return d(21870 * (2.7 + 1.36 * luck), h(21870)) / T * g(r(2.5, h(21870)));
    if (petal == "qdice") return d(65610 * (2.7 + 1.36 * luck), h(65610)) / T * g(r(2.5, h(65610)));

    // domino
    if (petal == "udomino")
        return (d(0, h(11664)) * 7 + d(729, h(11664)) + d(729 * 2, h(11664)) + d(729 * 3, h(11664)) + d(729 * 4, h(11664)) * 2 + d(729 * 5, h(11664)) + d(729 * 6, h(11664)) * 2 + d(729 * 8, h(11664)) + d(729 * 9, h(11664)) + d(729 * 10, h(11664)) + d(729 * 12, h(11664)) * 2 + d(729 * 15, h(11664)) + d(729 * 16, h(11664)) + d(729 * 18, h(11664)) + d(729 * 20, h(11664)) + d(729 * 24, h(11664)) + d(729 * 25, h(11664)) + d(729 * 30, h(11664)) + d(729 * 36, h(11664))) / T * g(r(1.0, h(11664))) / 28;
    if (petal == "domino")
        return (d(0, h(34992)) * 7 + d(2187, h(34992)) + d(2187 * 2, h(34992)) + d(2187 * 3, h(34992)) + d(2187 * 4, h(34992)) * 2 + d(2187 * 5, h(34992)) + d(2187 * 6, h(34992)) * 2 + d(2187 * 8, h(34992)) + d(2187 * 9, h(34992)) + d(2187 * 10, h(34992)) + d(2187 * 12, h(34992)) * 2 + d(2187 * 15, h(34992)) + d(2187 * 16, h(34992)) + d(2187 * 18, h(34992)) + d(2187 * 20, h(34992)) + d(2187 * 24, h(34992)) + d(2187 * 25, h(34992)) + d(2187 * 30, h(34992)) + d(2187 * 36, h(34992))) / T * g(r(1.0, h(34992))) / 28;
    if (petal == "qdomino")
        return (d(0, h(104976)) * 7 + d(6561, h(104976)) + d(6561 * 2, h(104976)) + d(6561 * 3, h(104976)) + d(6561 * 4, h(104976)) * 2 + d(6561 * 5, h(104976)) + d(6561 * 6, h(104976)) * 2 + d(6561 * 8, h(104976)) + d(6561 * 9, h(104976)) + d(6561 * 10, h(104976)) + d(6561 * 12, h(104976)) * 2 + d(6561 * 15, h(104976)) + d(6561 * 16, h(104976)) + d(6561 * 18, h(104976)) + d(6561 * 20, h(104976)) + d(6561 * 24, h(104976)) + d(6561 * 25, h(104976)) + d(6561 * 30, h(104976)) + d(6561 * 36, h(104976))) / T * g(r(1.0, h(104976))) / 28;

    // dust
    if (petal == "udust") return d(3159, h(1215)) / T * g(r(0.8, h(1215)) * (3 + dup));
    if (petal == "dust") return d(9477, h(3645)) / T * g(r(0.8, h(3645)) * (3 + dup));
    if (petal == "qdust") return d(28431, h(10935)) / T * g(r(0.8, h(10935)) * (3 + dup));

    // agg
    if (petal == "uagg") return d(4374, mh(182250), "uagg") / T * g(mr(60, mh(182250))) * (4 + dup);
    if (petal == "agg") return d(13122, mh(546750), "agg") / T * g(mr(60, mh(547650))) * (4 + dup);
    if (petal == "qagg") return d(39366, mh(1640250), "qagg") / T * g(mr(60, mh(1640250))) * (4 + dup);

    // bgg
    if (petal == "ubgg") return d(5103, mh(364500), "ubgg") / T * g(mr(30, mh(1093500)));
    if (petal == "bgg") return d(15309, mh(1093500), "bgg") / T * g(mr(30, mh(1093500)));
    if (petal == "qbgg") return d(45927, mh(3280500), "qbgg") / T * g(mr(30, mh(3280500)));

    // fang
    if (petal == "ufang") return d(10935) / T * g(r(3.5));
    if (petal == "fang") return d(32805) / T * g(r(3.5));
    if (petal == "qfang") return d(98415) / T * g(r(3.5));

    // faster
    if (petal == "ufaster") return d(8748, h(3645)) / T * g(r(2.5, h(3645)));
    if (petal == "faster") return d(26244, h(10935)) / T * g(r(2.5, h(10935)));
    if (petal == "qfaster") return d(78732, h(32805)) / T * g(r(2.5, h(32805)));

    // fragment/mjolnir
    if (petal == "ufragment") return d(364.5, h(364.5)) / T * g(r(10, h(364.5))) * 2;
    if (petal == "fragment") return d(729, h(729)) / T * g(r(10, h(729))) * 3;
    if (petal == "qmjolnir" || petal == "qmj?lnir") return d(328050, h(328050), "qmjolnir") / T * g(r(8, h(328050)));

    // glass
    if (petal == "uglass") return d(16038) / T * g(1);
    if (petal == "glass") return d(48114) / T * g(1);
    if (petal == "qglass") return d(144342) / T * g(1);

    // grapes
    if (petal == "ugrapes" || petal == "ugrapes_0")
        return d(2187, h(3645)) / T * g(r(1.5, h(3645))) + (18225 / 0.7) * poison;
    if (petal == "ugrapes_1" || petal == "ugrapes_2" || petal == "ugrapes_3" || petal == "ugrapes_4" || petal == "ugrapes_5" || petal == "ugrapes_6")
        return (d(2187, h(3645)) / T * g(r(1.5, h(3645) + 0.5)) + (18225 / 0.7) * poison) * suffixInt(petal, 8);
    if (petal == "grapes" || petal == "grapes_0")
        return d(6561, h(10935)) / T * g(r(1.5, h(10935))) + (54675 / 0.7) * poison;
    if (petal == "grapes_1" || petal == "grapes_2" || petal == "grapes_3" || petal == "grapes_4" || petal == "grapes_5" || petal == "grapes_6")
        return (d(6561, h(10935)) / T * g(r(1.5, h(10935) + 0.5)) + (54675 / 0.7) * poison) * suffixInt(petal, 7);
    if (petal == "qgrapes" || petal == "qgrapes_0")
        return d(19683, h(32805)) / T * g(r(1.5, h(32805))) + (164025 / 0.7) * poison;
    if (petal == "qgrapes_1" || petal == "qgrapes_2" || petal == "qgrapes_3" || petal == "qgrapes_4" || petal == "qgrapes_5" || petal == "qgrapes_6")
        return (d(19683, h(32805)) / T * g(r(1.5, h(32805) + 0.5)) + (164025 / 0.7) * poison) * suffixInt(petal, 8);

    // heavy
    if (petal == "uheavy") return d(9477, h(109350)) / T * g(r(10, h(109350)));
    if (petal == "heavy") return d(28431, h(328050)) / T * g(r(10, h(328050)));
    if (petal == "qheavy") return d(85293, h(984150)) / T * g(r(10, h(984150)));

    // iris
    if (petal == "uiris") return d(3645, h(3645)) / T * g(r(4, h(3645))) + 17010 * poison;
    if (petal == "iris") return d(10935, h(10935)) / T * g(r(4, h(10935))) + 51030 * poison;
    if (petal == "qiris") return d(32805, h(32805)) / T * g(r(4, h(32805))) + 153090 * poison;

    // jelly
    if (petal == "ujelly") return d(7290, h(7290)) / T * g(hr(10, h(7290)));
    if (petal == "jelly") return d(21870, h(21870)) / T * g(hr(10, h(21870)));
    if (petal == "qjelly") return d(65610, h(65610)) / T * g(hr(10, h(65610)));

    // laser
    if (petal == "ulaser_0") return d(3645, h(7290)) / T * g(hr(5, h(7290)));
    if (petal == "ulaser" || petal == "ulaser_1") return 36450;
    if (petal == "laser_0") return d(10935, h(21870)) / T * g(hr(5, h(21870)));
    if (petal == "laser" || petal == "laser_1") return 109350;
    if (petal == "qlaser_0") return d(32805, h(65610)) / T * g(hr(5, h(65610)));
    if (petal == "qlaser" || petal == "laser_1") return 328050;

    // leaf
    if (petal == "uleaf" || petal == "uleaf(magic)") return d(11664, h(8748)) / T * g(r(1.8, h(8748)));
    if (petal == "leaf" || petal == "leaf(magic)") return d(34992, h(26244)) / T * g(r(1.8, h(26244)));
    if (petal == "qleaf" || petal == "qleaf(magic)") return d(104976, h(78732)) / T * g(r(1.8, h(78732)));

    // leaf(dead)
    if (petal == "udl" || petal == "uleaf(dead)")
        return d(11664, h(8748)) / T * g(r(1.8 / 1.05, h(8748 / petalhealth * (petalhealth - 0.3))));
    if (petal == "dl" || petal == "leaf(dead)")
        return d(34992, h(26244)) / T * g(r(1.8 / 1.05, h(26244 / petalhealth * (petalhealth - 0.45))));
    if (petal == "qdl" || petal == "qleaf(dead)")
        return d(104976, h(78732)) / T * g(r(1.8 / 1.05, h(78732 / petalhealth * (petalhealth - 0.6))));

    // leaf(golden)
    if (petal == "ugl" || petal == "uleaf(golden)") return d(11664, h(8748)) / T * g(r(2.5 / 0.825, h(8748)));
    if (petal == "gl" || petal == "leaf(golden)") return d(34992, h(26244)) / T * g(r(2.5 / 0.8, h(26244)));
    if (petal == "qgl" || petal == "qleaf(golden)") return d(104976, h(78732)) / T * g(r(2.5 / 0.775, h(78732)));

    // lentil
    if (petal == "ulentil") return d(9477, h(8748)) / T * g(r(2, h(8748)));
    if (petal == "lentil") return d(28431, h(26244)) / T * g(r(2, h(26244)));
    if (petal == "qlentil") return d(85293, h(78732)) / T * g(r(2, h(78732)));

    // light
    if (petal == "ulight") return d(1895.4, h(729)) / T * g(r(0.8, h(729))) * (5 + dup);
    if (petal == "light") return d(5686.2, h(2187)) / T * g(r(0.8, h(2187))) * (5 + dup);
    if (petal == "qlight") return d(17058.6, h(6561)) / T * g(r(0.8, h(6561))) * (5 + dup);

    // lightning
    if (petal == "ulightning") return d(8748, h(14580), "ulightning") / T * g(r(2.5));
    if (petal == "lightning") return d(26244, h(43740), "lightning") / T * g(r(2.5));
    if (petal == "qlightning") return d(78732, h(131220), "qlightning") / T * g(r(2.5));

    // missile
    if (petal == "umissile_0" || petal == "umissile(mecha)_0")
        return d(25515.0 / 5, h(1458)) / T * g(r(1.5, h(1458)));
    if (petal == "umissile" || petal == "umissile_1" || petal == "umissile(mecha)" || petal == "umissile(mecha)_1")
        return d(25515, h(1458)) / T * g(r(1.5, h(1458)) + 0.5);
    if (petal == "missile_0" || petal == "missile(mecha)_0")
        return d(76545.0 / 5, h(4374)) / T * g(r(1.5, h(4374)));
    if (petal == "missile" || petal == "missile_1" || petal == "missile(mecha)" || petal == "missile(mecha)_1")
        return d(76545, h(4374)) / T * g(r(1.5, h(4374)) + 0.5);
    if (petal == "qmissile_0" || petal == "qmissile(mecha)_0")
        return d(229635.0 / 5, h(13122)) / T * g(r(1.5, h(13122)));
    if (petal == "qmissile" || petal == "qmissile_1" || petal == "qmissile(mecha)" || petal == "qmissile(mecha)_1")
        return d(229635, h(13122)) / T * g(r(1.5, h(13122)) + 0.5);

    // orange
    if (petal == "uorange") return d(5832, h(4860)) / T * g(r(3.5, h(4860))) * (3 + dup);
    if (petal == "orange") return d(17496, h(14580)) / T * g(r(3.5, h(14580))) * (3 + dup);
    if (petal == "qorange") return d(52488, h(43740)) / T * g(r(3.5, h(43740))) * (3 + dup);

    // pearl
    if (petal == "upearl" || petal == "upearl_0") return d(14580, h(36450)) / T * g(r(4, h(36450)));
    if (petal == "upearl_1") return d(14580, h(36450)) / T * g(r(4, h(36450)) + 0.5);
    if (petal == "pearl" || petal == "pearl_0") return d(43740, h(109350)) / T * g(r(4, h(109350)));
    if (petal == "pearl_1") return d(43740, h(109350)) / T * g(r(4, h(109350)) + 0.5);
    if (petal == "qpearl" || petal == "qpearl_0") return d(131220, h(328050)) / T * g(r(4, h(328050)));
    if (petal == "qpearl_1") return d(131220, h(328050)) / T * g(r(4, h(328050)) + 0.5);

    // peas
    if (petal == "upeas" || petal == "upeas_0") return d(10935, h(3645)) / T * g(r(1.5, h(3645)));
    if (petal == "upeas_1" || petal == "upeas_2" || petal == "upeas_3" || petal == "upeas_4" || petal == "upeas_5" || petal == "upeas_6")
        return d(10935, h(3645)) / T * g(r(1.5, h(3645)) + 0.5) * suffixInt(petal, 6);
    if (petal == "peas" || petal == "peas_0") return d(32805, h(10935)) / T * g(r(1.5, h(10935)));
    if (petal == "peas_1" || petal == "peas_2" || petal == "peas_3" || petal == "peas_4" || petal == "peas_5" || petal == "peas_6")
        return d(32805, h(10935)) / T * g(r(1.5, h(10935)) + 0.5) * suffixInt(petal, 5);
    if (petal == "qpeas" || petal == "qpeas_0") return d(98415, h(32805)) / T * g(r(1.5, h(32805)));
    if (petal == "qpeas_1" || petal == "qpeas_2" || petal == "qpeas_3" || petal == "qpeas_4" || petal == "qpeas_5" || petal == "qpeas_6")
        return d(98415, h(32805)) / T * g(r(1.5, h(32805)) + 0.5) * suffixInt(petal, 6);

    // pincer
    if (petal == "upincer") return d(3645, h(3645)) / T * g(r(2.5, h(3645))) + 14580 * poison;
    if (petal == "pincer") return d(10935, h(10935)) / T * g(r(2.5, h(10935))) + 43740 * poison;
    if (petal == "qpincer") return d(32805, h(32805)) / T * g(r(2.5, h(32805))) + 131220 * poison;

    // pollen
    if (petal == "upollen_0") return d(9234, h(1215)) / T * g(r(2, h(1215))) * (3 + dup);
    if (petal == "upollen" || petal == "upollen_1") return d(9234, h(1215)) / T * g(r(2, h(1215)) + 0.5) * (3 + dup);
    if (petal == "pollen_0") return d(27702, h(3645)) / T * g(r(2, h(3645))) * (3 + dup);
    if (petal == "pollen" || petal == "pollen_1") return d(27702, h(3645)) / T * g(r(2, h(3645)) + 0.5) * (3 + dup);
    if (petal == "qpollen_0") return d(83106, h(10935)) / T * g(r(2, h(10935))) * (3 + dup);
    if (petal == "qpollen" || petal == "qpollen_1") return d(83106, h(10935)) / T * g(r(2, h(10935)) + 0.5) * (3 + dup);

    // privet
    if (petal == "uprivet_ug") return (18225 / 0.7) * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "uprivet_ui") return 17010 * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "uprivet_up") return 14580 * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "uprivet_uu") return 36450 * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "privet_ug") return (18225 / 0.7) * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "privet_ui") return 17010 * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "privet_up") return 14580 * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "privet_uu") return 36450 * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "qprivet_ug") return (18225 / 0.7) * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));
    if (petal == "qprivet_ui") return 17010 * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));
    if (petal == "qprivet_up") return 14580 * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));
    if (petal == "qprivet_uu") return 36450 * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));
    if (petal == "uprivet_g") return (54675 / 0.7) * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "uprivet_i") return 51030 * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "uprivet_p") return 43740 * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "uprivet_u") return 109350 * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "privet_g") return (54675 / 0.7) * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "privet_i") return 51030 * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "privet_p") return 43740 * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "privet_u") return 109350 * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "qprivet_g") return (54675 / 0.7) * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));
    if (petal == "qprivet_i") return 51030 * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));
    if (petal == "qprivet_p") return 43740 * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));
    if (petal == "qprivet_u") return 109350 * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));
    if (petal == "uprivet_qg") return (164025 / 0.7) * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "uprivet_qi") return 153090 * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "uprivet_qp") return 131220 * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "uprivet_qu") return 328050 * poison * 0.2 / T * g(r(4 * pow(0.7, 6)));
    if (petal == "privet_qg") return (164025 / 0.7) * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "privet_qi") return 153090 * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "privet_qp") return 131220 * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "privet_qu") return 328050 * poison * 0.2 / T * g(r(4 * pow(0.7, 7)));
    if (petal == "qprivet_qg") return (164025 / 0.7) * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));
    if (petal == "qprivet_qi") return 153090 * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));
    if (petal == "qprivet_qp") return 131220 * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));
    if (petal == "qprivet_qu") return 328050 * poison * 0.2 / T * g(r(4 * pow(0.7, 8)));

    // rice
    if (petal == "urice") return d(2916, h(729)) / T * g(r(0.05, h(729)));
    if (petal == "rice") return d(8748, h(2187)) / T * g(r(0.05, h(2187)));
    if (petal == "qrice") return d(26244, h(6561)) / T * g(r(0.05, h(6561)));

    // rock
    if (petal == "urock") return d(16038, h(21870)) / T * g(r(3, h(21870)));
    if (petal == "rock") return d(48114, h(65610)) / T * g(r(3, h(65610)));
    if (petal == "qrock") return d(144342, h(196830)) / T * g(r(3, h(196830)));

    // sand
    if (petal == "usand") return d(3645, h(911.25)) / T * g(r(1.5, h(911.25))) * (4 + dup);
    if (petal == "sand") return d(10935, h(2733.75)) / T * g(r(1.5, h(2733.75))) * (4 + dup);
    if (petal == "qsand") return d(32805, h(8201.25)) / T * g(r(1.5, h(8201.25))) * (4 + dup);

    // sawblade
    if (petal == "usawblade") return d(29160, h(18225)) / T * g(r(2.5, h(18225)));
    if (petal == "sawblade") return d(87480, h(54675)) / T * g(r(2.5, h(54675)));
    if (petal == "qsawblade") return d(262440, h(164025)) / T * g(r(2.5, h(164025)));

    // starfish
    if (petal == "ustarfish") return d(3645, h(5103)) / T * g(r(1.5, h(5103)));
    if (petal == "starfish") return d(10935, h(15309)) / T * g(r(1.5, h(15309)));
    if (petal == "qstarfish") return d(32805, h(45927)) / T * g(r(1.5, h(45927)));

    // stick
    if (petal == "ustick") return d(65610, mh(65610), "ustick") / 5 * 4;
    if (petal == "stick") return d(65610, mh(65610), "stick") / 5 * 4;
    if (petal == "qstick") return d(65610, mh(65610), "qstick") / 5 * 4;

    // stinger
    if (petal == "ustinger") return d(14580) / T * g(r(10)) * (5 + dup);
    if (petal == "stinger") return d(43740) / T * g(r(10)) * (5 + dup);
    if (petal == "qstinger") return d(131220) / T * g(r(10)) * (5 + dup);

    // stinger(blood)
    if (petal == "ustinger(blood)") return d(14580) / T * g(r(7.5)) * (5 + dup);
    if (petal == "stinger(blood)") return d(43740) / T * g(r(7.5)) * (5 + dup);
    if (petal == "qstinger(blood)") return d(131220) / T * g(r(7.5)) * (5 + dup);

    // tomato
    if (petal == "utomato_0") return d(3645, h(7290)) / T * g(r(2.5, h(7290)));
    if (petal == "utomato" || petal == "utomato_1") return d(51030, h(7290)) / T * g(r(2.5, h(7290)) + 1);
    if (petal == "tomato_0") return d(10935, h(21870)) / T * g(r(2.5, h(21870)));
    if (petal == "tomato" || petal == "tomato_1") return d(153090, h(21870)) / T * g(r(2.5, h(21870)) + 1);
    if (petal == "qtomato_0") return d(32805, h(65610)) / T * g(r(2.5, h(65610)));
    if (petal == "qtomato" || petal == "qtomato_1") return d(459270, h(65610)) / T * g(r(2.5, h(65610)) + 1);

    // triangle
    if (petal == "utriangle") return d(3645 + 2916 * (utri - 1), h(7290)) / T * g(r(2.0, h(7290)));
    if (petal == "triangle") return d(10935 + 8748 * (tri - 1), h(21870)) / T * g(r(2.0, h(21870)));
    if (petal == "qtriangle") return d(32805 + 26244 * tri, h(65610)) / T * g(r(2.0, h(65610)));

    // uranium
    if (petal == "uuranium") return 36450 * poison;
    if (petal == "uranium") return 109350 * poison;
    if (petal == "quranium") return 328050 * poison;

    // web(electric)
    if (petal == "uweb(electric)") return 3645;
    if (petal == "web(electric)") return 10935;
    if (petal == "qweb(electric)") return 32805;

    // wing
    if (petal == "uwing") return d(14580, h(7290)) / T * g(r(3, h(7290)));
    if (petal == "wing") return d(43740, h(21870)) / T * g(r(3, h(21870)));
    if (petal == "qwing") return d(131220, h(65610)) / T * g(r(3, h(65610)));

    // yucca
    if (petal == "uyucca") return d(3645, h(7290)) / T * g(r(2.5, h(7290)));
    if (petal == "yucca") return d(10935, h(21870)) / T * g(r(2.5, h(21870)));
    if (petal == "qyucca") return d(32805, h(65610)) / T * g(r(2.5, h(65610)));

    return 0;
}

// ================= 天赋表 =================
map<string, double> ph_buff = {
    {"-", 1}, {"C", 1.15}, {"Un", pow(1.15, 2)}, {"R", pow(1.15, 3)},
    {"E", pow(1.15, 4)}, {"L", pow(1.15, 5)}, {"M", pow(1.15, 6)},
    {"U", pow(1.15, 7)}, {"S", pow(1.15, 8)}, {"Et", pow(1.15, 10)}
};
map<string, double> reload_buff_map = {
    {"-", 1}, {"C", 0.9}, {"Un", pow(0.9, 2)}, {"R", pow(0.9, 3)},
    {"E", pow(0.9, 4)}, {"L", pow(0.9, 4) * 0.8},
    {"M", pow(0.9, 4) * pow(0.8, 2)}, {"U", pow(0.9, 4) * pow(0.8, 3)},
    {"S", pow(0.9, 4) * pow(0.8, 4)}, {"Et", pow(0.9, 4) * pow(0.8, 4) * 0.7}
};
map<string, double> summoner_buff = {
    {"-", 1}, {"C", 1.15}, {"Un", pow(1.15, 2)}, {"R", pow(1.15, 3)},
    {"E", pow(1.15, 4)}, {"L", pow(1.15, 5)}, {"M", pow(1.15, 6)},
    {"U", pow(1.15, 7)}, {"S", pow(1.15, 8)}, {"Et", pow(1.15, 10)}
};
map<string, double> luck_buff = {
    {"-", 0}, {"C", 0.1}, {"Un", 0.25}, {"R", 0.45}, {"E", 0.7},
    {"L", 1}, {"M", 1.35}, {"U", 1.75}, {"S", 2.2}, {"Et", 2.7}
};
map<string, double> poison_buff = {
    {"-", 1}, {"1", 1.0625}, {"2", 1.125}, {"3", 1.1875}, {"4", 1.25},
    {"5", 1.3125}, {"6", 1.375}, {"7", 1.4375}, {"8", 1.5}, {"9", 1.5625}
};
map<string, double> cpoison_buff = {
    {"-", 1}, {"+", 1.2}
};
map<string, double> dup_buff = {
    {"-", 0}, {"L", 1}, {"U", 2}, {"S", 3}, {"Et", 3}
};
map<string, double> rot_buff = {
    {"-", 0}, {"C", 0.6}, {"Un", 1.2}, {"R", 1.8}, {"E", 2.4}, {"L", 3}
};

// ================= analyze =================
void analyze(string buildStr, string talentStr, double x = 21870.0, double y = 583.2,
             string mode = "lentil", double lentildis = 0.0, double rotspeed = 1.0) {
    vector<string> build = split(buildStr);

    // 展开数字前缀
    bool changed = true;
    while (changed) {
        changed = false;
        for (size_t i = 0; i < build.size(); ++i) {
            if (!build[i].empty() && isdigit((unsigned char)build[i][0])) {
                changed = true;
                string petal = build[i];
                string timesStr;
                size_t j = 0;
                while (j < petal.size() && isdigit((unsigned char)petal[j])) {
                    timesStr += petal[j];
                    ++j;
                }
                int times = stoi(timesStr);
                string base = petal.substr(j);
                build.erase(build.begin() + i);
                for (int k = 0; k < times; ++k) {
                    build.insert(build.begin() + i, base);
                }
                break;
            }
        }
    }

    vector<string> talent = split(talentStr);

    petalhealth = ph_buff[talent[0]];
    reload_buff_val = reload_buff_map[talent[1]];
    summoner = summoner_buff[talent[2]];
    luck = luck_buff[talent[3]];
    poison = poison_buff[talent[4]] * cpoison_buff[talent[5]];
    dup = dup_buff[talent[6]];
    rot = 2.5;
    if (dup == 3) {
        build.insert(build.begin(), build[0]);
        dup = 2;
    }
    if (talent.size() >= 8) {
        rot += rot_buff[talent[7]];
    }

    ed = x;
    ea = y;
    dis = lentildis;

    ea -= (countVec(build, "ubur") + countVec(build, "ubur(yy)")) * 1093.5;
    ea -= (countVec(build, "bur") + countVec(build, "bur(yy)")) * 3280.5;
    ea -= (countVec(build, "qbur") + countVec(build, "qbur(yy)")) * 9841.5;

    luck += (countVec(build, "uclover") + countVec(build, "uclover_")) * 0.7;
    luck += (countVec(build, "clover") + countVec(build, "clover_")) * 0.8;
    luck += (countVec(build, "qclover") + countVec(build, "qclover_")) * 0.9;

    rot += (countVec(build, "ufaster") + countVec(build, "ufaster_")) * 1.7;
    rot += (countVec(build, "faster") + countVec(build, "faster_")) * 1.9;
    rot += (countVec(build, "qfaster") + countVec(build, "qfaster_")) * 2.1;
    rot *= 0.3 + rotspeed * 0.7;
    T = 2 * std::acos(-1.0) / rot;

    udl = countVec(build, "udl") + countVec(build, "udl_");
    dl = countVec(build, "dl") + countVec(build, "dl_");
    qdl = countVec(build, "qdl") + countVec(build, "qdl_");
    ugl = countVec(build, "ugl") + countVec(build, "ugl_");
    gl = countVec(build, "gl") + countVec(build, "gl_");
    qgl = countVec(build, "qgl") + countVec(build, "qgl_");

    ph_bonus = petalhealth + udl * 0.3 + dl * 0.45 + qdl * 0.6;

    utri = countVec(build, "utriangle") + countVec(build, "utriangle_");
    tri = countVec(build, "triangle") + countVec(build, "triangle_");

    vector<long long> dps;
    if (mode == "lentil" || mode == "yy") {
        for (const auto& petal : build) {
            dps.push_back((long long)nearbyint(cal(petal)));
        }
    } else if (mode == "wheel") {
        for (const auto& petal : build) {
            dps.push_back((long long)nearbyint(calw(petal)));
        }
    }

    long long sumDps = 0;
    for (auto v : dps) sumDps += v;

    int maxn = (int)to_string(sumDps).size();
    for (const auto& petal : build) {
        maxn = max(maxn, (int)petal.size());
    }

    cout << "==============================\n";
    if (mode == "wheel") {
        cout << "Rotation Speed: " << formatDouble(rot / (0.3 + 0.7 * rotspeed)) 
             << "*(0.3+0.7*" << formatDouble(rotspeed) << ")=" << formatDouble(rot) << "\n";
        cout << "Period(T): " << formatDouble(2 * std::acos(-1.0) / rot) << "s\n";
    }
    cout << setprecision(6); // 保留原有的设置以防影响后续输出
    cout << "Build: ";
    for (const auto& petal : build) {
        cout << center(petal, maxn) << "|";
    }
    cout << "|" << center("TOTAL", maxn) << "\n";
    cout << "  DPS: ";
    for (auto v : dps) {
        cout << center(to_string(v), maxn) << "|";
    }
    cout << "|" << center(to_string(sumDps), maxn) << "\n";
}

// ================= 主函数 =================
int main() {
    // 示例调用(与 Python 代码保持一致)
    analyze("faster 9triangle", "Et U - - - - - L", 7290, 583.2, "wheel", 0.0, 1);
    analyze("2chip bur(yy) 6ugl_ unazar", "- Et - - - - S", 21870, 583.2, "yy");
    analyze("2ugl_ 4dust bur 2ulentil", "- Et - - - - S", 21870, 583.2, "lentil");
    analyze("2ugl_ 4dust bur 2ulentil", "- Et - - - - S", 21870, 583.2, "lentil", 112);

    cout << "\n\n\n请关注原作者:Hu0_gu0_4u31(florr Huo_guo_tu31)\n\n\n";

    while (true) {
        string build1, talent1, xStr, yStr, mode1;
        cout << "输入构筑(例:2ugl_ 4dust bur 2ulentil):";
        if (!getline(cin, build1)) break;
        cout << "输入天赋(例:M Et - - - - S,表示mph treload sdup):";
        getline(cin, talent1);
        cout << "输入生物体伤(例:21870):";
        getline(cin, xStr);
        cout << "输入生物护甲(例:583.2):";
        getline(cin, yStr);
        cout << "输入模式(lentil/wheel/yy):";
        getline(cin, mode1);

        double x1 = stod(xStr);
        double y1 = stod(yStr);

        if (mode1 == "lentil" || mode1 == "yy") {
            string disStr;
            cout << "输入lentil距离(例:112,不计算距离衰减则写0)";
            getline(cin, disStr);
            double lentildis1 = stod(disStr);
            cout << "analyze(\"" << build1 << "\", \"" << talent1 << "\", " 
                 << formatDouble(x1) << ", " << formatDouble(y1) << ", " 
                 << mode1 << ", lentildis=" << formatDouble(lentildis1) << ")\n";
            analyze(build1, talent1, x1, y1, mode1, lentildis1);
        } else {
            string speedStr;
            cout << "输入转速指令值(例:0.95,满转速则写1)";
            getline(cin, speedStr);
            double rotspeed1 = stod(speedStr);
            cout << "analyze(\"" << build1 << "\", \"" << talent1 << "\", " 
                 << formatDouble(x1) << ", " << formatDouble(y1) << ", " 
                 << mode1 << ", rotspeed=" << formatDouble(rotspeed1) << ")\n";
            analyze(build1, talent1, x1, y1, mode1, 0.0, rotspeed1);
        }
    }

    return 0;
}