RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[RunUO2- Distro] Ninja Move Script Modifications

Xen-miao

Sorceror
This is the SVN version of RunUo2, the last update. I found some code that it's better to exchange because it's contrary to the software engineering politicies.


DeathStrike.cs
public override void OnHit( Mobile attacker, Mobile defender, int damage )
{
if( !Validate( attacker ) || !CheckMana( attacker, true ) )
return;

ClearCurrentMove( attacker );

double ninjitsu =attacker.Skills[SkillName.Ninjitsu].Value;

double chance;

if( ninjitsu < 100 ) //This formula is an approximation from OSI data. TODO: find correct formula
chance = 30 + (ninjitsu - 85) * 2.2;
else
chance = 63 + (ninjitsu - 100) * 1.1;

if( (chance / 100) < Utility.RandomDouble() )
{
attacker.SendLocalizedMessage( 1070779 ); // You missed your opponent with a Death Strike.
return;
}

DeathStrikeInfo info;

int damageBonus = 0;

if( m_Table.Contains( defender ) )
{
defender.SendLocalizedMessage( 1063092 ); // Your opponent lands another Death Strike!

info = (DeathStrikeInfo)m_Table[defender];

if( info.m_Steps > 0 )
damageBonus = attacker.Skills[SkillName.Ninjitsu].Fixed / 150;

if( info.m_Timer != null )
info.m_Timer.Stop();

m_Table.Remove( defender );
}
else
{
defender.SendLocalizedMessage( 1063093 ); // You have been hit by a Death Strike! Move with caution!
}


attacker.SendLocalizedMessage( 1063094 ); // You inflict a Death Strike upon your opponent!

defender.FixedParticles( 0x374A, 1, 17, 0x26BC, EffectLayer.Waist );
attacker.PlaySound( attacker.Female ? 0x50D : 0x50E );

info = new DeathStrikeInfo( defender, attacker, damageBonus );
info.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( ProcessDeathStrike ), defender );

m_Table[defender] = info;

CheckGain( attacker );
}


It's better to exchange those red stringswith these ones sorted:

double ninjitsu = attacker.Skills[MoveSkill].Value;
and
damageBonus = attacker.Skills[MoveSkill].Fixed / 150;




private static void ProcessDeathStrike( object state )
{
Mobile defender = (Mobile)state;

DeathStrikeInfo info = m_Table[defender] as DeathStrikeInfo;

if( info == null ) //sanity
return;

double ninjitsu = info.m_Attacker.Skills[SkillName.Ninjitsu].Fixed;
int divisor = (info.m_Steps >= 5) ? 30 : 80;

double baseDamage = ninjitsu / divisor;
double stalkingBonus = Tracking.GetStalkingBonus( info.m_Attacker, info.m_Target );

int maxDamage = (info.m_Steps >= 5) ? 62 : 22;

int damage = Math.Max( 0, Math.Min( maxDamage, (int)(baseDamage + stalkingBonus) ) );

// This bonus is 8 at most. That brings the cap up to 70/30.
damage += info.m_DamageBonus;

if ( info.m_Attacker.Weapon is BaseWeapon && ((BaseWeapon)info.m_Attacker.Weapon).MaxRange > 1 )
damage /= 2;

// Damage is direct.
//info.m_Target.Damage( damage, info.m_Attacker );

AOS.Damage( info.m_Target, info.m_Attacker, damage, true, 100, 0, 0, 0, 0 );

if( info.m_Timer != null )
info.m_Timer.Stop();

m_Table.Remove( info.m_Target );
}
}
it's the same in this case, if you have that skill name in a internal field why do you repeat it statically in a method? It's against a logical view of class-object system.

so you should substitue that red string with this one
double ninjitsu = info.m_Attacker.Skills[SpecialMove.GetCurrentMove(info.m_Attacker).MoveSkill].Fixed;

same kind of problem are present in FocusAttack.cs
public override double GetDamageScalar( Mobile attacker, Mobile defender )
{
double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value;

return 1.0 + (ninjitsu * ninjitsu) / 43636;
}

public override double GetPropertyBonus( Mobile attacker )
{
double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value;

double bonus = (ninjitsu * ninjitsu) / 43636;

return 1.0 + (bonus * 3 + 0.01);
}
in both cases it's right to substitue the red skill with this one:
double ninjitsu = attacker.Skills[MoveSkill].Value;

it's the same in Backstab.cs

public override double GetDamageScalar( Mobile attacker, Mobile defender )
{
double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value;

return 1.0 + (ninjitsu / 360) + Tracking.GetStalkingBonus( attacker, defender ) / 100;
}

substitue the red string with this one
double ninjitsu = attacker.Skills[MoveSkill].Value;

In SurpriseAttack.cs
public override void OnHit( Mobile attacker, Mobile defender, int damage )
{
//Validates before swing

ClearCurrentMove( attacker );

attacker.SendLocalizedMessage( 1063129 ); // You catch your opponent off guard with your Surprise Attack!
defender.SendLocalizedMessage( 1063130 ); // Your defenses are lowered as your opponent surprises you!

defender.FixedParticles( 0x37B9, 1, 5, 0x26DA, 0, 3, EffectLayer.Head );

attacker.RevealingAction();

SurpriseAttackInfo info;

if ( m_Table.Contains( defender ) )
{
info = (SurpriseAttackInfo)m_Table[defender];

if ( info.m_Timer != null )
info.m_Timer.Stop();

m_Table.Remove( defender );
}

int ninjitsu = attacker.Skills[SkillName.Ninjitsu].Fixed;

int malus = ninjitsu / 60 + (int)Tracking.GetStalkingBonus( attacker, defender );

info = new SurpriseAttackInfo( defender, malus );
info.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 8.0 ), new TimerStateCallback( EndSurprise ), info );

m_Table[defender] = info;

CheckGain( attacker );
}

it's right to substitue the red string with this one

int ninjitsu = attacker.Skills[MoveSkill].Fixed;


I didn't find other things to substitue, if i'll find i'll write about them ^^.
 
Top