Jump to content

Okay, am I doing this right


Eidam

Recommended Posts

I changed every instance of WILLPOWER to STRENGTH in Holy Smite so the ability scales with a more coherent stat for Warriors. I ended up with this:

 

void _ApplySpellEffects(struct EventSpellScriptImpactStruct stEvent, object oTarget)
{
float fScaledValue;
effect eEffect;

switch (stEvent.nAbility)
{
	case ABILITY_TALENT_HOLY_SMITE:
	{
		// if hostile
		if (IsObjectHostile(stEvent.oCaster, oTarget) == TRUE)
		{
			float fDamage = (100.0f + GetAttributeModifier(stEvent.oCaster, PROPERTY_ATTRIBUTE_STRENGTH)) * HOLY_SMITE_BASE_DAMAGE_FACTOR;
			#ifdef DEBUG
			Log_Trace(LOG_CHANNEL_TEMP, "Base fDamage = " + ToString(fDamage));
			#endif

			// if the target
			if (oTarget == stEvent.oTarget)
			{
				if (IsMagicUser(oTarget) == TRUE)
				{
					// mana drain
					float fMana = (100.0f + GetAttributeModifier(stEvent.oCaster, PROPERTY_ATTRIBUTE_STRENGTH)) * HOLY_SMITE_MANA_FACTOR;
					#ifdef DEBUG
					Log_Trace(LOG_CHANNEL_TEMP, "Initial fMana = " + ToString(fMana));
					#endif
					fMana = MinF(fMana, GetCurrentManaStamina(oTarget));
					#ifdef DEBUG
					Log_Trace(LOG_CHANNEL_TEMP, "Final fMana = " + ToString(fMana));
					#endif
					eEffect = EffectModifyManaStamina(fMana * -1.0f);
					ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eEffect, oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility);

					// additional spirit damage
					fDamage += (fMana * HOLY_SMITE_MANA_DAMAGE_FACTOR);
					#ifdef DEBUG
					Log_Trace(LOG_CHANNEL_TEMP, "Final fDamage = " + ToString(fDamage));
					#endif
				}

				// spirit damage
				eEffect = EffectDamage(fDamage, DAMAGE_TYPE_SPIRIT);
				ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eEffect, oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility);

				// physical resistance
				if (ResistanceCheck(stEvent.oCaster, oTarget, PROPERTY_ATTRIBUTE_STRENGTH, RESISTANCE_PHYSICAL) == FALSE)
				{
					float fDuration = GetRankAdjustedEffectDuration(oTarget, HOLY_SMITE_STUN_DURATION);

					// remove stacking effects
					RemoveStackingEffects(oTarget, stEvent.oCaster, stEvent.nAbility);

					// stun
					eEffect = EffectStun();
					ApplyEffectOnObject(EFFECT_DURATION_TYPE_TEMPORARY, eEffect, oTarget, fDuration, stEvent.oCaster, stEvent.nAbility);
				}
			} else
			{
				// spirit damage
				eEffect = EffectDamage(fDamage, DAMAGE_TYPE_SPIRIT);
				ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eEffect, oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility);

				// physical resistance
				if (ResistanceCheck(stEvent.oCaster, oTarget, PROPERTY_ATTRIBUTE_STRENGTH, RESISTANCE_PHYSICAL) == FALSE)
				{
					// knockdown
					eEffect = EffectKnockdown(stEvent.oCaster, 0, stEvent.nAbility);
					eEffect = SetEffectEngineInteger(eEffect, EFFECT_INTEGER_USE_INTERPOLATION_ANGLE, 2);
					eEffect = SetEffectEngineVector(eEffect, EFFECT_VECTOR_ORIGIN, GetPositionFromLocation(stEvent.lTarget));
					ApplyEffectOnObject(EFFECT_DURATION_TYPE_TEMPORARY, eEffect, oTarget, RandomFloat(), stEvent.oCaster, stEvent.nAbility);
				}
			}
		}

		break;

 

 

Is it doing what I want now?

 

 

Also, I'm trying to figure out:

 

a) How do I modify the benefits of each attribute re: I want to lower Fatigue through CON.

 

b) How do I shorten the casting time of a spell.

 

c) Whether I'm reading this right and Chain Lightning doesn't scale at all with spellpower.

 

 

Does anyone have MSN or something so they can help me out? XD

Link to comment
Share on other sites

Trying to modify fatigue, I found this:

 

 //This function is duplicated within the game executable. Any change made to this function will
			//result in GUI glitches and other bugs. Sorry.
			fModifier +=  GetCreatureProperty(oCaster, PROPERTY_ATTRIBUTE_FATIGUE)*0.01f;
			fCost = FloatToInt(fCost*fModifier+0.5) * 1.0;

:mellow:

Link to comment
Share on other sites

Also, I'm trying to figure out:

 

a) How do I modify the benefits of each attribute re: I want to lower Fatigue through CON.

 

b) How do I shorten the casting time of a spell.

 

c) Whether I'm reading this right and Chain Lightning doesn't scale at all with spellpower.

 

 

Does anyone have MSN or something so they can help me out? XD

 

didn't look at your code but i want to add some remarks:

 

1) Be sure that your not directly overriding the core scripts but are creating a new script to handle your changed ability (just copy the core script and remove any event - switch that might be for another ability).

a) You have to create a ABI_Base M2DA to do that.

b) Cast Time is spezified in there as well.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...