Пример #1
0
 public static SetConditionEffect Instance(ConditionEffectIndex eff)
 {
     SetConditionEffect ret;
     if (!instances.TryGetValue(eff, out ret))
         ret = instances[eff] = new SetConditionEffect(eff);
     return ret;
 }
Пример #2
0
        private bool ApplyCondition(ConditionEffectIndex effect)
        {
            switch (effect)
            {
            case ConditionEffectIndex.Stunned
                when HasConditionEffect(ConditionEffects.StunImmume):
            case ConditionEffectIndex.Stasis
                when HasConditionEffect(ConditionEffects.StasisImmune):
            case ConditionEffectIndex.Paralyzed
                when HasConditionEffect(ConditionEffects.ParalyzeImmune):
            case ConditionEffectIndex.ArmorBroken
                when HasConditionEffect(ConditionEffects.ArmorBreakImmune):
            case ConditionEffectIndex.Curse
                when HasConditionEffect(ConditionEffects.CurseImmune):
            case ConditionEffectIndex.Petrify
                when HasConditionEffect(ConditionEffects.PetrifyImmune):
            case ConditionEffectIndex.Dazed
                when HasConditionEffect(ConditionEffects.DazedImmune):
            case ConditionEffectIndex.Slowed
                when HasConditionEffect(ConditionEffects.SlowedImmune):
                return(false);
            }

            return(true);
        }
Пример #3
0
        private bool ApplyCondition(ConditionEffectIndex effect)
        {
            if (effect == ConditionEffectIndex.Stunned &&
                HasConditionEffect(ConditionEffects.StunImmume))
                return false;

            if (effect == ConditionEffectIndex.Stasis &&
                HasConditionEffect(ConditionEffects.StasisImmune))
                return false;

            if (effect == ConditionEffectIndex.Paralyzed &&
                HasConditionEffect(ConditionEffects.ParalyzeImmune))
                return false;

            if (effect == ConditionEffectIndex.ArmorBroken &&
                HasConditionEffect(ConditionEffects.ArmorBreakImmune))
                return false;

            if (effect == ConditionEffectIndex.Curse &&
                HasConditionEffect(ConditionEffects.CurseImmune))
                return false;

            if (effect == ConditionEffectIndex.Petrify &&
                HasConditionEffect(ConditionEffects.PetrifyImmune))
                return false;

            if (effect == ConditionEffectIndex.Dazed &&
                HasConditionEffect(ConditionEffects.DazedImmune))
                return false;

            return effect != ConditionEffectIndex.Slowed || !HasConditionEffect(ConditionEffects.SlowedImmune);
        }
Пример #4
0
 public Grenade(
     float range                 = 8,
     int damage                  = 100,
     float radius                = 5,
     float?fixedAngle            = null,
     int cooldown                = 0,
     int cooldownOffset          = 0,
     int cooldownVariance        = 0,
     ConditionEffectIndex effect = ConditionEffectIndex.Nothing,
     int effectDuration          = 0,
     uint color                  = 0xFFFF0000)
 {
     Range            = range;
     Damage           = damage;
     Radius           = radius;
     FixedAngle       = fixedAngle * MathUtils.ToRadians;
     Cooldown         = cooldown;
     CooldownOffset   = cooldownOffset;
     CooldownVariance = cooldownVariance;
     Effects          = new ConditionEffectDesc[1]
     {
         new ConditionEffectDesc(effect, effectDuration)
     };
     Color = color;
 }
Пример #5
0
 public AddCond(
     ConditionEffectIndex effect,
     int duration = 0
     )
 {
     this.effect   = effect;
     this.duration = duration;
 }
Пример #6
0
 public RemCond(
     ConditionEffectIndex effect,
     bool perm = false
     )
 {
     this.effect = effect;
     this.perm   = perm;
 }
 public test1(ConditionEffectIndex effect, bool perm = false, int duration = 0, int coolDownOffset = 0, Cooldown coolDown = new Cooldown())
 {
     this.effect         = effect;
     this.perm           = perm;
     this.duration       = duration;
     this.coolDownOffset = coolDownOffset;
     this.coolDown       = coolDown.Normalize();
 }
Пример #8
0
 public override void Read(PacketReader r)
 {
     Location = (Location) new Location().Read(r);
     Radius = r.ReadSingle();
     Damage = r.ReadUInt16();
     Effects = (ConditionEffectIndex)r.ReadByte();
     EffectDuration = r.ReadSingle();
     OriginType = r.ReadInt16();
 }
Пример #9
0
 public Trap(Player player, float radius, int dmg, ConditionEffectIndex eff, float effDuration)
     : base(0x0711, LIFETIME * 1000, true, true, false)
 {
     this.player = player;
     this.radius = radius;
     this.dmg = dmg;
     this.effect = eff;
     this.duration = (int)(effDuration * 1000);
 }
Пример #10
0
 public override void Read(PacketReader r)
 {
     Location       = (Location) new Location().Read(r);
     Radius         = r.ReadSingle();
     Damage         = r.ReadUInt16();
     Effects        = (ConditionEffectIndex)r.ReadByte();
     EffectDuration = r.ReadSingle();
     OriginType     = r.ReadInt16();
 }
Пример #11
0
 public Trap(Player player, float radius, int dmg, ConditionEffectIndex eff, float effDuration)
     : base(player.Manager, 0x0711, LIFETIME * 1000, true, true, false)
 {
     this.player = player;
     this.radius = radius;
     this.dmg    = dmg;
     effect      = eff;
     duration    = (int)(effDuration * 1000);
 }
Пример #12
0
        public static UnsetConditionEffect Instance(ConditionEffectIndex eff)
        {
            UnsetConditionEffect ret;

            if (!instances.TryGetValue(eff, out ret))
            {
                ret = instances[eff] = new UnsetConditionEffect(eff);
            }
            return(ret);
        }
Пример #13
0
 public Grenade(double radius, int damage, double range = 5,
                double?fixedAngle = null, Cooldown coolDown = new Cooldown(), ConditionEffectIndex effect = 0, int effectDuration = 0, uint color = 0xffff0000)
 {
     this.radius         = (float)radius;
     this.damage         = damage;
     this.range          = range;
     this.fixedAngle     = fixedAngle * Math.PI / 180;
     this.coolDown       = coolDown.Normalize();
     this.effect         = effect;
     this.effectDuration = effectDuration;
     this.color          = color;
 }
Пример #14
0
 public Torii(Player player, float radius, int lifetime, bool targetPlayers
              , int duration, ConditionEffectIndex effect, uint effColor, ushort objType)
     : base(player.Manager, 0x0711, lifetime * 1000, true, true, false)
 {
     this.player        = player;
     this.radius        = radius;
     this.lifetime      = lifetime;
     this.duration      = duration;
     this.effect        = effect;
     this.targetPlayers = targetPlayers;
     this.effColor      = effColor;
     this.objType       = objType;
 }
Пример #15
0
 public static byte[] Aoe(Position pos, float radius, int damage, ConditionEffectIndex effect, uint color)
 {
     using (PacketWriter wtr = new PacketWriter(new MemoryStream()))
     {
         wtr.Write((byte)PacketId.Aoe);
         pos.Write(wtr);
         wtr.Write(radius);
         wtr.Write((short)damage);
         wtr.Write((byte)effect);
         wtr.Write((int)color);
         return((wtr.BaseStream as MemoryStream).ToArray());
     }
 }
Пример #16
0
        public void ApplyConditionEffect(ConditionEffectIndex effect, int durationMs = -1)
        {
            if (!ApplyCondition(effect))
                return;

            var eff = (int)effect;

            effects[eff] = durationMs;
            if (durationMs != 0)
                ConditionEffects |= (ConditionEffects)((ulong)1 << eff);

            tickingEffects = true;
            UpdateCount++;
        }
Пример #17
0
        void TimerHandler(int delay, ConditionEffectIndex cei)
        {
            Timer timer = new Timer(delay, (int)cei);

            timer.Elapsed += (o, e) => {
                Client.Player?.ApplyConditionEffect(cei);
                if (timerList.Exists(t => t == timer))
                {
                    timerList.Remove(timer);                                    //feels inefficient, prob isn't tho
                }
                timer.Dispose();
            };
            timer.Enabled = true;
            timerList.Add(timer);
        }
Пример #18
0
        private bool ApplyCondition(ConditionEffectIndex effect)
        {
            if (effect == ConditionEffectIndex.Stunned &&
                HasConditionEffect(ConditionEffects.StunImmune))
            {
                return(false);
            }

            if (effect == ConditionEffectIndex.Stasis &&
                HasConditionEffect(ConditionEffects.StasisImmune))
            {
                return(false);
            }

            return(true);
        }
Пример #19
0
        public void ApplyConditionEffect(ConditionEffectIndex effect, int duration)
        {
#if DEBUG
            if (duration != -1 && (((float)duration / Settings.MillisecondsPerTick) != (duration / Settings.MillisecondsPerTick)))
            {
                throw new Exception("Effect time out of sync with tick time.");
            }
#endif
            if (effect == ConditionEffectIndex.Nothing ||
                (effect == ConditionEffectIndex.Stunned && HasConditionEffect(ConditionEffectIndex.StunImmune)))
            {
                return;
            }

            Effects[(int)effect] = duration;
        }
Пример #20
0
        public void ApplyConditionEffect(ConditionEffectIndex effect, int durationMs = -1)
        {
            if (!ApplyCondition(effect))
            {
                return;
            }

            var eff = (int)effect;

            _effects[eff] = durationMs;
            if (durationMs != 0)
            {
                ConditionEffects |= (ConditionEffects)((ulong)1 << eff);
            }

            _tickingEffects = true;
        }
Пример #21
0
 public ManaDrainBomb(
     double radius,
     int damage,
     double range                = 5,
     double?direction            = null,
     Cooldown coolDown           = new Cooldown(),
     ConditionEffectIndex effect = ConditionEffectIndex.Hidden,
     int effectDuration          = -1
     )
 {
     this.radius         = (float)radius;
     this.damage         = damage;
     this.range          = range;
     this.direction      = direction * Math.PI / 180;
     this.coolDown       = coolDown.Normalize();
     this.effect         = effect;
     this.effectDuration = effectDuration;
 }
Пример #22
0
        public void ApplyConditionEffect(ConditionEffectIndex effect, int DurationMS = -1)
        {
            if (!ApplyCondition(effect))
            {
                return;
            }

            var eff = (int)effect;

            effects[eff] = DurationMS;
            if (DurationMS != 0)
            {
                ConditionEffects |= (ConditionEffects)((ulong)1 << eff);
            }

            tickingEffects = true;
            UpdateCount++;
        }
Пример #23
0
        public ActivateEffectDesc(XElement e)
        {
            Index       = (ActivateEffectIndex)Enum.Parse(typeof(ActivateEffectIndex), e.Value.Replace(" ", ""));
            Effect      = e.ParseConditionEffect("@effect");
            DurationMS  = (int)(e.ParseFloat("@duration", 0) * 1000);
            Range       = e.ParseFloat("@range");
            Amount      = e.ParseInt("@amount");
            TotalDamage = e.ParseInt("@totalDamage");
            Radius      = e.ParseFloat("@radius");
            MaxTargets  = e.ParseInt("@maxTargets");

            Effects = new ConditionEffectDesc[1]
            {
                new ConditionEffectDesc(Effect, DurationMS)
            };

            if (e.Attribute("color") != null)
            {
                Color = e.ParseUInt("@color");
            }
        }
Пример #24
0
 public RemoveConditionalEffect(ConditionEffectIndex effect)
 {
     _effect = effect;
 }
Пример #25
0
 public SetConditionEffectTimed(ConditionEffectIndex eff, int time)
 {
     this.eff = eff;
     this.time = time;
 }
Пример #26
0
 private UnsetConditionEffect(ConditionEffectIndex eff)
 {
     this.eff = eff;
 }
Пример #27
0
 public RemoveEffect(ConditionEffectIndex effect)
 {
     this.effect = effect;
 }
Пример #28
0
 public ConditionEffect(XElement e)
 {
     Effect     = Utils.GetEffect(e.Value);
     DurationMS = (int)(e.GetAttribute <float>("duration") * 1000.0f);
 }
Пример #29
0
 private UnsetConditionEffect(ConditionEffectIndex eff)
 {
     this.eff = eff;
 }
Пример #30
0
 public SetConditionEffectTimed(ConditionEffectIndex eff, int time)
 {
     this.eff  = eff;
     this.time = time;
 }
 public ConditionalEffect(ConditionEffectIndex effect, bool perm = false)
 {
     this.effect = effect;
     this.perm = perm;
 }
Пример #32
0
 Once.Instance(SetConditionEffect.Instance(ConditionEffectIndex.Armored)),
Пример #33
0
 public TalismanAttack(int damage, ConditionEffectIndex effect, int duration = 0)
 {
     _damage   = damage;
     _duration = duration;
     _effect   = effect;
 }
Пример #34
0
 public ConditionEffectDesc(ConditionEffectIndex effect, int durationMs)
 {
     Effect     = effect;
     DurationMS = durationMs;
 }
Пример #35
0
 public AoeEffect(double radius, int duration, ConditionEffectIndex effect)
 {
     this.radius   = (float)radius;
     this.effect   = effect;
     this.duration = duration;
 }
Пример #36
0
 public bool HasConditionEffect(ConditionEffectIndex eff)
 {
     return((ConditionEffects & (ConditionEffects)((ulong)1 << (int)eff)) != 0);
 }
Пример #37
0
 public ConditionEffectDesc(XElement e)
 {
     Effect     = (ConditionEffectIndex)Enum.Parse(typeof(ConditionEffectIndex), e.Value.Replace(" ", ""));
     DurationMS = (int)(e.ParseFloat("@duration") * 1000);
 }