Skip to content

Commit

Permalink
Rework duel and add phase logic (azerothcore#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
55Honey authored Nov 26, 2022
1 parent a94a3d9 commit 30e8dd2
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 113 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ local.properties
.loadpath
.project
.cproject
.idea
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@


## What is the purpose of this module?
This module provides a way to nerf or debuff players in order to increase the difficulty of certain dungeons or balance battlegrounds.
This module provides a way to nerf or debuff players in order to increase the difficulty of certain dungeons or balance battlegrounds/duels.

## How to use this module?
This module reads data from the `zone_difficulty_info` table to apply nerfs/debuffs. For example, you can nerf healing inside the Temple of Ahn'Qiraj dungeon by 90% with the following query:
This module reads data from the `zone_difficulty_info` and `zone_difficulty_spelloverrides` table.
`_info` serves to apply nerfs/debuffs per map and per phase. For example, you can nerf healing inside the Temple of Ahn'Qiraj dungeon for all phases (0 = Skip PhaseMask check, 6 = phases 2 and 4) by 90% with the following query:

```sql
INSERT INTO `zone_difficulty_info` (`MapId`, `HealingNerfValue`, `Enabled`, `Comment`)
INSERT INTO `zone_difficulty_info` (`MapId`, `PhaseMask`, HealingNerfValue`, `Enabled`, `Comment`)
VALUES
(531, '0.10', 1, 'AQ40 Healing Nerf');
(531, 0, '0.10', 1, 'AQ40 Healing Nerf');
```

The output will be multiplied by the value you input in `HealingNerfValue` as it follows:

Using `MapId` 2147483647 will be used for all targets in duels while they're in the zone hardcoded as `DUEL_AREA` (default 2402: Forbidding Sea, Wetlands).
PhaseMask must be 0 for Duels.
```
output = output * HealingNerfValue
```
You can also prevent certain spells from being affected at all. See `zone_difficulty_spelloverrides.sql` for examples.
## Changing values
You can edit the `zone_difficulty_info_content.sql` file to apply changes. They will be applied by the autoupdater the next time you restart your server.
Expand All @@ -28,3 +34,4 @@ Alternatively, you may edit the `zone_difficulty_info` table in your `world` dat
## Authors
- [Nyeriah](https://github.com/Nyeriah)
- [Honey](https://github.com/55Honey)
4 changes: 3 additions & 1 deletion data/sql/db-world/zone_difficulty_info.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
DROP TABLE IF EXISTS `zone_difficulty_info`;
CREATE TABLE `zone_difficulty_info` (
`MapID` INT NOT NULL DEFAULT 0,
`PhaseMask` INT NOT NULL DEFAULT 0,
`HealingNerfValue` FLOAT NOT NULL DEFAULT 1,
`AbsorbNerfValue` FLOAT NOT NULL DEFAULT 1,
`MeleeDmgBuffValue` FLOAT NOT NULL DEFAULT 1,
`SpellDmgBuffValue` FLOAT NOT NULL DEFAULT 1,
`Enabled` TINYINT DEFAULT 1,
`Comment` TEXT
`Comment` TEXT,
PRIMARY KEY (`MapID`, `PhaseMask`)
);
6 changes: 3 additions & 3 deletions data/sql/db-world/zone_difficulty_info_content.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DELETE FROM `zone_difficulty_info`;
INSERT INTO `zone_difficulty_info` (`MapId`, `HealingNerfValue`, `AbsorbNerfValue`, `MeleeDmgBuffValue`, `SpellDmgBuffValue`, `Enabled`, `Comment`) VALUES
(531, '0.10', '0.10', '1.40', '1.40', 1, 'AQ40 Healing 90% / Absorb 90% Nerf / 40% physical & spell damage buff'),
(2147483647, '0.10', '0.10', '0.5', '0.5', 1, 'Duel Healing 90% / Absorb 90% Nerf / 50% physical & spell damage nerf');
INSERT INTO `zone_difficulty_info` (`MapId`, `PhaseMask`, `HealingNerfValue`, `AbsorbNerfValue`, `MeleeDmgBuffValue`, `SpellDmgBuffValue`, `Enabled`, `Comment`) VALUES
(531, 0, '0.10', '0.10', '1.40', '1.40', 1, 'AQ40 Healing 90% / Absorb 90% Nerf / 40% physical & spell damage buff'),
(2147483647, 0, '0.10', '0.10', '0.5', '0.5', 1, 'Duel Healing 90% / Absorb 90% Nerf / 50% physical & spell damage nerf');
8 changes: 4 additions & 4 deletions src/ZoneDifficulty.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ struct ZoneDifficultyData
bool Enabled;
};

const uint32 DUEL_INDEX = 0x7FFFFFFF;
const uint32 DUEL_AREA = 2402; // Forbidding Sea (Wetlands)
const int32 DUEL_INDEX = 0x7FFFFFFF;
const int32 DUEL_AREA = 2402; // Forbidding Sea (Wetlands)

class ZoneDifficulty
{
Expand All @@ -26,12 +26,12 @@ class ZoneDifficulty
void LoadMapDifficultySettings();
[[nodiscard]] bool IsValidNerfTarget(Unit* target);
[[nodiscard]] bool ShouldNerfInDuels(Unit* target);
[[nodiscard]] bool ShouldNerfAbsorb(uint32 mapId, Unit* target);
[[nodiscard]] int32 GetLowestMatchingPhase(uint32 mapId, uint32 phaseMask);

bool IsEnabled{ false };
bool IsDebugInfoEnabled{ false };

typedef std::map<uint32, ZoneDifficultyData> ZoneDifficultyDataMap;
typedef std::map<uint32, std::map<uint32, ZoneDifficultyData> > ZoneDifficultyDataMap;
ZoneDifficultyDataMap ZoneDifficultyInfo;
std::map<uint32, float> SpellNerfOverrides;

Expand Down
Loading

0 comments on commit 30e8dd2

Please sign in to comment.