View Single Post
  #1  
Old 09-24-2008, 08:59 AM
seveianrex
Sarnak
 
Join Date: Sep 2008
Location: asdf
Posts: 60
Default Project Illusion AA

Hello. Here is my completed Project Illusion AA code. I have tested it. I apologize for not having that nifty .patch format but I couldn't get WinMerge to work :P

{spdat.h}
At bottom of file, add:
Code:
bool IsPlayerIllusionSpell(int16 spell_id); // seveian 2008-09-23
{spdat.cpp}
At bottom of file, add:
Code:
// seveian 2008-09-23
bool IsPlayerIllusionSpell(int16 spell_id) {
	return (spells[spell_id].effectdescnum == 49);
}
{AA.h}
In the enum aaEffectType, add a new item
Code:
aaEffectProjectIllusion // seveian 2008-09-23
{AA.cpp}
in the void Client::HandleAAAction(aaID activate), locate the switch(caa->action) and add the following case statement
Code:
		// seveian 2008-09-23
		case aaActionProjectIllusion:
			EnableAAEffect(aaEffectProjectIllusion, 3600);
			Message(10, "The power of your next illusion spell will flow to your grouped target in your place.");
			break;
{spells.cpp}
in the bool Mob:etermineSpellTargets, after the line "bodyType target_bt = BT_Humanoid;", add the following (NOTE: The switch I ended off with in my snippet above should _REPLACE_ the existing switch.)
Code:
	SpellTargetType targetType = spells[spell_id].targettype;

	// seveian 2008-09-23
	if(IsPlayerIllusionSpell(spell_id)
		&& !spell_target // null ptr crash safeguard
		&& !spell_target->IsNPC() // still self only if NPC targetted
		&& IsClient()
		&& IsGrouped() // still self only if not grouped
		&& CastToClient()->CheckAAEffect(aaEffectProjectIllusion)){
			targetType = ST_GroupClient;
	}

	switch (targetType)
In bool Mob::SpellFinished, after this snippet:
Code:
	//range check our target, if we have one and it is not us
	float range = spells[spell_id].range;
	if(IsClient() && CastToClient()->TGB() && IsTGBCompatibleSpell(spell_id) && IsGroupSpell(spell_id))
		range = spells[spell_id].aoerange;
	range = GetActSpellRange(spell_id, range);
Add this:
Code:
	// seveian 2008-09-23
	if(IsPlayerIllusionSpell(spell_id)
		&& IsClient()
		&& CastToClient()->CheckAAEffect(aaEffectProjectIllusion)){
		range = 100;
	}
After this snippet:
Code:
	//
	// solar: Switch #2 - execute the spell
	//
	switch(CastAction)
	{
		default:
		case CastActUnknown:
		case SingleTarget:
		{
			if(spell_target == NULL) {
				mlog(SPELLS__CASTING, "Spell %d: Targeted spell, but we have no target", spell_id);
				return(false);
			}
			SpellOnTarget(spell_id, spell_target);
Add this (before the break):

Code:
			// seveian 2008-09-23
			if(IsPlayerIllusionSpell(spell_id)
			&& IsClient()
			&& CastToClient()->CheckAAEffect(aaEffectProjectIllusion)){
				CastToClient()->DisableAAEffect(aaEffectProjectIllusion);
			}
Reply With Quote