From 20d041502eae1e403fc31979cec91dbdc5615568 Mon Sep 17 00:00:00 2001 From: Logg-y <49533518+Logg-y@users.noreply.github.com> Date: Sat, 2 Nov 2024 03:47:47 +0000 Subject: [PATCH] Isle of the maker golem fixes --- src/nss/death_makerbgol.nss | 22 +++++++++++++++------- src/nss/dlg_buff.nss | 21 ++++++++++++--------- src/nss/hb_maker.nss | 9 ++++++++- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/nss/death_makerbgol.nss b/src/nss/death_makerbgol.nss index 117a56d6..b7e2c5de 100644 --- a/src/nss/death_makerbgol.nss +++ b/src/nss/death_makerbgol.nss @@ -23,13 +23,21 @@ void MakeNewGolem(object oOne, object oTwo, location lMid) // Remove old ones from array if (GetIsObjectValid(oOne)) { - int nIndex = JsonGetInt(JsonFind(jGolems, JsonString(ObjectToString(oOne)))); - jGolems = JsonArrayDel(jGolems, nIndex); + json jResponse = JsonFind(jGolems, JsonString(ObjectToString(oOne))); + if (jResponse != JsonNull()) + { + int nIndex = JsonGetInt(jResponse); + jGolems = JsonArrayDel(jGolems, nIndex); + } } if (GetIsObjectValid(oTwo)) { - int nIndex = JsonGetInt(JsonFind(jGolems, JsonString(ObjectToString(oTwo)))); - jGolems = JsonArrayDel(jGolems, nIndex); + json jResponse = JsonFind(jGolems, JsonString(ObjectToString(oTwo))); + if (jResponse != JsonNull()) + { + int nIndex = JsonGetInt(jResponse); + jGolems = JsonArrayDel(jGolems, nIndex); + } } SetLocalJson(oArea, "maker_golems", jGolems); @@ -48,12 +56,12 @@ void main() return; } // Look for another dead one - int n=1; + int n=0; object oOther; do { - object oOther = GetNearestObjectByTag(GetTag(OBJECT_SELF), OBJECT_SELF, n); - if (GetIsDead(oOther) && GetIsObjectValid(oOther)) + oOther = GetNearestObjectByTag(GetTag(OBJECT_SELF), OBJECT_SELF, n); + if (GetIsDead(oOther) && GetIsObjectValid(oOther) && oOther != OBJECT_SELF) { if (!GetLocalInt(oOther, "tethering")) { diff --git a/src/nss/dlg_buff.nss b/src/nss/dlg_buff.nss index 7f6f6627..9c1c7cda 100644 --- a/src/nss/dlg_buff.nss +++ b/src/nss/dlg_buff.nss @@ -5,14 +5,17 @@ void main() if (GetIsDeveloper(oPC)) { - SendDiscordLogMessage(GetName(oPC) + " used the developer menu to apply various OP buffs to themselves, permanently."); - ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectAttackIncrease(20), oPC); - ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectDamageIncrease(30), oPC); - ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectMovementSpeedIncrease(99), oPC); - ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectTemporaryHitpoints(200), oPC); - ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectHaste(), oPC); - ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectSkillIncrease(SKILL_SEARCH, 50), oPC); - ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectSkillIncrease(SKILL_LORE, 50), oPC); - ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectSkillIncrease(SKILL_PERSUADE, 50), oPC); + SendDiscordLogMessage(GetName(oPC) + " used the developer menu to apply various OP buffs to themselves."); + effect eLink = EffectAttackIncrease(20); + eLink = EffectLinkEffects(eLink, EffectDamageIncrease(30)); + eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(4095, 90)); + eLink = EffectLinkEffects(eLink, EffectSpellResistanceIncrease(28)); + eLink = EffectLinkEffects(eLink, EffectMovementSpeedIncrease(99)); + eLink = EffectLinkEffects(eLink, EffectTemporaryHitpoints(200)); + eLink = EffectLinkEffects(eLink, EffectHaste()); + eLink = EffectLinkEffects(eLink, EffectSkillIncrease(SKILL_SEARCH, 50)); + eLink = EffectLinkEffects(eLink, EffectSkillIncrease(SKILL_LORE, 50)); + eLink = EffectLinkEffects(eLink, EffectSkillIncrease(SKILL_PERSUADE, 50)); + ApplyEffectToObject(DURATION_TYPE_TEMPORARY, SupernaturalEffect(eLink), oPC, 3600.0); } } diff --git a/src/nss/hb_maker.nss b/src/nss/hb_maker.nss index c1a40446..f587e35d 100644 --- a/src/nss/hb_maker.nss +++ b/src/nss/hb_maker.nss @@ -79,11 +79,13 @@ void main() int nDR = 0; int nHP = GetCurrentHitPoints(); int nLastHP = GetLocalInt(OBJECT_SELF, "last_hp"); + if (nLastHP == 0) + nLastHP = GetMaxHitPoints(); int nLastDR = GetLocalInt(OBJECT_SELF, "last_dr"); effect eTest = GetFirstEffect(OBJECT_SELF); while (GetIsEffectValid(eTest)) { - if (GetEffectType(eTest) == EFFECT_TYPE_DAMAGE_REDUCTION) + if (GetEffectType(eTest) == EFFECT_TYPE_DAMAGE_RESISTANCE) { nDR += GetEffectInteger(eTest, 2); } @@ -95,6 +97,8 @@ void main() if (nHPDelta <= 0) { nHPDelta = 0; } int nDRDelta = nLastDR - nDR; if (nDRDelta <= 0) { nDRDelta = 0; } + + //SpeakString("HP delta " + IntToString(nHPDelta) + " DR delta " + IntToString(nDRDelta) + ", current values " + IntToString(nHP) + " " + IntToString(nDR)); // This is deliberately built to make doing damage // to the maker rapidly cause him to be more inclined to make golems @@ -107,10 +111,13 @@ void main() // Actual HP damage counts for more // Dispelling premonition/stoneskin will count as a massive damage spike... int nEHPDelta = nHPDelta*2 + nDRDelta; + int nGolemPoints = FloatToInt(pow(IntToFloat(nEHPDelta), 1.4)); int nOldGolemPoints = GetLocalInt(OBJECT_SELF, "golem_points"); nGolemPoints += nOldGolemPoints; + nGolemPoints += 4; + //SpeakString("Golem points: " + IntToString(nGolemPoints)); float fDelay = 0.0; while (nGolemPoints > 400) {