Merge commit '26c583c24ab7dbbf1fecf3dcd737c1ad543c8b33' into Playerbot_1017

This commit is contained in:
Yunfan Li
2023-10-17 22:18:39 +08:00
57 changed files with 1461 additions and 879 deletions

View File

@@ -3708,6 +3708,24 @@ uint32 Creature::GetPlayerDamageReq() const
return _playerDamageReq;
}
bool Creature::CanCastSpell(uint32 spellID) const
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
int32 currentPower = GetPower(getPowerType());
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsSpellProhibited(spellInfo->GetSchoolMask()))
{
return false;
}
if (spellInfo && (currentPower < spellInfo->CalcPowerCost(this, spellInfo->GetSchoolMask())))
{
return false;
}
return true;
}
std::string Creature::GetDebugInfo() const
{
std::stringstream sstr;

View File

@@ -366,6 +366,7 @@ public:
// Handling caster facing during spellcast
void SetTarget(ObjectGuid guid = ObjectGuid::Empty) override;
void ClearTarget() { SetTarget(); };
void FocusTarget(Spell const* focusSpell, WorldObject const* target);
void ReleaseFocus(Spell const* focusSpell);
[[nodiscard]] bool IsMovementPreventedByCasting() const override;
@@ -398,6 +399,12 @@ public:
* */
void ResumeChasingVictim() { GetMotionMaster()->MoveChase(GetVictim()); };
/**
* @brief Returns true if the creature is able to cast the spell.
*
* */
bool CanCastSpell(uint32 spellID) const;
std::string GetDebugInfo() const override;
protected:

View File

@@ -1175,6 +1175,14 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, aurEff->GetAmount(), true);
}
break;
}
case NPC_VOIDWALKER:
{
if (AuraEffect* aurEff = owner->GetAuraEffectDummy(SPELL_GLYPH_OF_VOIDWALKER))
{
HandleStatModifier(UNIT_MOD_STAT_STAMINA, TOTAL_PCT, aurEff->GetAmount(), true);
}
break;
}
case NPC_WATER_ELEMENTAL_PERM:

View File

@@ -147,6 +147,7 @@ enum PetScalingSpells
SPELL_WARLOCK_PET_SCALING_04 = 34958,
SPELL_WARLOCK_PET_SCALING_05 = 61013, // Hit / Expertise
SPELL_GLYPH_OF_FELGUARD = 56246,
SPELL_GLYPH_OF_VOIDWALKER = 56247,
SPELL_INFERNAL_SCALING_01 = 36186,
SPELL_INFERNAL_SCALING_02 = 36188,
SPELL_INFERNAL_SCALING_03 = 36189,

View File

@@ -11272,12 +11272,12 @@ void Unit::SendEnergizeSpellLog(Unit* victim, uint32 spellID, uint32 damage, Pow
void Unit::EnergizeBySpell(Unit* victim, uint32 spellID, uint32 damage, Powers powerType)
{
victim->ModifyPower(powerType, damage, false);
int32 gainedPower = victim->ModifyPower(powerType, damage, false);
if (powerType != POWER_HAPPINESS)
if (powerType != POWER_HAPPINESS && gainedPower)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
victim->getHostileRefMgr().threatAssist(this, float(damage) * 0.5f, spellInfo);
victim->getHostileRefMgr().threatAssist(this, float(gainedPower) * 0.5f, spellInfo);
}
SendEnergizeSpellLog(victim, spellID, damage, powerType);
@@ -20255,7 +20255,7 @@ bool Unit::CanSwim() const
// Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water
if (HasUnitFlag(UNIT_FLAG_CANNOT_SWIM))
return false;
if (HasUnitFlag(UNIT_FLAG_POSSESSED)) // is player
if (HasUnitFlag(UNIT_FLAG_POSSESSED) || HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED)) // is player
return true;
if (HasUnitFlag2(UNIT_FLAG2_UNUSED_6))
return false;