Skip to content

Commit 83c21fb

Browse files
Merge pull request #3 from thetrueoneshots/revert-2-master
Revert "Rebalancing"
2 parents 8b11037 + d6e22d1 commit 83c21fb

File tree

5 files changed

+23
-89
lines changed

5 files changed

+23
-89
lines changed

main.cpp

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,7 @@ class Mod : GenericMod {
177177
if (player->id == attacker->id || player->pet_id == attacker->id)
178178
{
179179
FloatRGBA purple(0.65f, 0.40f, 1.0f, 1.0f);
180-
181-
int xp_gain = 100;
182-
183-
if (player->entity_data.level > GetCreatureLevel(creature)) {
184-
xp_gain = (int)std::roundf(100 * (creature->entity_data.level + 1) * std::powf(0.8f, player->entity_data.level - GetCreatureLevel(creature)));
185-
}
186-
else {
187-
xp_gain = (int)std::roundf(100 * (creature->entity_data.level + 1) * (1 + 0.15f * (GetCreatureLevel(creature) - player->entity_data.level)) * std::powf(1.05f, GetCreatureLevel(creature) - player->entity_data.level));
188-
}
189-
180+
int xp_gain = GetCreatureLevel(creature) * (creature->entity_data.level + 1);
190181

191182
if ((creature->entity_data.appearance.flags2 & (1 << (int)cube::Creature::AppearanceModifiers::IsBoss)) != 0)
192183
{
@@ -285,13 +276,13 @@ class Mod : GenericMod {
285276

286277
// ##### PLAYER ######
287278
// Defense
288-
m_PlayerScaling.insert_or_assign(STAT_TYPE::HEALTH, 1);
289-
m_PlayerScaling.insert_or_assign(STAT_TYPE::ARMOR, 0.2);
290-
m_PlayerScaling.insert_or_assign(STAT_TYPE::RESISTANCE, 0.2);
279+
m_PlayerScaling.insert_or_assign(STAT_TYPE::HEALTH, 5);
280+
m_PlayerScaling.insert_or_assign(STAT_TYPE::ARMOR, 1);
281+
m_PlayerScaling.insert_or_assign(STAT_TYPE::RESISTANCE, 1);
291282

292283
// Offense
293-
m_PlayerScaling.insert_or_assign(STAT_TYPE::ATK_POWER, 0.2);
294-
m_PlayerScaling.insert_or_assign(STAT_TYPE::SPELL_POWER, 0.2);
284+
m_PlayerScaling.insert_or_assign(STAT_TYPE::ATK_POWER, 1);
285+
m_PlayerScaling.insert_or_assign(STAT_TYPE::SPELL_POWER, 1);
295286
m_PlayerScaling.insert_or_assign(STAT_TYPE::CRIT, 0.0001f);
296287
m_PlayerScaling.insert_or_assign(STAT_TYPE::HASTE, 0.0001f);
297288

@@ -301,13 +292,13 @@ class Mod : GenericMod {
301292

302293
// ##### CREATURE ######
303294
// Defense
304-
m_CreatureScaling.insert_or_assign(STAT_TYPE::HEALTH, 4);
305-
m_CreatureScaling.insert_or_assign(STAT_TYPE::ARMOR, 0.02f);
306-
m_CreatureScaling.insert_or_assign(STAT_TYPE::RESISTANCE, 0.02f);
295+
m_CreatureScaling.insert_or_assign(STAT_TYPE::HEALTH, 20);
296+
m_CreatureScaling.insert_or_assign(STAT_TYPE::ARMOR, 0.1f);
297+
m_CreatureScaling.insert_or_assign(STAT_TYPE::RESISTANCE, 0.1f);
307298

308299
// Offense
309-
m_CreatureScaling.insert_or_assign(STAT_TYPE::ATK_POWER, 0.2);
310-
m_CreatureScaling.insert_or_assign(STAT_TYPE::SPELL_POWER, 0.2);
300+
m_CreatureScaling.insert_or_assign(STAT_TYPE::ATK_POWER, 1);
301+
m_CreatureScaling.insert_or_assign(STAT_TYPE::SPELL_POWER, 1);
311302
m_CreatureScaling.insert_or_assign(STAT_TYPE::CRIT, 0);
312303
m_CreatureScaling.insert_or_assign(STAT_TYPE::HASTE, 0);
313304

@@ -346,20 +337,20 @@ class Mod : GenericMod {
346337
if (creature->entity_data.hostility_type != cube::Creature::EntityBehaviour::Player &&
347338
creature->entity_data.hostility_type != cube::Creature::EntityBehaviour::Pet)
348339
{
349-
*stat *= 0.2 * std::pow(2.7183, 0.2 * GetCreatureLevel(creature)) / 1.21 * std::pow(0.99, 1 + 0.07 * GetCreatureLevel(creature) * GetCreatureLevel(creature));
350-
*stat += m_CreatureScaling.at(type) * GetCreatureLevel(creature);
351-
340+
*stat /= creature->entity_data.level + 1;
341+
*stat += m_CreatureScaling.at(type) * (GetCreatureLevel(creature) - LEVELS_PER_REGION / 2);
342+
*stat *= creature->entity_data.level + 1;
352343
}
353344
}
354345

355-
356346
virtual void OnCreatureArmorCalculated(cube::Creature* creature, float* armor) override {
357347
ApplyStatBuff(creature, armor, STAT_TYPE::ARMOR);
358348
ApplyCreatureBuff(creature, armor, STAT_TYPE::ARMOR);
359349
}
360350

361351
virtual void OnCreatureCriticalCalculated(cube::Creature* creature, float* critical) override {
362352
ApplyStatBuff(creature, critical, STAT_TYPE::CRIT);
353+
ApplyCreatureBuff(creature, critical, STAT_TYPE::CRIT);
363354
}
364355

365356
virtual void OnCreatureAttackPowerCalculated(cube::Creature* creature, float* power) override {
@@ -374,6 +365,7 @@ class Mod : GenericMod {
374365

375366
virtual void OnCreatureHasteCalculated(cube::Creature* creature, float* haste) override {
376367
ApplyStatBuff(creature, haste, STAT_TYPE::HASTE);
368+
ApplyCreatureBuff(creature, haste, STAT_TYPE::HASTE);
377369
}
378370

379371
virtual void OnCreatureHPCalculated(cube::Creature* creature, float* hp) override {

src/GearScalingOverWrite.h

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,60 +24,19 @@ extern "C" float GetGearScaling(cube::Item * item, cube::Creature* creature, int
2424
float base_res = ((base * 0.5f) / (float)0x20);
2525
float mod_modifier = (mod3 / 0x10624DD3) / 7.0f;
2626

27-
float X = 1.37;
27+
float X = 2;
2828
float Y = base_res + effective_rarity + mod_modifier;
2929

3030
float result = std::powf(X, Y);
3131

3232
cube::Game* game = cube::GetGame();
3333
if (game && creature->entity_data.hostility_type == cube::Creature::EntityBehaviour::Player)
3434
{
35-
result *= 0.2 * std::pow(2.7183, 0.2 * GetItemLevel(item)) / 1.21 * std::pow(0.99, 1 + 0.07 * GetItemLevel(item) * GetItemLevel(item));
35+
result *= 1 + 0.05f * GetItemLevel(item);
3636
}
3737
return result;
3838
}
3939

40-
extern "C" float GetOtherStatsRe(cube::Item * item, cube::Creature * creature)
41-
{
42-
IntVector2 region;
43-
if (creature->entity_data.hostility_type == 0)
44-
{
45-
region = creature->entity_data.current_region;
46-
}
47-
else
48-
{
49-
region = item->region;
50-
}
51-
52-
int mod = item->modifier;
53-
54-
int mod1 = mod ^ (mod << 0x0D);
55-
int mod2 = mod1 ^ (mod1 >> 0x11);
56-
int mod3 = mod2 ^ (mod2 << 0x05);
57-
58-
int effective_rarity = item->GetEffectiveRarity(&region);
59-
float mod_modifier = (mod3 / 0x10624DD3) / 7.0f;
60-
61-
float X = 1.2;
62-
float Y = effective_rarity + mod_modifier;
63-
64-
float result = std::powf(X, Y);
65-
66-
cube::Game* game = cube::GetGame();
67-
if (game && creature->entity_data.hostility_type == cube::Creature::EntityBehaviour::Player)
68-
{
69-
result *= 0.005f + 0.0008f * GetItemLevel(item);
70-
if (result > 0.2f) {
71-
result = std::log2f(result/0.2f)*0.2f + 0.2f;
72-
}
73-
}
74-
else {
75-
result = 0.01f;
76-
}
77-
78-
return result;
79-
}
80-
8140
extern "C" float GearScaling(float x, float y, cube::Item* item)
8241
{
8342
float n = std::pow(x, y);
@@ -103,7 +62,4 @@ __attribute__((naked)) void ASM_OverwriteGearScaling() {
10362
void Setup_GearScalingOverwrite() {
10463
//WriteFarJMP(CWOffset(0x109D11), (void*)&ASM_OverwriteGearScaling);
10564
WriteFarJMP(CWOffset(0x109C50), GetGearScaling);
106-
WriteFarJMP(CWOffset(0x10A490), GetOtherStatsRe); //haste
107-
WriteFarJMP(CWOffset(0x109F30), GetOtherStatsRe); //regen
108-
WriteFarJMP(CWOffset(0x1090F0), GetOtherStatsRe); //critical
10965
}

src/XPOverwrite.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
extern "C" int XP_Overwrite(int level)
66
{
77
//return (1050 * level - 50) / (level + 19);
8-
//return 50 * std::powf(level + 1, 1.3f);
9-
return 5000 + 400*level;
8+
return 50 * std::powf(level + 1, 1.3f);
109
}
1110

1211
__attribute__((naked)) void ASM_XP_Overwrite() {

src/utility.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@ int GetItemLevel(cube::Item* item)
2727
return item->rarity;
2828
}
2929

30-
int res = 1 + LEVELS_PER_REGION * GetRegionDistance(item->region) + GetLevelVariation(item->modifier, LEVELS_PER_REGION);
31-
32-
if (res > 333) {
33-
res = 333;
34-
}
35-
36-
return res;
30+
return 1 + LEVELS_PER_REGION * GetRegionDistance(item->region) + GetLevelVariation(item->modifier, LEVELS_PER_REGION);
3731
}
3832

3933
int GetCreatureLevel(cube::Creature* creature)
@@ -64,14 +58,7 @@ int GetCreatureLevel(cube::Creature* creature)
6458
default:
6559
// Variation where packs of creatures have the same level
6660
//return (1 + 5 * distance) + GetLevelVariation(creature->entity_data.race * distance, 5);
67-
68-
int res = (1 + LEVELS_PER_REGION * distance) + GetLevelVariation(creature->id, LEVELS_PER_REGION);
69-
if (res > 333) {
70-
res = 333;
71-
}
72-
73-
74-
return res;
61+
return (1 + LEVELS_PER_REGION * distance) + GetLevelVariation(creature->id, LEVELS_PER_REGION);
7562
}
7663
}
7764

src/utility.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22
#include "cwsdk.h"
33

4-
#define LEVELS_PER_REGION 3
5-
#define LEVEL_EQUIPMENT_CAP 0
4+
#define LEVELS_PER_REGION 10
5+
#define LEVEL_EQUIPMENT_CAP 5
66

77
int GetRegionDistance(IntVector2 region);
88
int GetItemLevel(cube::Item* item);

0 commit comments

Comments
 (0)