Page 1 of 1

SSI?

Posted: Sun Jun 29, 2008 9:20 pm
by Shaggy
Just wondering the formual for swing speed.

Archived topic from AOV, old topic ID:3186, old post ID:20271

SSI?

Posted: Sun Jun 29, 2008 9:25 pm
by Red Squirrel
Theres lot of calculations that go into SSI so theres not a set formula per say, so here is the entire function. This returns a time span to the next shot.

Code: Select all

public virtual TimeSpan GetDelay( Mobile m )
		{
			int penalty=0; 			
			int bonus = AosAttributes.GetValue( m, AosAttribute.WeaponSpeed );

			//calculate bonuses/penalties
			
			if ( Spells.Chivalry.DivineFurySpell.UnderEffect( m ) )
				bonus += 10;

			// Bonus granted by successful use of Honorable Execution.
			bonus += HonorableExecution.GetSwingBonus( m );

			if( DualWield.Registry.Contains( m ) )
				bonus = 70;

			//feint penalty
			if( Feint.Registry.Contains( m ) )
			penalty += ((Feint.FeintTimer)Feint.Registry[m]).SwingSpeedReduction;
			
			//spellweaving - reaper form bonus
			bonus += ReaperFormSpell.GetSwingBonus(m);
			
			//spellweaving - essence of wind penalty
			penalty += EssenceOfWindSpell.GetSwingMalus(m);			
			

			int discordanceEffect = 0;

			// Discordance gives a malus of -0/-28% to swing speed.
			if ( SkillHandlers.Discordance.GetEffect( m, ref discordanceEffect ) )
				penalty += discordanceEffect;

			//calculate bonus cap
			if ( bonus > 75 )
				bonus = 75;
				
			int stam = m.Stam;
			if(stam>170)stam=170; //cap stam in calculation (already capped in playermobile, but this is to ensure all calculations are acurate, including for mobs)
			
			bonus-=penalty;
			if(bonus<0)bonus=0;
			
			int divider=((170-stam)/15)+15;
			if(divider<1)divider=1;
			
			double FinalDelay = (((SpeedSecs*4)-((double)m.Stam/divider))*(100/(double)(100+bonus)))/4; //calculate actual speed (formula slightly differs from osi)
			
			if(FinalDelay<(MinTicks*0.25))FinalDelay=(MinTicks*0.25); //apply final speed cap
			
			double mutescalar=GetMutedDelayScalar(m); //mute used by various special abilities such as melissande aura
			FinalDelay*=mutescalar;
			
			//m.SendMessage("Speed: {0}  Pen: {1} bonus: {2}  mutescalar: {3}",FinalDelay,penalty,bonus,mutescalar); //debug 

			return TimeSpan.FromSeconds( FinalDelay );
		}
Archived topic from AOV, old topic ID:3186, old post ID:20272