コード例 #1
0
ファイル: Spell.cs プロジェクト: Inifield/zoso-server
        /// <summary>
        /// Creates an instance of <see cref="Spell"/> from <see cref="SpellData"/>.
        /// </summary>
        /// <param name="spellData"> RavenItem which contains the spell info. </param>
        /// <param name="caster"></param>
        public Spell(SpellData spellData, Character caster)
        {
            this.caster = caster;

            this.id                    = spellData.SpellId;
            this.school                = (SpellSchools)spellData.School;
            this.requiredTargetType    = (SpellTargetTypes)spellData.RequiredTargetType;
            this.targetSelectionMethod = (SpellTargetSelectionMethods)spellData.TargetSelectionMethod;
            this.spellAffectionMethod  = (SpellAffectionMethod)spellData.AffectionMethod;
            this.requiredWeaponType    = (WeaponTypes)spellData.RequiredWeaponType;
            this.flags                 = (SpellFlags)spellData.Flags;

            this.powerType     = (Vitals)spellData.PowerType;
            this.powerCost     = spellData.PowerCost;
            this.cooldown      = spellData.Cooldown;
            this.minCastRadius = spellData.MinCastRadius;
            this.maxCastRadius = spellData.MaxCastRadius;
            this.castTime      = spellData.CastTime;

            this.affectedByGcd = spellData.AffectedByGCD;
            this.isProc        = spellData.IsProc;
            this.triggersGcd   = spellData.TriggersGCD;

            var spellEffects = spellData.Effects;

            this.effects = spellEffects != null?spellEffects.Select(i => (SpellEffects)i).ToArray() : null;

            this.effectBaseValues = spellData.EffectBaseValues;

            this.state = SpellStates.Null;
        }
コード例 #2
0
        public Spell(string name, string desc, SpellFlags flags, float duration, float castTime, float cooldown, float costBloodCast, float costPhlegmCast, float costYBCast, float costBBCast, float costBloodCanalise, float costPhlegmCanalise, float costYBCanalise, float costBBCanalise, Action <SpellInstance> onCast, Action <SpellInstance> onCanalisation, Action <SpellInstance> onEnd, Action <SpellInstance> onCancel)
        {
            ID       = 0;
            IDSet    = false;
            Flags    = flags;
            CastTime = castTime;
            Duration = duration;

            if (Duration < CastTime)
            {
                Duration = CastTime;
            }
            if (!Flags.HasFlag(SpellFlags.CANALISED)) // Si ce sort n'est pas canalisé, alors les actions OnCanalisation, OnEnd et OnCancel ne seront jamais exécutées.
            {
                onCanalisation     = null;
                onEnd              = null;
                onCancel           = null;
                costBloodCanalise  = 0;
                costPhlegmCanalise = 0;
                costYBCanalise     = 0;
                costBBCanalise     = 0;
            }

            OnCast         = onCast;
            OnCanalisation = onCanalisation;
            OnEnd          = onEnd;
            OnCancel       = onCancel;

            Name = name;
            Desc = desc;

            OnCastCosts     = new float[] { costBloodCast, costPhlegmCast, costYBCast, costBBCast };
            OnCanaliseCosts = new float[] { costBloodCanalise, costPhlegmCanalise, costYBCanalise, costBBCanalise };
            Cooldown        = cooldown;
        }
コード例 #3
0
 public SpellData(SpellType Type, UInt32 Cost, UInt32 Level, SpellFlags Flags, Byte[] Unused)
 {
     this.Type   = Type;
     this.Cost   = Cost;
     this.Level  = Level;
     this.Flags  = Flags;
     this.Unused = Unused;
 }
コード例 #4
0
 public SpellData(string Tag = null)
     : base(Tag)
 {
     Type   = new SpellType();
     Cost   = new UInt32();
     Level  = new UInt32();
     Flags  = new SpellFlags();
     Unused = new byte[3];
 }
コード例 #5
0
        Action <SpellInstance> OnCancel;   // Lorsque le sort est canalisé et que son lancement est annulé quand ElapsedTime < Duration.

        public SpellInstance(uint spellID, Entity caster, object target, SpellFlags flags, Action <SpellInstance> onCast, Action <SpellInstance> onCanalisation, Action <SpellInstance> onEnd, Action <SpellInstance> onCancel)
        {
            Caster     = caster;
            Target     = target;
            OnCast     = onCast;
            OnCanalise = onCanalisation;
            OnEnd      = onEnd;
            OnCancel   = onCancel;
            Flags      = flags;
            SpellID    = spellID;
        }
コード例 #6
0
 /// <summary>
 /// Renvoi true si ce sort possède le flag passé en paramètre.
 /// </summary>
 public static bool HasFlag(this SpellFlags flag, SpellFlags f)
 {
     try
     {
         return(((int)(object)flag & (int)(object)f) == (int)(object)f);
     }
     catch
     {
         return(false);
     }
 }
コード例 #7
0
        public S2C_CreateTurret(PacketReader reader, ChannelID channelID, NetID senderNetID)
        {
            this.SenderNetID = senderNetID;
            this.ChannelID   = channelID;

            this.NetID     = reader.ReadNetID();
            this.NetNodeID = reader.ReadNetNodeID();
            this.Name      = reader.ReadFixedString(64);
            byte bitfield = reader.ReadByte();

            this.IsTargetable = (bitfield & 1) != 0;

            this.IsTargetableToTeam = reader.ReadSpellFlags();

            this.ExtraBytes = reader.ReadLeft();
        }
コード例 #8
0
        public S2C_SpawnTurret(PacketReader reader, ChannelID channelID, NetID senderNetID)
        {
            this.SenderNetID = senderNetID;
            this.ChannelID   = channelID;

            this.NetID      = reader.ReadNetID();
            this.OwnerNetID = reader.ReadNetID();
            this.NetNodeID  = reader.ReadNetNodeID();
            this.Name       = reader.ReadFixedString(64);
            this.SkinName   = reader.ReadFixedString(64);
            this.SkinID     = reader.ReadInt32();
            this.Position   = reader.ReadVector3();
            this.ModelDisappearOnDeathTime = reader.ReadFloat();
            ushort bitfield = reader.ReadUInt16();

            this.TeamID         = (TeamID)(bitfield & 0x01FF);
            this.IsTargetable   = (bitfield & 0x0200) != 0;
            this.IsInvulnerable = (bitfield & 0x400) != 0;

            this.IsTargetableToTeam = reader.ReadSpellFlags();

            this.ExtraBytes = reader.ReadLeft();
        }
コード例 #9
0
 public static void WriteSpellFlags(this PacketWriter writer, SpellFlags data)
 {
     writer.WriteUInt32((uint)data);
 }
コード例 #10
0
 public SpellData(System.IO.BinaryReader reader)
 {
     spellType  = (SpellType)reader.ReadInt32();
     spellCost  = reader.ReadInt32();
     spellFlags = (SpellFlags)reader.ReadInt32();
 }
コード例 #11
0
 public SpellData()
 {
     Effects   = new List <IEffect>();
     Modifiers = new List <SpellModifier>();
     flags     = SpellFlags.None;
 }