Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine rune effects from active bard songs. #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions zone/attack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6617,22 +6617,26 @@ int32 Mob::RuneAbsorb(int64 damage, uint16 type)
uint32 buff_max = GetMaxTotalSlots();
if (type == SE_Rune) {
for (uint32 slot = 0; slot < buff_max; slot++) {
if (slot == spellbonuses.MeleeRune[SBIndex::RUNE_BUFFSLOT] && spellbonuses.MeleeRune[SBIndex::RUNE_AMOUNT] && buffs[slot].melee_rune && IsValidSpell(buffs[slot].spellid)) {
bool active_rune = slot == spellbonuses.MeleeRune[SBIndex::RUNE_BUFFSLOT] && spellbonuses.MeleeRune[SBIndex::RUNE_AMOUNT];
bool bard_rune = IsBardSong(buffs[slot].spellid);

if ((active_rune || bard_rune) && buffs[slot].melee_rune && IsValidSpell(buffs[slot].spellid)) {
int melee_rune_left = buffs[slot].melee_rune;
LogCombat("Melee Rune - Slot [{}] SpellID [{}] Remaining [{}] Damage [{}]", slot, buffs[slot].spellid, melee_rune_left, damage);

if (melee_rune_left > damage)
{
melee_rune_left -= damage;
buffs[slot].melee_rune = melee_rune_left;

return -6;
}

else
{
if (melee_rune_left > 0)
damage -= melee_rune_left;

if (!TryFadeEffect(slot) && !IsBardSong(buffs[slot].spellid))
if (!bard_rune && !TryFadeEffect(slot))
BuffFadeBySlot(slot);
}
}
Expand All @@ -6641,21 +6645,26 @@ int32 Mob::RuneAbsorb(int64 damage, uint16 type)

else {
for (uint32 slot = 0; slot < buff_max; slot++) {
if (slot == spellbonuses.AbsorbMagicAtt[SBIndex::RUNE_BUFFSLOT] && spellbonuses.AbsorbMagicAtt[SBIndex::RUNE_AMOUNT] && buffs[slot].magic_rune && IsValidSpell(buffs[slot].spellid)) {
bool active_rune = slot == spellbonuses.AbsorbMagicAtt[SBIndex::RUNE_BUFFSLOT] && spellbonuses.AbsorbMagicAtt[SBIndex::RUNE_AMOUNT];
bool bard_rune = IsBardSong(buffs[slot].spellid);

if ((active_rune || bard_rune) && buffs[slot].magic_rune && IsValidSpell(buffs[slot].spellid)) {
int magic_rune_left = buffs[slot].magic_rune;
LogCombat("Magic Rune - Slot [{}] SpellID [{}] Remaining [{}] Damage [{}]", slot, buffs[slot].spellid, magic_rune_left, damage);

if (magic_rune_left > damage)
{
magic_rune_left -= damage;
buffs[slot].magic_rune = magic_rune_left;

return 0;
}

else
{
if (magic_rune_left > 0)
damage -= magic_rune_left;

if (!TryFadeEffect(slot) && !IsBardSong(buffs[slot].spellid))
if (!bard_rune && !TryFadeEffect(slot))
BuffFadeBySlot(slot);
}
}
Expand Down
9 changes: 6 additions & 3 deletions zone/bonuses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3720,27 +3720,30 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne
break;

case SE_Rune:

if (new_bonus->MeleeRune[SBIndex::RUNE_AMOUNT] && (new_bonus->MeleeRune[SBIndex::RUNE_BUFFSLOT] > buffslot)){
if (new_bonus->MeleeRune[SBIndex::RUNE_AMOUNT] && (new_bonus->MeleeRune[SBIndex::RUNE_BUFFSLOT] > buffslot || IsBardSong(new_bonus->MeleeRune[SBIndex::RUNE_SPELLID]))){

new_bonus->MeleeRune[SBIndex::RUNE_AMOUNT] = effect_value;
new_bonus->MeleeRune[SBIndex::RUNE_BUFFSLOT] = buffslot;
new_bonus->MeleeRune[SBIndex::RUNE_SPELLID] = spell_id;
}
else if (!new_bonus->MeleeRune[SBIndex::RUNE_AMOUNT]){
new_bonus->MeleeRune[SBIndex::RUNE_AMOUNT] = effect_value;
new_bonus->MeleeRune[SBIndex::RUNE_BUFFSLOT] = buffslot;
new_bonus->MeleeRune[SBIndex::RUNE_SPELLID] = spell_id;
}

break;

case SE_AbsorbMagicAtt:
if (new_bonus->AbsorbMagicAtt[SBIndex::RUNE_AMOUNT] && (new_bonus->AbsorbMagicAtt[SBIndex::RUNE_BUFFSLOT] > buffslot)){
if (new_bonus->AbsorbMagicAtt[SBIndex::RUNE_AMOUNT] && (new_bonus->AbsorbMagicAtt[SBIndex::RUNE_BUFFSLOT] > buffslot || IsBardSong(new_bonus->AbsorbMagicAtt[SBIndex::RUNE_SPELLID]))){
new_bonus->AbsorbMagicAtt[SBIndex::RUNE_AMOUNT] = effect_value;
new_bonus->AbsorbMagicAtt[SBIndex::RUNE_BUFFSLOT] = buffslot;
new_bonus->AbsorbMagicAtt[SBIndex::RUNE_SPELLID] = spell_id;
}
else if (!new_bonus->AbsorbMagicAtt[SBIndex::RUNE_AMOUNT]){
new_bonus->AbsorbMagicAtt[SBIndex::RUNE_AMOUNT] = effect_value;
new_bonus->AbsorbMagicAtt[SBIndex::RUNE_BUFFSLOT] = buffslot;
new_bonus->AbsorbMagicAtt[SBIndex::RUNE_SPELLID] = spell_id;
}
break;

Expand Down
5 changes: 3 additions & 2 deletions zone/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ struct StatBonuses {
int32 ImprovedTaunt[3]; // 0 = Max Level 1 = Aggro modifier 2 = buff slot
int8 Root[2]; // The lowest buff slot a root can be found. [0] = Bool if has root [1] = buff slot
int32 FrenziedDevastation; // base1= AArank(used) base2= chance increase spell criticals + all DD spells 2x mana.
uint32 AbsorbMagicAtt[2]; // 0 = magic rune value 1 = buff slot
uint32 MeleeRune[2]; // 0 = rune value 1 = buff slot
uint32 AbsorbMagicAtt[3]; // 0 = magic rune value 1 = buff slot 2 = spell id
uint32 MeleeRune[3]; // 0 = rune value 1 = buff slot 2 = spell id
bool NegateIfCombat; // Bool Drop buff if cast or melee
int8 Screech; // -1 = Will be blocked if another Screech is +(1)
int32 AlterNPCLevel; // amount of lvls +/-
Expand Down Expand Up @@ -627,6 +627,7 @@ namespace SBIndex {
constexpr uint16 ROOT_BUFFSLOT = 1; // SPA 99
constexpr uint16 RUNE_AMOUNT = 0; // SPA 55
constexpr uint16 RUNE_BUFFSLOT = 1; // SPA 78
constexpr uint16 RUNE_SPELLID = 2; // SPA 55,78
constexpr uint16 POSITION_BACK = 0; // SPA 503-506
constexpr uint16 POSITION_FRONT = 1; // SPA 503-506
constexpr uint16 PET_RAMPAGE_CHANCE = 0; // SPA 464,465
Expand Down