[Bugfix] - Focus on Spells with %-Costs

Discussions on various DOL development features

Moderator: Support Team

[Bugfix] - Focus on Spells with %-Costs

Postby Satyr » Wed Jan 31, 2007 9:03 am

First note this: I have to disable HTML-code for this post otherwise the code is truncated chaotically... so u will see those [quote]-tags. Also i am not able to keep the format (includings tabs etc.). I really think it would be better to let me send those code-files to u if u do not like to format it back each time hmf...

This way the 120% of spell-power is calculated in the beginning in the original version:
Code: Select all
...
double power = m_spell.Power * 1.2;
...

This is right of course but this way the focus-bonus for %-costs had been added as NEGATIVE AND ABSOLUT value instead of positive percent-value:


Code: Select all
...
power -=  m_spell.Power * focusBonus;
...


correction (to be inserted into 'SpellHandler.cs'):


Code: Select all
      public virtual int CalculateNeededPower(GameLiving target)
      {
            double basepower = m_spell.Power; //<== defined a basevar first then modified this base-var to tell %-costs from absolut-costs

         // percent of maxPower if less than zero
         if (basepower < 0)
            if (Caster is GamePlayer && ((GamePlayer)Caster).CharacterClass.ManaStat != eStat.UNDEFINED)
            {
               GamePlayer player = Caster as GamePlayer;
                    basepower = player.CalculateMaxMana(player.Level, player.GetBaseStat(player.CharacterClass.ManaStat)) * basepower * -0.01;
            }
            else
                    basepower = Caster.MaxMana * basepower * -0.01;

            double power = basepower * 1.2; //<==NOW holding basepower*1.2 within 'power'

            eProperty focusProp = SkillBase.SpecToFocus(SpellLine.Spec);
         if (focusProp != eProperty.Undefined)
         {
            double focusBonus = Caster.GetModified(focusProp) * 0.4;
            if (Spell.Level > 0)
               focusBonus /= Spell.Level;
            if (focusBonus > 0.4)
               focusBonus = 0.4;
            else if (focusBonus < 0)
               focusBonus = 0;
                power -= basepower * focusBonus; //<== So i can finally use 'basepower' for both calculations: % and absolut
            }
         else if (Caster is GamePlayer && ((GamePlayer)Caster).CharacterClass.ClassType == eClassType.Hybrid)
         {
            double specBonus = 0;
            if (Spell.Level != 0) specBonus = (((GamePlayer)Caster).GetBaseSpecLevel(SpellLine.Spec) * 0.4 / Spell.Level);

            if (specBonus > 0.4)
               specBonus = 0.4;
            else if (specBonus < 0)
               specBonus = 0;
                power -= basepower * specBonus;
         }
         // doubled power usage if quickcasting
         if (Caster.EffectList.GetOfType(typeof(QuickCastEffect)) != null && Spell.CastTime > 0)
            power *= 2;
         return (int)power;
      }
Last edited by Satyr on Wed Jan 31, 2007 9:34 am, edited 1 time in total.
Satyr
Server Team
 
Posts: 97
Joined: Tue Dec 05, 2006 2:06 am

omfg

Postby Satyr » Wed Jan 31, 2007 9:22 am

I am not able to put this damn code into quotes. never had this problem with other quotes but this code seem to command this to stop the quote earlier it seems lol. Dunno... maybe a EoL-char is inserted somewhere dunno.
Satyr
Server Team
 
Posts: 97
Joined: Tue Dec 05, 2006 2:06 am

Postby Etaew » Wed Jan 31, 2007 12:31 pm

you can try paste.dolserver.net
Retired DOL Enthusiast | Blog
User avatar
Etaew
Inactive Staff Member
 
Posts: 7602
Joined: Mon Oct 13, 2003 5:04 pm
Location: England

Postby Etaew » Fri Feb 02, 2007 9:37 pm

Ok, I edited your post, and re-enabled BBCode, you disabled it. I checked the code and it seems ok. I'll add it whenever I next commit, thanks.
Retired DOL Enthusiast | Blog
User avatar
Etaew
Inactive Staff Member
 
Posts: 7602
Joined: Mon Oct 13, 2003 5:04 pm
Location: England


Return to DOL Development Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron