diff --git a/Changelog.txt b/Changelog.txt index 2fed73343..7043f50d6 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3915,16 +3915,6 @@ Added: 'H' shortcut for variables to get the value as hexadecimal. 13-10-2024, Jhobean - Added: @PetRelease trigger work like @petdesert and return 1 to prevent the pet from being released. -26-10-2024, canerksk -- Fixed: Memory OnTick link char if not, the skill will not fail. - If the memory owner is not present, skills do not fail when taking damage, but if the memory owner is alive, skills fail when taking damage. - -- Fixed: The entity was jumping frames in flooded pet commands (come, guard) - -08-11-2024 -- Fixed: ITEMMEMORYEQUIP is not triggered in many default memories. - Previously, many memories did not have morex information, but now for some reason many memories have morex information and for this reason the trigger was not triggered in almost most of the memories, the morex query was removed. Also, the slang did not represent the memory item. - 27-11-2024, canerksk - Added: All skills that have a distance query have been adjusted to take the RANGE values ​​of that skill. All skills to be used in RANGE; @@ -3947,6 +3937,26 @@ Added: 'H' shortcut for variables to get the value as hexadecimal. 27-11-2024, Gladie - Fixed: Redeeding t_multi_addon outside of housing system. Before it was only looking for owner of the multi, but in our case we need to know uid of the redeeding char. -======= -02-11-2024, raydie -- Added: Add LAYER_SPELL_Explosion for use delayed explosion spell. Now if set Duration to spell explosion, these duration is the delay to execute the explosion (From UOGuide, explosion spell: 2 second delay between targetting and explosion) + +2-12-2024, canerksk +- Fixed: Memory OnTick link char if not, the skill will not fail. + If the memory owner is not present, skills do not fail when taking damage, but if the memory owner is alive, skills fail when taking damage. +- Fixed: The entity was jumping frames in flooded pet commands (come, guard). +- Fixed: ITEMMEMORYEQUIP is not triggered in many default memories. + Previously, many memories did not have morex information, but now for some reason many memories have morex information and for this reason the trigger was not triggered in almost most of the memories, the morex query was removed. Also, the slang did not represent the memory item. + +02-12-2024, raydie +- Added: Add LAYER_SPELL_Explosion for use delayed explosion spell. Now if set Duration to spell explosion, these duration is the delay to execute the explosion (From UOGuide, explosion spell: 2 second delay between targetting and explosion). + +3-12-2024, canerksk +- Added: New trigger @HitReactive Reactive Armor plays a key role in the action mechanism and is currently under very fixed rules. It has been added as a new trigger with some variables to make it a bit more flexible. + @HitReactive + Local.Sound (r/w) =Sound ID, If it is blank or zero, no sound is produced. (Default: 01F1) + Local.EffectID (r/w) = Effect ID, If it is empty or zero, no effect will occur. (Default: 0374a) + Local.Damage (r/w) = This is the more1l, or PolyStr, value coming from the reactive armor spell to i_rune_reactive_armor. + LOCAL.ReflectDamage (r/w) = The amount of damage that will be reflected to this other party + LOCAL.ReduceDamage (r/w) = Amount to be deducted from damage received + LOCAL.DamageType (r/w) = Type of damage received (Default: DAMAGE_FIXED andDAMAGE_REACTIVE) + NOTE; + 1. If no ReflectDamage or ReduceDamage values ​​are entered, the system defaults to the Reactive Armor Effect value. + 2. No damage amount can be less than 1. diff --git a/src/game/CObjBase.h b/src/game/CObjBase.h index e34a42979..857db7cdd 100644 --- a/src/game/CObjBase.h +++ b/src/game/CObjBase.h @@ -1088,6 +1088,7 @@ enum CTRIG_TYPE : short CTRIG_HitIgnore, // I should ignore this target, just giving a record to scripts. CTRIG_HitMiss, // I just missed. CTRIG_HitParry, // I succesfully parried an hit. + CTRIG_HitReactive, // Reactive damage trigger CTRIG_HitTry, // I am trying to hit someone. starting swing. CTRIG_HouseDesignBegin, // Starting to customize. CTRIG_HouseDesignCommit, // I committed a new house design diff --git a/src/game/chars/CChar.cpp b/src/game/chars/CChar.cpp index fad039269..2504cbed8 100644 --- a/src/game/chars/CChar.cpp +++ b/src/game/chars/CChar.cpp @@ -87,6 +87,7 @@ lpctstr const CChar::sm_szTrigName[CTRIG_QTY+1] = // static "@HitIgnore", // I'm going to avoid a target (attacker.n.ignore=1) , should I un-ignore him?. "@HitMiss", // I just missed. "@HitParry", // I succesfully parried an hit. + "@HitReactive", // Reactive damage trigger "@HitTry", // I am trying to hit someone. starting swing. "@HouseDesignBegin", // Starting to customize. "@HouseDesignCommit", // I committed a new house design. diff --git a/src/game/chars/CCharFight.cpp b/src/game/chars/CCharFight.cpp index 3ce5c26ba..182d96b14 100644 --- a/src/game/chars/CCharFight.cpp +++ b/src/game/chars/CCharFight.cpp @@ -943,19 +943,59 @@ int CChar::OnTakeDamage( int iDmg, CChar * pSrc, DAMAGE_TYPE uiType, int iDmgPhy { CItem* pReactive = LayerFind(LAYER_SPELL_Reactive); - if (pReactive) - { - int iReactiveDamage = (iDmg * pReactive->m_itSpell.m_PolyStr) / 100; - if (iReactiveDamage < 1) - { - iReactiveDamage = 1; - } - - iDmg -= iReactiveDamage; - pSrc->OnTakeDamage(iReactiveDamage, this, (DAMAGE_TYPE)(DAMAGE_FIXED | DAMAGE_REACTIVE), iDmgPhysical, iDmgFire, iDmgCold, iDmgPoison, iDmgEnergy,(SPELL_TYPE)pReactive->m_itSpell.m_spell); - pSrc->Sound(0x1F1); - pSrc->Effect(EFFECT_OBJ, ITEMID_FX_CURSE_EFFECT, this, 10, 16); - } + if (pReactive) + { + int iReactiveDamage = (iDmg * pReactive->m_itSpell.m_PolyStr) / 100; + int iReactiveRefDam = iReactiveDamage; + int iReactiveRedDam = iReactiveDamage; + SOUND_TYPE ReactiveSnd = 0x1F1; + ITEMID_TYPE ReactiveEffectID = ITEMID_FX_CURSE_EFFECT; + DAMAGE_TYPE ReactiveDamType = (DAMAGE_FIXED | DAMAGE_REACTIVE); + + if (IsTrigUsed(TRIGGER_HITREACTIVE)) + { + CScriptTriggerArgs HitReactiveArgs; + HitReactiveArgs.m_VarsLocal.SetNum("Sound", ReactiveSnd); // SOUND + HitReactiveArgs.m_VarsLocal.SetNum("EffectID", ReactiveEffectID); // EFFECTID + HitReactiveArgs.m_VarsLocal.SetNum("Damage", iReactiveDamage); // DAMAGE VALUE + HitReactiveArgs.m_VarsLocal.SetNum("ReflectDamage", iReactiveRefDam); // REFLECTED DAM + HitReactiveArgs.m_VarsLocal.SetNum("ReduceDamage", iReactiveRedDam); // REDUCED DAM + HitReactiveArgs.m_VarsLocal.SetNum("DamageType", ReactiveDamType); // DAMAGE TYPE + OnTrigger(CTRIG_HitReactive, pSrc, &HitReactiveArgs); + + ReactiveSnd = (SOUND_TYPE)HitReactiveArgs.m_VarsLocal.GetKeyNum("Sound"); // SOUND + ReactiveEffectID = (ITEMID_TYPE)HitReactiveArgs.m_VarsLocal.GetKeyNum("EffectID"); // EFFECTID + iReactiveDamage = (int)HitReactiveArgs.m_VarsLocal.GetKeyNum("Damage"); // DAMAGE VALUE + iReactiveRefDam = (int)HitReactiveArgs.m_VarsLocal.GetKeyNum("ReflectDamage"); // REFLECTED DAMAGE VALUE + iReactiveRedDam = (int)HitReactiveArgs.m_VarsLocal.GetKeyNum("ReduceDamage"); // REDUCED DAMAGE VALUE + ReactiveDamType = (DAMAGE_TYPE)HitReactiveArgs.m_VarsLocal.GetKeyNum("DamageType"); // DAMAGE TYPE + // should it be zero ? + //if (iReactiveDamage < 1) + // iReactiveDamage = 1; + + //if (iReactiveRedDam < 1) + // iReactiveRedDam = 1; + + //if (iReactiveRefDam < 1) + // iReactiveRefDam = 1; + } + + // reduce + if (iReactiveRedDam > 0 || iReactiveDamage > 0) + iDmg -= iReactiveRedDam ? iReactiveRedDam : iReactiveDamage; + + // reflect + if (iReactiveRefDam > 0 || iReactiveDamage > 0) + pSrc->OnTakeDamage(iReactiveRefDam ? iReactiveRefDam : iReactiveDamage, this, ReactiveDamType, iDmgPhysical, iDmgFire, iDmgCold, + iDmgPoison, iDmgEnergy, (SPELL_TYPE)pReactive->m_itSpell.m_spell); + + if (ReactiveSnd) + pSrc->Sound(ReactiveSnd); + + if (ReactiveEffectID) + pSrc->Effect(EFFECT_OBJ, ReactiveEffectID, this, 10, 16); + + } } } // Check if REFLECTPHYSICALDAM will reflect some damage back. diff --git a/src/tables/triggers.tbl b/src/tables/triggers.tbl index a200f613a..53e82c442 100644 --- a/src/tables/triggers.tbl +++ b/src/tables/triggers.tbl @@ -79,6 +79,7 @@ ADD(HITCHECK) ADD(HITIGNORE) ADD(HITMISS) ADD(HITPARRY) +ADD(HITREACTIVE) ADD(HITTRY) ADD(HOUSEDESIGNBEGIN) ADD(HOUSEDESIGNCOMMIT)