Esempio n. 1
0
        public void Execute()
        {
            try {
                for (int i = Count - 1; i >= 0; i--)
                {
                    Effect eff = GetItem(i);

                    eff.Execute();

                    if (eff.Action != EffectAction.ea_Instant)
                    {
                        if (eff.Duration > 0)
                        {
                            int      oldDuration = eff.Duration;
                            EffectID eid         = (EffectID)eff.CLSID;

                            EffectFlags flags = EffectsData.dbEffects[(int)eid].Flags;
                            if (flags.Contains(EffectFlags.ep_Decrease))
                            {
                                eff.Duration--;
                            }
                            else if (flags.Contains(EffectFlags.ep_Increase))
                            {
                                eff.Duration++;
                            }

                            eff.Magnitude = (int)Math.Round((float)eff.Magnitude * ((float)eff.Duration / (float)oldDuration));

                            if (eff.Source == null && eff.Duration == 0)
                            {
                                // e_Prowling has change effects list,
                                // so we need check current effect
                                // its hack and bad code!
                                if (GetItem(i) == eff)
                                {
                                    Delete(i);
                                }
                            }
                        }
                    }
                }
            } catch (Exception ex) {
                Logger.Write("EffectsList.execute(): " + ex.Message);
            }
        }
Esempio n. 2
0
 public EffectRec(int name, EffectParams reqParams, EffectFlags flags,
                  int frameCount, string gfx, string sfx, MNXRange duration,
                  MNXRange magnitude, int mpReq, int levReq,
                  AbilityID resistance, MNXRange damage)
 {
     NameRS     = name;
     ReqParams  = reqParams;
     Flags      = flags;
     FrameCount = (sbyte)frameCount;
     GFX        = gfx;
     SFX        = sfx;
     Duration   = duration;
     Magnitude  = magnitude;
     MPReq      = (short)mpReq;
     LevReq     = (short)levReq;
     Resistance = resistance;
     Damage     = damage;
     ImageIndex = -1;
 }