[API] Perl functions to set invulnerable to and modify environmental damage. (#2044)

* invulnerable

* modifier

* fix

* fix

* fix

* [API] Perl functions to set invulnerable to and modify environmental damage.

* [API] Perl and Lua functions to set invulnerable to and modify environmental damage.

credit to kinglykrab for lua
This commit is contained in:
KayenEQ
2022-03-08 19:50:46 -05:00
committed by GitHub
parent 5b6f1d38be
commit dbe0591b09
6 changed files with 113 additions and 0 deletions
+9
View File
@@ -5784,6 +5784,11 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app)
EnvDamage2_Struct* ed = (EnvDamage2_Struct*)app->pBuffer;
auto damage = ed->damage;
if (GetEnvironmentDamageModifier()) {
damage = static_cast<int32>(damage) + (static_cast<int32>(damage) * GetEnvironmentDamageModifier() / 100);
}
if (ed->dmgtype == EQ::constants::EnvironmentalDamage::Falling) {
uint32 mod = spellbonuses.ReduceFallDamage + itembonuses.ReduceFallDamage + aabonuses.ReduceFallDamage;
damage -= damage * mod / 100;
@@ -5817,6 +5822,10 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app)
);
SetHP(GetHP() - 1);//needed or else the client wont acknowledge
return;
}
else if (GetInvulnerableEnvironmentDamage()) {
SetHP(GetHP() - 1);
return;
} else if (zone->GetZoneID() == Zones::TUTORIAL || zone->GetZoneID() == Zones::LOAD) { // Hard coded tutorial and load zones for no fall damage
return;
} else {