Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func s_stat* get_tower_stats(
- s_item_tower* item_tower,
- s_sarray<int, c_max_tower_upgrade_tiers>* upgrades,
- s_stat skill_tree_stats[e_stat_count],
- int upgrade_tier,
- s_lin_arena* frame_arena
- )
- {
- m_timed_function();
- s_stat* result = (s_stat*)la_get(frame_arena, sizeof(*result) * e_stat_count, false);
- s_stat* stats_from_upgrades = get_stats_from_upgrades(upgrades, frame_arena);
- s_stat* stats_from_type = get_stats_from_tower_type(item_tower->type, frame_arena);
- for(int i = 0; i < e_stat_count; i++)
- {
- result[i] = make_stat();
- result[i].base = g_stat_data[i].tower_base;
- if(stats_from_upgrades)
- {
- result[i] = result[i] + stats_from_upgrades[i];
- }
- s_stat stat_from_affix = get_item_tower_affix_stat(item_tower, (e_stat)i);
- s_stat stat_from_tree = skill_tree_stats[i];
- s_stat stat = stat_from_affix + stat_from_tree + stats_from_type[i];
- result[i].base += stat.base;
- assert(floats_equal(result[i].extra_increased, 0));
- result[i].extra_increased += stat.increased;
- result[i].more *= stat.more;
- }
- // @Note(tkap, 12/09/2022): We cannot have "increased effect of gems" on a gem. That would be a mindfuck and wouldn't work.
- s_stat stats_from_gems[e_stat_count];
- get_item_tower_gem_stats(item_tower, stats_from_gems, result[e_stat_gem_effect]);
- for(int i = 0; i < e_stat_count; i++)
- {
- result[i].base += stats_from_gems[i].base;
- result[i].extra_increased += stats_from_gems[i].increased;
- result[i].more *= stats_from_gems[i].more;
- }
- {
- float orbs_per_upgrade = calculate_stat(result[e_stat_orbs_per_upgrade]);
- result[e_stat_orb].base += (int)(orbs_per_upgrade * upgrade_tier);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement