PDA

View Full Version : Project Illusion AA


seveianrex
09-24-2008, 08:59 AM
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:

bool IsPlayerIllusionSpell(int16 spell_id); // seveian 2008-09-23


{spdat.cpp}
At bottom of file, add:

// 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

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

// 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::DetermineSpellTargets, 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.)

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:

//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:

// seveian 2008-09-23
if(IsPlayerIllusionSpell(spell_id)
&& IsClient()
&& CastToClient()->CheckAAEffect(aaEffectProjectIllusion)){
range = 100;
}


After this snippet:

//
// 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):


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

seveianrex
09-26-2008, 11:43 PM
Sorry, need to post a change to this:

in {spells.cpp}

The line:

&& !spell_target // null ptr crash safeguard


Is supposed to read:

&& spell_target != NULL // null ptr crash safeguard