Iv been trying to make the reflect work like pre-uor. reflects one spell of any circle and then player has to recast.

iv tried in magicreflect.cs and also in spellhelper setting values ect, omitted out alot of lines

maybe somthing to do with this stuff

int value = (int)(Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Inscribe].Value);
value = (int)(8 + (value/200)*7.0);//absorb from 8 to 15 "circles"

but im freaking lost, everything has changed so much lol
 
There are several differences in "old school" magic reflect to the magic reflect found in ServUO.

Firstly, in MagicReflect.cs you can remove all checks for "CanBeginAction( typeof( DefensiveSpell ) )". These checks are what stops the spell from adhering for a few minutes after reflect has been taken down, or another defensive spell is active (RA or protection).

Secondly, you don't need to calculate what the "MagicDamageAbsorb" is going to be, and instead always set it to "1" when reflect is cast. For Pre T2A/T2A, this should really just be a bool and not an int, but that would require core editing which really isn't necessary for this.

Thirdly, you need to edit the method SpellHelper.cs. The CheckReflect method must be changed so a MagicDamageAbsorb of 1 will reflect all spell circles. Otherwise, you'd never be able to reflect a spell circle higher than 1.
 
using System;
using System.Collections;
using Server;
using Server.Targeting;
using Server.Network;

namespace Server.Spells.Fifth
{
public class MagicReflectSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Magic Reflection", "In Jux Sanct",
242,
9012,
Reagent.Garlic,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);

public override SpellCircle Circle { get { return SpellCircle.Fifth; } }


public MagicReflectSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}

public override bool CheckCast()
{
if ( Core.AOS )
return true;

if ( Caster.MagicDamageAbsorb > 0 )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
return false;
}
// else if ( !Caster.CanBeginAction( typeof( DefensiveSpell ) ) )
//{
// Caster.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time.
// return false;
//}

return true;
}

private static Hashtable m_Table = new Hashtable();

public override void OnCast()
{
if ( Core.AOS )
{
/* The magic reflection spell decreases the caster's physical resistance, while increasing the caster's elemental resistances.
* Physical decrease = 25 - (Inscription/20).
* Elemental resistance = +10 (-20 physical, +10 elemental at GM Inscription)
* The magic reflection spell has an indefinite duration, becoming active when cast, and deactivated when re-cast.
* Reactive Armor, Protection, and Magic Reflection will stay on—even after logging out, even after dying—until you “turn them off” by casting them again.
*/

if ( CheckSequence() )
{
Mobile targ = Caster;

ResistanceMod[] mods = (ResistanceMod[])m_Table[targ];

if ( mods == null )
{
targ.PlaySound( 0x1E9 );
targ.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );

mods = new ResistanceMod[5]
{
new ResistanceMod( ResistanceType.Physical, -25 + (int)(targ.Skills[SkillName.Inscribe].Value / 20) ),
new ResistanceMod( ResistanceType.Fire, 10 ),
new ResistanceMod( ResistanceType.Cold, 10 ),
new ResistanceMod( ResistanceType.Poison, 10 ),
new ResistanceMod( ResistanceType.Energy, 10 )
};

m_Table[targ] = mods;

for ( int i = 0; i < mods.Length; ++i )
targ.AddResistanceMod( mods );
}
else
{
targ.PlaySound( 0x1ED );
targ.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );

m_Table.Remove( targ );

for ( int i = 0; i < mods.Length; ++i )
targ.RemoveResistanceMod( mods );
}
}

FinishSequence();
}
else
{
if ( CheckBSequence( Caster ) )
{
if ( Caster.MagicDamageAbsorb >= 0 )
{
int value = 1;

Caster.MagicDamageAbsorb = value;
Caster.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );
Caster.PlaySound( 0x1E9 );
}
}

FinishSequence();
}
}
public static void EndReflect( Mobile m )
{
if ( m_Table.Contains( m ) )
{
ResistanceMod[] mods = (ResistanceMod[]) m_Table[ m ];

if ( mods != null )
{
for ( int i = 0; i < mods.Length; ++i )
m.RemoveResistanceMod( mods[ i ] );
}

m_Table.Remove( m );
BuffInfo.RemoveBuff( m, BuffIcon.MagicReflection );
}
}
}
}
 
Hi guys, what I need to change on my spellhelper.cs? I would like a old style reflect how says the starter threader,
On magicreflection.cs I put the absdamage to 1 how said jack.
I use runuo

//magic reflection
public static void CheckReflect( int circle, Mobile caster, ref Mobile target )
{
CheckReflect( circle, ref caster, ref target );
}
public static void CheckReflect( int circle, ref Mobile caster, ref Mobile target )
{
if( target.MagicDamageAbsorb > 1 )
{
++circle;
target.MagicDamageAbsorb -= circle;
// This order isn't very intuitive, but you have to nullify reflect before target gets switched
bool reflect = (target.MagicDamageAbsorb >= 1);
if( target is BaseCreature )
((BaseCreature)target).CheckReflect( caster, ref reflect );
if( target.MagicDamageAbsorb <= 1 )
{
target.MagicDamageAbsorb = 1;
DefensiveSpell.Nullify( target );
}
if( reflect )
{
target.FixedEffect( 0x37B9, 10, 5 );
Mobile temp = caster;
caster = target;
target = temp;
}
}
[doublepost=1551613920][/doublepost]This is my magicrefly.cs

using System;
using System.Collections;
using Server;
using Server.Targeting;
using Server.Network;
namespace Server.Spells.Fifth
{
public class MagicReflectSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Magic Reflection", "In Jux Sanct",
242,
9012,
Reagent.Garlic,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);
public override SpellCircle Circle { get { return SpellCircle.Fifth; } }
public MagicReflectSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override bool CheckCast()
{
if ( Core.AOS )
return true;
if ( Caster.MagicDamageAbsorb > 0 )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
return false;
}
else if ( !Caster.CanBeginAction( typeof( DefensiveSpell ) ) )
{
Caster.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time.
return false;
}
return true;
}
private static Hashtable m_Table = new Hashtable();
public override void OnCast()
{
if ( Core.AOS )
{
/* The magic reflection spell decreases the caster's physical resistance, while increasing the caster's elemental resistances.
* Physical decrease = 25 - (Inscription/20).
* Elemental resistance = +10 (-20 physical, +10 elemental at GM Inscription)
* The magic reflection spell has an indefinite duration, becoming active when cast, and deactivated when re-cast.
* Reactive Armor, Protection, and Magic Reflection will stay on—even after logging out, even after dying—until you “turn them off” by casting them again.
*/
if ( CheckSequence() )
{
Mobile targ = Caster;
ResistanceMod[] mods = (ResistanceMod[])m_Table[targ];
if ( mods == null )
{
targ.PlaySound( 0x1E9 );
targ.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );
int physiMod = -25 + (int)(targ.Skills[SkillName.Inscribe].Value / 20);
int otherMod = 10;
mods = new ResistanceMod[0]
{
/* new ResistanceMod( ResistanceType.Physical, physiMod ),
new ResistanceMod( ResistanceType.Fire, otherMod ),
new ResistanceMod( ResistanceType.Cold, otherMod ),
new ResistanceMod( ResistanceType.Poison, otherMod ),
new ResistanceMod( ResistanceType.Energy, otherMod )*/
};
m_Table[targ] = mods;
for ( int i = 0; i < mods.Length; ++i )
targ.AddResistanceMod( mods );
string buffFormat = String.Format( "{0}\t+{1}\t+{1}\t+{1}\t+{1}", physiMod, otherMod );
BuffInfo.AddBuff( targ, new BuffInfo( BuffIcon.MagicReflection, 1075817, buffFormat, true ) );
}
else
{
targ.PlaySound( 0x1ED );
targ.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );
m_Table.Remove( targ );
for ( int i = 0; i < mods.Length; ++i )
targ.RemoveResistanceMod( mods );
BuffInfo.RemoveBuff( targ, BuffIcon.MagicReflection );
}
}
FinishSequence();
}
else
{
if ( Caster.MagicDamageAbsorb > 0 )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
}
else if ( !Caster.CanBeginAction( typeof( DefensiveSpell ) ) )
{
Caster.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time.
}
else if ( CheckSequence() )
{
if ( Caster.BeginAction( typeof( DefensiveSpell ) ) )
{
int value = (int)(Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Inscribe].Value);
value = (int)(8 + (value/200)*7.0);//absorb from 8 to 15 "circles"
Caster.MagicDamageAbsorb = value;
Caster.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );
Caster.PlaySound( 0x1E9 );
}
else
{
Caster.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time.
}
}
FinishSequence();
}
}
public static void EndReflect( Mobile m )
{
if ( m_Table.Contains( m ) )
{
ResistanceMod[] mods = (ResistanceMod[]) m_Table[ m ];
if ( mods != null )
{
for ( int i = 0; i < mods.Length; ++i )
m.RemoveResistanceMod( mods[ i ] );
}
m_Table.Remove( m );
BuffInfo.RemoveBuff( m, BuffIcon.MagicReflection );
}
}
}
}
 
Last edited:
The spellhelper.cs how should me?
this is the original interested part;

//magic reflection
public static void CheckReflect( int circle, Mobile caster, ref Mobile target )
{
CheckReflect( circle, ref caster, ref target );
}
public static void CheckReflect( int circle, ref Mobile caster, ref Mobile target )
{
if( target.MagicDamageAbsorb > 0 )
{
++circle;
target.MagicDamageAbsorb -= circle;
// This order isn't very intuitive, but you have to nullify reflect before target gets switched
bool reflect = (target.MagicDamageAbsorb >= 0);
if( target is BaseCreature )
((BaseCreature)target).CheckReflect( caster, ref reflect );
if( target.MagicDamageAbsorb <= 0 )
{
target.MagicDamageAbsorb = 0;
DefensiveSpell.Nullify( target );
}
 
Back