All pastes #547665 Raw Edit

Mine

public text v1 · immutable
·published 2007-06-07 13:38 UTC
rendered paste body
function GetBoosters( strSpell )
//			1: Spell name (string)
//			return: array of structs

	var elmSpell := FindSpellElem( strSpell );
	var arrEnhanced := GetConfigStringArray( elmSpell, "BoostedBy" );
	if(len(arrEnhanced) > 0)
		var strSplit;
		var arrBoosts := array;
		var stcBoost := struct;
		stcBoost.+type1 := "";
		stcBoost.+type2 := "";
		stcBoost.+mult := cdbl(1);
			foreach strEntry in arrEnhanced
				strSplit := SplitWords(strEntry);
				stcBoost.type1 := strSplit[1];
				stcBoost.type2 := strSplit[2];
				stcBoost.mult := cdbl(strSplit[3]);
				arrBoosts.append(stcBoost);
				//Print("[Boost] Boosted by "+stcBoost);
			endforeach
			//print("Boosts: "+arrBoosts);
			return arrBoosts;	
	endif

	return 1;
endfunction

//////////////////////////////////////////////////////
function GetBoosts( mobWho, arrBoosts)
//			1: Spell name (string)
//			return: array of structs
	var numMult := cdbl(1);
	var intBase := cdbl(0);
	foreach stcBoost in arrBoosts
	case(stcBoost.type1)

	"skill": intBase := cdbl(GetEffectiveSkill(mobWho, cint(stcBoost.type2)));
		  if(!intBase) break; endif
		  numMult := numMult * (intBase * stcBoost.mult);
		  break;
	"resistance": intBase := (cdbl(1) - cdbl(Resistance(mobWho, cstr(stcBoost.type2)))) * 100;
		  if(!intBase) break; endif
		  numMult := numMult * (intBase * stcBoost.mult);
		  break;
	"statmod": intBase := cdbl(GetModifierSum( GetCurrentMods( mobWho, stcBoost.type2, "all" )));
		  if(!intBase) break; endif
		  numMult := numMult * (intBase * stcBoost.mult);
		  break;
	"statmod_reason": intBase := cdbl(GetModifierSum( GetCurrentMods( mobWho, "all", stcBoost.type2 )));
		  if(!intBase) break; endif
		  numMult := numMult * (intBase * stcBoost.mult);
		  break;
	"cprop":  intBase := cdbl(GetObjProperty(mobWho, stcBoost.type2));
		  if(!intBase) break; endif
		  numMult := numMult * (intBase * stcBoost.mult);
		  break;
	"vital":
		  if(stcBoost.type2 == "hp") intBase := cdbl(GetHP(mobWho));
		  elseif(stcBoost.type2 == "stam") intBase := cdbl(GetStamina(mobWho));
		  elseif(stcBoost.type2 == "mana") intBase := cdbl(GetMana(mobWho));
		  endif

		  if(!intBase) break; endif

		  numMult := numMult * (intBase * stcBoost.mult);
		  break;
	endcase

	intBase := cdbl(0);

		 //Print("<"+mobWho.name+"> [Boost] "+stcboost.type1+ " "+stcboost.type2+": "+numMult+"[Base: "+intBase+"]");

	endforeach
		//print("< Return "+numMult+">");
	return numMult;
endfunction


------

AUSpell SearingLight
{
	Type			damage
    	Name       		SearingLight
    	Description		This spell turns unliving flesh to dust.
	Prerequisite		Heal
    	Thread Fire 2
    	Thread Magic 2
	Range			8 skill
	Duration		instant
	Radius			0
	CastingTime		word
	RechargeTime		5
	Option			range
	Option			faster
	GraphicEffect		AtTarget gfx_flamestrike
	Sound			AtTarget flame_strike
	Animation		directed_cast
	Script      		SpellDamage hp 1 noarmor none
	BoostedBy		resistance life 2
	TargetOption		mob
}

AUSpell BaneOfTheWicked
{
	Type			damage
    	Name       		Bane of the Wicked
    	Description		Cripples the unholy.
    	Prerequisite		Retribution
    	Thread Air 2
    	Thread Magic 3
	Range			8 skill
	Duration		instant
	Radius			0
	CastingTime		charm
	RechargeTime		5
	Option			range
	Option			farcast
	Option			faster
  	GraphicEffect		AtTarget gfx_curse_effect 10
  	Sound 			AtTarget sfx_curse_effect
	Animation		directed_cast
	AffectStat		defense -1 none
	AffectStat		attack -1 none
	AffectStat		dex -1 none
	AffectStat		str -1 none
	AffectStat		damage -1 none
	AffectStat		light 1 none
	TargetOption		mob
	BoostedBy		resistance life 2
}


-----

SPELLMOD

	var strReason := "spell:"+strSpell;
// get random spell effect multiplier
	intModRandomize := CInt( RandomDiceRoll( "1d101+50" ) );
	intDurRandomize := CInt( RandomDiceRoll( "1d101+50" ) );

	var numBoost := GetBoosts( mobTarget, GetBoosters( strSpell ));
	DebugMessage(mobSource, "Boost multiplier: "+numBoost);
	intAmount := cdbl(intAmount) * cdbl(numBoost);

// base spell values ( base * spell % * random % / 100% / 100% )
	intMod := CInt( intBASE_MOD_AMOUNT * CInt( intAmount ) * intModRandomize) / 10000;
	intDur := CInt( intBASE_MOD_DURATION * intDuration * intDurRandomize ) / 10000;


SPELLDAMAGE

Debugmessage( mobSource, "Calculating spell damage");
// roll and calculate damage
	intRoll := CDbl( CalcSpellDamage( intBASE_DAMAGE_CIRCLE, mobSource, mobTarget ) / 10 );	// roll base damage
DebugMessage( mobSource, "damage base = " + intRoll );

	var numBoost := GetBoosts( mobTarget, GetBoosters( strSpell ));
	DebugMessage(mobSOurce, "Boost multiplier: "+numBoost);
	intDamage := cdbl(intDamage) * cdbl(numBoost);

	intRoll := intRoll * CDbl( intDamage ) / 100.0;					// adjust for spell
DebugMessage( mobSource, "damage for spell = " + intRoll );

// adjust for user stats and skill

	var intPotencySkill := SKILLID_EVALINT;
	
	intRoll := intRoll * ( CDbl ( GetEffectiveSkill( mobSource, intPotencySkill ) ) + 150.0 ) / 200.0;